Module: Mesa
Branch: gallium-array-textures
Commit: 6895a7f969ed7f9fa8ceb788810df8dbcf04c4c9
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6895a7f969ed7f9fa8ceb788810df8dbcf04c4c9

Author: Roland Scheidegger <[email protected]>
Date:   Wed Nov 24 03:07:36 2010 +0100

gallium: more compile fixes after merge

---

 src/gallium/auxiliary/util/u_dirty_surfaces.h  |    5 +-
 src/gallium/drivers/noop/noop_pipe.c           |   59 +++++-------------------
 src/gallium/drivers/noop/noop_state.c          |   32 +++++++++++++
 src/gallium/drivers/nv50/nv50_state_validate.c |    4 +-
 src/gallium/drivers/nv50/nv50_surface.c        |   12 ++--
 src/gallium/drivers/nvfx/nv30_fragtex.c        |    8 ++--
 src/gallium/drivers/nvfx/nv40_fragtex.c        |    8 ++--
 src/gallium/drivers/nvfx/nvfx_fragtex.c        |    4 +-
 src/gallium/drivers/nvfx/nvfx_miptree.c        |    5 +-
 src/gallium/drivers/nvfx/nvfx_resource.c       |    2 +-
 src/gallium/drivers/nvfx/nvfx_resource.h       |    8 ++--
 src/gallium/drivers/nvfx/nvfx_state_fb.c       |    8 ++--
 src/gallium/drivers/nvfx/nvfx_surface.c        |   29 +++++++-----
 src/gallium/drivers/nvfx/nvfx_transfer.c       |    6 +-
 14 files changed, 96 insertions(+), 94 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_dirty_surfaces.h 
b/src/gallium/auxiliary/util/u_dirty_surfaces.h
index fd1bbe5..f3618d9 100644
--- a/src/gallium/auxiliary/util/u_dirty_surfaces.h
+++ b/src/gallium/auxiliary/util/u_dirty_surfaces.h
@@ -77,7 +77,7 @@ util_dirty_surfaces_use_levels_for_sampling(struct 
pipe_context *pipe, struct ut
       struct util_dirty_surface *ds = LIST_ENTRY(struct util_dirty_surface, p, 
dirty_list);
       next = p->next;
 
-      if(ds->base.level >= first && ds->base.level <= last)
+      if(ds->base.u.tex.level >= first && ds->base.u.tex.level <= last)
         flush(pipe, &ds->base);
    }
 }
@@ -86,7 +86,8 @@ static INLINE void
 util_dirty_surfaces_use_for_sampling_with(struct pipe_context *pipe, struct 
util_dirty_surfaces *dss, struct pipe_sampler_view *psv, struct 
pipe_sampler_state *pss, util_dirty_surface_flush_t flush)
 {
    if(!LIST_IS_EMPTY(&dss->dirty_list))
-      util_dirty_surfaces_use_levels_for_sampling(pipe, dss, 
(unsigned)pss->min_lod + psv->first_level, MIN2((unsigned)ceilf(pss->max_lod) + 
psv->first_level, psv->last_level), flush);
+      util_dirty_surfaces_use_levels_for_sampling(pipe, dss, 
(unsigned)pss->min_lod + psv->u.tex.first_level,
+                                                 
MIN2((unsigned)ceilf(pss->max_lod) + psv->u.tex.first_level, 
psv->u.tex.last_level), flush);
 }
 
 static INLINE void
diff --git a/src/gallium/drivers/noop/noop_pipe.c 
b/src/gallium/drivers/noop/noop_pipe.c
index fb5cdb4..c9c463f 100644
--- a/src/gallium/drivers/noop/noop_pipe.c
+++ b/src/gallium/drivers/noop/noop_pipe.c
@@ -83,7 +83,7 @@ struct noop_resource {
 
 static unsigned noop_is_resource_referenced(struct pipe_context *pipe,
                                                struct pipe_resource *resource,
-                                               unsigned face, unsigned level)
+                                               unsigned level, int layer)
 {
        return PIPE_UNREFERENCED;
 }
