dri2_set_damage_region(__DRIdrawable *dPriv, unsigned int nrects, int *rects)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
- struct pipe_resource *resource = drawable->textures[ST_ATTACHMENT_BACK_LEFT];
- struct pipe_screen *screen = resource->screen;
struct pipe_box *boxes = NULL;
if (nrects) {
}
}
- screen->set_damage_region(screen, resource, nrects, boxes);
- FREE(boxes);
+ FREE(drawable->damage_rects);
+ drawable->damage_rects = boxes;
+ drawable->num_damage_rects = nrects;
+
+ /* Only apply the damage region if the BACK_LEFT texture is up-to-date. */
+ if (drawable->texture_stamp == drawable->dPriv->lastStamp &&
+ (drawable->texture_mask & (1 << ST_ATTACHMENT_BACK_LEFT))) {
+ struct pipe_screen *screen = drawable->screen->base.screen;
+ struct pipe_resource *resource;
+
+ if (drawable->stvis.samples > 1)
+ resource = drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT];
+ else
+ resource = drawable->textures[ST_ATTACHMENT_BACK_LEFT];
+
+ screen->set_damage_region(screen, resource,
+ drawable->num_damage_rects,
+ drawable->damage_rects);
+ }
}
static __DRI2bufferDamageExtension dri2BufferDamageExtension = {
}
} while (lastStamp != drawable->dPriv->lastStamp);
+ /* Flush the pending set_damage_region request. */
+ struct pipe_screen *pscreen = screen->base.screen;
+
+ if (new_mask & (1 << ST_ATTACHMENT_BACK_LEFT) &&
+ pscreen->set_damage_region) {
+ struct pipe_resource *resource = textures[ST_ATTACHMENT_BACK_LEFT];
+
+ pscreen->set_damage_region(pscreen, resource,
+ drawable->num_damage_rects,
+ drawable->damage_rects);
+ }
+
if (!out)
return true;
/* Notify the st manager that this drawable is no longer valid */
stapi->destroy_drawable(stapi, &drawable->base);
+ FREE(drawable->damage_rects);
FREE(drawable);
}
unsigned old_w;
unsigned old_h;
+ struct pipe_box *damage_rects;
+ unsigned int num_damage_rects;
+
struct pipe_resource *textures[ST_ATTACHMENT_COUNT];
struct pipe_resource *msaa_textures[ST_ATTACHMENT_COUNT];
unsigned int texture_mask, texture_stamp;