r300g: fix MSAA resolve to an untiled texture
authorMarek Olšák <maraeo@gmail.com>
Sun, 13 Jan 2013 23:27:28 +0000 (00:27 +0100)
committerMarek Olšák <maraeo@gmail.com>
Mon, 14 Jan 2013 02:12:01 +0000 (03:12 +0100)
RB3D_DEBUG_CTL doesn't help, so I resolve to a tiled temporary texture and
then blitting it to the destination one, which we also do in other situations.

src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_defines.h
src/gallium/drivers/r300/r300_texture_desc.c

index 0490160aad894391f701b8f42ec731a4368c74ff..f8d3b1fd1d1326120f38b0721f2aac726cba6bdc 100644 (file)
@@ -626,7 +626,9 @@ static boolean r300_is_simple_msaa_resolve(const struct pipe_blit_info *info)
            info->src.box.x == 0 &&
            info->src.box.y == 0 &&
            info->src.box.width == dst_width &&
-           info->src.box.height == dst_height;
+           info->src.box.height == dst_height &&
+           (r300_resource(info->dst.resource)->tex.microtile != RADEON_LAYOUT_LINEAR ||
+            r300_resource(info->dst.resource)->tex.macrotile[info->dst.level] != RADEON_LAYOUT_LINEAR);
 }
 
 static void r300_simple_msaa_resolve(struct pipe_context *pipe,
@@ -704,6 +706,7 @@ static void r300_msaa_resolve(struct pipe_context *pipe,
     templ.depth0 = 1;
     templ.array_size = 1;
     templ.usage = PIPE_USAGE_STATIC;
+    templ.flags = R300_RESOURCE_FORCE_MICROTILING;
 
     tmp = screen->resource_create(screen, &templ);
 
index 30e9befad21fdc7e4e8da82a30fd794fa65a4a1e..a2a1b791e67b6220e0f25bc5002d1d650c70c47d 100644 (file)
@@ -28,7 +28,8 @@
 #define R300_MAX_TEXTURE_LEVELS         13
 #define R300_MAX_DRAW_VBO_SIZE          (1024 * 1024)
 
-#define R300_RESOURCE_FLAG_TRANSFER     PIPE_RESOURCE_FLAG_DRV_PRIV
+#define R300_RESOURCE_FLAG_TRANSFER     (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
+#define R300_RESOURCE_FORCE_MICROTILING (PIPE_RESOURCE_FLAG_DRV_PRIV << 1)
 
 #define R300_INVALID_FORMAT 0xffff
 
index e9623eea6087be82ae0db0a5babf9d3090889286..8928f73f7cf899b0f47d1daa413af9ca8ef64d59 100644 (file)
@@ -416,6 +416,8 @@ static void r300_setup_tiling(struct r300_screen *screen,
     boolean rv350_mode = screen->caps.family >= CHIP_R350;
     boolean is_zb = util_format_is_depth_or_stencil(format);
     boolean dbg_no_tiling = SCREEN_DBG_ON(screen, DBG_NO_TILING);
+    boolean force_microtiling =
+        (tex->b.b.flags & R300_RESOURCE_FORCE_MICROTILING) != 0;
 
     if (tex->b.b.nr_samples > 1) {
         tex->tex.microtile = RADEON_LAYOUT_TILED;
@@ -431,7 +433,8 @@ static void r300_setup_tiling(struct r300_screen *screen,
     }
 
     /* If height == 1, disable microtiling except for zbuffer. */
-    if (!is_zb && (tex->b.b.height0 == 1 || dbg_no_tiling)) {
+    if (!force_microtiling && !is_zb &&
+        (tex->b.b.height0 == 1 || dbg_no_tiling)) {
         return;
     }