Commit Graph

1733 Commits

Author SHA1 Message Date
Daniel Stone e07be58dc4 gl-renderer: Use highest precision for vertex shaders
Whilst GLSL requires highp for the vertex shader stage, highp is
optional for the fragment shader.

Make sure that we work in highp by default during the vertex shader
stage, using either highp or mediump for the texcoord varying according
to what the fragment shader supports.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-02-02 21:46:06 +00:00
Derek Foreman e471edb33d drm-backend: Enable plane rotations
Search for planes that support the rotation required to properly display
a paint node, and properly set coordinates and rotation properties.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman b0f23dc09d backend-drm: Set rotation property on planes when possible
For now we just always set the plane up to have a "normal" rotation, so
no new features are added with this commit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman f89f440735 kms: Add plane rotation property
Add plane rotations to our recognized properties.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman 397ed8cec5 kms: Support bitmasks
From our perspective, a bitmask is pretty much the same as an enum, so
allow it to use the same path.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman e3ec879d11 drm-backend: Cache paint node transform
Instead of calculating this multiple times, just store it in the paint
node.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:54 -06:00
Derek Foreman da3d3c7e95 compositor: Add dirty bits to paint nodes
We're pushing more and more mutable state into paint nodes, but this state
has a non-zero cost to rebuild every render.

Let's take care to track when we need to rebuild the state.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 13:49:39 +00:00
Tran Ba Khang(MS/EMC31-XC) 776fafe13a libweston/desktop: committed when transiting from valid to invalid buffer
Every shells have an implementation of weston_desktop_api structures.
It includes some callbacks to listen to xdg_surface signals. Committed callback
is one of them.

Currently, the xdg_shell don't invoke the weston_desktop_api->committed
callback when the xdg_surface is initial stage or no surface content.

In the case: the client attached a null buffer after the valid buffer,
the shell isn't going to invoke to xdg_surface committed, and don't know
the surface is disappeared. If the surface is fullscreen, we will get
a black background on the screen until a new valid frame come. That
should not happen.

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2023-02-02 11:05:19 +02:00
Tran Ba Khang(MS/EMC31-XC) 7ba87d7062 libweston: support API to detect an unmapping commit of surface
Add the weston_surface_is_unmapping() api, this will help the shell
to detect the commit of a surface is unmapping or not.

Suggested-by: Morgane Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2023-02-02 11:03:10 +02:00
Philipp Zabel 51ef88a7f4 backend-vnc: destroy renderbuffer before renderer output state
Reorder pixman renderer output state and renderbuffer removal to make
sure the pixman renderbuffer list is empty when the output state is
destroyed.

Fixes: 4d96635a3f ("pixman-renderer: track damage in weston_renderbuffer")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-02 10:58:14 +02:00
Derek Foreman 8057f28b98 backend-drm: Support tearing
Allow tearing for clients that request it, provided we can put their
content on a plane.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 10:12:55 -06:00
Derek Foreman 9203d98f8b backend-drm: Check for the atomic tearing capability
Check if our drm device supports atomic async page flips.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 10:12:55 -06:00
Derek Foreman 974a707add libweston: Add support for tearing-control
Add core support for tearing control.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 10:12:55 -06:00
Derek Foreman 58dde0e0c0 drm-backend: Remember to set the zpos for the scanout plane
We can clear this via drm_plane_state_put_back() at the end of
drm_output_propose_state(). We need to set it back to the minimum zpos
when rendering.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 15:56:24 +00:00
Derek Foreman ac04199db1 libweston: Remove old coordinate conversion functions
We don't need these anymore, as all users have been moved to the
weston_coord equivalents.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman 64d9270804 libweston: Use weston_coord space conversion functions
Update users of the old coordinate space conversion functions that take
x, y pairs to the new weston_coord versions.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman 0b78ec96f7 libweston: use weston_coord for weston_matrix_transform_rect
Possibly the least useful place to use this, as the input comes directly
from pixman rects, and the output is more complicated than usual, but
I guess consistency counts for something.

