Bail from dri2_create_buffer2 if we can't get a pixmap
PATCH 1/3 Bail from dri2_create_buffer2 if we can't get a pixmap
From: Michel Dänzer <[email protected]>
We would store the NULL pointer and continue, which would lead to a crash down the road.
Bugzilla: https://bugs.freedesktop.org/106293
(Ported from radeon commit 3dcfce8d0f495d09d7836caf98ef30d625b78a13)
--- src/amdgpu_dri2.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
src/amdgpu_dri2.c +12 -14
@@ -161,29 +161,28 @@ amdgpu_dri2_create_buffer2(ScreenPtr pScreen, AMDGPU_CREATE_PIXMAP_DRI2); } +if (!pixmap) +return NULL ; + buffers =calloc (1 ,sizeof *buffers);if (!buffers) goto error; -if (pixmap) { -if (is_glamor_pixmap) { - pixmap =amdgpu_glamor_set_pixmap_bo (drawable, pixmap); - pixmap->refcnt++; - } - -if (!amdgpu_get_flink_name (pAMDGPUEnt, pixmap, &buffers->name)) - goto error; +if (is_glamor_pixmap) { + pixmap =amdgpu_glamor_set_pixmap_bo (drawable, pixmap); + pixmap->refcnt++; } +if (!amdgpu_get_flink_name (pAMDGPUEnt, pixmap, &buffers->name)) + goto error; + privates =calloc (1 ,sizeof (struct dri2_buffer_priv ));if (!privates) goto error; buffers->attachment = attachment; -if (pixmap) { - buffers->pitch = pixmap->devKind; - buffers->cpp = cpp; - } + buffers->pitch = pixmap->devKind; + buffers->cpp = cpp; buffers->driverPrivate = privates; buffers->format = format; buffers->flags =0 ;/* not tiled */
@@ -195,8 +194,7 @@ amdgpu_dri2_create_buffer2(ScreenPtr pScreen, error:free (buffers); -if (pixmap) - (*pScreen->DestroyPixmap) (pixmap); + (*pScreen->DestroyPixmap) (pixmap);return NULL ; }
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180710163451.3583-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
PATCH 2/3 glamor: Bail CreatePixmap on unsupported pixmap depth
From: Michel Dänzer <[email protected]>
Fixes crash in that case.
Bugzilla: https://bugs.freedesktop.org/106293
(Ported from radeon commit 65c9dfea4e841b7d6f795c7489fede58c5e9631f)
--- src/amdgpu_glamor.c | 3 +++ 1 file changed, 3 insertions(+)
src/amdgpu_glamor.c +3 -0
@@ -185,6 +185,9 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,struct amdgpu_pixmap *priv;PixmapPtr pixmap, new_pixmap =NULL ; +if (!xf86GetPixFormat (scrn, depth)) +return NULL ; +if (!AMDGPU_CREATE_PIXMAP_SHARED (usage)) {if (info->shadow_primary) {if (usage !=CREATE_PIXMAP_USAGE_BACKING_PIXMAP )
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 Move flush from radeon_scanout_do_update to its callers
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
No functional change intended.
(Ported from radeon commit 90b94d40449f665f2d12874598062a5e5e5b64cd)
--- src/amdgpu_kms.c | 8 +++++--- src/drmmode_display.c | 1 + 2 files changed, 6 insertions(+), 3 deletions(-)
src/amdgpu_kms.c +5 -3
@@ -882,8 +882,6 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,FreeScratchGC (gc); } -amdgpu_glamor_flush (xf86_crtc->scrn); -return TRUE; }
@@ -908,8 +906,10 @@ amdgpu_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec, drmmode_crtc->dpms_mode == DPMSModeOn) {if (amdgpu_scanout_do_update (crtc, drmmode_crtc->scanout_id, screen->GetWindowPixmap (screen->root), - region->extents)) + region->extents)) { +amdgpu_glamor_flush (crtc->scrn);RegionEmpty (region); + } }amdgpu_scanout_update_abort (crtc, event_data);
@@ -991,6 +991,8 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info, pScreen->GetWindowPixmap (pScreen->root), region->extents)) return; + +amdgpu_glamor_flush (scrn);RegionEmpty (region); drm_queue_seq = amdgpu_drm_queue_alloc(xf86_crtc,
src/drmmode_display.c +1 -0
@@ -3978,6 +3978,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,amdgpu_scanout_do_update (crtc, scanout_id, new_front, extents); +amdgpu_glamor_flush (crtc->scrn);if (drmmode_crtc->scanout_update_pending) { drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180710163451.3583-3-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Alex Deucher
Reviewed-byRe: [PATCH xf86-video-amdgpu 3/3] Move flush from radeon_scanout_do_update to its callers
Quoted 6 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
No functional change intended.
Reviewed-by Alex Deucher <[email protected]>(Ported from radeon commit
90b94d40449f665f2d12874598062a5e5e5b64cd)
Series is:
Quoted 56 lines
Signed-off-by Michel Dänzer <[email protected]>--- src/amdgpu_kms.c | 8 +++++--- src/drmmode_display.c | 1 + 2 files changed, 6 insertions(+), 3 deletions(-)src/amdgpu_kms.c +5
-3@@ -882,8 +882,6 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,FreeScratchGC (gc); } -amdgpu_glamor_flush (xf86_crtc->scrn); -return TRUE; }@@ -908,8 +906,10 @@ amdgpu_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec, drmmode_crtc->dpms_mode == DPMSModeOn) {if (amdgpu_scanout_do_update (crtc, drmmode_crtc->scanout_id, screen->GetWindowPixmap (screen->root), - region->extents)) + region->extents)) { +amdgpu_glamor_flush (crtc->scrn);RegionEmpty (region); + } }amdgpu_scanout_update_abort (crtc, event_data);@@ -991,6 +991,8 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info, pScreen->GetWindowPixmap (pScreen->root), region->extents)) return; + +amdgpu_glamor_flush (scrn);RegionEmpty (region); drm_queue_seq = amdgpu_drm_queue_alloc(xf86_crtc,src/drmmode_display.c +1
-1@@ -3978,6 +3978,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,amdgpu_scanout_do_update (crtc, scanout_id, new_front, extents); +amdgpu_glamor_flush (crtc->scrn);if (drmmode_crtc->scanout_update_pending) { drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd, --2.18.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx