diff options
authorMario Kleiner <>2018-04-24 10:17:26 +0200
committerAdam Jackson <>2018-04-25 14:48:58 -0400
commit352a5ac87fd344936b759a5766eb74271e7d295d (patch)
parentc6ab21022ce876f9c1409db4bb1967134f9f6dbe (diff)
dri3: Fix DRI3.2 support for drivers other than modesetting-ddx.
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 <> Cc: Daniel Stone <> Cc: Louis-Francis Ratté-Boulianne <> Tested-by: Mike Lothian <> Reviewed-by: Adam Jackson <>
1 files changed, 1 insertions, 2 deletions
diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
index a1d6f47dd..59abe6ed9 100644
--- a/dri3/dri3_screen.c
+++ b/dri3/dri3_screen.c
@@ -66,8 +66,7 @@ dri3_pixmap_from_fds(PixmapPtr *ppixmap, ScreenPtr screen,
if (info->version >= 2 && info->pixmap_from_fds != NULL) {
pixmap = (*info->pixmap_from_fds) (screen, num_fds, fds, width, height,
strides, offsets, depth, bpp, modifier);
- } else if (info->pixmap_from_fd != NULL && num_fds == 1 &&
- modifier == DRM_FORMAT_MOD_INVALID) {
+ } else if (info->pixmap_from_fd != NULL && num_fds == 1) {
pixmap = (*info->pixmap_from_fd) (screen, fds[0], width, height,
strides[0], depth, bpp);
} else {