There is some small benefit in switching to weston_matrix_transform_coord
to hide the perspective normalization step and the homogenous coords.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman e1b4ad7d0b matrix: Introduce weston_coord
All through weston we have code that passes int x, y or
float x, y or wl_fixed_t x, y pairs. These pairs are frequently
converted to/from wl_fixed_t and other types.

We also have struct vec2d and struct weston_geometry which also
contain coordinate pairs.

Let's create a family of coordinate vector structures for coordinate
pairs and use it anywhere we sensibly can.

This has a few benefits - it helps remove intermediate conversion
between fixed/float/int types. It lets us roll the homogenous
coordinate normalization bits into helper functions instead of
needing them open coded throughout the source.

Possibly most importantly, it also allows us to do some compile time
validation of what coordinate space we're working in.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman fe4d5711bf libweston: Split weston_view_set_position() into rel and abs variants
One variant is used when a view is being positioned relative to a parent,
the other is when the view is being given an absolute position in the
global space.

This will help later when surface and global coordinates are different
data types, but for now the two functions do essentially the same thing.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Philipp Zabel 397e66a4dd backend-drm: allow more formats with pixman-renderer
Clean up the code a little by dropping the now unnecessary switch case
in drm_output_init_pixman(). As a side effect, this enables all formats
that have a pixman_format entry in the pixel format table:

  - rgb565
  - xrgb8888
  - argb8888
  - xbgr8888
  - abgr8888
  - rgbx8888
  - rgba8888
  - bgrx8888
  - bgra8888
  - xrgb2101010
  - argb2101010
  - xbgr2101010
  - abgr2101010

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-31 15:32:24 +00:00
Philipp Zabel 4c3febfb52 backend-drm: use pixel_format_info instead of gbm_format
Use const struct pixel_format_info *format instead of uint32_t
gbm_format for backend and output pixel format.

Since create_gbm_surface() is never called without output->format being
set, drop the unnecessary error message.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-31 15:32:24 +00:00
Stefan Agner 64dea007c6 backend-vnc: add meson subprojects support
Make use of meson subprojects support. Allow to optionally build the
libraries required for the VNC backend as subproject of Weston.

Signed-off-by: Stefan Agner <stefan@agner.ch>
[philipp.zabel@gmail.com: update neatvnc and aml versions]
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-31 09:43:41 +02:00
Philipp Zabel ad38c41a50 gl-renderer: use pixel_format_info instead of drm fourccs
Use struct pixel_format_info pointers instead of uint32_t drm fourcc
values at the API surface for output and image creation.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-29 14:47:03 +01:00
Philipp Zabel 782fd7f370 pixel-formats: add pixel_format_get_array()
Add a helper function to turn an array of DRM fourccs into an array of
corresponding struct pixel_format_info pointers.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-29 14:47:03 +01:00
Philipp Zabel efffd0d8a4 Revert "libweston: let weston_output_update_capture_info() take drm_format"
This reverts commit af5acbc9cb.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-28 12:59:16 +00:00
Philipp Zabel c67773bc5c pixman-renderer: use pixel_format_info instead of pixman_format_code_t
Use struct pixel_format_info pointers instead of pixman_format_code_t
values at the API surface for output and image creation.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-28 12:59:16 +00:00
Derek Foreman 889c2e3f0d xwayland: Fix delay in displaying pop-up menu
Xwayland pop-up menus aren't displayed until the mouse moves, or some other
action causes the compositor to repaint.

This is because the shell knows nothing about xwayland override redirect
windows, so it won't assign them an output. Without an output, the
surface commit won't cause a repaint.

