[PATCH xf86-video-ati] Always use screen depth/bpp for KMS framebuffers

Michel Dänzer michel at daenzer.net
Thu Jan 25 16:04:30 UTC 2018


From: Michel Dänzer <michel.daenzer at amd.com>

DRI clients can use depth 32 pixmaps while the screen is depth 24, in
which case page flipping would fail.

Reported-by: Mario Kleiner <mario.kleiner.de at gmail.com>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c |  5 ++---
 src/radeon.h          | 13 ++++++-------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 21cc3c905..f94f70bf1 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -943,9 +943,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		if (!fb)
 			fb = radeon_pixmap_get_fb(pScreen->GetWindowPixmap(pScreen->root));
 		if (!fb) {
-			fb = radeon_fb_create(pRADEONEnt->fd, pScrn->virtualX,
-					      pScrn->virtualY, pScrn->depth,
-					      pScrn->bitsPerPixel,
+			fb = radeon_fb_create(pScrn, pRADEONEnt->fd,
+					      pScrn->virtualX, pScrn->virtualY,
 					      pScrn->displayWidth * info->pixel_bytes,
 					      info->front_bo->handle);
 			/* Prevent refcnt of ad-hoc FBs from reaching 2 */
diff --git a/src/radeon.h b/src/radeon.h
index 5b7173648..08e38c177 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -836,8 +836,8 @@ static inline Bool radeon_get_pixmap_shared(PixmapPtr pPix)
 }
 
 static inline struct drmmode_fb*
-radeon_fb_create(int drm_fd, uint32_t width, uint32_t height, uint8_t depth,
-		 uint8_t bpp, uint32_t pitch, uint32_t handle)
+radeon_fb_create(ScrnInfoPtr scrn, int drm_fd, uint32_t width, uint32_t height,
+		 uint32_t pitch, uint32_t handle)
 {
     struct drmmode_fb *fb  = malloc(sizeof(*fb));
 
@@ -845,8 +845,8 @@ radeon_fb_create(int drm_fd, uint32_t width, uint32_t height, uint8_t depth,
 	return NULL;
 
     fb->refcnt = 1;
-    if (drmModeAddFB(drm_fd, width, height, depth, bpp, pitch, handle,
-		     &fb->handle) == 0)
+    if (drmModeAddFB(drm_fd, width, height, scrn->depth, scrn->bitsPerPixel,
+		     pitch, handle, &fb->handle) == 0)
 	return fb;
 
     free(fb);
@@ -898,9 +898,8 @@ radeon_pixmap_get_fb(PixmapPtr pix)
 	    ScrnInfoPtr scrn = xf86ScreenToScrn(pix->drawable.pScreen);
 	    RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
 
-	    *fb_ptr = radeon_fb_create(pRADEONEnt->fd, pix->drawable.width,
-				       pix->drawable.height, pix->drawable.depth,
-				       pix->drawable.bitsPerPixel, pix->devKind,
+	    *fb_ptr = radeon_fb_create(scrn, pRADEONEnt->fd, pix->drawable.width,
+				       pix->drawable.height, pix->devKind,
 				       handle);
 	}
     }
-- 
2.15.1



More information about the amd-gfx mailing list