Commit Graph

8696 Commits

Author SHA1 Message Date
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
3012934a6d ttk: Use weston_matrix_init_transform in toy toolkit
Setup the cairo matrix with our new transform function.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-16 17:01:54 +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
Derek Foreman
5d6cb00b1a matrix-transform-test: Test vector transforms
Add an output transform function that doesn't use matrices so we can
test our matrix generation by applying it to vectors and comparing with
the non-matrix variant.

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
Emmanuel Gil Peyrot
e13c99690b libweston: Optimise matrix multiplication
The previous version used div() to separate the column and row of the
current element, but that function is implemented as a libc call, which
prevented the compiler from vectorising the loop and made matrix
multiplication appear quite high in profiles.

With div() removed, we are down from 64 calls to vfmadd132ss acting on
one float at a time, to just 8 calls to vfmadd132ps when compiled with
AVX2 support (or 16 mulps, 16 addps with SSE2 support only), and the
function isn’t a hot spot any more.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2023-01-11 20:03:36 +00: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