Fix this with brute force by updating their geometry on commit. If the
geometry is dirty (and it will be for new surfaces), this will cause an
output to be assigned before the upcoming weston_surface_schedule_repaint()

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Found-by: Hideyuki Nagase <hideyukn@microsoft.com>
2023-01-28 12:56:23 +00:00
Philipp Zabel 14533cdd25 libweston: make weston_renderbuffer refcounted
Add weston_renderbuffer_ref/unref() functions and use them to
eventually destroy the weston_renderbuffer. Drop the explicit
renderbuffer_destroy vfunc from the pixman renderer interface.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-27 16:52:14 +01:00
Philipp Zabel 8642a8e8e4 backend-wayland: drop unused pm_image
This pixman image is not actually used anymore, drop it.

Fixes: 89e1831cd7 ("pixman-renderer: add weston_renderbuffer and create/destroy interface")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-26 16:04:32 +01:00
Philipp Zabel e4538a7647 pixman-renderer: rename create_image_no_clear to create_image
Given that pixman_image_create_bits_no_clear() is asked to allocate the
buffer on its own, the _no_clear part is not important. Drop it.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-26 12:50:09 +01:00
Marius Vlad 59ac0a38da libweston/vertex-clipping: Use shared helper
And introduced a new helper, CLIP, with it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-24 16:59:37 +02:00
Marius Vlad 71e826defd gl-renderer: Use MIN/MAX helpers
We already have some helpers for MAX and MIN, just use those.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-24 16:59:08 +02:00
Philipp Zabel 5a41911ff0 ci, backend-vnc: update to Neat VNC 0.6.0, aml 0.3.0
Neat VNC 0.6.0 supports querying client side cursor support.
It requires aml 0.3.0.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-23 22:12:38 +01:00
Philipp Zabel a782040368 pixman-renderer: update capture info on output creation
Move the call to weston_output_update_capture_info() from the headless
backend into pixman_renderer_output_create(). For this, add an
uint32_t drm_format parameter to struct pixman_renderer_output_options.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-23 20:05:21 +00:00
Philipp Zabel af5acbc9cb libweston: let weston_output_update_capture_info() take drm_format
Let weston_output_update_capture_info() take a uint32_t drm_format
parameter directly instead of const struct pixel_format_info *format.
No other fields apart from the format were used from this structure.

Without this, callers may have to unnecessarily look up the pixel
format info in cases where the DRM fourcc is already available.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-23 20:05:21 +00:00
Philipp Zabel eb9a740c20 libweston: move pixman_renderer_init() into weston_compositor_init_renderer()
Stop calling pixman_renderer_init() from backends directly.
Call it via weston_compositor_init_renderer() instead.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-23 20:05:21 +00:00
Philipp Zabel 116c234703 pixman-renderer: add pixman_renderbuffer specialization
Add a private struct pixman_renderbuffer that derives from struct
weston_renderbuffer and move the pixman renderer specific image and link
fields into it.

Add a pixman_renderbuffer_get_image() helper for the backends that need
to access the contained pixman image, RDP and X11.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-23 20:05:21 +00:00
Philipp Zabel 4d96635a3f pixman-renderer: track damage in weston_renderbuffer
Add a damage region to struct weston_renderbuffer and use it to replace
the previous_damage tracking in the drm backend.

Keep renderbuffers on a list in struct pixman_output_state and use it
to accumulate damage on all renderbuffers during repaint_output.
Now renderbuffers have to be created when pixman output state already
exists.
Reorder renderer output state and renderbuffer creation accordingly.

With this, pixman_renderer_output_set_hw_extra_damage() can be removed.

This can not yet replace the external damage tracking in the VNC
backend, which needsto know the accumulated damage that is not returned
from repaint_output.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-23 20:05:21 +00:00
Philipp Zabel 6757bae0f3 pixman-renderer: set renderbuffer via new repaint_output parameter
Add a struct weston_renderbuffer parameter to repaint_output and make
backends set the pixman image renderbuffer through this parameter
instead of using pixman_renderer_output_set_buffer()

