diff --git a/src/i830_dri.c b/src/i830_dri.c index 40d11e4..6d8eb7d 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -172,6 +172,8 @@ I830DRI2CreateBuffer(DrawablePtr pDraw, unsigned int attachment, dri_bo *bo; I830DRI2BufferPrivatePtr privates; PixmapPtr pPixmap; + static PixmapPtr pDepthPixmap = NULL; + static DrawablePtr pDrawSave = NULL; buffer = xcalloc(1, sizeof *buffer); if (buffer == NULL) @@ -182,9 +184,16 @@ I830DRI2CreateBuffer(DrawablePtr pDraw, unsigned int attachment, return NULL; } + if(pDraw != pDrawSave) { + pDepthPixmap = NULL; + pDrawSave = pDraw; + } if (attachment == DRI2BufferFrontLeft) { pPixmap = get_drawable_pixmap(pDraw); pPixmap->refcnt++; + } else if (attachment == DRI2BufferStencil && pDepthPixmap) { + pPixmap = pDepthPixmap; + pPixmap->refcnt++; } else { unsigned int hint = 0; @@ -216,6 +225,8 @@ I830DRI2CreateBuffer(DrawablePtr pDraw, unsigned int attachment, } + if (attachment == DRI2BufferDepth) + pDepthPixmap = pPixmap; buffer->attachment = attachment; buffer->pitch = pPixmap->devKind;