Mesa (master): nvfx: use common NOUVEAU_RESOURCE_FLAG_LINEAR define

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Tue Aug 30 11:57:16 UTC 2011


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

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Tue Aug 30 13:44:31 2011 +0200

nvfx: use common NOUVEAU_RESOURCE_FLAG_LINEAR define

---

 src/gallium/drivers/nouveau/nouveau_winsys.h |    3 ++-
 src/gallium/drivers/nvfx/nv30_fragtex.c      |    2 +-
 src/gallium/drivers/nvfx/nvfx_buffer.c       |    5 +++--
 src/gallium/drivers/nvfx/nvfx_miptree.c      |    8 ++++----
 src/gallium/drivers/nvfx/nvfx_resource.h     |    3 +--
 src/gallium/drivers/nvfx/nvfx_state_fb.c     |    2 +-
 src/gallium/drivers/nvfx/nvfx_surface.c      |    6 +++---
 src/gallium/drivers/nvfx/nvfx_transfer.c     |    2 +-
 8 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h
index 37416f7..553a5e6 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -17,7 +17,8 @@
 #define NV04_PFIFO_MAX_PACKET_LEN 2047
 #endif
 
-#define NOUVEAU_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
+#define NOUVEAU_RESOURCE_FLAG_LINEAR   (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
+#define NOUVEAU_RESOURCE_FLAG_DRV_PRIV (PIPE_RESOURCE_FLAG_DRV_PRIV << 1)
 
 static INLINE uint32_t
 nouveau_screen_transfer_flags(unsigned pipe)