Turn pixman_renderer_output_set_buffer() static.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-23 20:05:21 +00:00
Philipp Zabel 89e1831cd7 pixman-renderer: add weston_renderbuffer and create/destroy interface
Add a create_image_from_ptr vfunc to struct pixman_renderer_interface,
which wraps weston_renderbuffer creation for the pixman renderer via
pixman_image_create_bits(), as well as a renderbuffer_destroy vfunc
to dispose of the pixman image renderbuffer.
Also add create_image_no_clear using pixman_image_create_bits_no_clear()
instead.

Make the backends create and destroy their pixman image renderbuffers
through this interface.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-23 20:05:21 +00:00
Philipp Zabel 32c7629516 pixman-renderer: add pixman_renderer_interface
Add a struct pixman_renderer_interface with output_create and
output_destroy vfuncs and store a pointer to it in struct
weston_renderer.

Make all backends access the pixman_renderer_output_create/destroy
functions through this interface and turn them static.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-23 20:05:21 +00:00
Loïc Molinari 35b3cb83b0 gl-renderer: Disable vertex attrib arrays in shadow pass
The blit_shadow_to_output() function leaves the generic vertex attrib
arrays 0 and 1 enabled. This commit disables them for consistency with
the other drawing calls of the renderer.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-01-17 01:24:12 +00:00
Loïc Molinari 27a2af589d gl-renderer: Enable vertex attrib arrays once per pass
Generic vertex attrib arrays 0 and 1 are constantly enabled across the
entire renderer. This commit enables them:

 - once per output repaint instead of once per view repaint,
 - once for the 4 borders instead of once for each border,
 - once for all the shadow regions instead of once for each region.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-01-17 01:24:12 +00:00
Loïc Molinari 4669a0897f gl-renderer: Set blend func once per output repaint
The blending func is constant across the entire renderer. This commit
sets it once per output repaint instead of once per view repaint.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-01-17 01:24:12 +00:00
Philipp Zabel fc8d260ce3 libweston, backends: move GL renderer interface into weston_renderer
Move the struct gl_renderer_interface pointer from the backends into
the weston_renderer structure. The interface struct only contains
function pointers that never change, so make it const.

Load and initialize the GL renderer in libweston instead of in the
backends, using the new weston_compositor_init_renderer() function.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-16 20:40:34 +01:00
Marius Vlad e96494801b compositor: Clarify if view is in a layer
As seen in some instances, subsurfaces do not have an entry in their
layer_link, as we bring them into existence rather directly in  the
view_list and not using the layer list approach.

This adds two messages to the debug scene graph to point out if the
views aren't really in any layer or if they're indirectly in the view
list using an ancestor (the main parent view actually).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-16 20:01:59 +02:00
Derek Foreman f31c81dce7 backend-drm: Use output to buffer matrix for plane setup
We can save a bit of work by using the output_to_buffer_matrix we've
already calculated for the paint node to transform the destination
rectangle, instead of starting over from global regions and doing
individual steps.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-16 17:56:36 +00:00
Derek Foreman 56cf553a63 drm: Don't try to correct flipped buffer coordinates
We should never hit this because drm_view_transform_supported() filters
out any transforms where it would occur.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-16 17:56:36 +00:00
Derek Foreman 19ea037399 gl-shaders: Don't attempt to set unicolor when it's not valid
It should harmlessly fail or do nothing, but seeing attempts to set
uniform -1 can be confusing when looking for real shader issues.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-16 17:47:30 +00:00
Derek Foreman d98255de78 libweston: use weston_matrix_init_transform for buffer matrix
Now that we have a helper, use it here.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-16 17:01:54 +00:00
Derek Foreman 31b3527418 libweston: Factor out transform matrix setup code
We want to use this in other places too, instead of open coding it
multiple times.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-16 17:01:54 +00:00
Philipp Zabel ce6c8e8fd6 backend-x11: store backend on struct x11_output
To avoid retrieving the backend from the compositor all the time, store
a pointer to the x11 backend on its x11_output structures.

This will be useful once the compositor contains more than one backend.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-16 17:11:08 +01:00
Philipp Zabel edb4ac4bf7 backend-wayland: store backend on struct wayland_output
To avoid retrieving the backend from the compositor all the time, store
a pointer to the wayland backend on its wayland_output structures.

