summaryrefslogtreecommitdiff
path: root/src/compositor.c
Commit message (Collapse)AuthorAgeFilesLines
* compositor: use generated constant instead of hardcoded valueFORT David2016-05-191-1/+1
| | | | | | | Use SINCE macros instead of the hardcoded version value. Signed-off-by: David Fort <contact@hardening-consulting.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* compositor: surface and view output comment fixesPekka Paalanen2016-05-171-5/+3
| | | | | | | | | | | | | | weston_surface::output and weston_view::output as used for different purposes. Only the surface output is used for frame callbacks. The uses of the view output are much more vague and hard to describe. Also fix a comment mistake in weston_surface_assign_output(). Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Armin Krezović <krezovic.armin@gmail.com> [Pekka: more verbose on the compositor.h comments]
* compositor: refactor into convert_size_by_transform_scale()Pekka Paalanen2016-05-061-40/+40
| | | | | | | | There were two copies of code applying transform and scale to size. Refactor the code to use just one copy in a new function. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* compositor: constify weston_surface_build_buffer_matrix()Pekka Paalanen2016-05-061-2/+2
| | | | | | | | Makes it easier to see that it does not change weston_surface state implicitly. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* compositor: Hyphenate compound adjective surface-localYong Bakos2016-04-291-1/+1
| | | | | | | See https://lists.freedesktop.org/archives/wayland-devel/2016-April/028249.html. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* compositor: remove input_loopPekka Paalanen2016-03-241-36/+0
| | | | | | | | | | | | | Remove the input event loop. After "compositor-x11: stop using input_loop", the input event loop is completely unused. The code was also broken because it did not account for multiple outputs with independent repaint cycles. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
* input: use doubles in the interfaces to notify of input eventsGiulio Camuffo2016-03-231-6/+6
| | | | | | | | | | | | This patch is a further step in the wl_fixed_t internal sanitization. It changes the notify_* functions to take doubles instead of wl_fixed_t but does not change how these are stored in the various input structs yet, except for weston_pointer_axis_event. However this already allows to remove all wl_fixed_t usage in places like the libinput or the x11 backend. Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* protocol: migrate to stable presentation-time.xmlPekka Paalanen2016-03-071-16/+16
| | | | | | | | | | | | | | | | | | | | Remove the unstable presentation_timing.xml file, and use presentation-time.xml from wayland-protocols instead to generate all the Presentation extension bindings. The following renames are done according to the XML changes: - generated header includes - enum constants and macros prefixed with WP_ - interface symbol names prefixed with wp_ - protocol API calls prefixed with wp_ Clients use wp_presentation_interface.name rather than hardcoding the global interface name: presentation-shm, weston-info, presentation-test. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> [Pekka: updated wayland-protocols dependency to 1.2]
* compositor: Make types consistent for bitshifting unsigned intsBryce Harrington2016-01-121-10/+10
|
* compositor: Verify that the maximum number of outputs is not exceededBryce Harrington2016-01-121-0/+3
| | | | | | | | | | | output_id_pool is defined as a uint32_t, thus ffs() provides a range of 1-32 available id numbers. When the 33rd output is enabled, Weston will set the ID to (unsigned)(-1) and thus lead to some unexpected behaviors. I'm not sure what the best way to handle this error would be since this is in an initialization routine, but at least let's document the potential error condition with an assert().
* compositor: Document how views and surfaces are mapped to outputsBryce Harrington2016-01-121-0/+73
|
* compositor: Document routines relating to idle behaviorBryce Harrington2015-12-221-0/+51
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: Add doxygen for weston_surface_to_buffer_rect()Derek Foreman2015-12-031-1/+20
| | | | | Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: Add damage_bufferDerek Foreman2015-12-031-14/+74
| | | | | | | | Add an implementation of wl_surface.damage_buffer, similar to wl_surface.damage except it uses buffer co-ordinates. Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
* compositor: Remove unused weston_surface_to_buffer functionChris Michael2015-12-011-13/+0
| | | | | | | | The function 'weston_surface_to_buffer' is unused by compositor and clients inside weston, so it should be safe to remove this function Signed-off-by: Chris Michael <cp.michael@samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: change rounding in weston_surface_to_buffer_rect()Derek Foreman2015-12-011-2/+2
| | | | | | | | | | | | | Rounding both corners of the rectangle down can result in a 0 width/height rectangle before passing to weston_transformed_rect. This showed up as missing damage in weston-simple-damage (the bouncing ball would leave green trails when --use-viewport was used) Reviewed-by: Daniel Stone <daniels@collabora.co.uk> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
* compositor, input: Don't use MIN() macro for new resource versionsDerek Foreman2015-11-271-4/+4
| | | | | | | | | | libwayland-server protects us from invalid serial numbers by posting an error already. MIN() is for clients when selecting interface versions. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: Fix comment of subsurface_commit_to_cache functionChris Michael2015-11-261-1/+1
| | | | | | | | commit 57388e44e5 accidentally changed the comment in compositor.c::subsurface_commit_to_cache Signed-off-by: Chris Michael <cp.michael@samsung.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
* compositor: ignore useless surface_damageDerek Foreman2015-11-261-0/+3
| | | | | | | | | | | If we pass negative height or width on to pixman we get error messages in the log. Also, if width or height is 0, there's no damage, so we can early return for that too. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: Remove extra blank lineChris Michael2015-11-231-1/+0
| | | | | | Signed-off-by: Chris Michael <cp.michael@samsung.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* compositor: Move weston_matrix_transform_region to compositor.c and export itDerek Foreman2015-11-201-0/+57
| | | | | | | | | We're going to use this to replace much of the other transform code so it's no longer just relevant to pixman-renderer.c Signed-off-by: Derek Foreman <derekf@osg.samsung.com> [Pekka: add the warning about matrix restrictions] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: Change "touched" to boolDerek Foreman2015-11-201-2/+2
| | | | | Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: don't crash if destroying a compositor without a backendGiulio Camuffo2015-10-051-1/+2
| | | | | | | | | Calling weston_compositor_destroy() on a pointer returned by weston_compositor_create() should be always valid, even if the compositor does not have yet a backend. Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
* compositor: remove incorrect idle timer initializationEgor Starkov2015-09-241-1/+0
| | | | | | | | | | | | | weston_compositor_create() should just create idle timer but not arm it, because idle-time setting is not ready at this point. Remove idle timer first update in weston_compositor_create() since idle_time variable is not set at this point. Idle timer is armed properly later in weston_compositor_wake(). Signed-off-by: Egor Starkov <egor.starkov@ge.com> [Pekka: tweaked commit message] Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* dmabuf: implement linux_dmabuf extensionPekka Paalanen2015-08-141-0/+28
| | | | | | | | | | | | | | | | | | | v2 changes: - implement the revised protocol - add basic sanity checks when creating buffer and check for support - add way to attach user data to the dmabuf for renderer use - bump max number of planes to 4 to follow DRM AddFb2 ioctl - improve errors handling - use separate linux_dmabuf_buffer fields for the different wl_resource types - as SERVER_ERROR code is no more, use a wl_display "generic" error for emergency-disconneting a client we fail to process - more documentation - change y-invert from per-plane boolean to per-buffer flag Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* compositor: fix crash when destroying incompletely created outputDawid Gajownik2015-08-071-0/+1
| | | | | | | | | | | | | | | | | When the output can't be completely created in the backend (for example lack of memory), weston_compositor_add_output() is never run. In such a case output->link is not initialized. Letter, when weston_output_destroy() is called, application crashes on wl_list_remove(&output->link). This problem happens when drm, fbdev, rdp, rpi or wayland backend is used. v2: Initialize output->link in weston_output_init() as suggested by Derek Foreman. Signed-off-by: Dawid Gajownik <gajownik@gmail.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
* input: add a weston_pointer_clear_focus() helper functionDerek Foreman2015-08-061-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Valgrind has shown that in at least one place (default_grab_pointer_focus) we're testing uninitialized values coming out of weston_compositor_pick_view. This is happening when default_grab_pointer_focus is called when there is nothing on the view list, and during the first repaint when only the black surface with no input region exists. This patch adds a function to clear pointer focus and also set the sx,sy co-ordinates to a sentinel value we shouldn't compute with. Assertions are added to make sure any time pointer focus is set to NULL these values are used. weston_compositor_pick_view() now returns these values too. Now the values are always initialized, even when no view exists, and they're initialized in such a way that actually doing computation with them should fail in an obvious way, but we can compare them safely for equality. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* compositor: remove a call to weston_compositor_schedule_repaintRyo Munakata2015-08-061-2/+0
| | | | | | | | | | In weston_compositor_create, we initialize output_list. After that we call weston_compositor_schedule_repaint which just calls weston_output_schedule_repaint on all elements of output_list. This call does nothing obviously. So we remove it. Signed-off-by: Ryo Munakata <ryomnktml@gmail.com> Reviewed-by: Guilio Camuffo <guiliocamuffo@gmail.com>
* input: Don't test keyboard/pointer/touch pointersDerek Foreman2015-07-311-11/+16
| | | | | | | | | | | | | | Keyboards and pointers aren't freed when devices are removed, so we should really be testing keyboard_device_count and pointer_device_count in most cases, not the actual pointers. Otherwise we end up with different behaviour after removing a device than we had before it was inserted. This commit renames the touch/keyboard/pointer pointers and adds helper functions to get them that hide this complexity and return NULL when *_device_count is 0. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
* compositor: Respect WESTON_BUILD_DIR env var in weston_load_moduleDerek Foreman2015-07-171-3/+8
| | | | | | | | | | | We were loading modules out of the system dirs unconditionally, so tests that loaded modules would use the system ones, or fail if they weren't installed. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-By: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* compositor: destroy modifier_binding_listRyo Munakata2015-07-171-0/+1
| | | | | Signed-off-by: Ryo Munakata <ryomnktml@gmail.com> Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
* input: Pass the appropriate pointer type to bindings instead of a seatDerek Foreman2015-07-161-1/+1
| | | | | | | | | | | | | | | | | Normally we need to check if a seat's [device_type]_count is > 0 before we can use the associated pointer. However, in a binding you're guaranteed that the seat has a device of that type. If we pass in that type instead of the seat, it's obvious we don't have to test it. The bindings can still get the seat pointer via whatever->seat if they need it. This is preparation for a follow up patch that prevents direct access to seat->device_type pointers, and this will save us a few tests at that point. Reviewed-by: Jonas Ådahl <jadahl@gmail.com> Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
* compositor: Respect repaint-window when restarting repaint loop.Mario Kleiner2015-07-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a stopped repaint loop gets restarted due to posting of new damage, and this restart of the repaint loop happens late in the video refresh cycle, ie. already inside the repaint-window and thereby after the composition deadline for the current frame, then defer the actual output repaint to the composition deadline of the next video refresh cycle by setting the repaint timer accordingly. This tries to make sure that: a) Client(s) posting damage timely before the composition deadline (video refresh duration - "repaint-window" duration) of the current refresh cycle will trigger a repaint within the current refresh cycle, thereby avoiding one extra frame of compositor lag due to the needed restart of the repaint loop if the loop was stopped. This allows them to benefit from the earlier "instant repaint restart" commit to keep latency low. b) Late clients which post damage close to the end of a refresh cycle can't race other clients if the repaint loop is restarted. Instead they will get deferred to the next compositor cycle, just as if the repaint loop would have been already running - the semantic of the "repaint-window" parameter is preserved. This is especially important to prevent a very late client from triggering a repaint very close to the vblank, which would cause the compositor to certainly miss the vblank and skip one frame and then cause a delay of another frame for other clients which posted their damage in time for the following frame. Iow. this provides clients with a more predictable compositor timing and makes it easier for them to latch onto the compositors repaint cycle. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor,shared: add millihz_to_nsec()Pekka Paalanen2015-07-161-1/+1
| | | | | | | | A helper to improbe readability. Cc: Daniel Stone <daniels@collabora.com> Cc: Mario Kleiner <mario.kleiner.de@gmail.com> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* shared: introduce timespec-util.hPekka Paalanen2015-07-161-20/+1
| | | | | | Copyright is set according to the moved code from compositor.c. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: make sure to reset views' pointers to destroyed outputGiulio Camuffo2015-07-131-0/+9
| | | | | | | | | | | When an output is being destroyed reassign the output of the views that were in it, to be sure not to keep a dangling pointer which could be used later on by calling weston_surface_assign_output() on the view's surface. Also make sure we send wl_surface.leave events to the surfaces that were in that output. Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
* compositor: move the main() to a new main.c fileGiulio Camuffo2015-07-101-804/+1
| | | | | | | | | | | | This commits starts to separate the libweston code from the weston specific code. As such, the main() is moved, together with signals handling and configuration handling. The definition of DEFAULT_REPAINT_WINDOW is left in compositor.c, so the config loading of repaint_msec is slightly modified to account that. Acked-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: add API to manage compositor instancesGiulio Camuffo2015-07-101-47/+120
| | | | | | | | | | | | | | | This commit adds three new exported functions: - weston_compositor_create() returns a new weston_compositor instance, initializing it as the now removed weston_compositor_init() did. - weston_compositor_exit(compositor) asks the compositor to tear down by calling the compositor's exit vfunc which is set by the libweston application. - weston_compositor_destroy(compositor) is called by the libweston application when tearing down the compositor. The compositor is destroyed and the memory freed. Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: introduce struct weston_backendGiulio Camuffo2015-07-091-12/+17
| | | | | | | | | | | | This is a preliminary change for libweston, with no functional modifications. Separate the backends and the core weston_compositor struct, by creating the weston_compositor in the main(), and having the various backends extend the weston_backend struct, an instance of which is returned by the backend entry point. This enable us to logically separate the compositor core from the backend, allowing the core to be extended without messing with the backends. Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: add missing help textJoonCheol Park2015-06-221-0/+3
| | | | | | | The headless-backend.so was missing in available backend list Signed-off-by: JoonCheol Park <jooncheol@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: Add missing help textDerek Foreman2015-06-221-1/+3
| | | | | | | Help messages were missing for some command line options. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* Moved helper macro to a discrete include file.Jon Cruz2015-06-151-0/+1
| | | | | | | | | | | To help reduce code duplication and also 'kitchen-sink' includes the ARRAY_LENGTH macro was moved to a stand-alone file and referenced from the sources consuming it. Other macros will be added in subsequent passes. Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* Remove redundant #include path component.Jon Cruz2015-06-151-1/+1
| | | | | | | | | Using the parent '../' path component in #include statements makes the codebase more rigid and is redundant due to proper -I use. Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* src: Update boilerplate from MIT X11 license to MIT Expat licenseBryce Harrington2015-06-151-16/+19
|
* move text_backend initialization into the shell pluginMurray Calavera2015-06-111-2/+0
| | | | | | | | | Whether a input method is used should be the responsibility of the shell because some shells may not want to implement an input method at all Signed-off-by: Murray Calavera <murray.calavera@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: send the output_created signal after inserting it in the listGiulio Camuffo2015-05-081-1/+14
| | | | | | | | | | The compositor's output_created signal used to be sent in weston_output_init() which the backend call before putting the output in the output_list. This caused problems when creating a new view in a listener to that signal, because weston_view_assign_output() doesn't yet know the new output exists. To fix this add a new weston_composito_add_output() func which adds the output in the list and later sends the signal, and make the backends call that.
* touch: Make weston_touch_set_focus() take a touch instead of a seatDerek Foreman2015-05-011-1/+1
| | | | | | | | The other set_focus() functions take the relevant type instead of a seat already, so this is consistent. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* compositor: change weston_surface::destroy_signal argumentPekka Paalanen2015-04-301-3/+3
| | | | | | | | | | | | | | Pass 'this' weston_surface as the data argument to weston_surface::destroy_signal listeners. The old &surface->resource was really just an offsetted pointer to the weston_surface anyway. And, because 'resource' happened to be the first member in struct weston_surface, it was actually 'this' weston_surface. The argument type was accidentally changed in commit 26ed73cee858956f6af07c3e4bb49b5514f17b8b from wl_resource* to wl_resource**. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: inert wl_surface objects do not existPekka Paalanen2015-04-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no valid case, where you would actually destroy a weston_surface, while leaving the wl_surface protocol object in existence. Therefore, inert wl_surface objects do not exist, except because of bugs. To catch such bugs, check that the resource is really NULL before actually destroying the weston_surface. We actually used to have this check, but it was removed by: commit 9dadfb53526bc97d62dc01c165e8b6f722f7ea5a Author: Kristian Høgsberg <krh@bitplanet.net> Date: Mon Jul 8 13:49:36 2013 -0400 compositor: Eliminate marshalling warning for leave events However, the invariant was put back in: commit 0d379744d34e616fea840272deda6b7027f79f55 Author: Giulio Camuffo <giuliocamuffo@gmail.com> Date: Fri Nov 15 22:06:15 2013 +0100 compositor: set weston_surface:resource to NULL when destroyed So apparently the issue fixed by 9dadfb53 was fixed another way later. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: Help text for --configBryce Harrington2015-04-071-0/+1
| | | | | Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>