[Mesa-dev] [PATCH 09/13] i915g: switch to tiled allocations, kill set_fence

Daniel Vetter daniel.vetter at ffwll.ch
Fri Nov 19 14:38:26 PST 2010


This way relaxed fencing is handled by libdrm. And buffers _can't_
ever change their tiling.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 src/gallium/drivers/i915/i915_resource_texture.c |   16 ++--------------
 src/gallium/drivers/i915/i915_winsys.h           |    9 ---------
 src/gallium/winsys/i915/drm/i915_drm_buffer.c    |   19 -------------------
 src/gallium/winsys/i915/sw/i915_sw_buffer.c      |   18 ------------------
 src/gallium/winsys/i915/sw/i915_sw_winsys.h      |    1 -
 5 files changed, 2 insertions(+), 61 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c
index b4c0843..f563d06 100644
--- a/src/gallium/drivers/i915/i915_resource_texture.c
+++ b/src/gallium/drivers/i915/i915_resource_texture.c
@@ -785,23 +785,11 @@ i915_texture_create(struct pipe_screen *screen,
    else
       buf_usage = I915_NEW_TEXTURE;
 
-   tex->buffer = iws->buffer_create(iws, tex_size);
+   tex->buffer = iws->buffer_create_tiled(iws, tex->stride, tex->total_nblocksy,
+		   			  &tex->tiling, &tex->stride);
    if (!tex->buffer)
       goto fail;
 
-   /* setup any hw fences */
-   if (tex->tiling) {
-      iws->buffer_set_fence_reg(iws, tex->buffer, tex->stride, tex->tiling);
-   }
-
-   
-#if 0
-   void *ptr = ws->buffer_map(ws, tex->buffer,
-      PIPE_BUFFER_USAGE_CPU_WRITE);
-   memset(ptr, 0x80, tex_size);
-   ws->buffer_unmap(ws, tex->buffer);
-#endif
-
    I915_DBG(DBG_TEXTURE, "%s: %p size %u, stride %u, blocks (%u, %u)\n", __func__,
             tex, (unsigned int)tex_size, tex->stride,
             tex->stride / util_format_get_blocksize(tex->b.b.format),
diff --git a/src/gallium/drivers/i915/i915_winsys.h b/src/gallium/drivers/i915/i915_winsys.h
index a071c5e..72d8c6c 100644
--- a/src/gallium/drivers/i915/i915_winsys.h
+++ b/src/gallium/drivers/i915/i915_winsys.h
@@ -161,15 +161,6 @@ struct i915_winsys {
                                 unsigned stride);
 
    /**
-    * Fence a buffer with a fence reg.
-    * Not to be confused with pipe_fence_handle.
-    */
-   int (*buffer_set_fence_reg)(struct i915_winsys *iws,
-                               struct i915_winsys_buffer *buffer,
-                               unsigned stride,
-                               enum i915_winsys_buffer_tile tile);
-
-   /**
     * Map a buffer.
     */
    void *(*buffer_map)(struct i915_winsys *iws,
diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
index be87d28..a0a9d65 100644
--- a/src/gallium/winsys/i915/drm/i915_drm_buffer.c
+++ b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
@@ -124,24 +124,6 @@ i915_drm_buffer_get_handle(struct i915_winsys *iws,
    return TRUE;
 }
 
-static int
-i915_drm_buffer_set_fence_reg(struct i915_winsys *iws,
-                               struct i915_winsys_buffer *buffer,
-                               unsigned stride,
-                               enum i915_winsys_buffer_tile tile)
-{
-   struct i915_drm_buffer *buf = i915_drm_buffer(buffer);
-   assert(I915_TILING_NONE == I915_TILE_NONE);
-   assert(I915_TILING_X == I915_TILE_X);
-   assert(I915_TILING_Y == I915_TILE_Y);
-
-   if (tile != I915_TILE_NONE) {
-      assert(buf->map_count == 0);
-   }
-
-   return drm_intel_bo_set_tiling(buf->bo, &tile, stride);
-}
-
 static void *
 i915_drm_buffer_map(struct i915_winsys *iws,
                      struct i915_winsys_buffer *buffer,
@@ -214,7 +196,6 @@ i915_drm_winsys_init_buffer_functions(struct i915_drm_winsys *idws)
    idws->base.buffer_create_tiled = i915_drm_buffer_create_tiled;
    idws->base.buffer_from_handle = i915_drm_buffer_from_handle;
    idws->base.buffer_get_handle = i915_drm_buffer_get_handle;
-   idws->base.buffer_set_fence_reg = i915_drm_buffer_set_fence_reg;
    idws->base.buffer_map = i915_drm_buffer_map;
    idws->base.buffer_unmap = i915_drm_buffer_unmap;
    idws->base.buffer_write = i915_drm_buffer_write;
diff --git a/src/gallium/winsys/i915/sw/i915_sw_buffer.c b/src/gallium/winsys/i915/sw/i915_sw_buffer.c
index be8b9cb..7c00781 100644
--- a/src/gallium/winsys/i915/sw/i915_sw_buffer.c
+++ b/src/gallium/winsys/i915/sw/i915_sw_buffer.c
@@ -52,23 +52,6 @@ err:
    return NULL;
 }
 
-static int
-i915_sw_buffer_set_fence_reg(struct i915_winsys *iws,
-                               struct i915_winsys_buffer *buffer,
-                               unsigned stride,
-                               enum i915_winsys_buffer_tile tile)
-{
-   struct i915_sw_buffer *buf = i915_sw_buffer(buffer);
-
-   if (tile != I915_TILE_NONE) {
-      assert(buf->map_count == 0);
-   }
-
-   buf->tile = tile;
-
-   return 0;
-}
-
 static void *
 i915_sw_buffer_map(struct i915_winsys *iws,
                    struct i915_winsys_buffer *buffer,
@@ -121,7 +104,6 @@ i915_sw_winsys_init_buffer_functions(struct i915_sw_winsys *isws)
 {
    isws->base.buffer_create = i915_sw_buffer_create;
    isws->base.buffer_create_tiled = i915_sw_buffer_create_tiled;
-   isws->base.buffer_set_fence_reg = i915_sw_buffer_set_fence_reg;
    isws->base.buffer_map = i915_sw_buffer_map;
    isws->base.buffer_unmap = i915_sw_buffer_unmap;
    isws->base.buffer_write = i915_sw_buffer_write;
diff --git a/src/gallium/winsys/i915/sw/i915_sw_winsys.h b/src/gallium/winsys/i915/sw/i915_sw_winsys.h
index 7d6e8fd..8ecf6b0 100644
--- a/src/gallium/winsys/i915/sw/i915_sw_winsys.h
+++ b/src/gallium/winsys/i915/sw/i915_sw_winsys.h
@@ -42,7 +42,6 @@ struct i915_sw_buffer {
 
    void *ptr;
    unsigned map_count;
-   enum i915_winsys_buffer_tile tile;
    const char *name;
    unsigned tiling;
    unsigned stride;
-- 
1.7.1



More information about the mesa-dev mailing list