summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/xorg/xorg_exa.c
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2009-11-27 15:28:46 +0000
committerKeith Whitwell <keithw@vmware.com>2009-11-27 15:30:18 +0000
commit4236493899b9ccfcc8df3dcf81697776621fa1f8 (patch)
treed07e53f0337d8267d9275d9819b23464bb5407b3 /src/gallium/state_trackers/xorg/xorg_exa.c
parent1310811469e7a1e27669ad1513b5bd4a60207c4f (diff)
st/xorg: proper fix for compositing after rounding up
Basically don't round up shared textures. This fixes compiz, but I'm afraid that rounding up texture sizes here in the driver is doomed, as it will inevitably break texture wrap modes.
Diffstat (limited to 'src/gallium/state_trackers/xorg/xorg_exa.c')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index a22f15f64a..32485add94 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -48,6 +48,7 @@
#include "util/u_debug.h"
#define DEBUG_PRINT 0
+#define ROUND_UP_TEXTURES 1
/*
* Helper functions
@@ -273,13 +274,18 @@ ExaPrepareAccess(PixmapPtr pPix, int index)
PIPE_REFERENCED_FOR_WRITE)
exa->pipe->flush(exa->pipe, 0, NULL);
+ assert(pPix->drawable.width <= priv->tex->width[0]);
+ assert(pPix->drawable.height <= priv->tex->height[0]);
+
priv->map_transfer =
exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
#ifdef EXA_MIXED_PIXMAPS
PIPE_TRANSFER_MAP_DIRECTLY |
#endif
PIPE_TRANSFER_READ_WRITE,
- 0, 0, priv->tex->width[0], priv->tex->height[0]);
+ 0, 0,
+ pPix->drawable.width,
+ pPix->drawable.height );
if (!priv->map_transfer)
#ifdef EXA_MIXED_PIXMAPS
return FALSE;
@@ -820,6 +826,22 @@ xorg_exa_get_pixmap_handle(PixmapPtr pPixmap, unsigned *stride_out)
}
static Bool
+size_match( int width, int tex_width )
+{
+#if ROUND_UP_TEXTURES
+ if (width > tex_width)
+ return FALSE;
+
+ if (width * 2 < tex_width)
+ return FALSE;
+
+ return TRUE;
+#else
+ return width == tex_width;
+#endif
+}
+
+static Bool
ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
int depth, int bitsPerPixel, int devKind,
pointer pPixData)
@@ -862,12 +884,15 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
miModifyPixmapHeader(pPixmap, width, height, depth,
bitsPerPixel, devKind, NULL);
+ priv->width = width;
+ priv->height = height;
+
/* Deal with screen resize */
if ((exa->accel || priv->flags) &&
(!priv->tex ||
- (priv->tex->width[0] != width ||
- priv->tex->height[0] != height ||
- priv->tex_flags != priv->flags))) {
+ !size_match(width, priv->tex->width[0]) ||
+ !size_match(height, priv->tex->height[0]) ||
+ priv->tex_flags != priv->flags)) {
struct pipe_texture *texture = NULL;
struct pipe_texture template;
@@ -875,13 +900,15 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
template.target = PIPE_TEXTURE_2D;
exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format);
pf_get_block(template.format, &template.block);
-#if 1
- template.width[0] = util_next_power_of_two(width);
- template.height[0] = util_next_power_of_two(height);
-#else
- template.width[0] = width;
- template.height[0] = height;
-#endif
+ if (ROUND_UP_TEXTURES && priv->flags == 0) {
+ template.width[0] = util_next_power_of_two(width);
+ template.height[0] = util_next_power_of_two(height);
+ }
+ else {
+ template.width[0] = width;
+ template.height[0] = height;
+ }
+
template.depth[0] = 1;
template.last_level = 0;
template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET | priv->flags;