Move the code that checks for unhandled command line options only after
all the module loading. We pass argc, argv to all module loaders, so
modules might want to have command line options, but you cannot use them
if the check is too early.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
We've already computer the inverse of the output matrix, so we
don't need to calculate it again here.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Right now zoom only works on the output at 0, 0 because it's adding
the output corner co-ordinates to global co-ordinates that already
include the output offset.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
weston_output_transform_coordinate() was supposed to convert from device
co-ordinates to global co-ordinates.
Commit 0f67941c broke that by converting from global to device instead,
which just magically works ok for single untransformed outputs (where the
transformation is identity)
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
We were correctly handling decorated and fullscreen clients, but left
uninitialized values in the input region for undecorated clients. Fix
this behavi-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Currently we unmap and re-map the cursor when the hotspot changes which
causes spurious enter/leave events.
This changes the pointer_set_cursor() logic to avoid this.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This means compositors don't need to call supports() manually and
create() will just return -1 in the failure case as before. This also
means we can deal with the case of eglGetProcAddress returning
non-NULL but not actually being available at runtime.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tablet shell is long gone. Might as well list what we have now.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
There were a few cases of 'goto out' in main() that did not set ret to
EXIT_FAILURE. Shell failing to init is the one I hit when writing tests
for ivi-shell.
Rather than adding a few more 'ret = EXIT_FAILURE', make that the
default and remove the redundant assignments. When Weston exits
properly ec->exit_code will take care of the exit code.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Make the sanity check more explicit and log a warning if it happens.
Small negative values are ok because it just means the compositor is
lagging behind, or more likely the user specified a too long repaint
window.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
This timer delays the output_repaint towards the end of the refresh
period, reducing the time from repaint to present.
The length of the repaint window can be set in weston.ini.
The call to weston_output_schedule_repaint_reset() is delayed by one
more period. If we exit the continuous repaint loop (set
output->repaint_scheduled to false) in finish_frame, we may call
start_repaint_loop() unnecessarily. The problem case was actually
observed with two outputs on the DRM backend at 60 Hz, and 7 ms
repaint-window. During a window move, one output was constantly falling
off the continuous repaint loop and introducing additional one frame
latency, leading to jerky window motion. This code now avoids the
problem.
Changes in v2:
- Rename repaint_delay_timer to repaint_timer and
output_repaint_delay_handler to output_repaint_timer_handler.
- When computing the delay, take the current time into account. The timer
uses a relative timeout, so we have to subtract any time already gone.
Note, that 'gone' may also be negative. DRM has a habit of predicting
the page flip timestamp so it may be still in the future when we get the
completion event.
- Do also a sanity check 'msec > 1000'. In the unlikely case that
something fails to provide a good timestamp, never delay for more than
one second.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Create a new function weston_compositor_read_presentation_clock() to
wrap the clock_gettime() call for the Presentation clock.
Reading the presentation clock is never supposed to fail, but if it
does, this will notify about it. I have not seen it fail yet, though.
This prepares for new testing features in the future that might allow
controlling the presentation clock. Right now it is just a convenience
function for clock_gettime().
All presentation clock readers are converted to call this new function
except rpi-backend's rpi_flippipe_update_complete(), because it gets its
clock id via a thread-safe mechanism. There shouldn't be anything really
thread-unsafe in weston_compositor_read_presentation_clock() at the
moment, but might be in the future, and weston core is not expected to
need to be thread-safe.
This is based on the original patch by
Cc: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
If the client calls wl_pointer.set_cursor with the same surface and hot
spot coordinate that is already set, don't do anything as no state was
changed.
This avoids an issue where a client setting the same cursor surface
multiple times would receive wl_surface.leave/enter on that surface
every time.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
first is for getting and binding to globals and the other one is for
getting wl_shm.formats that are emitted after binding
to wl_shm
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Now clamping width and height to a minimum of 1, 1 when drag resizing.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
The pixman-renderer is already performing transformations when compositing
into the shadow buffer, we just need to get the damage co-ordinates right
when copying from shadow to front.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Thilo Cestonaro <thilo@cestona.ro>
If an output is unnamed and devices are in seats, the strcmp will crash.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
If you have devices configured in seats with udev then the output names
are tested with string compare. This fixes a potential crash on startup and
device insertion.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Only needed in the source-clipped case, otherwise the boundingbox is
already doing the necessary clipping.
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>
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>