Mesa (master): r100/r200: Bring back old PolygonStripple for DRI1.

Pauli Nieminen suokko at kemper.freedesktop.org
Fri Aug 28 02:43:06 UTC 2009


Module: Mesa
Branch: master
Commit: 4322181e6a07ecb8891c2d1ada74fd48c996a8fc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4322181e6a07ecb8891c2d1ada74fd48c996a8fc

Author: Pauli Nieminen <suokkos at gmail.com>
Date:   Fri Aug 28 05:42:41 2009 +0300

r100/r200: Bring back old PolygonStripple for DRI1.

DRI1 didn't have support for command buffer emit for stripple.

---

 src/mesa/drivers/dri/r200/r200_context.c           |    2 +-
 src/mesa/drivers/dri/r200/r200_context.h           |    1 -
 src/mesa/drivers/dri/r200/r200_state.c             |    7 ++++-
 src/mesa/drivers/dri/r200/r200_state.h             |    2 +-
 src/mesa/drivers/dri/radeon/radeon_common.c        |   22 ++++++++++++++++++++
 src/mesa/drivers/dri/radeon/radeon_common.h        |    1 +
 .../drivers/dri/radeon/radeon_common_context.h     |    4 ---
 src/mesa/drivers/dri/radeon/radeon_context.c       |    2 +-
 src/mesa/drivers/dri/radeon/radeon_context.h       |    1 -
 src/mesa/drivers/dri/radeon/radeon_state.c         |    7 ++++-
 src/mesa/drivers/dri/radeon/radeon_state.h         |    2 +-
 11 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index e8e7a42..0898617 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -345,7 +345,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
    _mesa_init_driver_functions(&functions);
    r200InitDriverFuncs(&functions);
    r200InitIoctlFuncs(&functions);
-   r200InitStateFuncs(&functions);
+   r200InitStateFuncs(&functions, screen->kernel_mm);
    r200InitTextureFuncs(&functions);
    r200InitShaderFuncs(&functions); 
    radeonInitQueryObjFunctions(&functions);
diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h
index e26514b..c5dccf0 100644
--- a/src/mesa/drivers/dri/r200/r200_context.h
+++ b/src/mesa/drivers/dri/r200/r200_context.h
@@ -526,7 +526,6 @@ struct r200_hw_state {
 struct r200_state {
    /* Derived state for internal purposes:
     */
-   struct radeon_stipple_state stipple;
    struct r200_texture_state texture;
    GLuint envneeded;
 };
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index af60861..ab1ba1f 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -2468,7 +2468,7 @@ static void r200WrapRunPipeline( GLcontext *ctx )
 
 /* Initialize the driver's state functions.
  */
-void r200InitStateFuncs( struct dd_function_table *functions )
+void r200InitStateFuncs( struct dd_function_table *functions, GLboolean dri2 )
 {
    functions->UpdateState		= r200InvalidateState;
    functions->LightingSpaceChange	= r200LightingSpaceChange;
@@ -2502,7 +2502,10 @@ void r200InitStateFuncs( struct dd_function_table *functions )
    functions->LogicOpcode		= r200LogicOpCode;
    functions->PolygonMode		= r200PolygonMode;
    functions->PolygonOffset		= r200PolygonOffset;
-   functions->PolygonStipple		= radeonPolygonStipple;
+   if (dri2)
+      functions->PolygonStipple		= radeonPolygonStipple;
+   else
+      functions->PolygonStipple		= radeonPolygonStipplePreKMS;
    functions->PointParameterfv		= r200PointParameter;
    functions->PointSize			= r200PointSize;
    functions->RenderMode		= r200RenderMode;
diff --git a/src/mesa/drivers/dri/r200/r200_state.h b/src/mesa/drivers/dri/r200/r200_state.h
index 7b9b0c1..9c62f0a 100644
--- a/src/mesa/drivers/dri/r200/r200_state.h
+++ b/src/mesa/drivers/dri/r200/r200_state.h
@@ -38,7 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "r200_context.h"
 
 extern void r200InitState( r200ContextPtr rmesa );
-extern void r200InitStateFuncs( struct dd_function_table *functions );
+extern void r200InitStateFuncs( struct dd_function_table *functions, GLboolean dri2 );
 extern void r200InitTnlFuncs( GLcontext *ctx );
 
 extern void r200UpdateMaterial( GLcontext *ctx );
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c
index e760279..e14a419 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -273,6 +273,28 @@ void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h)
 	}
 }
 