This will be useful once the compositor contains more than one backend.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-16 17:11:08 +01:00
Philipp Zabel c2d2525aaa backend-vnc: store backend on struct vnc_output
To avoid retrieving the backend from the compositor all the time, store
a pointer to the vnc backend on its vnc_output structures.

This will be useful once the compositor contains more than one backend.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-16 17:11:08 +01:00
Philipp Zabel 30cca75086 backend-rdp: store backend on struct rdp_output
To avoid retrieving the backend from the compositor all the time, store
a pointer to the rdp backend on its rdp_output structures.

This will be useful once the compositor contains more than one backend.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-16 17:11:08 +01:00
Philipp Zabel 39aebcabcb backend-headless: store backend on struct headless_output
To avoid retrieving the backend from the compositor all the time, store
a pointer to the headless backend on its headless_output structures.

This will be useful once the compositor contains more than one backend.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-16 17:11:08 +01:00
Philipp Zabel 97e9ee5b10 backend-drm: store backend on struct drm_output
To avoid retrieving the backend from the compositor all the time, store
a pointer to the drm backend on its drm_output structures.

This will be useful once the compositor contains more than one backend.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-16 11:51:48 +01:00
Philipp Zabel 6f977640e6 libweston, backends: pass backend parameter to weston_backend functions
Passing the backend as a parameter to the weston_backend function
pointers seems more natural and will be very useful once there can be
more than one backend.

Since all backends already store a pointer to the compositor instance,
replace the compositor parameter with the backend in all functions.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-13 18:55:59 +01:00
Derek Foreman 0a8861e5ae pixman-renderer: Use transform from paint node
We've stored this in the paint node and don't need to calculate it here
anymore.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-11 15:49:01 -06:00
Derek Foreman e45a75f35e pixman-renderer: use filtering decision from paint node
We already calculated this, we can use it here now.

Fixes #685

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-11 15:49:01 -06:00
Derek Foreman 0dba133151 compositor: Store output_to_buffer transform in paint node
We already store the buffer_to_output, and this is just the inverse.

The pixman renderer will use the inverted version.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-11 15:49:01 -06:00
Derek Foreman 898c40752e pixman-renderer: pass paint nodes instead of views
Trivially plumb paint nodes into various places.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-11 15:49:01 -06:00
Derek Foreman 39bae60e6a gl-renderer: pass paint nodes instead of views
Trivially plumb paint nodes into various places.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-11 15:48:26 -06:00
Philipp Zabel 102acac6a9 backend-vnc: fix vnc_switch_mode
Fix the incorrect fb_pool stride set in vnc_switch_mode.
Also replace nvnc_fb_pool_unref/new with nvnc_fb_pool_resize.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-11 17:58:06 +01:00
Philipp Zabel 0f5f794ddb gl-renderer: make import_simple_dmabuf attributes parameter const
The import_simple_dmabuf() function does not modify the contents of its
struct dmabuf_attributes parameter, so make it const.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-11 14:51:09 +00:00
Philipp Zabel 20d8963d3c backend-rdp: fix for heterogeneous outputs
Fix the RDP backend to handle to_rdp_head() returning NULL.
In practice, this should only happen once multi-backend support
is enabled.

Fixes: 70b03b2928 ("rdp: Add preliminary rdp multihead support")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-11 12:37:39 +01:00
Marius Vlad 7086b9eac2 libweston: Avoid using the surface's output when emitting a timeline
This is an odd corner case where the surface doesn't yet have an output
assigned -- noticed when starting up with the RDP backend and
fullscreen-shell, and we attempt to emit a timeline point for a surface
without an output assigned, causing weston to crash when that
happens.

Rather than trying to catch this in the timeline code, still emit the
flush damage timeline but instead of using the output the surface is on,
use the output that accumulates damage.

