summaryrefslogtreecommitdiff
path: root/dri3
AgeCommit message (Collapse)AuthorFilesLines
2019-02-20dri3: Fix XACE access mode for open and get_supported_modifiersAdam Jackson1-2/+2
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 (cherry picked from commit 086c2e3de55bbf0cbc1d97f7dc2db70a7f5e69e3)
2018-05-08dri3: Switch fds_from_pixmap to stdint types.Eric Anholt3-10/+10
Again, this was causing 32-bit build warnings due to mixing CARD* and stdint. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-05-08dri3: Switch get_modifiers to using stdint.Eric Anholt2-5/+5
We were mixing stdint and CARD* types, causing compiler warnings on 32-bit. Just switch over to stdint, which is what we'd like the server to be using long term, anyway. Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-05-08dri3: Switch get_drawable_modifiers to using stdint.Eric Anholt2-5/+5
We were mixing stdint and CARD* types, causing compiler warnings on 32-bit. Just switch over to stdint, which is what we'd like the server to be using long term, anyway. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-30dri3: Robustly clamp to 1.0 if not all screens support 1.2Mario Kleiner1-2/+6
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-30dri3: Fix error handling in dri3_buffer_from_pixmap request.Mario Kleiner1-1/+1
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: 75bba3aedcb0 ("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-25dri3: Clamp to 1.0 if not all screens support 1.2Adam Jackson1-0/+26
Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-04-25dri3: Fix DRI3.2 support for drivers other than modesetting-ddx.Mario Kleiner1-2/+1
Both xf86-video-intel and xf86-video-nouveau cause OpenGL clients to fail when used with DRI3 on server 1.20 with Mesa 18.1. Reason is that the servers DRI3 version is now unconditionally reported as DRI3 1.2 to 1.2 capable clients. This causes clients using Mesa 18.1 to use the new DRI 3.2 requests DRI3GetSupportedModifiers, DRI3PixmapFromBuffers, etc. Drivers other than modesetting-ddx do not support the needed hooks like info->pixmap_from_fds or info->get_formats, info->get_modifiers. Unfortunately we can't simply report the servers DRI3 version as 1.0 in this case, as the reported version can not be specific to a X-Screen, and different screens may have drivers with different capabilities. Luckily the server has fallbacks to ->pixmap_from_fd, ->fd_from_pixmap, and simply reporting an empty set of supported modifiers for the DRI3GetSupportedModifiers request if the ddx doesn't support DRI 3.2. Clients like Mesa 18.1's dri3 loader respond to the empty set of reported modifiers by falling back to a dri driver selected buffer format (image->createImageWithModifiers responds to a NULL modifier_list by acting like ->createImage()). This works, but Mesa 18.1 will still try to use the DRI3PixmapFromBuffers request to create the corresponding pixmap, just passing in a modifier that corresponds to whatever tiling the dri driver selected by default. To prevent this request - and thereby the client - from failing with a BadImplementation error, remove the check for modifier == DRM_MOD_FORMAT_INVALID in the pixmap_from_fd fallback path of dri3_pixmap_from_fds() and trust that if we hit the fallback path then the client will have passed a buffer with some driver specific default tiling that can be handled by pixmap_from_fd. Another approach would be for Mesa's dri3 loader to keep track how a buffer was created (with explicit modifiers or not), and then call DRI3PixmapFromBuffers or DRI3PixmapFromBuffer, but then any future DRI3 client implementation would need to be fixed, so the server side is probably the better place for this. Tested on Intel Ivybridge and NVidia Pascal. Fixes: 6e7c40f62db6 ("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> Tested-by: Mike Lothian <mike@fireburn.co.uk> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-24dri3: Don't call vfuncs on old DRI3 screensDaniel Stone1-1/+1
Only call the get_supported_modifiers vfunc if the DRI3 screen struct is sufficiently new. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-17dri3: Fix dri3_buffers_from_pixmap request.Mario Kleiner1-1/+3
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: 6e7c40f62db6 ("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-10dri3: rework format/modifier cachingEmil Velikov1-23/+27
Cut down the unnecessary malloc/memcpy/free by utilising the explicit copy provided by the client. But above all: do so, after ensuring we get valid data from the implementation. Fixes: cef12efc15c ("glamor: Implement GetSupportedModifiers") Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Cc: Daniel Stone <daniels@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-04-10dri3: check for ::get_drawable_modifiers failureEmil Velikov1-4/+7
Currently if the function fails, we'll fall into two false assumptions: - the the count is zero - that the storage pointer is safe for free() I've just fixed the former (in glamor + xwayland) and have no plans on adding yet another workaround for the latter. Simply zero both variables. Regardless if the implementation is missing the callback or it foobars with output variables (normally a bad idea). Bonus points - this fixes a bug where we feed garbage to free() further down ;-) Fixes: cef12efc15c ("glamor: Implement GetSupportedModifiers") Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Cc: Daniel Stone <daniels@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-04-10dri3: simplify dri3_open() implementationEmil Velikov1-17/+5
Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-04-10dri3: annotate fds/strides/offsets arrays as constEmil Velikov3-7/+9
It makes it perfectly clear that we should not be modifying them. Should help highlight issues like the one fixed with previous commit. Fixes: cef12efc15c ("glamor: Implement GetSupportedModifiers") Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Cc: Daniel Stone <daniels@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-04-10dri3: annotate the dri3_screen_info data as constEmil Velikov4-10/+10
dri3_screen_info is the user provide dispatch. Something that we do not and should not change. When using the _ptr typecast + const the compiler barfs at us (rightfully so), so use the _rec one. [Silence a new const mismatch warning too - ajax] Fixes: 56313829886 ("dri3: Add DRI3 extension") Cc: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-04-05dri3: Set stride and size for old clientsDaniel Stone1-0/+2
For old clients using the fd_from_pixmap entrypoint, make sure we set stride and size correctly. Noticed by inspection. Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-04-04dri3: Use single-FD screen call for single-FD requestDaniel Stone3-11/+48
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-02meson: Distribute more SDK headersThierry Reding1-0/+6
Install missing headers to the SDK directory to allow external modules to properly build against the SDK. After this commit, the list of files installed in the SDK include directory is the same as the list of files installed by the autotools-based build. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2018-03-19dri3: cap the version returned to the clientEmil Velikov1-1/+13
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: 563138298868 ("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-05dri3: Add multi-planar/modifier buffer requestsLouis-Francis Ratté-Boulianne5-25/+555
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>
2017-09-20Build: Use dri3proto/libdrm CFLAGSDaniel Stone1-1/+1
Make sure we get the CFLAGS required for building DRI3 into the command line. Signed-off-by: Daniel Stone <daniels@collabora.com>
2017-05-10meson: Make driprotos and libdrm optionalJon TURNEY1-6/+9
Add options for DRI{1,2,3} shmfence is required for DRI3 libdrm is required for any DRI{1,2,3} Consolidate calls to dependency('libdrm') Set WITH_LIBDRM when building with libdrm v2: Initialize libxserver_dri3 to [] Manually flatten libxserver, since meson doesn't (currently) Use version_compare rather than circumloctions with dependency() Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk> Reviewed-by: Eric Anholt <eric@anholt.net>
2017-04-26Add a Meson build system alongside autotools.Eric Anholt1-0/+12
This is a work in progress that builds Xvfb, Xephyr, Xwayland, Xnest, and Xdmx so far. The outline of Xquartz/Xwin support is in tree, but hasn't been built yet. The unit tests are also not done. The intent is to build this as a complete replacement for the autotools system, then eventually replace autotools. meson is faster to generate the build, faster to run the bulid, shorter to write the build files in, and less error-prone than autotools. v2: Fix indentation nits, move version declaration to project(), use existing meson_options for version-config.h's vendor name/web. Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-01dispatch: Mark swapped dispatch as _X_COLDAdam Jackson1-7/+7
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>
2016-09-02dri3: Don't do return client->noClientExceptionAdam Jackson1-2/+2
Hasn't been necessary since: commit 92ed75ac59e2d3af149cddb962efd05fc8487750 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-04-18dri3: remove unused file dri3int.hEmil Velikov1-26/+0
Copied during the prototyping stage and never used. Cc: Keith Packard <keithp@keithp.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-03-08dri3: return an error if AddResource failsJulien Cristau1-2/+2
Reviewed-by: Rémi Cardona <remi@gentoo.org> Signed-off-by: Julien Cristau <jcristau@debian.org>
2016-03-01dri3: Refuse to work for remote clients (v2)Michel Dänzer1-0/+4
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>
2015-07-08dri3: static cleanupAdam Jackson2-4/+1
Also remove unused window private key. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-07-08dri3: Remove unbuilt dri3_event.cAdam Jackson1-163/+0
The config notifies live in present, not dri3. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-12-08dri3: unvalidated lengths in DRI3 extension swapped procs [CVE-2014-8103 1/2]Alan Coopersmith1-0/+6
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-17dri3: Don't enable the DRI3 extension unless some screen supports itKeith Packard1-0/+10
There's no reason to advertise this extension unless one of the hardware drivers actually supports it. Not listing it means it's slightly easier for users to tell what's going on. On the other hand, not listing it means we may have applications that only check for the extension and not for appropriate per-screen support. I don't think that's a real risk as DRI3 is only useful for systems with deep knowledge of the hardware. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2014-07-30Fix files including xorg-server.h by mistakeKeith Packard1-2/+0
A few files in the server are including xorg-server.h, which is only for use by Xorg server drivers. This fixes those errors and then adds a check to make sure it doesn't happen again. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-08dri3: Fix dri3_open API change by adding new dri3_open_clientKeith Packard2-5/+25
Xwayland will eventually need the current client in dri3_open. Simply changing that API is not an option though as other drivers that implement DRI3 will not have a matching function signature and will crash when called. Add a new dri3_open_client function pointer and bump DRI3_SCREEN_INFO_VERSION so that drivers can be aware of the new function which will be used in preference to the old function when available. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anhole <eric@anholt.net>
2014-04-01dri3: Allow asynchronous implementation for dri3_openKristian Høgsberg3-16/+30
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-01-12Replace 'pointer' type with 'void *'Keith Packard2-5/+5
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>
2013-12-13dri3: Don't use the major/minor version from the protocol headersAdam Jackson1-2/+3
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-13dri3: Guard against buggy clientsAdam Jackson1-0/+6
There's nothing to stop a client from sending these requests to screens without DRI3 support, and if they do, we'll crash. Let's not do that. Reviewed-by: Jasper St. Pierre <<jstpierre@mecheye.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-12-09dri3: Disable when Xinerama is activeAdam Jackson1-0/+5
Pretty sure this can't work. Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-11-04Disable DRI3 and sync fence FD functions if xshmfence isn't availableKeith Packard1-0/+6
Make sure the server can build when the xshmfence library isn't present Signed-off-by: Keith Packard <keithp@keithp.com>
2013-10-31dri3: Add DRI3 extensionKeith Packard8-0/+902
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>