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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Rather than reinventing --use-pixman and --use-gl throughout each
backend, just have a common --renderer=foo argument which can be used to
explicitly specify the renderer.
The old arguments are still handled for backwards compatibility.
Signed-off-by: Daniel Stone <daniels@collabora.com>
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>
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>
When we're selecting our renderer, use the enum rather than two
mutually-exclusive booleans to not use the no-op renderer.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Add an 'auto' or unspecified renderer type, so we can use enum
weston_renderer_type during the configuration stage, where the target
renderer may be unspecified or unknown.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Similar to the backend type, also expose the renderer type enum as ABI.
This makes it possible to implement a more consistent config API, as
opposed to every backend hand-rolling its own use-the-other-one bool.
The enums are explicitly numbered to avoid 0, so 0 can be used as a
'not-specified' sentinel value to allow backwards compatibility with the
old config interfaces.
Signed-off-by: Daniel Stone <daniels@collabora.com>
unreachable() is used to hint to the compiler that a certain branch
cannot ever be reached. The implementation is taken from Mesa.
Signed-off-by: Daniel Stone <daniels@collabora.com>