@@ -193,7 +193,7 @@ static struct pipe_resource *noop_user_buffer_create(struct 
pipe_screen *screen,
  */
 static struct pipe_transfer *noop_get_transfer(struct pipe_context *context,
                                                struct pipe_resource *resource,
-                                               struct pipe_subresource sr,
+                                               unsigned level,
                                                enum pipe_transfer_usage usage,
                                                const struct pipe_box *box)
 {
@@ -203,11 +203,11 @@ static struct pipe_transfer *noop_get_transfer(struct 
pipe_context *context,
        if (transfer == NULL)
                return NULL;
        pipe_resource_reference(&transfer->resource, resource);
-       transfer->sr = sr;
+       transfer->level = level;
        transfer->usage = usage;
        transfer->box = *box;
        transfer->stride = 1;
-       transfer->slice_stride = 1;
+       transfer->layer_stride = 1;
        return transfer;
 }
 
@@ -239,12 +239,12 @@ static void noop_transfer_destroy(struct pipe_context 
*pipe,
 
 static void noop_transfer_inline_write(struct pipe_context *pipe,
                                        struct pipe_resource *resource,
-                                       struct pipe_subresource sr,
+                                       unsigned level,
                                        unsigned usage,
                                        const struct pipe_box *box,
                                        const void *data,
                                        unsigned stride,
-                                       unsigned slice_stride)
+                                       unsigned layer_stride)
 {
 }
 
@@ -277,12 +277,11 @@ static void noop_clear_depth_stencil(struct pipe_context 
*ctx,
 
 static void noop_resource_copy_region(struct pipe_context *ctx,
                                      struct pipe_resource *dst,
-                                     struct pipe_subresource subdst,
+                                     unsigned dst_level,
                                      unsigned dstx, unsigned dsty, unsigned 
dstz,
                                      struct pipe_resource *src,
-                                     struct pipe_subresource subsrc,
-                                     unsigned srcx, unsigned srcy, unsigned 
srcz,
-                                     unsigned width, unsigned height)
+                                     unsigned src_level,
+                                     const struct pipe_box *src_box)
 {
 }
 
@@ -332,46 +331,14 @@ static struct pipe_context *noop_create_context(struct 
pipe_screen *screen, void
        return ctx;
 }
 
-/*
- * texture
- */
-static struct pipe_surface *noop_get_tex_surface(struct pipe_screen *screen,
-                                               struct pipe_resource *texture,
-                                               unsigned face, unsigned level,
-                                               unsigned zslice, unsigned flags)
-{
-       struct pipe_surface *surface = CALLOC_STRUCT(pipe_surface);
-
-       if (surface == NULL)
-               return NULL;
-       pipe_reference_init(&surface->reference, 1);
-       pipe_resource_reference(&surface->texture, texture);
-       surface->format = texture->format;
-       surface->width = texture->width0;
-       surface->height = texture->height0;
-       surface->offset = 0;
-       surface->usage = flags;
-       surface->zslice = zslice;
-       surface->texture = texture;
-       surface->face = face;
-       surface->level = level;
-
-       return surface;
-}
-
-static void noop_tex_surface_destroy(struct pipe_surface *surface)
-{
-       pipe_resource_reference(&surface->texture, NULL);
-       FREE(surface);
-}
-
 
 /*
  * pipe_screen
  */
 static void noop_flush_frontbuffer(struct pipe_screen *_screen,
-                                       struct pipe_surface *surface,
-                                       void *context_private)
+                                  struct pipe_resource *resource,
+                                  unsigned level, unsigned layer,
+                                  void *context_private)
 {
 }
 
@@ -537,8 +504,6 @@ struct pipe_screen *noop_screen_create(struct sw_winsys 
*winsys)
        screen->get_paramf = noop_get_paramf;
        screen->is_format_supported = noop_is_format_supported;
        screen->context_create = noop_create_context;
-       screen->get_tex_surface = noop_get_tex_surface;
-       screen->tex_surface_destroy = noop_tex_surface_destroy;
        screen->resource_create = noop_resource_create;
        screen->resource_from_handle = noop_resource_from_handle;
        screen->resource_get_handle = noop_resource_get_handle;
diff --git a/src/gallium/drivers/noop/noop_state.c 
b/src/gallium/drivers/noop/noop_state.c
index 048ed42..5c62fc1 100644
--- a/src/gallium/drivers/noop/noop_state.c
+++ b/src/gallium/drivers/noop/noop_state.c
@@ -101,6 +101,28 @@ static struct pipe_sampler_view 
*noop_create_sampler_view(struct pipe_context *c
        return sampler_view;
 }
 
+static struct pipe_surface *noop_create_surface(struct pipe_context *ctx,
+                                               struct pipe_resource *texture,
+                                               const struct pipe_surface 
*surf_tmpl)
+{
+       struct pipe_surface *surface = CALLOC_STRUCT(pipe_surface);
+
+       if (surface == NULL)
+               return NULL;
+       pipe_reference_init(&surface->reference, 1);
+       pipe_resource_reference(&surface->texture, texture);
+       surface->context = ctx;
+       surface->format = surf_tmpl->format;
+       surface->width = texture->width0;
+       surface->height = texture->height0;
+       surface->usage = surf_tmpl->usage;
+       surface->texture = texture;
+       surface->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
+       surface->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
+       surface->u.tex.level = surf_tmpl->u.tex.level;
+
+       return surface;
+}
 static void noop_set_vs_sampler_view(struct pipe_context *ctx, unsigned count,
                                        struct pipe_sampler_view **views)
 {
@@ -163,6 +185,14 @@ static void noop_sampler_view_destroy(struct pipe_context 
*ctx,
        FREE(state);
 }
 
+
+static void noop_surface_destroy(struct pipe_context *ctx,
+                                struct pipe_surface *surface)
+{
+       pipe_resource_reference(&surface->texture, NULL);
+       FREE(surface);
+}
+
 static void noop_bind_state(struct pipe_context *ctx, void *state)
 {
 }
@@ -221,6 +251,7 @@ void noop_init_state_functions(struct pipe_context *ctx)
        ctx->create_rasterizer_state = noop_create_rs_state;
        ctx->create_sampler_state = noop_create_sampler_state;
        ctx->create_sampler_view = noop_create_sampler_view;
+       ctx->create_surface = noop_create_surface;
        ctx->create_vertex_elements_state = noop_create_vertex_elements;
        ctx->create_vs_state = noop_create_shader_state;
        ctx->bind_blend_state = noop_bind_state;
@@ -252,5 +283,6 @@ void noop_init_state_functions(struct pipe_context *ctx)
        ctx->set_vertex_sampler_views = noop_set_vs_sampler_view;
        ctx->set_viewport_state = noop_set_viewport_state;
        ctx->sampler_view_destroy = noop_sampler_view_destroy;
+       ctx->surface_destroy = noop_surface_destroy;
        ctx->draw_vbo = noop_draw_vbo;
 }
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c 
b/src/gallium/drivers/nv50/nv50_state_validate.c
index dc612d6..ae02143 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -63,9 +63,9 @@ validate_fb(struct nv50_context *nv50)
                so_data  (so, fb->cbufs[i]->height);
 
                so_method(so, tesla, NV50TCL_RT_ADDRESS_HIGH(i), 5);
-               so_reloc (so, bo, fb->cbufs[i]->offset, NOUVEAU_BO_VRAM |
+               so_reloc (so, bo, ((struct nv50_surface 
*)fb->cbufs[i])->offset, NOUVEAU_BO_VRAM |
                              NOUVEAU_BO_HIGH | NOUVEAU_BO_RDWR, 0, 0);
-               so_reloc (so, bo, fb->cbufs[i]->offset, NOUVEAU_BO_VRAM |
+               so_reloc (so, bo, ((struct nv50_surface 
*)fb->cbufs[i])->offset, NOUVEAU_BO_VRAM |
                              NOUVEAU_BO_LOW | NOUVEAU_BO_RDWR, 0, 0);
                so_data  (so, nv50_format_table[fb->cbufs[i]->format].rt);
                so_data  (so, nv50_miptree(pt)->
diff --git a/src/gallium/drivers/nv50/nv50_surface.c 
b/src/gallium/drivers/nv50/nv50_surface.c
index 0109c28..ce48022 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -236,10 +236,10 @@ nv50_clear_render_target(struct pipe_context *pipe,
        BEGIN_RING(chan, tesla, NV50TCL_RT_CONTROL, 1);
        OUT_RING  (chan, 1);
        BEGIN_RING(chan, tesla, NV50TCL_RT_ADDRESS_HIGH(0), 5);
-       OUT_RELOCh(chan, bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
-       OUT_RELOCl(chan, bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RELOCh(chan, bo, ((struct nv50_surface *)dst)->offset, 
NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RELOCl(chan, bo, ((struct nv50_surface *)dst)->offset, 
NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
        OUT_RING  (chan, nv50_format_table[dst->format].rt);
-       OUT_RING  (chan, mt->level[dst->level].tile_mode << 4);
+       OUT_RING  (chan, mt->level[dst->u.tex.level].tile_mode << 4);
        OUT_RING  (chan, 0);
        BEGIN_RING(chan, tesla, NV50TCL_RT_HORIZ(0), 2);
        OUT_RING  (chan, dst->width);
@@ -292,10 +292,10 @@ nv50_clear_depth_stencil(struct pipe_context *pipe,
                return;
 
        BEGIN_RING(chan, tesla, NV50TCL_ZETA_ADDRESS_HIGH, 5);
-       OUT_RELOCh(chan, bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
-       OUT_RELOCl(chan, bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RELOCh(chan, bo, ((struct nv50_surface *)dst)->offset, 
NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RELOCl(chan, bo, ((struct nv50_surface *)dst)->offset, 
NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
        OUT_RING  (chan, nv50_format_table[dst->format].rt);
-       OUT_RING  (chan, mt->level[dst->level].tile_mode << 4);
+       OUT_RING  (chan, mt->level[dst->u.tex.level].tile_mode << 4);
        OUT_RING  (chan, 0);
        BEGIN_RING(chan, tesla, NV50TCL_ZETA_ENABLE, 1);
        OUT_RING  (chan, 1);
diff --git a/src/gallium/drivers/nvfx/nv30_fragtex.c 
b/src/gallium/drivers/nvfx/nv30_fragtex.c
index d6ede5b..951fb20 100644
--- a/src/gallium/drivers/nvfx/nv30_fragtex.c
+++ b/src/gallium/drivers/nvfx/nv30_fragtex.c
@@ -37,12 +37,12 @@ nv30_sampler_view_init(struct pipe_context *pipe,
        struct pipe_resource* pt = sv->base.texture;
        struct nvfx_texture_format *tf = &nvfx_texture_formats[sv->base.format];
        unsigned txf;
-       unsigned level = pt->target == PIPE_TEXTURE_CUBE ? 0 : 
sv->base.first_level;
+       unsigned level = pt->target == PIPE_TEXTURE_CUBE ? 0 : 
sv->base.u.tex.first_level;
 
        assert(tf->fmt[0] >= 0);
 
        txf = sv->u.init_fmt;
-       txf |= (level != sv->base.last_level ? NV30_3D_TEX_FORMAT_MIPMAP : 0);
+       txf |= (level != sv->base.u.tex.last_level ? NV30_3D_TEX_FORMAT_MIPMAP 
: 0);
        txf |= util_logbase2(u_minify(pt->width0, level)) << 
NV30_3D_TEX_FORMAT_BASE_SIZE_U__SHIFT;
        txf |= util_logbase2(u_minify(pt->height0, level)) << 
NV30_3D_TEX_FORMAT_BASE_SIZE_V__SHIFT;
        txf |= util_logbase2(u_minify(pt->depth0, level)) << 
NV30_3D_TEX_FORMAT_BASE_SIZE_W__SHIFT;
@@ -60,8 +60,8 @@ nv30_sampler_view_init(struct pipe_context *pipe,
        else
                sv->u.nv30.rect = !!(pt->flags & NVFX_RESOURCE_FLAG_LINEAR);
 
-       sv->lod_offset = sv->base.first_level - level;
-       sv->max_lod_limit = sv->base.last_level - level;
+       sv->lod_offset = sv->base.u.tex.first_level - level;
+       sv->max_lod_limit = sv->base.u.tex.last_level - level;
 }
 
 void
diff --git a/src/gallium/drivers/nvfx/nv40_fragtex.c 
b/src/gallium/drivers/nvfx/nv40_fragtex.c
index d4fb737..e8ab403 100644
--- a/src/gallium/drivers/nvfx/nv40_fragtex.c
+++ b/src/gallium/drivers/nvfx/nv40_fragtex.c
@@ -46,7 +46,7 @@ nv40_sampler_view_init(struct pipe_context *pipe,
        struct nvfx_miptree* mt = (struct nvfx_miptree*)pt;
        struct nvfx_texture_format *tf = &nvfx_texture_formats[sv->base.format];
        unsigned txf;
-       unsigned level = pt->target == PIPE_TEXTURE_CUBE ? 0 : 
sv->base.first_level;
+       unsigned level = pt->target == PIPE_TEXTURE_CUBE ? 0 : 
sv->base.u.tex.first_level;
        assert(tf->fmt[4] >= 0);
 
        txf = sv->u.init_fmt;
@@ -54,7 +54,7 @@ nv40_sampler_view_init(struct pipe_context *pipe,
        if(pt->target == PIPE_TEXTURE_CUBE)
                txf |= ((pt->last_level + 1) << 
NV40_3D_TEX_FORMAT_MIPMAP_COUNT__SHIFT);
        else
-               txf |= (((sv->base.last_level - sv->base.first_level) + 1) << 
NV40_3D_TEX_FORMAT_MIPMAP_COUNT__SHIFT);
+               txf |= (((sv->base.u.tex.last_level - 
sv->base.u.tex.first_level) + 1) << NV40_3D_TEX_FORMAT_MIPMAP_COUNT__SHIFT);
 
        if (!mt->linear_pitch)
                sv->u.nv40.npot_size2 = 0;
@@ -68,8 +68,8 @@ nv40_sampler_view_init(struct pipe_context *pipe,
 
        sv->u.nv40.npot_size2 |= (u_minify(pt->depth0, level) << 
NV40_3D_TEX_SIZE1_DEPTH__SHIFT);
 
-       sv->lod_offset = (sv->base.first_level - level) * 256;
-       sv->max_lod_limit = (sv->base.last_level - level) * 256;
+       sv->lod_offset = (sv->base.u.tex.first_level - level) * 256;
+       sv->max_lod_limit = (sv->base.u.tex.last_level - level) * 256;
 }
 
 void
diff --git a/src/gallium/drivers/nvfx/nvfx_fragtex.c 
b/src/gallium/drivers/nvfx/nvfx_fragtex.c
index 1d6b4e2..fd0aff6 100644
--- a/src/gallium/drivers/nvfx/nvfx_fragtex.c
+++ b/src/gallium/drivers/nvfx/nvfx_fragtex.c
@@ -122,8 +122,8 @@ nvfx_create_sampler_view(struct pipe_context *pipe,
        }
        else
        {
-               sv->offset = nvfx_subresource_offset(pt, 0, 
sv->base.first_level, 0);
-               sv->npot_size = (u_minify(pt->width0, sv->base.first_level) << 
NV30_3D_TEX_NPOT_SIZE_W__SHIFT) | u_minify(pt->height0, sv->base.first_level);
+               sv->offset = nvfx_subresource_offset(pt, 0, 
sv->base.u.tex.first_level, 0);
+               sv->npot_size = (u_minify(pt->width0, 
sv->base.u.tex.first_level) << NV30_3D_TEX_NPOT_SIZE_W__SHIFT) | 
u_minify(pt->height0, sv->base.u.tex.first_level);
 
                /* apparently, we need to ignore the t coordinate for 1D 
textures to fix piglit tex1d-2dborder */
                if(pt->target == PIPE_TEXTURE_1D)
diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c 
b/src/gallium/drivers/nvfx/nvfx_miptree.c
index 9e7df11..15fa181 100644
--- a/src/gallium/drivers/nvfx/nvfx_miptree.c
+++ b/src/gallium/drivers/nvfx/nvfx_miptree.c
@@ -42,7 +42,6 @@ nvfx_miptree_choose_format(struct nvfx_miptree *mt)
                mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR;
                uniform_pitch = 1;
        }
-       nr_faces = pt->depth0 + pt->array_size - 1;
 
        if(uniform_pitch)
        {
@@ -201,10 +200,10 @@ nvfx_miptree_surface_new(struct pipe_context *pipe, 
struct pipe_resource *pt,
        assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
        ns = (struct nvfx_surface*)util_surfaces_get(&mt->surfaces, 
sizeof(struct nvfx_surface), NULL, pt,
                                                     0, level, 
surf_tmpl->u.tex.first_layer, surf_tmpl->usage);
-       if(ns->base.base.offset == ~0) {
+       if(ns->offset == ~0) {
                util_dirty_surface_init(&ns->base);
                ns->pitch = nvfx_subresource_pitch(pt, level);
-               ns->base.base.offset = nvfx_subresource_offset(pt, 
surf_tmpl->u.tex.first_layer, level, surf_tmpl->u.tex.first_layer);
+               ns->offset = nvfx_subresource_offset(pt, 
surf_tmpl->u.tex.first_layer, level, surf_tmpl->u.tex.first_layer);
        }
 
        return &ns->base.base;
diff --git a/src/gallium/drivers/nvfx/nvfx_resource.c 
b/src/gallium/drivers/nvfx/nvfx_resource.c
index 5bce324..c60a7bb 100644
--- a/src/gallium/drivers/nvfx/nvfx_resource.c
+++ b/src/gallium/drivers/nvfx/nvfx_resource.c
@@ -6,7 +6,7 @@
 
 static unsigned int
 nvfx_resource_is_referenced(struct pipe_context *pipe,
-                           struct pipe_resource *resource,
+                           struct pipe_resource *pr,
                            unsigned level, int layer)
 {
        return !!nouveau_reference_flags(nvfx_resource(pr)->bo);
diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h 
b/src/gallium/drivers/nvfx/nvfx_resource.h
index 583be4d..070f897 100644
--- a/src/gallium/drivers/nvfx/nvfx_resource.h
+++ b/src/gallium/drivers/nvfx/nvfx_resource.h
@@ -74,6 +74,7 @@ struct nvfx_miptree {
 struct nvfx_surface {
        struct util_dirty_surface base;
        unsigned pitch;
+       unsigned offset;
 
        struct nvfx_miptree* temp;
 };
@@ -116,12 +117,11 @@ nvfx_miptree_from_handle(struct pipe_screen *pscreen,
                         struct winsys_handle *whandle);
 
 void
-nvfx_miptree_surface_del(struct pipe_surface *ps);
+nvfx_miptree_surface_del(struct pipe_context *pipe, struct pipe_surface *ps);
 
 struct pipe_surface *
-nvfx_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt,
-                        unsigned face, unsigned level, unsigned zslice,
-                        unsigned flags);
+nvfx_miptree_surface_new(struct pipe_context *pipe, struct pipe_resource *pt,
+                        const struct pipe_surface *surf_tmpl);
 
 /* only for miptrees, don't use for buffers */
 
diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c 
b/src/gallium/drivers/nvfx/nvfx_state_fb.c
index 30e48c8..01fa66a 100644
--- a/src/gallium/drivers/nvfx/nvfx_state_fb.c
+++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c
@@ -7,7 +7,7 @@ nvfx_surface_linear_renderable(struct pipe_surface* surf)
 {
        /* TODO: precompute this in nvfx_surface creation */
        return (surf->texture->flags & NVFX_RESOURCE_FLAG_LINEAR)
-               && !(surf->offset & 63)
+               && !(((struct nvfx_surface*)surf)->offset & 63)
                && !(((struct nvfx_surface*)surf)->pitch & 63);
 }
 
@@ -16,8 +16,8 @@ nvfx_surface_swizzled_renderable(struct 
pipe_framebuffer_state* fb, struct pipe_
 {
        /* TODO: precompute this in nvfx_surface creation */
        return !((struct nvfx_miptree*)surf->texture)->linear_pitch
-               && (surf->texture->target != PIPE_TEXTURE_3D || 
u_minify(surf->texture->depth0, surf->level) <= 1)
-               && !(surf->offset & 127)
+               && (surf->texture->target != PIPE_TEXTURE_3D || 
u_minify(surf->texture->depth0, surf->u.tex.level) <= 1)
+               && !(((struct nvfx_surface*)surf)->offset & 127)
                && (surf->width == fb->width)
                && (surf->height == fb->height)
                && !((struct nvfx_surface*)surf)->temp
@@ -31,7 +31,7 @@ nvfx_surface_get_render_target(struct pipe_surface* surf, int 
all_swizzled, stru
        if(!ns->temp)
        {
                target->bo = ((struct nvfx_miptree*)surf->texture)->base.bo;
-               target->offset = surf->offset;
+               target->offset = ns->offset;
                target->pitch = align(ns->pitch, 64);
                assert(target->pitch);
                return FALSE;
diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c 
b/src/gallium/drivers/nvfx/nvfx_surface.c
index ccdba2d..c4d2cfd 100644
--- a/src/gallium/drivers/nvfx/nvfx_surface.c
+++ b/src/gallium/drivers/nvfx/nvfx_surface.c
@@ -99,17 +99,17 @@ nvfx_region_init_for_surface(struct nv04_region* rgn, 
struct nvfx_surface* surf,
                        
util_dirty_surface_set_dirty(nvfx_surface_get_dirty_surfaces(&surf->base.base), 
&surf->base);
        } else {
                rgn->bo = ((struct nvfx_resource*)surf->base.base.texture)->bo;
-               rgn->offset = surf->base.base.offset;
+               rgn->offset = surf->offset;
 
                if(surf->base.base.texture->flags & NVFX_RESOURCE_FLAG_LINEAR)
                        rgn->pitch = surf->pitch;
                else
                {
                        rgn->pitch = 0;
-                       rgn->z = surf->base.base.zslice;
+                       rgn->z = surf->base.base.u.tex.first_layer;
                        rgn->w = surf->base.base.width;
                        rgn->h = surf->base.base.height;
-                       rgn->d = u_minify(surf->base.base.texture->depth0, 
surf->base.base.level);
+                       rgn->d = u_minify(surf->base.base.texture->depth0, 
surf->base.base.u.tex.level);
                }
        }
 
@@ -372,7 +372,7 @@ static void
 nvfx_surface_copy_temp(struct pipe_context* pipe, struct pipe_surface* surf, 
int to_temp)
 {
        struct nvfx_surface* ns = (struct nvfx_surface*)surf;
-       struct pipe_subresource tempsr, surfsr;
+       struct pipe_box box;
        struct nvfx_context* nvfx = nvfx_context(pipe);
        struct nvfx_miptree* temp;
        unsigned use_vertex_buffers;
@@ -388,15 +388,20 @@ nvfx_surface_copy_temp(struct pipe_context* pipe, struct 
pipe_surface* surf, int
        use_index_buffer = nvfx->use_index_buffer;
        base_vertex = nvfx->base_vertex;
 
-       tempsr.face = 0;
-       tempsr.level = 0;
-       surfsr.face = surf->face;
-       surfsr.level = surf->level;
+       box.x = box.y = 0;
+       assert(surf->u.tex.first_layer = surf->u.tex.last_layer);
+       box.width = surf->width;
+       box.height = surf->height;
+       box.depth = 1;
 
-       if(to_temp)
-               nvfx_resource_copy_region(pipe, &temp->base.base, tempsr, 0, 0, 
0, surf->texture, surfsr, 0, 0, surf->zslice, surf->width, surf->height);
-       else
-               nvfx_resource_copy_region(pipe, surf->texture, surfsr, 0, 0, 
surf->zslice, &temp->base.base, tempsr, 0, 0, 0, surf->width, surf->height);
+       if(to_temp) {
+               box.z = surf->u.tex.first_layer;
+               nvfx_resource_copy_region(pipe, &temp->base.base, 0, 0, 0, 0, 
surf->texture, surf->u.tex.level, &box);
+       }
+       else {
+               box.z = 0;
+               nvfx_resource_copy_region(pipe, surf->texture, 
surf->u.tex.level, 0, 0, surf->u.tex.first_layer, &temp->base.base, 0, &box);
+       }
 
        /* If this triggers, it probably means we attempted to use the blitter
         * but failed due to non-renderability of the target.
diff --git a/src/gallium/drivers/nvfx/nvfx_transfer.c 
b/src/gallium/drivers/nvfx/nvfx_transfer.c
index 9089173..2debcb6 100644
--- a/src/gallium/drivers/nvfx/nvfx_transfer.c
+++ b/src/gallium/drivers/nvfx/nvfx_transfer.c
@@ -48,7 +48,7 @@ nvfx_transfer_new(struct pipe_context *pipe,
                tx->usage = usage;
                tx->box = *box;
 
-               tx->slice_stride = tx->stride = 
util_format_get_stride(pt->format, box->width);
+               tx->layer_stride = tx->stride = 
util_format_get_stride(pt->format, box->width);
                tx->data = buffer->data + util_format_get_stride(pt->format, 
box->x);
 
                return tx;
@@ -67,7 +67,7 @@ nvfx_transfer_new(struct pipe_context *pipe,
                if(direct)
                {
                        tx->base.base.stride = nvfx_subresource_pitch(pt, 
level);
-                       tx->base.base.slice_stride = tx->base.base.stride * 
u_minify(pt->height0, level);
+                       tx->base.base.layer_stride = tx->base.base.stride * 
u_minify(pt->height0, level);
                        tx->offset = nvfx_subresource_offset(pt, box->z, level, 
box->z)
                                + util_format_get_2d_size(pt->format, 
tx->base.base.stride, box->y)
                                + util_format_get_stride(pt->format, box->x);
@@ -75,7 +75,7 @@ nvfx_transfer_new(struct pipe_context *pipe,
                else
                {
                        tx->base.base.stride = 
nvfx_subresource_pitch(tx->base.staging_resource, 0);
-                       tx->base.base.slice_stride = tx->base.base.stride * 
tx->base.staging_resource->height0;
+                       tx->base.base.layer_stride = tx->base.base.stride * 
tx->base.staging_resource->height0;
                        tx->offset = 0;
                }
 

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to