[Mesa-dev] [PATCH] nv50/nvc0: Build codegen in nv50.
Johannes Obermayr
johannesobermayr at gmx.de
Sat Jan 12 03:55:08 PST 2013
This is required to make libnv50 independent of libnvc0.
---
src/gallium/drivers/nv50/Makefile.sources | 12 +++++++-
src/gallium/drivers/nv50/nv50_miptree.c | 32 ++++++++++++++++++--
src/gallium/drivers/nv50/nv50_resource.h | 3 +-
src/gallium/drivers/nvc0/Makefile.sources | 6 ----
.../drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp | 2 +-
src/gallium/drivers/nvc0/nvc0_miptree.c | 26 ++--------------
6 Dateien geändert, 45 Zeilen hinzugefügt(+), 36 Zeilen entfernt(-)
diff --git a/src/gallium/drivers/nv50/Makefile.sources b/src/gallium/drivers/nv50/Makefile.sources
index c112e82..1092570 100644
--- a/src/gallium/drivers/nv50/Makefile.sources
+++ b/src/gallium/drivers/nv50/Makefile.sources
@@ -15,7 +15,7 @@ C_SOURCES := \
nv50_push.c \
nv50_query.c
-CPP_SOURCES := \
+CODEGEN_NV50_SOURCES := \
codegen/nv50_ir.cpp \
codegen/nv50_ir_bb.cpp \
codegen/nv50_ir_build_util.cpp \
@@ -30,3 +30,13 @@ CPP_SOURCES := \
codegen/nv50_ir_target.cpp \
codegen/nv50_ir_target_nv50.cpp \
codegen/nv50_ir_util.cpp
+
+CODEGEN_NVC0_SOURCES := \
+ $(top_srcdir)/src/gallium/drivers/nvc0/codegen/nv50_ir_emit_gk110.cpp \
+ $(top_srcdir)/src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp \
+ $(top_srcdir)/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp \
+ $(top_srcdir)/src/gallium/drivers/nvc0/codegen/nv50_ir_target_nvc0.cpp
+
+CPP_SOURCES := \
+ $(CODEGEN_NV50_SOURCES) \
+ $(CODEGEN_NVC0_SOURCES)
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index fc9d7f3..7883edb 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -28,10 +28,38 @@
#include "nv50_context.h"
#include "nv50_resource.h"
-static INLINE uint32_t
+uint32_t
+nv50_tex_choose_tile_dims_helper(unsigned nx, unsigned ny, unsigned nz)
+{
+ uint32_t tile_mode = 0x000;
+
+ if (ny > 64) tile_mode = 0x040; /* height 128 tiles */
+ else
+ if (ny > 32) tile_mode = 0x030; /* height 64 tiles */
+ else
+ if (ny > 16) tile_mode = 0x020; /* height 32 tiles */
+ else
+ if (ny > 8) tile_mode = 0x010; /* height 16 tiles */
+
+ if (nz == 1)
+ return tile_mode;
+ else
+ if (tile_mode > 0x020)
+ tile_mode = 0x020;
+
+ if (nz > 16 && tile_mode < 0x020)
+ return tile_mode | 0x500; /* depth 32 tiles */
+ if (nz > 8) return tile_mode | 0x400; /* depth 16 tiles */
+ if (nz > 4) return tile_mode | 0x300; /* depth 8 tiles */
+ if (nz > 2) return tile_mode | 0x200; /* depth 4 tiles */
+
+ return tile_mode | 0x100;
+}
+
+static uint32_t
nv50_tex_choose_tile_dims(unsigned nx, unsigned ny, unsigned nz)
{
- return nvc0_tex_choose_tile_dims(nx, ny * 2, nz);
+ return nv50_tex_choose_tile_dims_helper(nx, ny * 2, nz);
}
static uint32_t
diff --git a/src/gallium/drivers/nv50/nv50_resource.h b/src/gallium/drivers/nv50/nv50_resource.h
index 4808955..a2bc980 100644
--- a/src/gallium/drivers/nv50/nv50_resource.h
+++ b/src/gallium/drivers/nv50/nv50_resource.h
@@ -32,8 +32,7 @@ nv50_screen_init_resource_functions(struct pipe_screen *pscreen);
#endif /* __NVC0_RESOURCE_H__ */
uint32_t
-nvc0_tex_choose_tile_dims(unsigned nx, unsigned ny, unsigned nz);
-
+nv50_tex_choose_tile_dims_helper(unsigned nx, unsigned ny, unsigned nz);
struct nv50_miptree_level {
uint32_t offset;
diff --git a/src/gallium/drivers/nvc0/Makefile.sources b/src/gallium/drivers/nvc0/Makefile.sources
index 82504bf..d0e213b 100644
--- a/src/gallium/drivers/nvc0/Makefile.sources
+++ b/src/gallium/drivers/nvc0/Makefile.sources
@@ -14,9 +14,3 @@ C_SOURCES := \
nvc0_program.c \
nvc0_shader_state.c \
nvc0_query.c
-
-CPP_SOURCES := \
- codegen/nv50_ir_emit_gk110.cpp \
- codegen/nv50_ir_emit_nvc0.cpp \
- codegen/nv50_ir_lowering_nvc0.cpp \
- codegen/nv50_ir_target_nvc0.cpp
diff --git a/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp
index 749ace5..c5a7772 100644
--- a/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp
@@ -1096,7 +1096,7 @@ NVC0LoweringPass::visit(Instruction *i)
break;
default:
break;
- }
+ }
return true;
}
diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c b/src/gallium/drivers/nvc0/nvc0_miptree.c
index b63f196..fee89a7 100644
--- a/src/gallium/drivers/nvc0/nvc0_miptree.c
+++ b/src/gallium/drivers/nvc0/nvc0_miptree.c
@@ -28,32 +28,10 @@
#include "nvc0_context.h"
#include "nvc0_resource.h"
-uint32_t
+static uint32_t
nvc0_tex_choose_tile_dims(unsigned nx, unsigned ny, unsigned nz)
{
- uint32_t tile_mode = 0x000;
-
- if (ny > 64) tile_mode = 0x040; /* height 128 tiles */
- else
- if (ny > 32) tile_mode = 0x030; /* height 64 tiles */
- else
- if (ny > 16) tile_mode = 0x020; /* height 32 tiles */
- else
- if (ny > 8) tile_mode = 0x010; /* height 16 tiles */
-
- if (nz == 1)
- return tile_mode;
- else
- if (tile_mode > 0x020)
- tile_mode = 0x020;
-
- if (nz > 16 && tile_mode < 0x020)
- return tile_mode | 0x500; /* depth 32 tiles */
- if (nz > 8) return tile_mode | 0x400; /* depth 16 tiles */
- if (nz > 4) return tile_mode | 0x300; /* depth 8 tiles */
- if (nz > 2) return tile_mode | 0x200; /* depth 4 tiles */
-
- return tile_mode | 0x100;
+ return nv50_tex_choose_tile_dims_helper(nx, ny, nz);
}
static uint32_t
--
1.7.10.4
More information about the mesa-dev
mailing list