[Nouveau] [PATCH] nv10/exa : demagify tex and rt format

Xavier Chantry chantry.xavier at gmail.com
Tue Apr 20 10:45:39 PDT 2010


Signed-off-by: Xavier Chantry <chantry.xavier at gmail.com>
---
 src/nv10_exa.c |   35 +++++++++++++++++++----------------
 1 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/src/nv10_exa.c b/src/nv10_exa.c
index 1acb583..23a68e3 100644
--- a/src/nv10_exa.c
+++ b/src/nv10_exa.c
@@ -34,30 +34,33 @@ static struct pict_format {
 	int exa;
 	int hw;
 } nv10_tex_format_pot[] = {
-	{ PICT_a8,       0x80  },
-	{ PICT_r5g6b5,	 0x280 },
-	{ PICT_x8r8g8b8, 0x300 },
-	{ PICT_a8r8g8b8, 0x300 },
+	{ PICT_a8,       NV10TCL_TX_FORMAT_FORMAT_A8 },
+	{ PICT_r5g6b5,	 NV10TCL_TX_FORMAT_FORMAT_R5G6B5 },
+	{ PICT_x8r8g8b8, NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8 },
+	{ PICT_a8r8g8b8, NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8 },
 	{},
 
 }, nv10_tex_format_rect[] = {
-	{ PICT_a8,       0x980 },
-	{ PICT_r5g6b5,   0x880 },
-	{ PICT_x8r8g8b8, 0x900 },
-	{ PICT_a8r8g8b8, 0x900 },
+	{ PICT_a8,       NV10TCL_TX_FORMAT_FORMAT_A8_RECT },
+	{ PICT_r5g6b5,   NV10TCL_TX_FORMAT_FORMAT_R5G6B5_RECT },
+	{ PICT_x8r8g8b8, NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT },
+	{ PICT_a8r8g8b8, NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT },
 	{},
 
+/* That's awesome, we need to use the nv20 rect formats on nv20 for
+ * NV10TCL_TX_FORMAT. Only A8_RECT differs between nv10 and nv20, but with the
+ * great side-effect to cause a DATA error when that is enabled */
 }, nv20_tex_format_rect[] = {
-	{ PICT_a8,	 0xd80 },
-	{ PICT_r5g6b5,   0x880 },
-	{ PICT_x8r8g8b8, 0x900 },
-	{ PICT_a8r8g8b8, 0x900 },
+	{ PICT_a8,	 0x1b << NV10TCL_TX_FORMAT_FORMAT_SHIFT },
+	{ PICT_r5g6b5,   NV10TCL_TX_FORMAT_FORMAT_R5G6B5_RECT },
+	{ PICT_x8r8g8b8, NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT },
+	{ PICT_a8r8g8b8, NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT },
 	{},
 
 }, nv10_rt_format[] = {
-	{ PICT_r5g6b5,	 0x103 },
-	{ PICT_x8r8g8b8, 0x108 },
-	{ PICT_a8r8g8b8, 0x108 },
+	{ PICT_r5g6b5,	 NV10TCL_RT_FORMAT_COLOR_R5G6B5 },
+	{ PICT_x8r8g8b8, NV10TCL_RT_FORMAT_COLOR_X8R8G8B8 },
+	{ PICT_a8r8g8b8, NV10TCL_RT_FORMAT_COLOR_A8R8G8B8 },
 	{},
 };
 
@@ -432,7 +435,7 @@ setup_render_target(NVPtr pNv, PicturePtr pict, PixmapPtr pixmap)
 	struct nouveau_bo *bo = nouveau_pixmap_bo(pixmap);
 
 	BEGIN_RING(chan, celsius, NV10TCL_RT_FORMAT, 2);
-	OUT_RING  (chan, get_rt_format(pict));
+	OUT_RING  (chan, get_rt_format(pict) | NV10TCL_RT_FORMAT_TYPE_LINEAR);
 	OUT_RING  (chan, (exaGetPixmapPitch(pixmap) << 16 |
 			  exaGetPixmapPitch(pixmap)));
 
-- 
1.7.0.5



More information about the Nouveau mailing list