Merge branch 'mesa_7_6_branch'

This commit is contained in:
Brian Paul
2009-10-22 18:38:19 -06:00
9 changed files with 85 additions and 20 deletions

View File

@@ -95,7 +95,7 @@ enum sync_type {
static void usage(char *name) static void usage(char *name)
{ {
printf("usage: %s [-w <width>] [-h <height>] [-s<sync method>] " printf("usage: %s [-w <width>] [-h <height>] [-s<sync method>] "
"[-vc]\n", name); "[-v]\n", name);
printf("\t-s<sync method>:\n"); printf("\t-s<sync method>:\n");
printf("\t\tn: none\n"); printf("\t\tn: none\n");
printf("\t\ts: SGI video sync extension\n"); printf("\t\ts: SGI video sync extension\n");

View File

@@ -540,6 +540,16 @@ DestroyContext(Display * dpy, GLXContext gc)
imported = gc->imported; imported = gc->imported;
gc->xid = None; gc->xid = None;
if (gc->currentDpy) {
/* This context is bound to some thread. According to the man page,
* we should not actually delete the context until it's unbound.
* Note that we set gc->xid = None above. In MakeContextCurrent()
* we check for that and delete the context there.
*/
__glXUnlock();
return;
}
#ifdef GLX_DIRECT_RENDERING #ifdef GLX_DIRECT_RENDERING
/* Destroy the direct rendering context */ /* Destroy the direct rendering context */
if (gc->driContext) { if (gc->driContext) {

View File

@@ -1196,12 +1196,16 @@ getFallbackString(GLuint bit)
/**
* Enable/disable a fallback flag.
* \param bit one of INTEL_FALLBACK_x flags.
*/
void void
intelFallback(struct intel_context *intel, GLuint bit, GLboolean mode) intelFallback(struct intel_context *intel, GLbitfield bit, GLboolean mode)
{ {
GLcontext *ctx = &intel->ctx; GLcontext *ctx = &intel->ctx;
TNLcontext *tnl = TNL_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint oldfallback = intel->Fallback; const GLbitfield oldfallback = intel->Fallback;
if (mode) { if (mode) {
intel->Fallback |= bit; intel->Fallback |= bit;

View File

@@ -115,7 +115,9 @@
* Handles blending and (presumably) depth and stencil testing. * Handles blending and (presumably) depth and stencil testing.
*/ */
#define BRW_FALLBACK_TEXTURE 0x1
#define BRW_FALLBACK_DRAW (INTEL_FALLBACK_DRIVER << 0)
#define BRW_MAX_CURBE (32*16) #define BRW_MAX_CURBE (32*16)
struct brw_context; struct brw_context;
@@ -454,7 +456,6 @@ struct brw_context
GLuint primitive; GLuint primitive;
GLboolean emit_state_always; GLboolean emit_state_always;
GLboolean tmp_fallback;
GLboolean no_batch_wrap; GLboolean no_batch_wrap;
struct { struct {

View File

@@ -375,9 +375,10 @@ static void brw_prepare_vertices(struct brw_context *brw)
* isn't an issue at this point. * isn't an issue at this point.
*/ */
if (brw->vb.nr_enabled >= BRW_VEP_MAX) { if (brw->vb.nr_enabled >= BRW_VEP_MAX) {
intel->Fallback = 1; FALLBACK(intel, BRW_FALLBACK_DRAW, GL_TRUE);
return; return;
} }
FALLBACK(intel, BRW_FALLBACK_DRAW, GL_FALSE);
for (i = 0; i < brw->vb.nr_enabled; i++) { for (i = 0; i < brw->vb.nr_enabled; i++) {
struct brw_vertex_element *input = brw->vb.enabled[i]; struct brw_vertex_element *input = brw->vb.enabled[i];
@@ -427,9 +428,10 @@ static void brw_prepare_vertices(struct brw_context *brw)
/* Position array not properly enabled: /* Position array not properly enabled:
*/ */
if (input->glarray->StrideB == 0) { if (input->glarray->StrideB == 0) {
intel->Fallback = 1; FALLBACK(intel, BRW_FALLBACK_DRAW, GL_TRUE);
return; return;
} }
FALLBACK(intel, BRW_FALLBACK_DRAW, GL_FALSE);
interleave = input->glarray->StrideB; interleave = input->glarray->StrideB;
ptr = input->glarray->Ptr; ptr = input->glarray->Ptr;

View File

@@ -830,7 +830,7 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
_vbo_DestroyContext(&intel->ctx); _vbo_DestroyContext(&intel->ctx);
_swrast_DestroyContext(&intel->ctx); _swrast_DestroyContext(&intel->ctx);
intel->Fallback = 0; /* don't call _swrast_Flush later */ intel->Fallback = 0x0; /* don't call _swrast_Flush later */
intel_batchbuffer_free(intel->batch); intel_batchbuffer_free(intel->batch);
intel->batch = NULL; intel->batch = NULL;
@@ -935,10 +935,23 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
__DRIdrawablePrivate * driReadPriv) __DRIdrawablePrivate * driReadPriv)
{ {
__DRIscreenPrivate *psp = driDrawPriv->driScreenPriv; __DRIscreenPrivate *psp = driDrawPriv->driScreenPriv;
struct intel_context *intel;
GET_CURRENT_CONTEXT(curCtx);
if (driContextPriv)
intel = (struct intel_context *) driContextPriv->driverPrivate;
else
intel = NULL;
/* According to the glXMakeCurrent() man page: "Pending commands to
* the previous context, if any, are flushed before it is released."
* But only flush if we're actually changing contexts.
*/
if (intel_context(curCtx) && intel_context(curCtx) != intel) {
_mesa_flush(curCtx);
}
if (driContextPriv) { if (driContextPriv) {
struct intel_context *intel =
(struct intel_context *) driContextPriv->driverPrivate;
struct intel_framebuffer *intel_fb = struct intel_framebuffer *intel_fb =
(struct intel_framebuffer *) driDrawPriv->driverPrivate; (struct intel_framebuffer *) driDrawPriv->driverPrivate;
GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate; GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate;

View File

@@ -61,6 +61,10 @@ typedef void (*intel_line_func) (struct intel_context *, intelVertex *,
intelVertex *); intelVertex *);
typedef void (*intel_point_func) (struct intel_context *, intelVertex *); typedef void (*intel_point_func) (struct intel_context *, intelVertex *);
/**
* Bits for intel->Fallback field
*/
/*@{*/
#define INTEL_FALLBACK_DRAW_BUFFER 0x1 #define INTEL_FALLBACK_DRAW_BUFFER 0x1
#define INTEL_FALLBACK_READ_BUFFER 0x2 #define INTEL_FALLBACK_READ_BUFFER 0x2
#define INTEL_FALLBACK_DEPTH_BUFFER 0x4 #define INTEL_FALLBACK_DEPTH_BUFFER 0x4
@@ -68,8 +72,10 @@ typedef void (*intel_point_func) (struct intel_context *, intelVertex *);
#define INTEL_FALLBACK_USER 0x10 #define INTEL_FALLBACK_USER 0x10
#define INTEL_FALLBACK_RENDERMODE 0x20 #define INTEL_FALLBACK_RENDERMODE 0x20
#define INTEL_FALLBACK_TEXTURE 0x40 #define INTEL_FALLBACK_TEXTURE 0x40
#define INTEL_FALLBACK_DRIVER 0x1000 /**< first for drivers */
/*@}*/
extern void intelFallback(struct intel_context *intel, GLuint bit, extern void intelFallback(struct intel_context *intel, GLbitfield bit,
GLboolean mode); GLboolean mode);
#define FALLBACK( intel, bit, mode ) intelFallback( intel, bit, mode ) #define FALLBACK( intel, bit, mode ) intelFallback( intel, bit, mode )
@@ -171,7 +177,7 @@ struct intel_context
struct dri_metaops meta; struct dri_metaops meta;
GLint refcount; GLint refcount;
GLuint Fallback; GLbitfield Fallback; /**< mask of INTEL_FALLBACK_x bits */
GLuint NewGLState; GLuint NewGLState;
dri_bufmgr *bufmgr; dri_bufmgr *bufmgr;

View File

@@ -1504,6 +1504,33 @@ _mesa_record_error(GLcontext *ctx, GLenum error)
} }
/**
* Flush commands and wait for completion.
*/
void
_mesa_finish(GLcontext *ctx)
{
FLUSH_CURRENT( ctx, 0 );
if (ctx->Driver.Finish) {
ctx->Driver.Finish(ctx);
}
}
/**
* Flush commands.
*/
void
_mesa_flush(GLcontext *ctx)
{
FLUSH_CURRENT( ctx, 0 );
if (ctx->Driver.Flush) {
ctx->Driver.Flush(ctx);
}
}
/** /**
* Execute glFinish(). * Execute glFinish().
* *
@@ -1515,10 +1542,7 @@ _mesa_Finish(void)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
FLUSH_CURRENT( ctx, 0 ); _mesa_finish(ctx);
if (ctx->Driver.Finish) {
ctx->Driver.Finish(ctx);
}
} }
@@ -1533,10 +1557,7 @@ _mesa_Flush(void)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
FLUSH_CURRENT( ctx, 0 ); _mesa_flush(ctx);
if (ctx->Driver.Flush) {
ctx->Driver.Flush(ctx);
}
} }

View File

@@ -170,6 +170,14 @@ _mesa_valid_to_render(GLcontext *ctx, const char *where);
extern void extern void
_mesa_record_error( GLcontext *ctx, GLenum error ); _mesa_record_error( GLcontext *ctx, GLenum error );
extern void
_mesa_finish(GLcontext *ctx);
extern void
_mesa_flush(GLcontext *ctx);
extern void GLAPIENTRY extern void GLAPIENTRY
_mesa_Finish( void ); _mesa_Finish( void );