summaryrefslogtreecommitdiff
path: root/src/radeon_dri2.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2013-01-10 17:00:15 +0100
committerMichel Dänzer <michel@daenzer.net>2013-01-11 12:05:48 +0100
commitf5d2682584c74587890a9795ece7a8917214a83f (patch)
treebff7493ac116cb67c55deefb0316fca831d40b31 /src/radeon_dri2.c
parent4e35b2f530e2ca8c7b7220cacd05c661de43d20d (diff)
DRI2: Properly use buffer depth passed in by client.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Diffstat (limited to 'src/radeon_dri2.c')
-rw-r--r--src/radeon_dri2.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index f0c5c012..36a44e47 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -164,6 +164,26 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
unsigned aligned_width = drawable->width;
unsigned height = drawable->height;
Bool is_glamor_pixmap = FALSE;
+ int depth;
+ int cpp;
+
+ if (format) {
+ depth = format;
+
+ switch (depth) {
+ case 15:
+ cpp = 2;
+ break;
+ case 24:
+ cpp = 4;
+ break;
+ default:
+ cpp = depth / 8;
+ }
+ } else {
+ depth = drawable->depth;
+ cpp = drawable->bitsPerPixel / 8;
+ }
pixmap = pScreen->GetScreenPixmap(pScreen);
front_width = pixmap->drawable.width;
@@ -248,14 +268,13 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
if (flags & RADEON_CREATE_PIXMAP_TILING_MACRO)
tiling |= RADEON_TILING_MACRO;
-
if (aligned_width == front_width)
aligned_width = pScrn->virtualX;
pixmap = (*pScreen->CreatePixmap)(pScreen,
aligned_width,
height,
- (format != 0)?format:drawable->depth,
+ depth,
flags | RADEON_CREATE_PIXMAP_DRI2);
}
@@ -292,7 +311,7 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
buffers->attachment = attachment;
if (pixmap) {
buffers->pitch = pixmap->devKind;
- buffers->cpp = pixmap->drawable.bitsPerPixel / 8;
+ buffers->cpp = cpp;
}
buffers->driverPrivate = privates;
buffers->format = format;