Implement a way to do composition clipping with a region32 given in
source image space.
Pixman does not directly support this kind of operation at all. If you
pixman_image_set_clip_region32() on a source image, it will be ignored
unless you also
pixman_image_set_source_clipping(image, 1);
pixman_image_set_has_client_clip(image, 1);
but then it takes the region from source image and still uses it in the
destination coordinate space. For reference:
http://lists.freedesktop.org/archives/pixman/2015-March/003501.html
That is actually the intended behaviour in Pixman.
This patch implements source clipping by taking each rectangle of the
source clip region, wrapping that sub-rect of the source image in a new
pixman_image_t, and compositing it separately. This might be very heavy as
we are painting the whole damage the number of rectangles times, but
practically always the number of rectangles is one.
An alternative solution would be to use mask images of type PIXMAN_a1,
render the source clip region in it, and set the transformation. You'd
probably also want to cache those images. And because we use the mask to
apply view->alpha, you'd have to use PIXMAN_a8 in those cases.
v2: Fix a comment.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Move code from draw_view() into a new function draw_view_translated().
This new function is correct only if
view_transformation_is_translation().
The test for view->alpha is moved into draw_view_translated() too, so we
don't need to pass the pixman_op from draw_view(). The non-translation
path is already using PIXMAN_OP_OVER, so it does not care about the
alpha.
v2: Fixed commit message.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Change the region argument types in repaint_region(), moving the
final_region computation to the caller. The caller is in a better
position deciding if source clipping is needed or if it can be intersected
into the final_region via a simple translation. This avoids
surf_region or source clip implying that the transformation is only a
translation.
The region_global_to_output() call is also moved into the callers so
that repaint_region() would not modify caller-provided data. Modifying
caller provided data could be surprising.
This patch does not change the rendering output.
v2: Remove unused source_clip argument.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Move code into a new helper function. No changes.
v3: Add assert, and reorder this patch with adding
view_transformation_is_translation().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
A simple refactoring just to help readability.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Move the code computing the end-to-end transformation from
repaint_region() into a new function
pixman_renderer_compute_transform().
The code itself is not modified.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This will be used by pixman-renderer.
v2: Fix doc typo.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Now that we have a buffer-to-surface matrix and the global-to-output matrix
is in pixels, we can remove a large chunk of confusing code from the pixman
renderer. Hopefully, having this stuff in weston core will keep the pixman
renderer from gettin broken quite as often.
This patch makes attempting zoom on the pixman-renderer render funny
stuff. We didn't support zoom before, now it renders wrong instead of
not zooming at all.
[Pekka: adjust commit message]
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Add matrix representations of these two transformations. Future patches
will leverage these to simplify the coordinate transformation code.
[Pekka: commit message]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
We can greatly simplify weston_output_transform_coordinate now by simply
multiplying by the output matrix and converting the result to fixed point.
This patch fixes zoomed input behaviour on the nested backends (x11,
wayland) which use absolute input coordinates. And probably also
absolute input devices. The patch that broke this was "zoom: Use pixels
instead of GL coordinates".
Signed-off-By: Derek Foreman <derekf@osg.samsung.com>
[Pekka: adjusted coding style and message]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
The patch "zoom: Use pixels instead of GL coordinates" changed the
meaning of weston_output_zoom::trans_x,trans_y from GL coordinate system
to global coordinates.
This patch is a minimal untested change to the rpi-renderer to try and
follow up on that change.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Previously, the zoom functions used GL coordinates natively which doesn't
work with the new output matrix calculations. This changes zoom to work in
pixel coordinates to match the new output matrix format. This also cleans
up the math in the zoom code substantially.
This patch changes the meaning of weston_output_zoom::trans_x,trans_y,
and doing so probably breaks zoom on the rpi-renderer and all absolute
input devices. These problems are fixed by the following patches:
rpi-renderer: minimal fix to zoom coordinates
compositor: use weston_matrix_transform for
weston_output_transform_coordinate
[Pekka: added a comment]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Previously, weston_output.matrix was in GL coordinates and therefore only
really useful for the GL backend.
This breaks zoom, which will be fixed by the following patch:
zoom: Use pixels instead of GL coordinates
[Pekka: added a comment to compositor.h, message]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Also remove the now dead code from weston_output_update_zoom().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Remove several fields from struct weston_output_zoom as a consequence of
removing animation_xy from it. Animation_xy was always empty, unused.
Animation_xy was likely used by text_cursor_position implementation, but
that was removed in commit a7af70436b.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Rviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Support for scissor not implemented yet on cursor overlay or for direct
scanout. Overlays OTOH use the boundingbox to compute their coordinates,
so that should probably work.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Add API for setting a clip ('scissor' in the code) rectangle per view,
in surface coordinates. Ivi-shell requires this feature to be able to
implement the IVI Layer Manager API, which includes clipping of
surfaces.
The names weston_view_set_mask() and weston_view_set_mask_infinite()
mirror the existing weston_layer_set_mask*() functions.
This view clipping complements the weston_layer clipping, because view
clipping is defined in surface local coordinates, while layer
mask/clipping is defined in global coordinates.
View clipping requires explicit support from the renderers. Therefore a
new Weston capability bit is added: WESTON_CAP_VIEW_CLIP_MASK. Shells
(and all users) of this new API are required to check the capability bit
is set before using the API. Otherwise the rendering will not be what
they expect.
View clips are inherited through the transformation inheritance
mechanism. However, there are restrictions. The clip rectangle can be
set only on the root view of a transformation inheritance tree. The
additional transformations in child views must not rotate the coordinate
axes. These restrictions avoid corner cases in clip inheritance, and
keep the renderer implementations as simple as they are right now.
Renderers only need to do an additional intersection with the clip
rectangle which is always aligned to the surface coordinate system.
For more details, see the API documentation in the patch.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Expand weston_compositor_pick_view() so it is easier to read. Use
short-hand variables, that make it easier to add one more test in the
future.
Write the output coordinate pointers only when returning non-NULL.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
The code for the key binding that triggers debug key bindings, that is,
the code that makes mod+SHIFT+SPACE work, used to live in shell.c. I
want to make the debug key bindings available in ivi-shell too, so this
code should be shared. Move it to core.
The code was originally introduced in
commit c509d2b152
so update the copyright in binding.c to reflect that.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Daniel Stone <daniels@collabora.com>
All things everywhere, except this one case, assume weston_plane::damage
is in global coordinates. Document it.
view_accumulate_damage() is wrong in converting damage to plane
coordinates (similar to global coordinate except translated). Fix this
by removing the unwanted translation, and use only global coordinates.
We have not seen this bug manifest in real life because we get lucky:
the origin of the primary plane is always at 0, 0. We do not use
non-primary planes, except cursor plane on DRM backend where the actual
damage coordinates are ignored.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
There are two call sites, one is already having a pixman_box32_t it
needs to call view_compute_bbox() with. The other call site will have a
box32_t when view clipping gets implemented.
Change view_compute_bbox() to take a pixman_box32_t as the input
argument, and convert call sites.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Add a comment saying it is. I'm not aware of misuses of it.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Also fixes a theoretical memory leak as the region was never fini'd.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
The fix is not trivial, so I want to document the problem before I
forget about it again.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Changes in v2:
- remove stride and format arguments from the API
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v1 Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Taking the easy way, always do a rendering pass when copying any real
buffer or texture. Will handle YUV formats, and makes it easy to always
return data the right y-direction up.
All the FBO GL state is created and torn down on every invocation, so this
is a pretty naive implementation.
If there was a wl_shm buffer giving the content to the surface, and the
stride of the buffer was greater than width * bytes_per_pixel, then this
implementation will return stride long rows, not width.
Changes in v2:
- simplify pack_color()
- remove stride and format from the API
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v1 Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Add a new buffer type identifying the solid color contents which do not
have a real buffer.
Solid color surfaces now pretend to have 1x1 pixel content data.
This helps the future surface_get_data_size() implementation.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Use shared code for this kind of stuff.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This is an optional API that will be implemented by the renderers. It
allows to fetch the current contents of a surface, essentially the
buffer contents from a client buffer, converted to an RGBA format.
This is meant as a debugging API. The implementations may be heavy and
cause a stall, so they are not intended to be used often during normal
operations.
Renderers are expected to convert whatever data a surface has to a
single RGBA format.
Changes in v2:
- remove stride and format arguments from the API
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v1 Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Daniel Stone <daniels@collabora.com>
weston_view::transform.boundingbox is made to include the layer mask,
which removes the need for masked_boundingbox.
The following were using boundingbox when they should have used
masked_boundingbox:
- drm_output_prepare_overlay_view() uses boundingbox to compute overlay
position, source and destination coordinates.
- drm_assign_planes() uses boundingbox for view overlap checks.
- is_view_not_visible() uses boundingbox, but nothing will show outside
the layer mask.
- weston_surface_assign_output() intersects boundingbox with output
region to choose the primary output for a surface.
- weston_view_assign_output() intersects boundingbox with output region
to pick the outputs the view is on.
This patch essentially changes all those cases to use the masked
boundingbox.
Therefore there are no cases which would need the boundingbox without
the layer mask, and we can convert boundingbox into masked and remove
the left-over member.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[v2: don't move the decl of 'mask' in weston_view_update_transform]
Reviewed-By: Giulio Camuffo <giuliocamuffo@gmail.com>
Turns out there were no users of weston_view::transform.opaque,
everything was already using transform.masked_opaque. Therefore
repurpose transform.opaque as masked_opaque, and remove masked_opaque
member.
Now this opaque region in global coordinates is clipped by the layer
mask, if set. There are no cases where you would need the opaque region
without the effect of layer mask.
Also add a note in compositor.h, that changing view's layer counts as
changing geometry, which requires calling weston_view_geometry_dirty()
to let all derived state update.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Giulio Camuffo <giuliocamuffo@gmail.com>
It is used by sub-surfaces only, for fetching the root view's
weston_layer.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Giulio Camuffo <giuliocamuffo@gmail.com>
60 millihertz is a bit low, let's make it 60 Hz as it was supposed to
be.
When the new repaint scheduling algorithm gets implemented, this
fixes 'make check' taking almost 3 minutes instead of the normal 3
seconds, when running with 7 millisecond repaint window.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Older versions of Mesa provided header definitions for the
EGL_WL_bind_wayland_display extension, but an earlier version of the
extension which only provided the (un)bind entrypoints, and not
QueryWaylandBuffer. Detect this half-provision and make sure we export
the QueryWaylandBuffer definitions as well.
Fixes build failure with EGL on Ubuntu 12.04.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
The input loop is actually dispatched in the middle of the frame repaint.
When the X11 event results in closing the compositor, this can cause the
current output to be destroyed just prior to trying to process animations
on it.
We fix this by handling the window close event in an idle callback.
NOTE: this requires a patch for wayland that moves the idle handler
dispatch to after epoll_wait in the event loop processing.
Closes bug: https://bugs.freedesktop.org/show_bug.cgi?id=81314
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Keyboard key events will be received from a device where a key has
been pressed, even though an equivalent key has been pressed (same
key code) on a device connected to the same seat. notify_key()
expects to only be called as if there was only one keyboard device
associated with the given seat, so to achieve this, ignore every event
where forwarding it would result in multiple 'pressed' or 'released'
notifications.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Pointer button events will be received from a device where a button has
been pressed, even though an equivalent button has been pressed (same
button code) on a device connected to the same seat. notify_button()
expects to only be called as if there was only one pointer device
associated with the given seat, so to achieve this, ignore every event
where forwarding it would result in multiple 'pressed' or 'released'
notifications.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This patch adds the maximize button to the window frame for the windows
which set the MWM_DECOR_MAXIMIZE hint, and it wires it with the shell
via a new method in weston_shell_interface.
Additionally, it also listens for the wm hints coming from the client,
but it doesn't support maximizing a window only vertically or horizontally.
The window will be maximized only when both directions are maximized.
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
While it conceptually makes sense to put the x11 event handler
in the compositor "input" loop, the input loop is actually
dispatched in the middle of the frame repaint. When the
X11 event results in closing the compositor, this can cause
the current output to be destroyed just prior to trying to
process animations on it.
Closes bug: https://bugs.freedesktop.org/show_bug.cgi?id=81314
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Using the x11 output (maybe with others as well), weston would hang
when closing the output if the colord plugin is enabled.
The hang occurs in mutex lock in the output notifier handler because
the given GMutex value is incorrect.
This is because of a cast error, the type of container should be
"cms_output" and not "cms_colord".
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Richard Hughes <richard@hughsie.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>