[PATCH xserver] modesetting: Fix msSharePixmapBacking returning a non-linear bo
Hans de Goede
hdegoede at redhat.com
Wed Aug 17 10:13:05 UTC 2016
Some code paths end up in msSharePixmapBacking with a pixmap
which does not have its usage_hint set to sharable.
This causes glamor_fd_from_pixmap() to create a non-linear bo,
which is wrong for a shared pixmap.
This commits sets the pixmap usage hint to shared before
calling glamor_fd_from_pixmap(), fixing this.
Specifically this fixes mis-rendering when running the mode
setting driver on the master gpu in a dual-gpu setup and
running an opengl app with DRI_PRIME=1.
One could argue that this is a problem of the caller, but the
usage_hint is as the name implies just a hint. I've tried
tracing the DRI_PRIME case from above, but the pixmap
ends up coming from a drawable passed into the server by
a client.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
hw/xfree86/drivers/modesetting/driver.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 5ebb394..023d491 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -1382,7 +1382,12 @@ msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle)
int ret;
CARD16 stride;
CARD32 size;
+ unsigned orig_usage_hint = ppix->usage_hint;
+
+ /* Ensure that glamor_fd_from_pixmap creates a sharable (linear) bo */
+ ppix->usage_hint = CREATE_PIXMAP_USAGE_SHARED;
ret = glamor_fd_from_pixmap(ppix->drawable.pScreen, ppix, &stride, &size);
+ ppix->usage_hint = orig_usage_hint;
if (ret == -1)
return FALSE;
--
2.7.4
More information about the xorg-devel
mailing list