Mesa (master): i965g: update for u_format changes

Keith Whitwell keithw at kemper.freedesktop.org
Tue Dec 22 01:52:23 PST 2009


Module: Mesa
Branch: master
Commit: 96d63ebbf524df78e7a1d83d2acf75ae72d27f2a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=96d63ebbf524df78e7a1d83d2acf75ae72d27f2a

Author: Keith Whitwell <keithw at vmware.com>
Date:   Tue Dec 22 09:52:26 2009 +0000

i965g: update for u_format changes

---

 src/gallium/drivers/i965/brw_screen_texture.c |   23 ++++++++++++-----------
 src/gallium/drivers/i965/brw_winsys.h         |    2 +-
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/i965/brw_screen_texture.c b/src/gallium/drivers/i965/brw_screen_texture.c
index ff99908..feb9d5f 100644
--- a/src/gallium/drivers/i965/brw_screen_texture.c
+++ b/src/gallium/drivers/i965/brw_screen_texture.c
@@ -31,6 +31,7 @@
 
 #include "util/u_memory.h"
 #include "util/u_simple_list.h"
+#include "util/u_format.h"
 
 #include "brw_screen.h"
 #include "brw_defines.h"
@@ -201,8 +202,8 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen,
 
    /* XXX: compressed textures need special treatment here
     */
-   tex->cpp = pf_get_size(tex->base.format);
-   tex->compressed = pf_is_compressed(tex->base.format);
+   tex->cpp = util_format_get_blocksize(tex->base.format);
+   tex->compressed = util_format_is_compressed(tex->base.format);
 
    make_empty_list(&tex->views[0]);
    make_empty_list(&tex->views[1]);
@@ -213,7 +214,7 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen,
        !bscreen->no_tiling) 
    {
       if (bscreen->chipset.is_965 &&
-	  pf_is_depth_or_stencil(templ->format))
+	  util_format_is_depth_or_stencil(templ->format))
 	 tex->tiling = BRW_TILING_Y;
       else
 	 tex->tiling = BRW_TILING_X;
@@ -391,14 +392,10 @@ brw_get_tex_transfer(struct pipe_screen *screen,
    trans = CALLOC_STRUCT(brw_transfer);
    if (trans) {
       pipe_texture_reference(&trans->base.texture, texture);
-      trans->base.format = trans->base.format;
       trans->base.x = x;
       trans->base.y = y;
       trans->base.width = w;
       trans->base.height = h;
-      trans->base.block = texture->block;
-      trans->base.nblocksx = texture->nblocksx[level];
-      trans->base.nblocksy = texture->nblocksy[level];
       trans->base.stride = tex->pitch * tex->cpp;
       trans->offset = offset;
       trans->base.usage = usage;
@@ -426,9 +423,11 @@ brw_transfer_map(struct pipe_screen *screen,
    if (!map)
       return NULL;
 
+   /* XXX: blocksize and compressed textures
+    */
    return map + brw_transfer(transfer)->offset +
-      transfer->y / transfer->block.height * transfer->stride +
-      transfer->x / transfer->block.width * transfer->block.size;
+      transfer->y /* / transfer->block.height */ * transfer->stride +
+      transfer->x /* / transfer->block.width */ * brw_texture(transfer->texture)->cpp;
 }
 
 static void
@@ -481,7 +480,7 @@ brw_texture_blanket_winsys_buffer(struct pipe_screen *screen,
        templ->depth0 != 1)
       return NULL;
 
-   if (pf_is_compressed(templ->format))
+   if (util_format_is_compressed(templ->format))
       return NULL;
 
    tex = CALLOC_STRUCT(brw_texture);
@@ -492,7 +491,9 @@ brw_texture_blanket_winsys_buffer(struct pipe_screen *screen,
    pipe_reference_init(&tex->base.reference, 1);
    tex->base.screen = screen;
 
-   tex->cpp = pf_get_size(tex->base.format);
+   /* XXX: cpp vs. blocksize
+    */
+   tex->cpp = util_format_get_blocksize(tex->base.format);
    tex->tiling = tiling;
 
    make_empty_list(&tex->views[0]);
diff --git a/src/gallium/drivers/i965/brw_winsys.h b/src/gallium/drivers/i965/brw_winsys.h
index 2f47067..4f3187c 100644
--- a/src/gallium/drivers/i965/brw_winsys.h
+++ b/src/gallium/drivers/i965/brw_winsys.h
@@ -244,7 +244,7 @@ bo_reference(struct brw_winsys_buffer **ptr, struct brw_winsys_buffer *buf)
 {
    struct brw_winsys_buffer *old_buf = *ptr;
 
-   if (pipe_reference((struct pipe_reference **)ptr, &buf->reference))
+   if (pipe_reference(&(*ptr)->reference, &buf->reference))
       old_buf->sws->bo_destroy(old_buf);
 }
 



More information about the mesa-commit mailing list