r100/r200: Bring back old PolygonStripple for DRI1.

DRI1 didn't have support for command buffer emit for stripple.
This commit is contained in:
Pauli Nieminen
2009-08-28 05:42:41 +03:00
parent bfbad4fbb7
commit 4322181e6a
11 changed files with 37 additions and 14 deletions

View File

@@ -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);

View File

@@ -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;
};

View File

@@ -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;

View File

@@ -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 );

View File

@@ -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);

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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 );

View File

@@ -328,7 +328,6 @@ struct r100_hw_state {
struct r100_state {
struct radeon_stipple_state stipple;
struct radeon_texture_state texture;
};

View File

@@ -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;

View File

@@ -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 );