intel/DRI2: add DRI2flushExtension support with invalidate hook
Needed to support the SwapBuffers code properly. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
This commit is contained in:

committed by
Jesse Barnes

parent
c642f3941b
commit
7c50d29f7c
@@ -72,8 +72,6 @@ int INTEL_DEBUG = (0);
|
|||||||
#define DRIVER_DATE_GEM "GEM " DRIVER_DATE
|
#define DRIVER_DATE_GEM "GEM " DRIVER_DATE
|
||||||
|
|
||||||
|
|
||||||
static void intel_flush(GLcontext *ctx, GLboolean needs_mi_flush);
|
|
||||||
|
|
||||||
static const GLubyte *
|
static const GLubyte *
|
||||||
intelGetString(GLcontext * ctx, GLenum name)
|
intelGetString(GLcontext * ctx, GLenum name)
|
||||||
{
|
{
|
||||||
@@ -380,6 +378,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drawable->validBuffers = GL_TRUE;
|
||||||
driUpdateFramebufferSize(&intel->ctx, drawable);
|
driUpdateFramebufferSize(&intel->ctx, drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,7 +466,7 @@ intelInvalidateState(GLcontext * ctx, GLuint new_state)
|
|||||||
intel->vtbl.invalidate_state( intel, new_state );
|
intel->vtbl.invalidate_state( intel, new_state );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
|
intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
|
||||||
{
|
{
|
||||||
struct intel_context *intel = intel_context(ctx);
|
struct intel_context *intel = intel_context(ctx);
|
||||||
@@ -950,11 +949,7 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
|
|||||||
(struct intel_framebuffer *) driDrawPriv->driverPrivate;
|
(struct intel_framebuffer *) driDrawPriv->driverPrivate;
|
||||||
GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate;
|
GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate;
|
||||||
|
|
||||||
if (driContextPriv->driScreenPriv->dri2.enabled) {
|
if (!driContextPriv->driScreenPriv->dri2.enabled) {
|
||||||
intel_update_renderbuffers(driContextPriv, driDrawPriv);
|
|
||||||
if (driDrawPriv != driReadPriv)
|
|
||||||
intel_update_renderbuffers(driContextPriv, driReadPriv);
|
|
||||||
} else {
|
|
||||||
/* XXX FBO temporary fix-ups! These are released in
|
/* XXX FBO temporary fix-ups! These are released in
|
||||||
* intelDextroyContext(), above. Changes here should be
|
* intelDextroyContext(), above. Changes here should be
|
||||||
* reflected there.
|
* reflected there.
|
||||||
@@ -1088,6 +1083,10 @@ void LOCK_HARDWARE( struct intel_context *intel )
|
|||||||
if (intel->driDrawable) {
|
if (intel->driDrawable) {
|
||||||
intel_fb = intel->driDrawable->driverPrivate;
|
intel_fb = intel->driDrawable->driverPrivate;
|
||||||
|
|
||||||
|
if (!intel->driDrawable->validBuffers)
|
||||||
|
intel_update_renderbuffers(intel->driContext,
|
||||||
|
intel->driDrawable);
|
||||||
|
|
||||||
if (intel_fb)
|
if (intel_fb)
|
||||||
intel_rb =
|
intel_rb =
|
||||||
intel_get_renderbuffer(&intel_fb->Base,
|
intel_get_renderbuffer(&intel_fb->Base,
|
||||||
|
@@ -447,6 +447,7 @@ extern void intelGetLock(struct intel_context *intel, GLuint flags);
|
|||||||
|
|
||||||
extern void intelFinish(GLcontext * ctx);
|
extern void intelFinish(GLcontext * ctx);
|
||||||
extern void intelFlush(GLcontext * ctx);
|
extern void intelFlush(GLcontext * ctx);
|
||||||
|
extern void intel_flush(GLcontext * ctx, GLboolean needs_mi_flush);
|
||||||
|
|
||||||
extern void intelInitDriverFunctions(struct dd_function_table *functions);
|
extern void intelInitDriverFunctions(struct dd_function_table *functions);
|
||||||
|
|
||||||
|
@@ -32,5 +32,8 @@
|
|||||||
extern void
|
extern void
|
||||||
intelInitExtensions(GLcontext *ctx);
|
intelInitExtensions(GLcontext *ctx);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
intelFlushDrawable(__DRIdrawable *drawable);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -236,6 +236,31 @@ static const __DRItexBufferExtension intelTexBufferExtension = {
|
|||||||
intelSetTexBuffer2,
|
intelSetTexBuffer2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
intelDRI2Flush(__DRIdrawable *drawable)
|
||||||
|
{
|
||||||
|
struct intel_context *intel = drawable->driContextPriv->driverPrivate;
|
||||||
|
|
||||||
|
if (intel->gen < 4)
|
||||||
|
INTEL_FIREVERTICES(intel);
|
||||||
|
|
||||||
|
if (intel->batch->map != intel->batch->ptr)
|
||||||
|
intel_batchbuffer_flush(intel->batch);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
intelDRI2FlushInvalidate(__DRIdrawable *drawable)
|
||||||
|
{
|
||||||
|
intelDRI2Flush(drawable);
|
||||||
|
drawable->validBuffers = GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct __DRI2flushExtensionRec intelFlushExtension = {
|
||||||
|
{ __DRI2_FLUSH, __DRI2_FLUSH_VERSION },
|
||||||
|
intelDRI2Flush,
|
||||||
|
intelDRI2FlushInvalidate,
|
||||||
|
};
|
||||||
|
|
||||||
static const __DRIextension *intelScreenExtensions[] = {
|
static const __DRIextension *intelScreenExtensions[] = {
|
||||||
&driReadDrawableExtension,
|
&driReadDrawableExtension,
|
||||||
&driCopySubBufferExtension.base,
|
&driCopySubBufferExtension.base,
|
||||||
@@ -244,6 +269,7 @@ static const __DRIextension *intelScreenExtensions[] = {
|
|||||||
&driMediaStreamCounterExtension.base,
|
&driMediaStreamCounterExtension.base,
|
||||||
&intelTexOffsetExtension.base,
|
&intelTexOffsetExtension.base,
|
||||||
&intelTexBufferExtension.base,
|
&intelTexBufferExtension.base,
|
||||||
|
&intelFlushExtension.base,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -524,11 +550,9 @@ intelFillInModes(__DRIscreenPrivate *psp,
|
|||||||
unsigned back_buffer_factor;
|
unsigned back_buffer_factor;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
|
|
||||||
* support pageflipping at all.
|
|
||||||
*/
|
|
||||||
static const GLenum back_buffer_modes[] = {
|
static const GLenum back_buffer_modes[] = {
|
||||||
GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
|
GLX_NONE, GLX_SWAP_UNDEFINED_OML,
|
||||||
|
GLX_SWAP_EXCHANGE_OML, GLX_SWAP_COPY_OML
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t depth_bits_array[3];
|
uint8_t depth_bits_array[3];
|
||||||
@@ -711,11 +735,10 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp)
|
|||||||
intelScreenPrivate *intelScreen;
|
intelScreenPrivate *intelScreen;
|
||||||
GLenum fb_format[3];
|
GLenum fb_format[3];
|
||||||
GLenum fb_type[3];
|
GLenum fb_type[3];
|
||||||
/* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
|
|
||||||
* support pageflipping at all.
|
|
||||||
*/
|
|
||||||
static const GLenum back_buffer_modes[] = {
|
static const GLenum back_buffer_modes[] = {
|
||||||
GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
|
GLX_NONE, GLX_SWAP_UNDEFINED_OML,
|
||||||
|
GLX_SWAP_EXCHANGE_OML, GLX_SWAP_COPY_OML
|
||||||
};
|
};
|
||||||
uint8_t depth_bits[4], stencil_bits[4], msaa_samples_array[1];
|
uint8_t depth_bits[4], stencil_bits[4], msaa_samples_array[1];
|
||||||
int color;
|
int color;
|
||||||
|
@@ -749,7 +749,8 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
|
|||||||
if (!intelObj)
|
if (!intelObj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
intel_update_renderbuffers(pDRICtx, dPriv);
|
if (!dPriv->validBuffers)
|
||||||
|
intel_update_renderbuffers(pDRICtx, dPriv);
|
||||||
|
|
||||||
rb = intel_fb->color_rb[0];
|
rb = intel_fb->color_rb[0];
|
||||||
/* If the region isn't set, then intel_update_renderbuffers was unable
|
/* If the region isn't set, then intel_update_renderbuffers was unable
|
||||||
|
Reference in New Issue
Block a user