From: Roland Scheidegger Date: Fri, 13 Jul 2007 18:47:17 +0000 (+0200) Subject: bugfixes (wrt fb updates), cleanups X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f022bff5aa828cfdbb4749f672fc51c345f9cb33;p=mesa.git bugfixes (wrt fb updates), cleanups move drawable validation back to where it was now that the driDrawable information isn't used directly anymore. Fix bogus fb updates (the context we get for SwapBuffer processing may not have the drawable being processed attached!) glthreads behaves a bit better but still not correct. --- diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.c b/src/mesa/drivers/dri/i915tex/intel_blit.c index 2a0a6393152..db72f59a2c7 100644 --- a/src/mesa/drivers/dri/i915tex/intel_blit.c +++ b/src/mesa/drivers/dri/i915tex/intel_blit.c @@ -79,13 +79,6 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv, */ LOCK_HARDWARE(intel); - if (intel->revalidateDrawable) { - __DRIscreenPrivate *sPriv = intel->driScreen; - if (dPriv) { - DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv); - } - } - if (dPriv && dPriv->numClipRects) { struct intel_framebuffer *intel_fb = dPriv->driverPrivate; const struct intel_region *frontRegion @@ -190,9 +183,14 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv, UNLOCK_HARDWARE(intel); - if (intel->revalidateDrawable) { - intel->revalidateDrawable = GL_FALSE; - intelWindowMoved(intel); + /* XXX this is bogus. The context here may not even be bound to this drawable! */ + if (intel->lastStamp != dPriv->lastStamp) { + GET_CURRENT_CONTEXT(currctx); + struct intel_context *intelcurrent = intel_context(currctx); + if (intelcurrent == intel && intelcurrent->driDrawable == dPriv) { + intelWindowMoved(intel); + intel->lastStamp = dPriv->lastStamp; + } } } diff --git a/src/mesa/drivers/dri/i915tex/intel_context.c b/src/mesa/drivers/dri/i915tex/intel_context.c index 451c7fd1ba5..41eaafece23 100644 --- a/src/mesa/drivers/dri/i915tex/intel_context.c +++ b/src/mesa/drivers/dri/i915tex/intel_context.c @@ -572,7 +572,6 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, __DRIdrawablePrivate * driDrawPriv, __DRIdrawablePrivate * driReadPriv) { - GLuint updatebufsize = GL_FALSE; #if 0 if (driDrawPriv) { @@ -620,22 +619,18 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, } } - /* only update GLframebuffer size to match window - if here for the first time */ - if (intel->ctx.FirstTimeCurrent) { - updatebufsize = GL_TRUE; - driUpdateFramebufferSize(&intel->ctx, driDrawPriv); + /* update GLframebuffer size to match window if needed */ + driUpdateFramebufferSize(&intel->ctx, driDrawPriv); - if (driReadPriv != driDrawPriv) { - driUpdateFramebufferSize(&intel->ctx, driReadPriv); - } + if (driReadPriv != driDrawPriv) { + driUpdateFramebufferSize(&intel->ctx, driReadPriv); } _mesa_make_current(&intel->ctx, &intel_fb->Base, readFb); /* The drawbuffer won't always be updated by _mesa_make_current: */ - if (updatebufsize && intel->ctx.DrawBuffer == &intel_fb->Base) { + if (intel->ctx.DrawBuffer == &intel_fb->Base) { if (intel->driDrawable != driDrawPriv) { intel_fb->vblank_flags = (intel->intelScreen->irq_active != 0) @@ -646,9 +641,11 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, &intel_fb->vbl_seq); intel->driDrawable = driDrawPriv; intelWindowMoved(intel); + intel->lastStamp = driDrawPriv->lastStamp; + } + else if (intel->lastStamp != driDrawPriv->lastStamp) { + intel_draw_buffer(&intel->ctx, &intel_fb->Base); } - - intel_draw_buffer(&intel->ctx, &intel_fb->Base); } } else { @@ -677,8 +674,7 @@ intelContendedLock(struct intel_context *intel, GLuint flags) * checking must be done *after* this call: */ if (dPriv) - intel->revalidateDrawable = GL_TRUE; -// DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv); + DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv); if (sarea->width != intelScreen->width || sarea->height != intelScreen->height || diff --git a/src/mesa/drivers/dri/i915tex/intel_context.h b/src/mesa/drivers/dri/i915tex/intel_context.h index f85b3a63627..b5defdc47e4 100644 --- a/src/mesa/drivers/dri/i915tex/intel_context.h +++ b/src/mesa/drivers/dri/i915tex/intel_context.h @@ -272,7 +272,6 @@ struct intel_context drmI830Sarea *sarea; GLuint lastStamp; - GLuint revalidateDrawable; /** * Configuration cache diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c index aeb909cce17..afee07c6898 100644 --- a/src/mesa/drivers/dri/i915tex/intel_fbo.c +++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c @@ -299,7 +299,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, } - +#if 0 /** * Called for each hardware renderbuffer when a _window_ is resized. * Just update fields. @@ -316,6 +316,7 @@ intel_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, return GL_TRUE; } +#endif static void intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb, @@ -352,7 +353,7 @@ intel_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, } - +#if 0 /** * Create a new intel_renderbuffer which corresponds to an on-screen window, * not a user-created renderbuffer. @@ -452,15 +453,16 @@ intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height, return irb; } +#endif -struct gl_renderbuffer * -intel_new_renderbuffer_fb(GLcontext * ctx, GLuint intFormat) +struct intel_renderbuffer * +intel_new_renderbuffer_fb(GLuint intFormat) { struct intel_renderbuffer *irb; irb = CALLOC_STRUCT(intel_renderbuffer); if (!irb) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "creating renderbuffer"); + _mesa_error(NULL, GL_OUT_OF_MEMORY, "creating renderbuffer"); return NULL; } @@ -474,7 +476,7 @@ intel_new_renderbuffer_fb(GLcontext * ctx, GLuint intFormat) irb->Base.GetPointer = intel_get_pointer; /* span routines set in alloc_storage function */ - return &irb->Base; + return irb; } /** diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.h b/src/mesa/drivers/dri/i915tex/intel_fbo.h index 963f5e706f4..762aac594e8 100644 --- a/src/mesa/drivers/dri/i915tex/intel_fbo.h +++ b/src/mesa/drivers/dri/i915tex/intel_fbo.h @@ -84,7 +84,7 @@ struct intel_renderbuffer GLuint vbl_pending; /**< vblank sequence number of pending flip */ }; - +#if 0 extern struct intel_renderbuffer *intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height, @@ -92,7 +92,9 @@ extern struct intel_renderbuffer *intel_create_renderbuffer(GLenum intFormat, int pitch, int cpp, void *map); +#endif +extern struct intel_renderbuffer *intel_new_renderbuffer_fb(GLuint intFormat); extern void intel_fbo_init(struct intel_context *intel); diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.c b/src/mesa/drivers/dri/i915tex/intel_screen.c index 08057a66006..dcc29923834 100644 --- a/src/mesa/drivers/dri/i915tex/intel_screen.c +++ b/src/mesa/drivers/dri/i915tex/intel_screen.c @@ -680,14 +680,14 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, /* XXX allocation should only happen in the unusual case it's actually needed */ intel_fb->color_rb[0] - = intel_new_renderbuffer_fb(NULL, rgbFormat); + = intel_new_renderbuffer_fb(rgbFormat); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT, &intel_fb->color_rb[0]->Base); } if (mesaVis->doubleBufferMode) { intel_fb->color_rb[1] - = intel_new_renderbuffer_fb(NULL, rgbFormat); + = intel_new_renderbuffer_fb(rgbFormat); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT, &intel_fb->color_rb[1]->Base); @@ -695,14 +695,14 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, struct gl_renderbuffer *tmp_rb = NULL; intel_fb->color_rb[2] - = intel_new_renderbuffer_fb(NULL, rgbFormat); + = intel_new_renderbuffer_fb(rgbFormat); _mesa_reference_renderbuffer(&tmp_rb, &intel_fb->color_rb[2]->Base); } } if (mesaVis->depthBits == 24 && mesaVis->stencilBits == 8) { /* combined depth/stencil buffer */ struct intel_renderbuffer *depthStencilRb - = intel_new_renderbuffer_fb(NULL, GL_DEPTH24_STENCIL8_EXT); + = intel_new_renderbuffer_fb(GL_DEPTH24_STENCIL8_EXT); /* note: bind RB to two attachment points */ _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthStencilRb->Base); @@ -712,7 +712,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, else if (mesaVis->depthBits == 16) { /* just 16-bit depth buffer, no hw stencil */ struct intel_renderbuffer *depthRb - = intel_new_renderbuffer_fb(NULL, GL_DEPTH_COMPONENT16); + = intel_new_renderbuffer_fb(GL_DEPTH_COMPONENT16); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base); } @@ -987,18 +987,19 @@ struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen) * context at screen creation. For now just use the current context. */ -/* GET_CURRENT_CONTEXT(ctx); + GET_CURRENT_CONTEXT(ctx); if (ctx == NULL) { - _mesa_problem(NULL, "No current context in intelScreenContext\n"); - return NULL; +/* _mesa_problem(NULL, "No current context in intelScreenContext\n"); + return NULL; */ + /* need a context for the first time makecurrent is called (for hw lock + when allocating priv buffers) */ + if (intelScreen->dummyctxptr == NULL) { + _mesa_problem(NULL, "No current context in intelScreenContext\n"); + return NULL; + } + return intelScreen->dummyctxptr; } return intel_context(ctx); -*/ - if (intelScreen->dummyctxptr == NULL) { - _mesa_problem(NULL, "No current context in intelScreenContext\n"); - return NULL; - } - return intelScreen->dummyctxptr; }