summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-01-25 16:59:30 +0100
committerMichel Dänzer <michel@daenzer.net>2018-01-25 16:59:30 +0100
commit733f606dd6ca8350e6e7f0858bfff5454ddc98ed (patch)
treebe2ce9686273dbe7f8fb6a4b19a60c3debc9fdeb
parent83124426040bc1f2dba74c8eeb5a5a9c7c64e664 (diff)
Always use screen depth/bpp for KMS framebuffers
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@gmail.com> Reviewed-and-Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
-rw-r--r--src/drmmode_display.c5
-rw-r--r--src/radeon.h13
2 files changed, 8 insertions, 10 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 21cc3c90..f94f70bf 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 5b717364..08e38c17 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);
}
}