sna: Take advantage of the needs_flush tracking on the front buffer

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-07-06 20:19:00 +01:00
parent 0be47f459b
commit d180c5f5f7
2 changed files with 11 additions and 0 deletions

View File

@ -181,8 +181,13 @@ static inline void kgem_bo_submit(struct kgem *kgem, struct kgem_bo *bo)
void __kgem_flush(struct kgem *kgem, struct kgem_bo *bo);
static inline void kgem_bo_flush(struct kgem *kgem, struct kgem_bo *bo)
{
if (!bo->needs_flush)
return;
kgem_bo_submit(kgem, bo);
__kgem_flush(kgem, bo);
bo->needs_flush = false;
}
static inline struct kgem_bo *kgem_bo_reference(struct kgem_bo *bo)

View File

@ -1787,6 +1787,12 @@ sna_do_pageflip(struct sna *sna,
sna->mode.fb_pixmap = pixmap->drawable.serialNumber;
bo->cpu_read = bo->cpu_write = false;
bo->gpu = true;
/* Although the kernel performs an implicit flush upon
* page-flipping, marking the bo as requiring a flush
* here ensures that the buffer goes into the active cache
* upon release.
*/
bo->needs_flush = true;
} else {
drmModeRmFB(sna->kgem.fd, mode->fb_id);