diff --git a/src/gallium/drivers/nvfx/nv30_fragtex.c b/src/gallium/drivers/nvfx/nv30_fragtex.c
index b609891..6fe5932 100644
--- a/src/gallium/drivers/nvfx/nv30_fragtex.c
+++ b/src/gallium/drivers/nvfx/nv30_fragtex.c
@@ -58,7 +58,7 @@ nv30_sampler_view_init(struct pipe_context *pipe,
 	if(pt->height0 <= 1 || util_format_is_compressed(sv->base.format))
 		sv->u.nv30.rect = -1;
 	else
-		sv->u.nv30.rect = !!(pt->flags & NVFX_RESOURCE_FLAG_LINEAR);
+		sv->u.nv30.rect = !!(pt->flags & NOUVEAU_RESOURCE_FLAG_LINEAR);
 
 	sv->lod_offset = sv->base.u.tex.first_level - level;
 	sv->max_lod_limit = sv->base.u.tex.last_level - level;
diff --git a/src/gallium/drivers/nvfx/nvfx_buffer.c b/src/gallium/drivers/nvfx/nvfx_buffer.c
index b407429..76b7f45 100644
--- a/src/gallium/drivers/nvfx/nvfx_buffer.c
+++ b/src/gallium/drivers/nvfx/nvfx_buffer.c
@@ -31,7 +31,7 @@ nvfx_buffer_create(struct pipe_screen *pscreen,
 		return NULL;
 
 	buffer->base.base = *template;
-	buffer->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR;
+	buffer->base.base.flags |= NOUVEAU_RESOURCE_FLAG_LINEAR;
 	pipe_reference_init(&buffer->base.base.reference, 1);
 	buffer->base.base.screen = pscreen;
 	buffer->size = util_format_get_stride(template->format, template->width0);
@@ -56,7 +56,8 @@ nvfx_user_buffer_create(struct pipe_screen *pscreen,
 		return NULL;
 
 	pipe_reference_init(&buffer->base.base.reference, 1);
-	buffer->base.base.flags = NVFX_RESOURCE_FLAG_LINEAR | NVFX_RESOURCE_FLAG_USER;
+	buffer->base.base.flags =
+		NOUVEAU_RESOURCE_FLAG_LINEAR | NVFX_RESOURCE_FLAG_USER;
 	buffer->base.base.screen = pscreen;
 	buffer->base.base.format = PIPE_FORMAT_R8_UNORM;
 	buffer->base.base.usage = PIPE_USAGE_IMMUTABLE;
diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c
index 1be84b9..8695aa3 100644
--- a/src/gallium/drivers/nvfx/nvfx_miptree.c
+++ b/src/gallium/drivers/nvfx/nvfx_miptree.c
@@ -33,13 +33,13 @@ nvfx_miptree_choose_format(struct nvfx_miptree *mt)
 		|| util_format_is_compressed(pt->format)
 		|| no_swizzle
 	)
-		mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR;
+		mt->base.base.flags |= NOUVEAU_RESOURCE_FLAG_LINEAR;
 
 	/* non compressed formats with uniform pitch must be linear, and vice versa */
 	if(!util_format_is_s3tc(pt->format)
-		&& (uniform_pitch || mt->base.base.flags & NVFX_RESOURCE_FLAG_LINEAR))
+		&& (uniform_pitch || mt->base.base.flags & NOUVEAU_RESOURCE_FLAG_LINEAR))
 	{
-		mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR;
+		mt->base.base.flags |= NOUVEAU_RESOURCE_FLAG_LINEAR;
 		uniform_pitch = 1;
 	}
 
@@ -175,7 +175,7 @@ nvfx_miptree_from_handle(struct pipe_screen *pscreen, const struct pipe_resource
         unsigned stride;
         if(whandle->stride) {
 		mt->linear_pitch = whandle->stride;
-		mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR;
+		mt->base.base.flags |= NOUVEAU_RESOURCE_FLAG_LINEAR;
         } else
 		nvfx_miptree_choose_format(mt);
 
diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h b/src/gallium/drivers/nvfx/nvfx_resource.h
index 070f897..6e0493f 100644
--- a/src/gallium/drivers/nvfx/nvfx_resource.h
+++ b/src/gallium/drivers/nvfx/nvfx_resource.h
@@ -23,8 +23,7 @@ struct nvfx_resource *nvfx_resource(struct pipe_resource *resource)
 	return (struct nvfx_resource *)resource;
 }
 
-#define NVFX_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
-#define NVFX_RESOURCE_FLAG_USER (PIPE_RESOURCE_FLAG_DRV_PRIV << 1)
+#define NVFX_RESOURCE_FLAG_USER (NOUVEAU_RESOURCE_FLAG_DRV_PRIV << 0)
 
 /* is resource mapped into the GPU's address space (i.e. VRAM or GART) ? */
 static INLINE boolean
diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c b/src/gallium/drivers/nvfx/nvfx_state_fb.c
index f9fed94..dc4ab2f 100644
--- a/src/gallium/drivers/nvfx/nvfx_state_fb.c
+++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c
@@ -6,7 +6,7 @@ static inline boolean
 nvfx_surface_linear_renderable(struct pipe_surface* surf)
 {
 	/* TODO: precompute this in nvfx_surface creation */
-	return (surf->texture->flags & NVFX_RESOURCE_FLAG_LINEAR)
+	return (surf->texture->flags & NOUVEAU_RESOURCE_FLAG_LINEAR)
 		&& !(((struct nvfx_surface*)surf)->offset & 63)
 		&& !(((struct nvfx_surface*)surf)->pitch & 63);
 }
diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c
index 04b0304..91ca1c3 100644
--- a/src/gallium/drivers/nvfx/nvfx_surface.c
+++ b/src/gallium/drivers/nvfx/nvfx_surface.c
@@ -102,7 +102,7 @@ nvfx_region_init_for_surface(struct nv04_region* rgn, struct nvfx_surface* surf,
 		rgn->bo = ((struct nvfx_resource*)surf->base.base.texture)->bo;
 		rgn->offset = surf->offset;
 
-		if(surf->base.base.texture->flags & NVFX_RESOURCE_FLAG_LINEAR)
+		if(surf->base.base.texture->flags & NOUVEAU_RESOURCE_FLAG_LINEAR)
 			rgn->pitch = surf->pitch;
 	        else
 	        {
@@ -137,7 +137,7 @@ nvfx_region_init_for_subresource(struct nv04_region* rgn, struct pipe_resource*
 	rgn->x = x;
 	rgn->y = y;
 
-	if(pt->flags & NVFX_RESOURCE_FLAG_LINEAR)
+	if(pt->flags & NOUVEAU_RESOURCE_FLAG_LINEAR)
 	{
 		rgn->pitch = nvfx_subresource_pitch(pt, level);
 		rgn->z = 0;
@@ -438,7 +438,7 @@ nvfx_surface_create_temp(struct pipe_context* pipe, struct pipe_surface* surf)
 	template.height0 = surf->height;
 	template.depth0 = 1;
 	template.nr_samples = surf->texture->nr_samples;
-	template.flags = NVFX_RESOURCE_FLAG_LINEAR;
+	template.flags = NOUVEAU_RESOURCE_FLAG_LINEAR;
 
 	assert(!ns->temp && !util_dirty_surface_is_dirty(&ns->base));
 
diff --git a/src/gallium/drivers/nvfx/nvfx_transfer.c b/src/gallium/drivers/nvfx/nvfx_transfer.c
index cc4b51e..7a218b1 100644
--- a/src/gallium/drivers/nvfx/nvfx_transfer.c
+++ b/src/gallium/drivers/nvfx/nvfx_transfer.c
@@ -56,7 +56,7 @@ nvfx_transfer_new(struct pipe_context *pipe,
 	else
 	{
 	        struct nvfx_staging_transfer* tx;
-	        boolean direct = !nvfx_resource_on_gpu(pt) && pt->flags & NVFX_RESOURCE_FLAG_LINEAR;
+	        boolean direct = !nvfx_resource_on_gpu(pt) && pt->flags & NOUVEAU_RESOURCE_FLAG_LINEAR;
 
 	        tx = CALLOC_STRUCT(nvfx_staging_transfer);
 	        if(!tx)




More information about the mesa-commit mailing list