The first is just clamps x2/y2 as previously discussed. It just hasn't
been committed yet.

The second is more complicated. I've noticed that occasionally the
output view is offset in the Y direction from where the actual window
is. With some poking around I've come to the conclusion it's due to
the hardware viewport (as calculated by r128CalcViewport) not being
updated after resizing the window. What I think is happening is:

1. I resize window
2. Resize event propegates down to the actual drawable containing the
OpenGL output
3. User program does a new glViewport()
4. This calls r128CalcViewport() but produces the wrong output because
drawable->h is not yet updated
5. Sometime later the client program does some drawing which grabs the
lock and revalidates the context, updating the width/height values.

All this patch does is call r128CalcViewport() again after the new
window coordinates have been detected.

However, I've noticed other people with other drivers complaining
about a similar issue, so maybe there should be a general call by the
DRI code to ctx->Driver.Viewport().

Have a nice day,
--
Martijn van Oosterhout <[EMAIL PROTECTED]> http://svana.org/kleptog/
Index: src/mesa/drivers/dri/r128/r128_state.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r128/r128_state.c,v
retrieving revision 1.20
diff -u -r1.20 r128_state.c
--- src/mesa/drivers/dri/r128/r128_state.c	3 Jul 2006 13:17:00 -0000	1.20
+++ src/mesa/drivers/dri/r128/r128_state.c	3 Jul 2006 14:58:41 -0000
@@ -608,6 +608,14 @@
          y1 = 0;
       else if ( y1 >= rmesa->driScreen->fbHeight )
          y1 = rmesa->driScreen->fbHeight - 1;
+      if ( x2 < 0 )
+         x2 = 0;
+      else if ( x2 >= rmesa->driScreen->fbWidth )
+         x2 = rmesa->driScreen->fbWidth - 1;
+      if ( y2 < 0 )
+         y2 = 0;
+      else if ( y2 >= rmesa->driScreen->fbHeight )
+         y2 = rmesa->driScreen->fbHeight - 1;
 
       rmesa->setup.sc_top_left_c     = (((y1 & 0x3FFF) << 16) | (x1 & 0x3FFF));
       rmesa->setup.sc_bottom_right_c = (((y2 & 0x3FFF) << 16) | (x2 & 0x3FFF));
Index: src/mesa/drivers/dri/r128/r128_state.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r128/r128_state.c,v
retrieving revision 1.20
diff -u -r1.20 r128_state.c
--- src/mesa/drivers/dri/r128/r128_state.c	3 Jul 2006 13:17:00 -0000	1.20
+++ src/mesa/drivers/dri/r128/r128_state.c	3 Jul 2006 14:58:41 -0000
@@ -1226,7 +1234,10 @@
 	 r128UpdateMasks( ctx );
 
       if ( new_state & R128_NEW_WINDOW )
+      {
 	 r128UpdateWindow( ctx );
+	 r128CalcViewport( ctx );
+      }
 
       if ( rmesa->NewGLState & _NEW_TEXTURE ) {
 	 r128UpdateTextureState( ctx );
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to