Call drmmode_crtc_scanout_create in drmmode_crtc_shadow_allocate as well

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: 5f71238088 ("Pass pitch from drmmode_crtc_scanout_allocate to
                      drmmode_create_bo_pixmap")
(Ported from radeon commit 987a34adb319923ad36e2b47a26837248f187c3e)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Michel Dänzer
2017-03-02 16:42:04 +09:00
parent 49b092563c
commit 03c2db3c67

View File

@@ -1047,14 +1047,20 @@ static void drmmode_show_cursor(xf86CrtcPtr crtc)
info->cursor_w, info->cursor_h);
}
static void *drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width,
int height)
/* 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
@@ -1062,11 +1068,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