+void radeonPolygonStipplePreKMS( GLcontext *ctx, const GLubyte *mask )
+{
+   radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+   GLuint i;
+   drm_radeon_stipple_t stipple;
+
+   /* Must flip pattern upside down.
+   */
+   for ( i = 0 ; i < 32 ; i++ ) {
+      stipple.mask[31 - i] = ((GLuint *) mask)[i];
+   }
+
+   /* TODO: push this into cmd mechanism
+   */
+   radeon_firevertices(radeon);
+   LOCK_HARDWARE( radeon );
+
+   drmCommandWrite( radeon->dri.fd, DRM_RADEON_STIPPLE,
+	 &stipple, sizeof(stipple) );
+   UNLOCK_HARDWARE( radeon );
+}
+
 void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask )
 {
    radeonContextPtr radeon = RADEON_CONTEXT(ctx);
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h b/src/mesa/drivers/dri/radeon/radeon_common.h
index e2a65f4..ba983e5 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common.h
@@ -11,6 +11,7 @@ void radeonSetCliprects(radeonContextPtr radeon);
 void radeonUpdateScissor( GLcontext *ctx );
 void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h);
 void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask );
+void radeonPolygonStipplePreKMS( GLcontext *ctx, const GLubyte *mask );
 
 void radeonWaitForIdleLocked(radeonContextPtr radeon);
 extern uint32_t radeonGetAge(radeonContextPtr radeon);
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h
index 427eb94..3463b4d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
@@ -158,10 +158,6 @@ struct radeon_stencilbuffer_state {
 	GLuint clear;		/* rb3d_stencilrefmask value */
 };
 
-struct radeon_stipple_state {
-	GLuint mask[32];
-};
-
 struct radeon_state_atom {
 	struct radeon_state_atom *next, *prev;
 	const char *name;	/* for debug */
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index cbe3416..32485a7 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -395,7 +395,7 @@ r100CreateContext( const __GLcontextModes *glVisual,
    radeon_fbo_init(&rmesa->radeon);
    radeonInitSpanFuncs( ctx );
    radeonInitIoctlFuncs( ctx );
-   radeonInitStateFuncs( ctx );
+   radeonInitStateFuncs( ctx , rmesa->radeon.radeonScreen->kernel_mm );
    radeonInitState( rmesa );
    radeonInitSwtcl( ctx );
 
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h
index 0845cad..572acbb 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_context.h
@@ -328,7 +328,6 @@ struct r100_hw_state {
 
 
 struct r100_state {
-	struct radeon_stipple_state stipple;
 	struct radeon_texture_state texture;
 };
 
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index 9d877cb..e03551d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -2202,7 +2202,7 @@ static void radeonWrapRunPipeline( GLcontext *ctx )
  * Many of the ctx->Driver functions might have been initialized to
  * software defaults in the earlier _mesa_init_driver_functions() call.
  */
-void radeonInitStateFuncs( GLcontext *ctx )
+void radeonInitStateFuncs( GLcontext *ctx , GLboolean dri2 )
 {
    ctx->Driver.UpdateState		= radeonInvalidateState;
    ctx->Driver.LightingSpaceChange      = radeonLightingSpaceChange;
@@ -2235,7 +2235,10 @@ void radeonInitStateFuncs( GLcontext *ctx )
    ctx->Driver.LogicOpcode		= radeonLogicOpCode;
    ctx->Driver.PolygonMode		= radeonPolygonMode;
    ctx->Driver.PolygonOffset		= radeonPolygonOffset;
-   ctx->Driver.PolygonStipple		= radeonPolygonStipple;
+   if (dri2)
+      ctx->Driver.PolygonStipple		= radeonPolygonStipple;
+   else
+      ctx->Driver.PolygonStipple		= radeonPolygonStipplePreKMS;
    ctx->Driver.RenderMode		= radeonRenderMode;
    ctx->Driver.Scissor			= radeonScissor;
    ctx->Driver.ShadeModel		= radeonShadeModel;
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.h b/src/mesa/drivers/dri/radeon/radeon_state.h
index a7c8eef..c780cff 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.h
+++ b/src/mesa/drivers/dri/radeon/radeon_state.h
@@ -40,7 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "radeon_context.h"
 
 extern void radeonInitState( r100ContextPtr rmesa );
-extern void radeonInitStateFuncs( GLcontext *ctx );
+extern void radeonInitStateFuncs( GLcontext *ctx , GLboolean dri2);
 
 extern void radeonUpdateMaterial( GLcontext *ctx );
 




More information about the mesa-commit mailing list