[PATCH xf86-video-ati 1/3] Call drmmode_crtc_scanout_create in drmmode_crtc_shadow_allocate as well
Michel Dänzer
michel at daenzer.net
Tue Feb 28 08:59:37 UTC 2017
From: Michel Dänzer <michel.daenzer at amd.com>
Calling drmmode_crtc_scanout_allocate in drmmode_crtc_shadow_allocate
resulted in drmmode_crtc_scanout_create called from
drmmode_crtc_shadow_create passing an uninitialized pitch value to
drmmode_create_bo_pixmap.
Fixes issues such as failure to allocate the scanout pixmap or visual
corruption and GPUVM faults when attempting to use rotation with Xorg
<1.19.
Bugzilla: https://bugs.freedesktop.org/99916
Fixes: ea30d856ba5e ("Pass pitch from drmmode_crtc_scanout_allocate to drmmode_create_bo_pixmap")
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/drmmode_display.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index fd22a19ba..560bfae44 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1194,14 +1194,20 @@ drmmode_show_cursor (xf86CrtcPtr crtc)
info->cursor_w, info->cursor_h);
}
+/* Xorg expects a non-NULL return value from drmmode_crtc_shadow_allocate, and
+ * passes that back to drmmode_crtc_scanout_create; it doesn't use it for
+ * anything else.
+ */
static void *
drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- int pitch;
- return drmmode_crtc_scanout_allocate(crtc, &drmmode_crtc->rotate,
- width, height, &pitch);
+ if (!drmmode_crtc_scanout_create(crtc, &drmmode_crtc->rotate, width,
+ height))
+ return NULL;
+
+ return (void*)~0UL;
}
static PixmapPtr
@@ -1209,11 +1215,12 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- /* Xorg passes in the return value of drmmode_crtc_shadow_allocate
- * for data, but that's redundant for drmmode_crtc_scanout_create.
- */
- return drmmode_crtc_scanout_create(crtc, &drmmode_crtc->rotate, width,
- height);
+ if (!data) {
+ drmmode_crtc_scanout_create(crtc, &drmmode_crtc->rotate, width,
+ height);
+ }
+
+ return drmmode_crtc->rotate.pixmap;
}
static void
--
2.11.0
More information about the amd-gfx
mailing list