summaryrefslogtreecommitdiff
path: root/src/compositor-rpi.c
Commit message (Collapse)AuthorAgeFilesLines
* protocol: migrate to stable presentation-time.xmlPekka Paalanen2016-03-071-4/+4
| | | | | | | | | | | | | | | | | | | | 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-{drm, fbdev, rpi}: Make VT switching configurableBob Ham2016-01-121-15/+1
| | | | | | | | | | | | Add a new boolean weston.ini option, "vt-switching" to enable or disable Ctrl-Alt-Fn key combinations. Signed-off-by: Bob Ham <bob.ham@collabora.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com> (Derek Foreman changed the prototype for switch_vt_binding to have a weston_keyboard * instead of weston_seat *. The pointer wasn't used, so this is just a warning fix.)
* compositor: pass the backend config struct to the backends init functionGiulio Camuffo2015-10-231-1/+2
| | | | | | | | | Add new configuration argument to the backend_init() function, which will replace the current argc, argv, and config arguments. After each backend is converted individually the unused parameters will be removed. Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* rpi: fix segfault at startup in rpi_flippipe_init() v2John Sadler2015-09-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When running with the RPi backend, Weston now segfaults at startup on the line: flippipe->clk_id = output->base.compositor->presentation_clock; in `rpi_flippipe_init()`. This is because `output->base.compositor` is NULL. This problem did not exist on 1.8.0, and it looks like it may have been introduced by 954f183e2f. This commit ensures that the `compositor` is initialised in `rpi_backend` and that flippipe init uses the compositor pointer from backend. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91885 Signed-off-by: John Sadler <deathofathousandpapercuts@gmail.com> Changes in v2: - fix summary to not break the build - use output->backend->compositor in rpi_flippipe_init() instead of output->base.compositor. The latter is set by weston_output_init() which gets called later than rpi_flippipe_init(). Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: John Sadler <deathofathousandpapercuts@gmail.com>
* rpi: prevent segfault on shut-down due to NULL backendJohn Sadler2015-09-081-0/+2
| | | | | | | | | | | | | | When running with the RPi backend, Weston sefaults during shutdown. This is due to the fact that `compositor->backend` is never initialised, and there is no NULL check prior to calling `destroy()`. This commit fixes the issue by making `rpi_backend_create()` intialise `compositor->backend` - just like the X11 backend does. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91886 Signed-off-by: John Sadler <deathofathousandpapercuts@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* backends: don't destroy renderer and output twiceDawid Gajownik2015-08-061-5/+2
| | | | | | | | drm, fbdev, rpi and wayland backends are unnecessarily destroying renderer and output before executing weston_compositor_shutdown() Signed-off-by: Dawid Gajownik <gajownik@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/+2
| | | | | | | | | | | | | | | | | 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: add API to manage compositor instancesGiulio Camuffo2015-07-101-9/+2
| | | | | | | | | | | | | | | 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-70/+77
| | | | | | | | | | | | 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>
* 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>
* src: Update boilerplate from MIT X11 license to MIT Expat licenseBryce Harrington2015-06-151-16/+19
|
* compositor: send the output_created signal after inserting it in the listGiulio Camuffo2015-05-081-1/+1
| | | | | | | | | | 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.
* compositor, backends: weston_compositor_read_presentation_clockPekka Paalanen2015-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* compositor-rpi: give the output a nameDerek Foreman2015-03-181-0/+1
| | | | | Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: set presentation.presented flagsPekka Paalanen2015-01-201-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change weston_output_finish_frame() signature so that backends are required to set the flags, that will be reported on the Presentation 'presented' event. This is meant for output-wide feedback flags. Flags that vary per wl_surface are subject for the following patch. All start_repaint_loop functions use the special private flag PRESENTATION_FEEDBACK_INVALID to mark, that this call of weston_output_finish_frame() cannot trigger the 'presented' event. If it does, we now hit an assert, and should then investigate why a fake update triggered Presentation feedback. DRM: Page flip is always vsync'd, and always gets the completion timestamp from the kernel which should correspond well to hardware. Completion is triggered by the kernel/hardware. Vblank handler is only used with the broken planes path, therefore do not report VSYNC, because we cannot guarantee all the planes updated at the same time. We cannot set the INVALID, because it would abort the compositor if the broken planes path was ever used. This is a hack that will get fixed with nuclear pageflip support in the future. fbdev: No vsync, update done by copy, no completion event from hardware, and completion time is totally fake. headless: No real output to update. RDP: Guessing that maybe no vsync, fake time, and copy make sense (pixels sent over network). Also no event that the pixels have been shown? RPI: Presumably Dispmanx updates are vsync'd. We get a completion event from the driver, but need to read the clock ourselves, so the completion time is somewhat unreliable. Zero-copy flag not implemented though it would be theoretically possible with EGL clients (zero-copy is a per-surface flag anyway, so in this patch). Wayland: No information how the host compositor is doing updates, so make a safe guess without assuming vsync or hardware completion event. While we do get some timestamp from the host compositor, it is not the completion time. Would need to hook to the Presentation extension of the host compositor to get more accurate flags. X11: No idea about vsync, completion event, or copying. Also the timestamp is a fake. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com> Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com> Acked-by: Mario Kleiner <mario.kleiner.de@gmail.com>
* logind: forward Active=true changes for non-DRM backendsDavid Herrmann2015-01-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Logind sends us a notification whenever the Active attribute of our session changes. However, due to the way compositor-drm.c relies on the master DRM device to be synced with the session, we used to delay Active=true handling until the DRM device was up, too. See: commit aedc7732ebd9bc7b4f51ee247ea857ffec6260a7 Author: David Herrmann <dh.herrmann@gmail.com> Date: Sat Nov 30 11:25:45 2013 +0100 logind: delay wakeup until DRM-device is resumed However, the other compositor backends do not use DRM, so logind-util will never get notified about any DRM device. Therefore, we have to forward the Active=true change immediately. This commit fixes logind-util to take sync_drm as argument. If it is true, we do DRM-device synchronisation, otherwise we don't. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=86889 Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
* Use zalloc instead of calloc(1, ...)Bryce Harrington2014-11-281-3/+3
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
* compositor: Drop legacy backends in favor of libinputPeter Hutterer2014-11-261-1/+1
| | | | Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* backends: refactor transform string parsingDerek Foreman2014-11-191-39/+4
| | | | | | | Most of the backends do their own parsing of transform strings, so let's put that all in the same place (compositor.c/h) Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: set and use the presentation clock everywherePekka Paalanen2014-09-301-25/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add presentation clock setters that verify the given clock actually works. Offer an automatic choice of a software fallback clock, when a backend has to always use clock_gettime() to approximate the presentation time. The DRM backend already queried the DRM about the clock id, just let the DRM backend set the presentation clock from that. For all other backends which do not get a timestamp from the driver, call the software clock setter to choose a suitable clock. Report the chosen clock via presentation.clock_id event to clients. In finish_frame(), upgrade the argument from uint32_t milliseconds to struct timespec which can accurately hold the presentation clock values. This will be needed when weston_output_finish_frame() starts to send out presentation_feedback.presented events. While at it, replace gettimeofday() calls with clock_gettime() using the chosen presentation clock, so we manufacture presentation timestamps from the presentation clock when the gfx drivers cannot give us a proper timestamp. Rpi patch is more verbose due to not having the compositor pointer available in rpi_flippipe_update_complete(). Explicitly carry the clock id with flippipe so it is available in the thread. Changes in v4: * rpi debug build fix v4 Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> v3 Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
* Add libinput based input device backendJonas Ådahl2014-03-121-2/+3
| | | | | | | | | | | While disable by default, passing --enable-libinput-backend to ./configure switches the input backend in weston's drm, fbdev and rpi compositing backends to use libinput instead of udev-seat.c, evdev.c and friends. When enabled, weston now also depends on libinput >= 0.1.0. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* udev-seat: Make udev_input own its own udev object referenceJonas Ådahl2014-03-121-1/+1
| | | | | | | No functional changes; API simplification in preparation for multiple input backends. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* compositor-rpi: Fix input initializationEmilio Pozuelo Monfort2014-02-051-11/+8
| | | | | | | The input initialization code assumes the outputs have already been initialized; thus create the outputs first. This fixes a segfault upon startup. It is also what the drm and fbdev backends do.
* compositor: Destroy renderer in weston_compositor_shutdown()Ander Conselvan de Oliveira2013-12-221-2/+0
| | | | | | | | | | Currently we destroy the renderer before the outputs are destroyed, but that sometimes leads to an error since a reference to the renderer is necessary in order to destroy a gl_renderer_output. Since destroying the renderer is common among all backends, just move that call into weston_compositor_shutdown() immediately after the outputs being destroyed.
* compositor: Remove output from list in weston_output_destroy()Ander Conselvan de Oliveira2013-12-161-1/+0
| | | | | | | When destroying ouputs, they would sometimes be removed before the call to weston_output_destory() and sometimes after, depending on the backend. Now the output is remove withing that function so the behavior is standard across all backends.
* rpi: launcher must init before udev-seatPekka Paalanen2013-12-041-12/+12
| | | | | | | | udev-seat will call weston_launcher_open(), so we better init launcher first. Fixes a segfault. Cc: Jonas Ådahl <jadahl@gmail.com> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* rpi: seat quick fixPekka Paalanen2013-12-041-1/+1
| | | | | | | | | | | | | Fix the default seat name, so that we can find the input devices by default. This is just a quick fix. Further enhancement would be to make the default seat on rpi taken from a command line option like the other backends do. Furthermore, udev_input_init() should accept NULL as seat to use the default seat, avoiding us hardcoding "seat0" all over. Cc: Jonas Ådahl <jadahl@gmail.com> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* rpi: Use common udev_input for input device handlingJonas Ådahl2013-12-021-245/+16
| | | | | | | | | | The purpose of this patch is to move away from separating evdev functionality from udev functionality in order to rely on a separate library to do this for us. This patch is only compile tested and I have no idea how much it breaks. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* rpi: Support opaque regionsTomeu Vizoso2013-12-021-0/+3
| | | | | | | | This is needed for XWayland surfaces with alpha channel, as X will be sending crap in there that should be discarded. This is currently done with a copy in the compositor, while we wait for support in the VideoCore side.
* pixman-renderer, gl-renderer: Destroy debug bindings on clean upAnder Conselvan de Oliveira2013-10-251-1/+2
| | | | | | | Also make sure backends destroy the renderers before shutting down the compositor to avoid a double call to weston_binding_destroy(). This is a step towards making renderers switchable during runtime.
* compositor: Remove redundant and not well-defined focus fieldKristian Høgsberg2013-10-221-3/+0
| | | | It was never clear what this field really did.
* compositor: finish frame if redraw failsDavid Herrmann2013-10-221-1/+2
| | | | | | | | | | | | | | If we are about to finish a frame, but a redraw is pending and we let the compositor redraw, we need to check for errors. If the redraw fails and the backend cannot schedule a page-flip, we need to finish the frame, anyway. All backends except DRM use a timer to schedule frames. Hence, they cannot fail. But for DRM, we need to be able to handle drmModePageFlip() failures in case access got revoked. This fixes a bug where logind+drm caused keyboard input to be missed as we didn't reenable it after a failed page-flip during deactivation.
* launcher: add logind backendDavid Herrmann2013-10-211-1/+1
| | | | | | Instead of connecting to weston-launch from launcher-util, we now try to connect to logind first. If logind provides session-devices, we use them. If not, we fall back to the old weston-launch facility.
* launcher: Add back support for specifying VT to run onKristian Høgsberg2013-10-021-1/+2
| | | | | | | | | This is only available when running weston directly as root typically for ssh logins. It's a somewhat destructive option, as it will take over any existing VT completely, unless there's already an display server running there. https://bugs.freedesktop.org/show_bug.cgi?id=69731
* Notify clients on mode_switch()Hardening2013-09-211-1/+0
| | | | | | | | | | This patch implements the notification of clients during mode_switch. As discussed on IRC, clients are notified of mode_switch only when the "native" mode is changed and activated. That means that if the native mode is changed and the compositor had activated a temporary mode for a fullscreen surface, the clients will be notified only when the native mode is restored. The scaling factor is treated the same way as modes.
* Rename current, origin, scale, origin_scaleHardening2013-09-211-2/+2
| | | | This patch renames that fields to have consistent names.
* launcher: Move rest of tty object into struct weston_launcherKristian Høgsberg2013-09-181-13/+11
| | | | | | The struct weston_launcher object will now either handle tty and vt switching details in-process (when running weston directly as root) or talk to the weston-launch process.
* compositor: Generalize VT switching as a session_signalKristian Høgsberg2013-09-181-11/+11
| | | | | Instead of a callback from the tty module, we now have a compositor level signal that fires when our session is activated or deactivated.
* malloc + memset -> zallocPeter Hutterer2013-08-081-2/+1
| | | | | | And for clients using the xmalloc helper, use xzalloc. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* configure.ac: Enable AC_USE_SYSTEM_EXTENSIONSDaniel Stone2013-06-051-3/+1
| | | | | | | | | | | | | | | | | | AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar macros to expose the largest extent of functionality supported by the underlying system. This is required since these macros are often limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually on some systems hide declarations which are not part of the X/Open spec. Since this goes into config.h rather than the command line, ensure all source is consistently including config.h before anything else, including system libraries. This doesn't need to be guarded by a HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org modular transition. Signed-off-by: Daniel Stone <daniel@fooishbar.org> [pq: rebased and converted more files]
* input: Add a seat name parameter to weston_seat_initRob Bradford2013-06-051-1/+1
|
* compositor: Parse config file in main(), only keep weston config objectKristian Høgsberg2013-05-261-4/+5
| | | | | Now that all backends and modules have been converted to the new config parser API, we don't have to keep the fd around.
* rpi: remove weston_plane supportPekka Paalanen2013-05-221-727/+0
| | | | | | | There is no need to support weston_plane anymore. The max-planes option is removed as unused. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* rpi: switch to rpi-rendererPekka Paalanen2013-05-221-87/+85
| | | | | | | | | | | | | | | | | Replace the GL renderer with the new rpi-renderer on the Raspberry Pi backend. This makes Weston on rpi not use EGL or GL anymore, at all. The weston_plane feature is disabled, since the rpi-renderer does the same, but better. Add a command line option to select the output transform. It is not a weston.ini option for now, since the rpi backend does not read the configuration file yet. Hopefully that will be done later with some shared code. Add the rpi options to 'weston --help' output. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* compositor: Support output/buffer scalingAlexander Larsson2013-05-221-1/+2
| | | | | | | | | | | | | | If you specify e.g. scale=2 in weston.ini an output section for the X11 backend we automatically upscale all normal surfaces by this amount. Additionally we respect a buffer_scale set on the buffer to mean that the buffer is already in a scaled form. This works with both the gl and the pixman renderer. The non-X backends compile and work, but don't support changing the output scale (they do downscale as needed due to buffer_scale though). This also sends the new "scale" and "done" events on wl_output, making clients aware of the scale.
* config-parser: Honor XDG_CONFIG_DIRSOssama Othman2013-05-141-4/+4
| | | | | | | | | | | | | | This set of changes adds support for searching for a given config file in the directories listed in $XDG_CONFIG_DIRS if it wasn't found in $XDG_CONFIG_HOME or ~/.config. This allows packages to install custom config files in /etc/xdg/weston, for example, thus allowing them to avoid dealing with home directories. To avoid a TOCTOU race the config file is actually open()ed during the search. Its file descriptor is returned and stored in the compositor for later use when performing subsequent config file parses. Signed-off-by: Ossama Othman <ossama.othman@intel.com>
* compositor: Adapt to wl_surface going awayKristian Høgsberg2013-05-081-2/+2
| | | | | | struct weston_surface is now the only surface type we have (in core, shell.c has shell_surface, of course). A lot of code gets simpler and we never have to try to guess whether an API takes a wl_surface or a weston_surface.
* input: Merge wl_seat into weston_seatKristian Høgsberg2013-05-071-2/+2
|
* Make backends always specify output repaint time1.0.90Jonas Ådahl2013-04-081-4/+21
| | | | | | | | | | | | | | | | | | Most backends relies on gettimeofday(2) for output repaint timestamps but this is not a requirement. Before this patch repaints coming from idle_repaint() always used gettimeofday(2) for timestamps. For backends not using that time source this could cause large jumps between timestamps. To fix this, timestamps needs to always come from the backend. This means that the backend needs to always be responsible of starting the repaint loop in case that the repaint cannot start immediately. The drm backend implementation is from the patch by Ander Conselvan de Oliveira found here: http://lists.freedesktop.org/archives/wayland-devel/2013-February/007393.html Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* compositor: add WESTON_COMPOSITOR_OFFSCREEN statePhilipp Brüschweiler2013-03-291-2/+2
| | | | | | | | | | This state is used when the user switches the vt. It turns of rendering and frame events, but doesn't set the DPMS state to off. As a part of this change, also turn off the idle timer when entering the SLEEPING or OFFSCREEN states, which fixes https://bugs.freedesktop.org/show_bug.cgi?id=61910 (rpi backend untested).