Suggested-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-10 13:14:06 +00:00
Hideyuki Nagase 70b03b2928 rdp: Add preliminary rdp multihead support
This sets up monitor layout callbacks, and enables input event translation
between the RDP space and the weston desktop. The RDP backend now uses
a heads changed callback instead of the simple head configurator.

We only allow a single monitor for now, but in the future RAIL will make
use of multi-head.

As a side effect, scaling is now supported in RDP sessions.

It should be noted that due to differences between RDP and wayland
representation of their global coordinate spaces, mixing DPI leads to
RDP monitor layouts that can't properly be represented in weston.

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
2023-01-10 12:12:49 +00:00
Hideyuki Nagase 8a2d961b92 rdp: Pass a monitor configuration to rdp_head_create
Instead of passing a name, pass a FreeRDP rdpMonitor struct. For now the
only caller will pass a NULL to use default values.

Also, drop static from the function declaration as new code will call it
from another file shortly.

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
2023-01-10 12:12:49 +00:00
Derek Foreman 3e27571001 rdp: Apply scale in context resets at activation time
Scale is currently always 1, but we can do this safely now to prepare for
when it isn't.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman bacae46632 rdp: Move output callback setup into rdp_output_create
In some upcoming changes rdp_output_set_size will be removed. There's
no need to have it do this setup, so move that into output_create.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman 801d9c55c8 rdp: Use xzalloc for output creation
Reduce error handling burden

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman f9832bcb0a rdp: Use xzalloc in rdp_head_create
We can no longer fail.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Hideyuki Nagase 1d2227f5b5 rdp: Transform damage regions
In the absence of scale factors, this has been accurate. Once we allow
scaling we need to apply a full transform.

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
2023-01-10 12:12:49 +00:00
Derek Foreman 8e7cf52638 rdp: use mode instead of output size for full region refresh
Output dimensions are only correct here with unity scaling, but we're
going to allow scale factors shortly. The mode matches what RDP
expects.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman 7bd82a19d4 rdp: Only allow a single graphics mode
If a client connects to an RDP session it should replace the existing
mode, not add a new one.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman 42a2c0502f rdp: Set current mode flag properly in rdp_output_set_size
ensure_matching_mode() pays no attention to flags, we must set them on the
returned result afterwards.

This could be reproduced by making the initial connection to an rdp session
using the same mode it picked at startup.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman 50d42f88da rdp: Use xzalloc in rdp_insert_new_mode
We can remove some error handling if we don't allow this to fail.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman fc848b30c8 rdp: Move some head setup to rdp_head_create
We know these at creation time, so just set them immediately.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman b02ffbd244 rdp: Remove singleton output tracking
We don't need this anymore. Since we only support one output,
we  can use the first output for any place we used to use it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman 6f2ab50405 rdp: Don't release the singleton output on backend creation failure
If an output exists, it should be cleaned up automatically when we release
all our heads later anyway.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman ac11926c61 rdp: be more careful to free listener on output creation failure
By the time we get to this failure we may (or may not) have implanted a
listener.

freerdp_listener_free() safely handles passed NULL pointers, so we don't
have to add any additional checks on our end.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman e4895fa5fc rdp: Switch to xzalloc for backend allocation
We're giving up on trying to recover from these kinds of failures.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman 00de8ceff7 rdp: Use the first output in rdp_peer_refresh_region
Currently, this is what backend->output would be anyway. This is another
step towards removing the singleton output stored in the backend.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman 0d06d709d6 rdp: Export rdp_head_destroy
We'll need this from other files for multi-head support.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman 5f628006f0 rdp: Don't use pixman shadow buffer
We don't need this.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman cb796135be libweston: Allow changing scale
The RDP backend wants to be able to change scale for existing outputs,
so try to hook this up mostly in the same way a mode switch works.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman bf8c7ddd8f libweston: Damage outputs in mode_switch_finish
When changing to/from the native mode, or when changing the native
mode we need to damage the changed output to ensure it's redrawn.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman 0e71aff8ea libweston: Make weston_head_set_device_changed public
Some backends have special head specific state that doesn't fit into the
existing generic head setter functions, and is too specific to make more
functions for.

