Hi,

Here is my first patch for Nouveau project: a fix for 3D software rendering using SSE2 instruction set.

The problem is that Gallium doesn't save/restore used registers (eax, edx, ecx, esi in my case). So I added push/pop in tgsi_emit_sse2().

My patch is quick and dirty, eg. tgsi_emit_sse2_fs() is not fixed. I don't know Gallium enough to write better fix ;-)

Victor Stinner aka haypo
diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c b/src/gallium/auxiliary/draw/draw_vs_sse.c
index a4503c1..f11f9c6 100644
diff --git a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
index 4e80597..b0bf49a 100755
--- a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
@@ -1998,6 +1998,18 @@ emit_instruction(
 
    case TGSI_OPCODE_RET:
    case TGSI_OPCODE_END:
+       emit_pop(
+          func,
+          get_temp_base() );
+       emit_pop(
+          func,
+          get_const_base() );
+       emit_pop(
+          func,
+          get_output_base() );
+       emit_pop(
+          func,
+          get_input_base() );
 #ifdef WIN32
       emit_retw( func, 16 );
 #else
@@ -2248,22 +2260,35 @@ tgsi_emit_sse2(
 
    func->csr = func->store;
 
+   emit_push(
+      func,
+      get_input_base() );
+   emit_push(
+      func,
+      get_output_base() );
+   emit_push(
+      func,
+      get_const_base() );
+   emit_push(
+      func,
+      get_temp_base() );
+
    emit_mov(
       func,
       get_input_base(),
-      get_argument( 0 ) );
+      get_argument( 0+4 ) );
    emit_mov(
       func,
       get_output_base(),
-      get_argument( 1 ) );
+      get_argument( 1+4 ) );
    emit_mov(
       func,
       get_const_base(),
-      get_argument( 2 ) );
+      get_argument( 2+4 ) );
    emit_mov(
       func,
       get_temp_base(),
-      get_argument( 3 ) );
+      get_argument( 3+4 ) );
 
    tgsi_parse_init( &parse, tokens );
 
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to