summaryrefslogtreecommitdiff
path: root/src/amdgpu_kms.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2017-05-12 19:01:18 +0900
committerMichel Dänzer <michel@daenzer.net>2017-05-24 10:10:17 +0900
commit2ea2d4d827f086098be198f110ca822ed2c290cd (patch)
treeaf947a07f548111cbf5db4eea4201e7009636e89 /src/amdgpu_kms.c
parent8cb41b962eb06b9cb1b3a573a4087e4d89f733fb (diff)
Simplify tracking of PRIME scanout pixmap
Remember the shared pixmap passed to drmmode_set_scanout_pixmap for each CRTC, and just compare against that. Fixes leaving stale entries in ScreenRec::pixmap_dirty_list under some circumstances, which would usually result in use-after-free and a crash down the line. (Ported from radeon commit 7dc68e26755466f9056f8c72195ab8690660693d) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/amdgpu_kms.c')
-rw-r--r--src/amdgpu_kms.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 4df81f9..a418cf9 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -562,8 +562,7 @@ amdgpu_prime_dirty_to_crtc(PixmapDirtyUpdatePtr dirty)
xf86CrtcPtr xf86_crtc = xf86_config->crtc[c];
drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
- if (drmmode_crtc->scanout[0].pixmap == dirty->slave_dst ||
- drmmode_crtc->scanout[1].pixmap == dirty->slave_dst)
+ if (drmmode_crtc->prime_scanout_pixmap == dirty->src)
return xf86_crtc;
}
@@ -576,13 +575,11 @@ amdgpu_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id)
ScrnInfoPtr scrn = crtc->scrn;
ScreenPtr screen = scrn->pScreen;
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- PixmapPtr scanoutpix = crtc->randr_crtc->scanout_pixmap;
PixmapDirtyUpdatePtr dirty;
Bool ret = FALSE;
xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
- if (dirty->src == scanoutpix && dirty->slave_dst ==
- drmmode_crtc->scanout[scanout_id ^ drmmode_crtc->tear_free].pixmap) {
+ if (dirty->src == drmmode_crtc->prime_scanout_pixmap) {
RegionPtr region;
if (master_has_sync_shared_pixmap(scrn, dirty))