Mesa (nvfx-next-6): nvfx: new 2D: use new 2D engine in Gallium

Luca Barbieri lb at kemper.freedesktop.org
Sun Apr 18 14:25:33 UTC 2010


Module: Mesa
Branch: nvfx-next-6
Commit: d1cd0718f007ea3140e619c1e7dc14a4a4a41ac1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d1cd0718f007ea3140e619c1e7dc14a4a4a41ac1

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Tue Jan 19 18:51:30 2010 +0100

nvfx: new 2D: use new 2D engine in Gallium

This patch implements nv04_surface_copy/fill using the new 2D engine module.
It supports falling back to the 3D engine using the u_blitter module.
That support is however inactive because it requires card-specific code that
will be introduced for nv30 and nvfx in a later patch.

---

 src/gallium/drivers/nouveau/nouveau_screen.h |   13 +++++++++++++
 src/gallium/drivers/nvfx/nv04_surface_2d.h   |   21 ---------------------
 src/gallium/drivers/nvfx/nvfx_context.h      |    1 +
 src/gallium/drivers/nvfx/nvfx_miptree.c      |    1 -
 src/gallium/drivers/nvfx/nvfx_resource.h     |    7 +++++++
 src/gallium/drivers/nvfx/nvfx_screen.h       |    5 +++--
 src/gallium/drivers/nvfx/nvfx_surface.h      |    4 ++++
 src/gallium/drivers/nvfx/nvfx_transfer.c     |    3 +--
 8 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h
index 747fd15..221ff49 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -77,4 +77,17 @@ RING_3D_NI(unsigned mthd, unsigned size)
 	return 0x40000000 | (7 << 13) | (size << 18) | mthd;
 }
 
+#include <nouveau/nouveau_bo.h>
+
+static inline int
+nouveau_resource_on_gpu(struct pipe_resource* resource)
+{
+#ifdef nouveau_bo_domain
+	return nouveau_bo_domain(nouveau_miptree(src->texture)->bo) & NOUVEAU_BO_VRAM;
+#else
+	/* Can't tell, assume that if we would like it to be in VRAM, it is */
+	return !(resource->_usage & PIPE_USAGE_DYNAMIC);
+#endif
+}
+
 #endif
diff --git a/src/gallium/drivers/nvfx/nv04_surface_2d.h b/src/gallium/drivers/nvfx/nv04_surface_2d.h
deleted file mode 100644
index 0b849f0..0000000
--- a/src/gallium/drivers/nvfx/nv04_surface_2d.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __NV04_SURFACE_2D_H__
-#define __NV04_SURFACE_2D_H__
-
-struct nvfx_surface {
-	struct pipe_surface base;
-	unsigned pitch;
-};
-
-struct nvfx_surface_2d {
-	struct nouveau_notifier *ntfy;
-	struct nouveau_grobj *surf2d;
-	struct nouveau_grobj *swzsurf;
-	struct nouveau_grobj *m2mf;
-	struct nouveau_grobj *rect;
-	struct nouveau_grobj *blit;
-	struct nouveau_grobj *sifm;
-};
-
-#define NVFX_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
-
-#endif
diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h
index e2c6d09..772320e 100644
--- a/src/gallium/drivers/nvfx/nvfx_context.h
+++ b/src/gallium/drivers/nvfx/nvfx_context.h
@@ -18,6 +18,7 @@
 #include "nouveau/nouveau_gldefs.h"
 
 #include "nvfx_state.h"
+#include "nvfx_surface.h"
 
 #define NOUVEAU_ERR(fmt, args...) \
 	fprintf(stderr, "%s:%d -  "fmt, __func__, __LINE__, ##args);
diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c
index 1aa9abf..7a2c8f8 100644
--- a/src/gallium/drivers/nvfx/nvfx_miptree.c
+++ b/src/gallium/drivers/nvfx/nvfx_miptree.c
@@ -7,7 +7,6 @@
 
 #include "nouveau/nouveau_winsys.h"
 #include "nouveau/nouveau_screen.h"
-#include "nv04_surface_2d.h"
 #include "nvfx_resource.h"
 #include "nvfx_transfer.h"
 #include "state_tracker/drm_api.h"
diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h b/src/gallium/drivers/nvfx/nvfx_resource.h
index 73d4019..e5c95b0 100644
--- a/src/gallium/drivers/nvfx/nvfx_resource.h
+++ b/src/gallium/drivers/nvfx/nvfx_resource.h
@@ -20,6 +20,8 @@ struct nvfx_resource {
 	struct nouveau_bo *bo;
 };
 
+#define NVFX_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
+
 #define NVFX_MAX_TEXTURE_LEVELS  16
 
 struct nvfx_miptree {
@@ -30,6 +32,11 @@ struct nvfx_miptree {
         unsigned level_offset[NVFX_MAX_TEXTURE_LEVELS];
 };
 
+struct nvfx_surface {
+	struct pipe_surface base;
+	unsigned pitch;
+};
+
 static INLINE 
 struct nvfx_resource *nvfx_resource(struct pipe_resource *resource)
 {
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.h b/src/gallium/drivers/nvfx/nvfx_screen.h
index 6377194..4dedbe9 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.h
+++ b/src/gallium/drivers/nvfx/nvfx_screen.h
@@ -3,9 +3,10 @@
 
 #include "util/u_double_list.h"
 #include "nouveau/nouveau_screen.h"
-#include "nv04_surface_2d.h"
 #include "nvfx_context.h"
 
+struct nv04_2d_context;
+
 struct nvfx_screen {
 	struct nouveau_screen base;
 
@@ -31,7 +32,7 @@ struct nvfx_screen {
 	struct nouveau_resource *vp_exec_heap;
 	struct nouveau_resource *vp_data_heap;
 
-	struct nvfx_surface_2d eng2d;
+	struct nv04_2d_context* eng2d;
 };
 
 static INLINE struct nvfx_screen *
diff --git a/src/gallium/drivers/nvfx/nvfx_surface.h b/src/gallium/drivers/nvfx/nvfx_surface.h
new file mode 100644
index 0000000..f3d2815
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_surface.h
@@ -0,0 +1,4 @@
+#ifndef __NVFX_SURFACE_H__
+#define __NVFX_SURFACE_H__
+
+#endif
diff --git a/src/gallium/drivers/nvfx/nvfx_transfer.c b/src/gallium/drivers/nvfx/nvfx_transfer.c
index ec0e6d2..d076cb7 100644
--- a/src/gallium/drivers/nvfx/nvfx_transfer.c
+++ b/src/gallium/drivers/nvfx/nvfx_transfer.c
@@ -79,8 +79,7 @@ nvfx_miptree_transfer_new(struct pipe_context *pipe,
 	tx->base.box = *box;
 
 	/* Direct access to texture */
-	if ((util_format_is_s3tc(pt->format) || pt->_usage & PIPE_USAGE_DYNAMIC) &&
-	    pt->flags & NVFX_RESOURCE_FLAG_LINEAR)
+	if (pt->_usage & PIPE_USAGE_DYNAMIC && pt->flags & NVFX_RESOURCE_FLAG_LINEAR)
 	{
 		tx->direct = true;
 




More information about the mesa-commit mailing list