i965g: pass backbuffer tiling information to driver
authorKeith Whitwell <keithw@vmware.com>
Mon, 30 Nov 2009 15:35:58 +0000 (15:35 +0000)
committerKeith Whitwell <keithw@vmware.com>
Mon, 30 Nov 2009 15:37:27 +0000 (15:37 +0000)
The gem winsys gets this information, needs to pass it on.

src/gallium/drivers/i965/brw_screen.h
src/gallium/drivers/i965/brw_screen_tex_layout.c
src/gallium/drivers/i965/brw_screen_texture.c
src/gallium/drivers/i965/brw_winsys.h
src/gallium/winsys/drm/i965/gem/i965_drm_api.c
src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h

index 301b20d54908b367cc7766e0187304e39c7ce3c7..ab811e48fcae6083692ef87b1e5c064eacf7f067 100644 (file)
@@ -72,9 +72,6 @@ struct brw_buffer
    void *ptr;
 };
 
-#define BRW_TILING_NONE  0
-#define BRW_TILING_Y     1
-#define BRW_TILING_X     2
 
 union brw_surface_id {
    struct {
index f793fa8859ef08cf1ceb471cfe01cd179909a1dd..71a8890f83365c9e4f0231b93faf2b766ba544b2 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "brw_screen.h"
 #include "brw_debug.h"
+#include "brw_winsys.h"
 
 /* Code to layout images in a mipmap tree for i965.
  */
index 666ec70d4240a37d96c42a4a422f6a8f2d967d71..650cac240bb15a3eda16fcdbda6cb88cd87c75a5 100644 (file)
@@ -472,7 +472,8 @@ boolean brw_texture_get_winsys_buffer(struct pipe_texture *texture,
 struct pipe_texture * 
 brw_texture_blanket_winsys_buffer(struct pipe_screen *screen,
                                   const struct pipe_texture *templ,
-                                  const unsigned pitch,
+                                  unsigned pitch,
+                                 unsigned tiling,
                                   struct brw_winsys_buffer *buffer)
 {
    struct brw_screen *bscreen = brw_screen(screen);
@@ -495,18 +496,11 @@ brw_texture_blanket_winsys_buffer(struct pipe_screen *screen,
    tex->base.screen = screen;
 
    tex->cpp = pf_get_size(tex->base.format);
+   tex->tiling = tiling;
 
    make_empty_list(&tex->views[0]);
    make_empty_list(&tex->views[1]);
 
-   if (1)
-      tex->tiling = BRW_TILING_NONE;
-   else if (bscreen->chipset.is_965 &&
-            pf_is_depth_or_stencil(templ->format))
-      tex->tiling = BRW_TILING_Y;
-   else
-      tex->tiling = BRW_TILING_X;
-
    if (!brw_texture_layout(bscreen, tex))
       goto fail;
 
index 9e86a1256e1726166015f13b38b55dfd8634b81d..af506a283dc43ca9284e10d2c208fa9838358142 100644 (file)
@@ -111,6 +111,12 @@ enum brw_buffer_data_type {
 };
 
 
+/* Matches the i915_drm definitions:
+ */
+#define BRW_TILING_NONE  0
+#define BRW_TILING_X     1
+#define BRW_TILING_Y     2
+
 
 /* Relocations to be applied with subdata in a call to sws->bo_subdata, below.
  *
@@ -271,7 +277,8 @@ boolean brw_texture_get_winsys_buffer(struct pipe_texture *texture,
 struct pipe_texture * 
 brw_texture_blanket_winsys_buffer(struct pipe_screen *screen,
                                   const struct pipe_texture *template,
-                                  const unsigned pitch,
+                                  unsigned pitch,
+                                 unsigned tiling,
                                   struct brw_winsys_buffer *buffer);
 
 
index 5172b5410b4c1e4f90a804772a42e012ec1d5dbb..fc9678d2b628a7583fcf8eceade062edb2c730e8 100644 (file)
@@ -42,7 +42,7 @@ i965_libdrm_buffer_from_handle(struct i965_libdrm_winsys *idws,
                                const char* name, unsigned handle)
 {
    struct i965_libdrm_buffer *buf = CALLOC_STRUCT(i965_libdrm_buffer);
-   uint32_t tile = 0, swizzle = 0;
+   uint32_t swizzle = 0;
 
    if (BRW_DUMP)
       debug_printf("%s\n", __FUNCTION__);
@@ -60,8 +60,8 @@ i965_libdrm_buffer_from_handle(struct i965_libdrm_winsys *idws,
    if (!buf->bo)
       goto err;
 
-   drm_intel_bo_get_tiling(buf->bo, &tile, &swizzle);
-   if (tile != 0)
+   drm_intel_bo_get_tiling(buf->bo, &buf->tiling, &swizzle);
+   if (buf->tiling != 0)
       buf->map_gtt = TRUE;
 
    return buf;
@@ -100,7 +100,9 @@ i965_libdrm_texture_from_shared_handle(struct drm_api *api,
    if (!buffer)
       return NULL;
 
-   return brw_texture_blanket_winsys_buffer(screen, template, pitch, &buffer->base);
+   return brw_texture_blanket_winsys_buffer(screen, template, pitch,
+                                           buffer->tiling,
+                                           &buffer->base);
 }
 
 
index 235eaf68fa2eafe9bd29daac1fb0444e206ff2ed..c6a7d4a8c51d1f14f7029a96098b0dcadd6d7ae9 100644 (file)
@@ -46,14 +46,12 @@ struct i965_libdrm_buffer {
 
    void *ptr;
    unsigned map_count;
-   boolean map_gtt;
+   unsigned data_type;         /* valid while mapped */
+   unsigned tiling;
 
+   boolean map_gtt;
    boolean flinked;
    unsigned flink;
-
-   unsigned data_type;         /* valid while mapped */
-
-   unsigned cheesy_refcount;
 };
 
 static INLINE struct i965_libdrm_buffer *