In case we have multiple outputs let's us choose the first output,
rather use the last one, which would happen when multiple are present in
the system.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
In preparation of having multiple outputs available we should be able to
specify by its name. We just use the default one if none was set-up at all.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
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>
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>
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>
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>
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>
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>
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>
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>
Now that enum weston_renderer_type is public, there is no need for a
local enum renderer_type in the tests.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>