summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/xorg
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2009-03-04 23:51:14 +0100
committerJakob Bornecrantz <[email protected]>2009-03-05 00:10:12 +0100
commitb611f81477b196fed9d249b1e0f37ef186dd1426 (patch)
treec5e55ea2226fde1eefe09382cf1b1422b5298e50 /src/gallium/state_trackers/xorg
parentdca226fefb9a0e469ca34b3c1e364b60fae341fa (diff)
st/xorg: Change format function a bit
Diffstat (limited to 'src/gallium/state_trackers/xorg')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index a69df3f7f17..b29cd5e49ff 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -54,6 +54,7 @@ struct PixmapPriv
struct pipe_texture *tex;
unsigned int color;
struct pipe_surface *src_surf; /* for copies */
+
struct pipe_transfer *map_transfer;
unsigned map_count;
};
@@ -62,25 +63,34 @@ struct PixmapPriv
* Helper functions
*/
-static enum pipe_format
-exa_get_pipe_format(int depth)
+static void
+exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp)
{
switch (depth) {
case 32:
- return PIPE_FORMAT_A8R8G8B8_UNORM;
+ *format = PIPE_FORMAT_A8R8G8B8_UNORM;
+ assert(*bbp == 32);
+ break;
case 24:
- return PIPE_FORMAT_X8R8G8B8_UNORM;
+ *format = PIPE_FORMAT_X8R8G8B8_UNORM;
+ assert(*bbp == 32);
+ break;
case 16:
- return PIPE_FORMAT_R5G6B5_UNORM;
+ *format = PIPE_FORMAT_R5G6B5_UNORM;
+ assert(*bbp == 16);
+ break;
case 15:
- return PIPE_FORMAT_A1R5G5B5_UNORM;
+ *format = PIPE_FORMAT_A1R5G5B5_UNORM;
+ assert(*bbp == 16);
+ break;
case 8:
case 4:
case 1:
- return PIPE_FORMAT_A8R8G8B8_UNORM; /* bad bad bad */
+ *format = PIPE_FORMAT_A8R8G8B8_UNORM; /* bad bad bad */
+ break;
default:
assert(0);
- return 0;
+ break;
}
}
@@ -436,7 +446,7 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
memset(&template, 0, sizeof(template));
template.target = PIPE_TEXTURE_2D;
template.compressed = 0;
- template.format = exa_get_pipe_format(depth);
+ exa_get_pipe_format(depth, &template.format, &bitsPerPixel);
pf_get_block(template.format, &template.block);
template.width[0] = width;
template.height[0] = height;