summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-02-13 18:26:06 +0100
committerMichel Dänzer <michel@daenzer.net>2018-02-14 17:06:27 +0100
commitb3095710b7c240ddefce794033a77033806f639d (patch)
treef13a9ef966a4fc537ff39b884a0cb1c4b445a191
parent6aee5770fb913713bb1b9a1af8f0d0892a66f21a (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> (Ported from radeon commit 733f606dd6ca8350e6e7f0858bfff5454ddc98ed) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/amdgpu_pixmap.h13
-rw-r--r--src/drmmode_display.c5
2 files changed, 8 insertions, 10 deletions
diff --git a/src/amdgpu_pixmap.h b/src/amdgpu_pixmap.h
index eded170..d744ca5 100644
--- a/src/amdgpu_pixmap.h
+++ b/src/amdgpu_pixmap.h
@@ -104,8 +104,8 @@ static inline struct amdgpu_buffer *amdgpu_get_pixmap_bo(PixmapPtr pPix)
}
static inline struct drmmode_fb*
-amdgpu_fb_create(int drm_fd, uint32_t width, uint32_t height, uint8_t depth,
- uint8_t bpp, uint32_t pitch, uint32_t handle)
+amdgpu_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));
@@ -113,8 +113,8 @@ amdgpu_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);
@@ -154,9 +154,8 @@ amdgpu_pixmap_get_fb(PixmapPtr pix)
ScrnInfoPtr scrn = xf86ScreenToScrn(pix->drawable.pScreen);
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
- *fb_ptr = amdgpu_fb_create(pAMDGPUEnt->fd, pix->drawable.width,
- pix->drawable.height, pix->drawable.depth,
- pix->drawable.bitsPerPixel, pix->devKind,
+ *fb_ptr = amdgpu_fb_create(scrn, pAMDGPUEnt->fd, pix->drawable.width,
+ pix->drawable.height, pix->devKind,
handle);
}
}
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index e52b7a3..8ccbf73 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -885,9 +885,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
union gbm_bo_handle bo_handle;
bo_handle = gbm_bo_get_handle(info->front_buffer->bo.gbm);
- fb = amdgpu_fb_create(pAMDGPUEnt->fd, pScrn->virtualX,
- pScrn->virtualY, pScrn->depth,
- pScrn->bitsPerPixel,
+ fb = amdgpu_fb_create(pScrn, pAMDGPUEnt->fd,
+ pScrn->virtualX, pScrn->virtualY,
pScrn->displayWidth * info->pixel_bytes,
bo_handle.u32);
/* Prevent refcnt of ad-hoc FBs from reaching 2 */