Commit Graph

18 Commits

Author SHA1 Message Date
Michel Dänzer 0ce93e5ba7 dri3: Include dix-config.h instead of xorg-config.h
This is DIX code.
2020-09-15 11:38:55 +02:00
Adam Jackson 086c2e3de5 dri3: Fix XACE access mode for open and get_supported_modifiers
Neither opening a screen nor querying its modifiers confers the right to
attach the buffer for any particular pixmap. GetAttr seems more correct.

Fixes: xorg/xserver#550
2019-01-16 20:05:43 +00:00
Mario Kleiner 55db3c9cfc dri3: Robustly clamp to 1.0 if not all screens support 1.2
Checking for dri3_screen_info_rec.version >= 2 is insufficient,
as some shipping drivers, e.g., intel-ddx, nouveau-ddx, set the
version to DRI3_SCREEN_INFO_VERSION, ie. to whatever version the
installed servers headers define. On server 1.20 that would
be version 2, but the drivers still don't support the v1.2
hooks. Make sure all hooks are defined before reporting v1.2.

Also make clamping of reported version to minimum of client
or server robust against possible future clients with possible
majorVersion >= 2.0.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Cc: Daniel Stone <daniels@collabora.com>
2018-04-30 13:48:00 -04:00
Mario Kleiner fbc5c5cd53 dri3: Fix error handling in dri3_buffer_from_pixmap request.
The old info->fd_from_pixmap() driver hook, which is
preferentially used in dri3_fd_from_pixmap(), can return
error codes other than -1, e.g., -EINVAL (-22) on nouveau-ddx.

Not handling the error causes a broken/corrupted X-Connection
resulting from a failed request.

This fixes failure of sddm-greeter to start up under nouveau-ddx
with DRI3 enabled and DRI3 protocol version properly clamped
to 1.0 by the server (see followup patch).

Fixes: 75bba3aedc ("dri3: Use single-FD screen call for single-FD request")
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Cc: Daniel Stone <daniels@collabora.com>
2018-04-30 13:47:44 -04:00
Adam Jackson 19d006ee3d dri3: Clamp to 1.0 if not all screens support 1.2
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-04-25 14:51:02 -04:00
Mario Kleiner 4e92c51ce4 dri3: Fix dri3_buffers_from_pixmap request.
Sending pixmap depth and bpp was omitted, so the Mesa
X11 + EGL + DRI3 side of things always failed to
dri3_create_image_khr_pixmap_from_buffers(), which led
to failure of X11 + EGL compositing under DRI3 under,
e.g., KDE Plasma 5.

Fixes: 6e7c40f62d ("dri3: Add multi-planar/modifier buffer requests")
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2018-04-17 10:24:42 -04:00
Daniel Stone 75bba3aedc dri3: Use single-FD screen call for single-FD request
When importing client buffers into Pixmaps, we can use the fds_to_pixmap
hook for both single-FD and multi-FD client requests without any harm.

For the other direction of exporting Pixmap buffers to client FDs,
create a new helper which calls the old pixmap_to_fd hook if available.
This allows the implementation to ensure that the Pixmap storage is
accessible to clients not aware of multiple planes or modifiers, e.g. by
reallocating and copying.

This makes it possible to run a compositing manager on an old GLX/EGL
stack on top of an X server which allocates internal buffer storage
using exotic modifiers from modifier-aware GBM/EGL/KMS.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04 13:46:57 -04:00
Emil Velikov ae5c0dd199 dri3: cap the version returned to the client
As per the protocol, the server should not return version greater than
the one supported by the client.

Add a spec quote and tweak the numbers accordingly.

Fixes: 5631382988 ("dri3: Add DRI3 extension")
Cc: Daniel Stone <daniels@collabora.com>
Cc: Keith Packard <keithp@keithp.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-19 15:49:36 -04:00
Louis-Francis Ratté-Boulianne 6e7c40f62d dri3: Add multi-planar/modifier buffer requests
Initial implementation for DRI3 v1.1. Only the DRI3 implementation
is there, backends need to implement the proper hooks.

Version is still set to 1.0 so clients shouldn't use the new
requests yet.

v2: Use depth/bpp instead of DRM formats in requests

v3: Remove DMA fence requests from v1.1
    Add screen/drawable modifier sets

v4: Free array returned by 'get_drawable_modifiers()'

v5: Fix FD leak

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-05 13:27:20 -05:00
Adam Jackson dc7ceda90f dispatch: Mark swapped dispatch as _X_COLD
This touches everything that ends up in the Xorg binary; the big missing
part is GLX since that's all generated code. Cuts about 14k from the
binary on amd64.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-03-01 10:16:20 -05:00
Adam Jackson dff435568b dri3: Don't do return client->noClientException
Hasn't been necessary since:

    commit 92ed75ac59
    Author: Jamey Sharp <jamey@minilop.net>
    Date:   Mon May 10 20:22:05 2010 -0700

        Eliminate boilerplate around client->noClientException.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-09-02 13:41:24 -04:00
Julien Cristau ac97fb2b80 dri3: return an error if AddResource fails
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2016-03-08 10:19:37 -05:00
Michel Dänzer 43eb5b6047 dri3: Refuse to work for remote clients (v2)
Prevents clients forwarded via SSH from hanging while waiting for the
reply from the DRI3Open request.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93261

v2: Return BadMatch instead of BadRequest (Keith Packard)

Reviewed-by: Keith Packard <keithp@keithp.com>
2016-03-01 11:59:51 +09:00
Alan Coopersmith 0a6085aaf3 dri3: unvalidated lengths in DRI3 extension swapped procs [CVE-2014-8103 1/2]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-08 18:09:48 -08:00
Kristian Høgsberg 9ba2084321 dri3: Allow asynchronous implementation for dri3_open
By passing the client pointer to the dri3_open implementation, we allow
the clients to implement the open callback asynchronously.  If the
client ignore count is positive after returning from dri3_open, we
assume that authentication is in progress and doesn't send the reply.
The code to send the reply is moved into a helper function, which the
implementation can call upon receiving its authenticaion reply.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-04-01 10:31:09 -07:00
Keith Packard 60014a4a98 Replace 'pointer' type with 'void *'
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer'
is used throughout the X server for other things, and having duplicate
names generates compiler warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-12 10:24:11 -08:00
Adam Jackson ec6087bf07 dri3: Don't use the major/minor version from the protocol headers
We want to advertise the version we implement, not the version the
protocol headers happen to describe.

Reviewed-by: Jasper St. Pierre <<jstpierre@mecheye.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-12-13 14:59:03 -05:00
Keith Packard 5631382988 dri3: Add DRI3 extension
Adds DRM compatible fences using futexes.
Uses FD passing to get pixmaps from DRM applications.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-10-31 16:58:30 -07:00