- Dec 13, 2017
-
-
Pekka Paalanen authored
Follow the standard pattern used in the headless and x11 backend migration, but also cater for the two other backend modes: --sprawl or fullscreen-shell, and --fullscreen. Stops relying on the implicit weston_output::head. Unlike other backends, this uses the attach_head hook to do the required head setup that is not possible to do without an output, but must be done before weston_output_enable(). This also requires the detach_head hook for the one case where the user attaches a --fullscreen head and then detaches it without enabling the output. It is a little awkward to fully initialize heads as late as attach, but aside from the --sprawl/fullscreen-shell case, there is not really a way to know the head properties without creating the parent wl_surface and configuring it. Heads/outputs created for parent outputs now have distinct names instead of all being called "wlparent". Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Add safeguards to make it painfully obvious if we ever get the pairing of wayland_backend_create_output_surface() and wayland_backend_destroy_output_surface() wrong. Helps catching bugs. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Follow the standard pattern set by the headless backend which also uses the the window output API. Stops relying on the implicit weston_output::head. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Implement the head-based output API in this backend, and stop relying on the implicit weston_output::head. The split between fbdev_head and fbdev_output is somewhat arbitrary. There is no hotplug or unplug, and there is always 1:1 relationship. Struct fbdev_screeninfo could have been split as well, but it would not have made much difference. I chose fbdev_output to carry the mmap details (buffer_length is now duplicated here), and fbdev_head to carry the display parameters and device node path. The device node identifies the head, similar to a connector. The backend init creates a head. The compositor uses it to create an output. Libweston core attaches the head automatically after creating the output. The attach hook is a suitable place to set up the video modes on the output as they are dictated by the head, it would be too late at enable() time. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Destroying the whole output in reenable would cause list walk corruption: the loop over output_list in session_notify() is not using wl_list_for_each_safe so output removal would break it. Creating a new output is also problematic as it needs the compositor to configure it, but that probably saved us from another list walk failure: adding the new output to be list while walking the list, possibly causing it to be destroyed and re-created ad infinitum. Instead of a complete destroy/create cycle, just do our internal disable/enable cycle. That will re-open the fbdev, re-read the parameters, re-create hw_surface, and reinitialize the renderer output. A problem with this is if fbdev_set_screen_info() fails. We do read the new parameters, but we don't communicate them to libweston core or old clients. However, it is hard to care: to trigger this path, one needs to VT-switch to another fbdev app which changes the fbdev parameters. That is quite difficult as VT-switching has been broken for a good while for fbdev-backend, at least with logind. Also fbdev_set_screen_info() would have to fail before one should be able to tell something is wrong. The real reason behind this patch, though, is the migration to the head-based output API. Destroying and re-creating an output really does not fit that design. Destroying and re-creating a head would be better, but again not testable in the current state. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Follow the starndard patttern as the other backends, headless and x11 in particular, to stop relying on the implicit weston_output::head. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Implement the head-based output API in this backend, and stop relying on the implicit weston_output::head. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
If the idle_repaint() callback has been scheduled when a weston_output gets destroyed, the callback will hit use-after-free. I have encountered this when migrating the wayland backend to the head-based API, using --sprawl, and closing/disconnecting one of the parent compositor outputs. Store the idle_repaint callback source, and destroy it in weston_output_release(), ensuring we don't get a stale call to start_repaint_loop later. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
The functions called here, particularly weston_output_transform_scale_init(), rely on current mode being set. The current mode must also be found in the mode list, though we don't explicitly check it here. current_mode not being set is a programmer error. It could be a backend bug, but it could also be a libweston user bug not calling a set size function. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Output make and model are not allowed to be NULL in the protocol, so ensure they are not forgotten when enabling an output. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
All frontends have been converted to the new head-based output management API, which means that weston_compositor_create_output_with_head() is calling weston_output_attach_head(). We will never hit the implicit attach anymore. Therefore we can now require that an output has at least one head when calling weston_output_enable(). An output without heads is useless. The auto-add code is removed as dead. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
The signal has been replaced with the heads_changed hook and is no longer useful. weston_pending_output_coldplug() is renamed to weston_compositor_flush_heads_changed() for two reasons: it better describes what it does now, and it serves as an obvious flag that libweston ABI has been broken. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Rename the function pointer to create_head() because that is what it does on backends that are converted to the head-based API. Update the documentation to match. Surprisingly this is not an ABI break, as the function behaviour and signature remain intact. Hence API_NAME is not bumped. This is only an API break, and main.c is fixed accordingly. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Migrate the DRM frontend to use the simple head-based output configurator, maintaining the exact same features and semantics as before. This is an intermediate step. It is unoptimal to create a weston_output just to turn it off, but the libweston implementation and the DRM backend require it for now. In the future, the DRM frontend will get its own configurator that does not create useless weston_outputs and supports clone mode by attaching multiple heads to the same weston_output. Clone mode is not yet supported by libweston/DRM. This is the last frontend migrated, wet_set_pending_output_handler() is deleted as dead code. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Migrate the RDP frontend to use the new head-based output configuration API: listen for heads_changed, and process all heads. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Migrate the fbdev frontend to use the new head-based output configuration API: listen for heads_changed, and process all heads. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Migrate the Wayland frontend to use the new head-based output configuration API: listen for heads_changed, and process all heads. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Migrate the x11 frontend to use the new head-based output configuration API: listen for heads_changed, and process all heads. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Migrate the headless frontend to use the new head-based output configuration API: listen for heads_changed, and process all heads. The simple_heads_changed() function is written to be able to cater for all backends. The rest will be migrated individually. The head destroy listeners are not exactly necessary, for headless anyway, but this is an example excercising the API. Also is_device_changed() check is mostly useful with DRM. v3: Print "Detected a monitor change" only for enabled heads. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Move the call out of wet_configure_windowed_output_from_config() and into its callers. This allows to migrate each frontend one by one. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Reacting to DRM hotplug events is racy. It is theoretically possible to get hotplug events for a quick swap from one monitor to another and process both only after the new monitor is connected. Hence it is possible for display device information to change without going through a disconnected state for the head. To support such cases, add API to allow detecting it in the compositor. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Add support for subscribing to weston_head destruction. The primary use case for heads being destroyed arbitrarily is the DRM-backend with MST connectors, which may disappear on unplug. It is not just the connector becoming disconnected, it is the connector actually disappearing. The compositor needs to know about disappearing heads so that it has a chance to clean up "orphaned" outputs which do get disabled but still need destroying at run time. Shutdown would destroy them as well. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Introduce the API for users (compositors) to create an output from a head, attach and detach heads, and destroy outputs created this way. This also adds the backend-facing API to libweston. In the new API design, a backend creates heads, and the compositor chooses one or more heads (clone mode) to be driven by an output. In the future backends will be converted to not create outputs directly but only in the new create_output hook. The user subscribes to a heads_changed hook and arranges heads into outputs from there. Adding the API this way will allow frontends (main.c) and backends to be converted one by one. This adds compatiblity paths in weston_compositor_create_output_with_head() and weston_output_destroy() so that frontends can be converted first to call these, and then backends can be converted one by one to the new design. Afterwards, the compatibility paths will be removed along with weston_output::head. Currently heads can be added to a disabled output only. This is less than ideal for clone mode hotplug and should be improved on later. v4: Remove the wl_output global on head detach if output is enabled. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Add a hook for compositors to get a callback when heads are added or their connection status changes, to which compositors likely want to react to by enabling or disabling outputs (API for that to be added later). As many head changes as possible should be coalesced into a single heads_changed call. Therefore the callback is made from an idle task. This anticipates a future atomic output configuration API, where the global output configuration is tested and set atomically instead of one by one. weston_pending_output_coldplug() needs to manually execute the heads_changed call so that initial outputs are created before any plugins get their start-up idle tasks ran. This is especially important for ivi-shell which does not support output hotplug, and for tests to guarantee the expected outputs. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
weston_compositor needs to maintain a list of all available heads, so that a compositor can pick and choose which heads to take into or out of use at arbitrary times. The heads may be on or off, and connected or disconnected. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Heads may be disconnected or connected and the compositor needs to be able to know the state to know which heads to take into use. Currently a single head is automatically created with an output, and outputs are only ever created as connected and destroyed on disconnection, so it suffices to set connected to true. In the future, backends are expected to create heads for both connected and disconnected connectors, so that a connector can be forced on without it being actually connected. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Heads need to be named, so they can be referenced in logs and configuration sources. When clone mode is implemented, output and head names may differ. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
The 'head' member of 'struct weston_output' is going to go unused and then disappear, so stop using it and find a head from the proper list. However, this leaves a problem in cms-colord: if you have multiple monitors driver with the same CRTC, what do you say to the color management system? The monitors could be different, but all the color LUTs etc. are in the CRTC and are shared, as is the framebuffer. Do the simple hack here and just use whatever head happens to be the first in the list. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Duplicate these strings to decouple their lifetime from whatever the backends used. This should prevent hard to catch use after frees and such problems in the future. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
-
Pekka Paalanen authored
Remove the wl_resource in the head's resource list when we are removing the wl_output global. We sent global removal events to clients, the resources should become dummies until clients reap them. Reset user data so that clients triying to use dummy objects don't hit e.g. a freed head pointer. This fixes a theoretical issue: if an enabled output is disabled and then gets enabled again, mode changes and wl_surface.enter/leave would still attempt to use the dummy objects. If a client destroyed a dummy object, we don't have the destructor to remove it from the resource list, and libweston would hit freed memory. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
The intention is that in the future backends will dynamically allocate weston_heads based on the resources they have. The lifetime of a weston_head will be independent of the lifetime of a weston_output it may be attached to. Backends allocate objects derived from weston_head, like they currently do for weston_output. Backend will choose when to destroy a weston_head. For clone mode, struct weston_output gains head_list member, which is the list of attached heads that will all show the same framebuffer. Since heads are growing out of weston_output, management functions are added. Detaching a head from an enabled output is allowed to accommodate disappearing heads. Attaching a head to an enabled output is disallowed because it may need hardware reconfiguration and testing, and so requires a weston_output_enable() call. As a temporary measure, we have one weston_head embedded in weston_output, so that backends can be migrated individually to the new allocation scheme. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
Split out a new function. This is a pure refactoring, no change in behaviour. This helps a following patch that adds a loop over output->head_list. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
-
Pekka Paalanen authored
The user data of a wl_resource representing a wl_output protocol object used to be a pointer to weston_output. Now that weston_output is being split, wl_output more accurately refers to weston_head which is a single monitor. Change the wl_output user data to point to weston_head. weston_output_from_resource() is replaced with weston_head_from_resource(). This change is not strictly necessary, but architecturally it is the right thing to do. In the future there might appear the need to refer to a specific head of a cloned pair, for instance. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
As a wl_output represents weston_head, use a weston_head pointer as the wl_output global's user data. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
The wl_output protocol interface exposes things like monitor make, model, sub-pixel layout and physical dimensions. Obviously wl_output is meant to represent a monitor. The abstraction of a monitor is weston_head. Therefore move the wl_output global and the bound resources list into weston_head. When clone mode gets implemented in the future, this means that monitors driven by the same CRTC will still be represented as separate wl_output globals. This allows to accurately represent the hardware. Clone mode that used separate, not frame-locked, CRTCs to drive two monitors as clones would necessarily also be exposed as separate wl_output since they have different timings. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Pekka Paalanen authored
In order to support clone modes, libweston needs the concept of a head that is separate from weston_output. While weston_output manages buffers and the repaint state machine, weston_head will represent a single monitor. In the future it will be possible to have a single weston_output drive one or more weston_heads for a clone mode that shares the framebuffers between all cloned heads. All the fields that are obviously properties of the monitor are moved from weston_output into weston_head. As moving the fields requires one to touch all the backends for all the assingments, introduce setter functions for them while we are here. The setters are identical to the old assignments, for now. As a temporary measure, weston_output embeds a single head. Also the ugly casts in weston_head_set_monitor_strings() will be removed by a follow-up patch. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
- Dec 12, 2017
-
-
Split pointer motion and pointer button tests so that each test case is more focused and self-contained. Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
Move wl_pointer tests from event-test.c to their own pointer-test.c file. This move makes the test organization clearer and more consistent, and will make addition of further pointer tests easier. Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
- Dec 11, 2017
-
-
Nobody checks for the bool returned by these functions. At the same time: a) the functions set the respective num_foo to zero on error and b) callers honour that variable. Just drop the return type - it's useless. Note: this is an ABI break. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
-
Signed-off-by: Arnaud Vrac <rawoul@gmail.com> Fixes: 00a03d2f ("gl-renderer: add support of WL_SHM_FORMAT_NV12") Reviewed-by: Daniel Stone <daniels@collabora.com>
-