RDP's primary output flag is an example.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Derek Foreman f5e9904d4a libweston: Update view transform in seat_get_pointer
This triggers my new favourite assert sometimes when making RDP
connections, so just update the transform here.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Pekka Paalanen 409993639e backend-drm: reset CRTC_VRR_ENABLED
Libweston has no support for VRR yet, so make sure it cannot be on by
accident.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-01-10 11:28:27 +00:00
Pekka Paalanen e0d267fb12 backend-drm: reset CRTC_CTM
We are assuming that CRTC_CTM is pass-through, so better ensure it
really is pass-through rather than whatever the previous KMS client left
there.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-01-10 11:28:27 +00:00
Pekka Paalanen d1ca5f71ee backend-drm: reset CRTC_DEGAMMA_LUT
We are assuming that CRTC_DEGAMMA_LUT is pass-through, so better ensure
it really is pass-through rather than whatever the previous KMS client
left there.

This too falls under deprecated_gamma_is_set check, because the legacy
gamma could use either GAMMA or DEGAMMA.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-01-10 11:28:27 +00:00
Pekka Paalanen 1acf69ac2f backend-drm: reset gamma on legacy KMS
We are assuming that gamma LUT is pass-through, so better ensure it
really is pass-through rather than whatever the previous KMS client left
there.

Unfortunately the legacy ioctl does not offer any way to reset the LUT
without actually crafting an identity LUT.

If the legacy gamma libdrm function indicates the feature is not
supported, do not try to use it again. This avoids hammering the legacy
gamma every frame when deprecated drm_output_set_gamma() is not used.

drm_output_set_gamma() is not updated to check/set this flag in order to
maintain its old behavior.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-01-10 11:28:27 +00:00
Pekka Paalanen debfeb3049 backend-drm: reset CRTC_GAMMA_LUT
We are assuming that CRTC_GAMMA_LUT is pass-through, so better ensure it
really is pass-through rather than whatever the previous KMS client left
there.

Unfortunately, we have old drm_output_set_gamma() API that cms-static
and cms-colord plugins are using. To avoid trampling over them, do not
touch gamma after they did. Those plugins are deprecated, so there is no
reason to make set_gamma work through atomic.

drm_output_set_gamma() is called from weston_compositor_add_output()
through the output_created_signal. This is after drm_output_enable() and
before any KMS modeset or atomic commit on the CRTC. Therefore it is not
possible that there would be any KMS action in flight when
drm_output_set_gamma() is called, and so setting deprecated_gamma_is_set
should be non-racy - like setting CRTC_GAMMA_LUT itself.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-01-10 11:28:27 +00:00
Pekka Paalanen dbce396c7c backend-drm: move *_add_prop() debug earlier
Move the debug printing before the bail-out if the property does not
exist. This means that trying to set a missing property will be logged,
and it can be identified by the property id being 0.

We are starting to program more KMS properties, and if KMS state
building fails, this gives better chances to figure out what happened.
For example, if we accidentally assume that some property always exists
when it doesn't.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-01-10 11:28:27 +00:00
Daniel Stone 54356be853 backend-vnc: Add renderer parameter to backend config
Add an explicit request to the backend config to choose the renderer.
Currently, only Pixman remains supported, with auto defaulting to that.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00
Daniel Stone 6a45ae871c backend-rdp: Add renderer parameter to backend config
Add an explicit request to the backend config to choose the renderer.
Currently, only Pixman remains supported, with auto defaulting to that.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00
Daniel Stone 53a32e7888 backend-x11: Use renderer enum type for config selection
When we're selecting our renderer, use the enum rather than a boolean to
force Pixman on.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00
Daniel Stone 0a5bb7acff backend-wayland: Use renderer enum type for config selection
When we're selecting our renderer, use the enum rather than a boolean to
force Pixman on.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00