psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i];
if (strcmp(extensions[i]->name, __DRI_IMAGE_LOOKUP) == 0)
psp->dri2.image = (__DRIimageLookupExtension *) extensions[i];
+ if (strcmp(extensions[i]->name, __DRI_USE_INVALIDATE) == 0)
+ psp->dri2.useInvalidate = (__DRIuseInvalidateExtension *) extensions[i];
}
}
int enabled;
__DRIdri2LoaderExtension *loader;
__DRIimageLookupExtension *image;
+ __DRIuseInvalidateExtension *useInvalidate;
} dri2;
/* The lock actually in use, old sarea or DRI2 */
GLint x, GLint y, GLsizei width, GLsizei height)
{
intelCalcViewport(ctx);
-
- intel_viewport(ctx, x, y, width, height);
}
GLint x, GLint y, GLsizei width, GLsizei height)
{
intelCalcViewport(ctx);
-
- intel_viewport(ctx, x, y, width, height);
}
brwInitFragProgFuncs( functions );
brwInitProgFuncs( functions );
brw_init_queryobj_functions(functions);
-
- functions->Viewport = intel_viewport;
}
GLboolean brwCreateContext( int api,
intel->front_buffer_dirty = GL_TRUE;
}
-void
+static void
intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
struct intel_context *intel = intel_context(ctx);
__DRIcontext *driContext = intel->driContext;
+ if (intel->saved_viewport)
+ intel->saved_viewport(ctx, x, y, w, h);
+
if (!intel->using_dri2_swapbuffers &&
!intel->meta.internal_viewport_call && ctx->DrawBuffer->Name == 0) {
dri2InvalidateDrawable(driContext->driDrawablePriv);
if (intelScreen->bufmgr == NULL)
return GL_FALSE;
+ /* Can't rely on invalidate events, fall back to glViewport hack */
+ if (!driContextPriv->driScreenPriv->dri2.useInvalidate) {
+ intel->saved_viewport = functions->Viewport;
+ functions->Viewport = intel_viewport;
+ }
+
if (!_mesa_initialize_context_for_api(&intel->ctx, api, mesaVis, shareCtx,
functions, (void *) intel)) {
printf("%s: failed to init mesa context\n", __FUNCTION__);
__DRIcontext *driContext;
struct intel_screen *intelScreen;
+ void (*saved_viewport)(GLcontext * ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height);
/**
* Configuration cache
extern int intel_translate_blend_factor(GLenum factor);
extern int intel_translate_logic_op(GLenum opcode);
-void intel_viewport(GLcontext * ctx, GLint x, GLint y,
- GLsizei width, GLsizei height);
-
void intel_update_renderbuffers(__DRIcontext *context,
__DRIdrawable *drawable);
void intel_prepare_render(struct intel_context *intel);