[Mesa-dev] [PATCH 07/13] i915g: drop alignment, type parameters for iws->buffer_create

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


type was only used to name the buffer. If needed, better let the
caller specify a meaningful name.

alignment is also rather unecessary. The kernel gem ignores it totally,
and we can't run on the old userspace fake bo manager due to lack of
dri2.

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

diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c
index bd046bd..41d2450 100644
--- a/src/gallium/drivers/i915/i915_prim_vbuf.c
+++ b/src/gallium/drivers/i915/i915_prim_vbuf.c
@@ -197,8 +197,7 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size)
    }
 #endif
 
-   i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size,
-                                         64, I915_NEW_VERTEX);
+   i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size);
 }
 
 /**
@@ -726,8 +725,7 @@ i915_vbuf_render_create(struct i915_context *i915)
    i915_render->pool_fifo = u_fifo_create(6);
    for (i = 0; i < 6; i++)
       u_fifo_add(i915_render->pool_fifo,
-                 iws->buffer_create(iws, i915_render->pool_buffer_size, 64,
-                                    I915_NEW_VERTEX));
+                 iws->buffer_create(iws, i915_render->pool_buffer_size);
 #else
    (void)i;
    (void)iws;
diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c
index d45346b..b4c0843 100644
--- a/src/gallium/drivers/i915/i915_resource_texture.c
+++ b/src/gallium/drivers/i915/i915_resource_texture.c
@@ -785,7 +785,7 @@ i915_texture_create(struct pipe_screen *screen,
    else
       buf_usage = I915_NEW_TEXTURE;
 
-   tex->buffer = iws->buffer_create(iws, tex_size, 64, buf_usage);
+   tex->buffer = iws->buffer_create(iws, tex_size);
    if (!tex->buffer)
       goto fail;
 
diff --git a/src/gallium/drivers/i915/i915_winsys.h b/src/gallium/drivers/i915/i915_winsys.h
index 5385e40..1058a0e 100644
--- a/src/gallium/drivers/i915/i915_winsys.h
+++ b/src/gallium/drivers/i915/i915_winsys.h
@@ -130,8 +130,7 @@ struct i915_winsys {
     */
    struct i915_winsys_buffer *
       (*buffer_create)(struct i915_winsys *iws,
-                       unsigned size, unsigned alignment,
-                       enum i915_winsys_buffer_type type);
+                       unsigned size);
 
    /**
     * Creates a buffer from a handle.
diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
index 15ec448..ffc1772 100644
--- a/src/gallium/winsys/i915/drm/i915_drm_buffer.c
+++ b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
@@ -7,8 +7,7 @@
 
 static struct i915_winsys_buffer *
 i915_drm_buffer_create(struct i915_winsys *iws,
-                        unsigned size, unsigned alignment,
-                        enum i915_winsys_buffer_type type)
+                        unsigned size)
 {
    struct i915_drm_buffer *buf = CALLOC_STRUCT(i915_drm_buffer);
    struct i915_drm_winsys *idws = i915_drm_winsys(iws);
@@ -21,18 +20,8 @@ i915_drm_buffer_create(struct i915_winsys *iws,
    buf->flinked = FALSE;
    buf->flink = 0;
 
-   if (type == I915_NEW_TEXTURE) {
-      name = "gallium3d_texture";
-   } else if (type == I915_NEW_VERTEX) {
-      name = "gallium3d_vertex";
-   } else if (type == I915_NEW_SCANOUT) {
-      name = "gallium3d_scanout";
-   } else {
-      assert(0);
-      name = "gallium3d_unknown";
-   }
-
-   buf->bo = drm_intel_bo_alloc(idws->gem_manager, name, size, alignment);
+   buf->bo = drm_intel_bo_alloc(idws->gem_manager, "i915 gallium buffer",
+		   		size, 0);
 
    if (!buf->bo)
       goto err;
diff --git a/src/gallium/winsys/i915/sw/i915_sw_buffer.c b/src/gallium/winsys/i915/sw/i915_sw_buffer.c
index df17568..a1c2deb 100644
--- a/src/gallium/winsys/i915/sw/i915_sw_buffer.c
+++ b/src/gallium/winsys/i915/sw/i915_sw_buffer.c
@@ -4,29 +4,15 @@
 
 static struct i915_winsys_buffer *
 i915_sw_buffer_create(struct i915_winsys *iws,
-                      unsigned size, unsigned alignment,
-                      enum i915_winsys_buffer_type type)
+                      unsigned size)
 {
    struct i915_sw_buffer *buf = CALLOC_STRUCT(i915_sw_buffer);
-   char *name;
 
    if (!buf)
       return NULL;
 
-   if (type == I915_NEW_TEXTURE) {
-      name = "gallium3d_texture";
-   } else if (type == I915_NEW_VERTEX) {
-      name = "gallium3d_vertex";
-   } else if (type == I915_NEW_SCANOUT) {
-      name = "gallium3d_scanout";
-   } else {
-      assert(0);
-      name = "gallium3d_unknown";
-   }
-
    buf->magic = 0xDEAD1337;
-   buf->name = name;
-   buf->type = type;
+   buf->name = "i915 gallium buffer";
    buf->ptr = CALLOC(size, 1);
 
    if (!buf->ptr)
diff --git a/src/gallium/winsys/i915/sw/i915_sw_winsys.h b/src/gallium/winsys/i915/sw/i915_sw_winsys.h
index b7b4366..666ea34 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_type type;
    enum i915_winsys_buffer_tile tile;
    const char *name;
 };
-- 
1.7.1



More information about the mesa-dev mailing list