Add reporting of damage by DRI drivers when the extension support is available.

With this, tools like ximagesrc in gstreamer correctly see updates from GL
rendering.  Support requires that the Xdamage library be current (but will be
disabled if not present) plus a new X Server with support for the new
XDamagePost request.  libGL now has a new interface version, and also links
against libXdamage and libXfixes to support it, but backwards compatibility
is retained.

Currently, all drivers report damage at SwapBuffers time through common code --
front buffer rendering doesn't result in damage being reported.  Also, the
damage is against the root window, as our drivers don't yet render to backing
store when they should (composited environments).
This commit is contained in:
Eric Anholt
2007-01-05 18:19:58 -08:00
parent b530d96216
commit c2b185cff8
6 changed files with 112 additions and 4 deletions

View File

@@ -482,8 +482,27 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
static void driSwapBuffers( __DRInativeDisplay *dpy, void *drawablePrivate )
{
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
drm_clip_rect_t rect;
dPriv->swapBuffers(dPriv);
(void) dpy;
/* Check that we actually have the new damage report method */
if (api_ver < 20070105 || dri_interface->reportDamage == NULL)
return;
/* Assume it's affecting the whole drawable for now */
rect.x1 = 0;
rect.y1 = 0;
rect.x2 = rect.x1 + dPriv->w;
rect.y2 = rect.y1 + dPriv->h;
/* Report the damage. Currently, all our drivers draw directly to the
* front buffer, so we report the damage there rather than to the backing
* store (if any).
*/
(*dri_interface->reportDamage)(dpy, dPriv->screen, dPriv->draw,
dPriv->x, dPriv->y,
&rect, 1, GL_TRUE);
}
/**