diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2011-06-20 09:58:44 +0200 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2011-06-22 22:34:43 +0200 |
commit | f6a4690832143b01d419b52a4cb74350cdfa38bf (patch) | |
tree | 55888f9feb63c3d8dcea17e1eb92a19ec8a6b045 /vmwgfx/vmwgfx_saa.c | |
parent | eea0e6e242a604b1f4d85d947cf2b3f9f4977533 (diff) |
vmwgfx: Make a list of scanout bounding boxes available to each scanout pixmap
This info is needed for present readback.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'vmwgfx/vmwgfx_saa.c')
-rw-r--r-- | vmwgfx/vmwgfx_saa.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c index f733328..55b5fea 100644 --- a/vmwgfx/vmwgfx_saa.c +++ b/vmwgfx/vmwgfx_saa.c @@ -246,7 +246,6 @@ vmwgfx_pixmap_present_readback(struct vmwgfx_saa *vsaa, struct vmwgfx_saa_pixmap *vpix = to_vmwgfx_saa_pixmap(spix); RegionRec intersection; - if (!spix->damage || !REGION_NOTEMPTY(vsaa->pScreen, &spix->dirty_hw) || !vpix->dirty_present) return TRUE; @@ -266,6 +265,7 @@ vmwgfx_pixmap_present_readback(struct vmwgfx_saa *vsaa, if (!vmwgfx_pixmap_create_gmr(vsaa, pixmap)) goto out_err; + /* * FIXME: Cliprects may not overlap screen boundaries. */ @@ -431,6 +431,8 @@ vmwgfx_create_pixmap(struct saa_driver *driver, struct saa_pixmap *spix, *new_pitch = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits); WSBMINITLISTHEAD(&vpix->sync_x_head); + WSBMINITLISTHEAD(&vpix->scanout_list); + return TRUE; } @@ -1126,14 +1128,15 @@ vmwgfx_scanout_refresh(PixmapPtr pixmap) */ uint32_t -vmwgfx_scanout_ref(PixmapPtr pixmap) +vmwgfx_scanout_ref(struct vmwgfx_screen_box *box) { + PixmapPtr pixmap = box->pixmap; struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pixmap->drawable.pScreen)); struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap); int ret; - if (vpix->scanout_refcnt++ == 0) { + if (WSBMLISTEMPTY(&vpix->scanout_list)) { ret = !vmwgfx_pixmap_create_gmr(vsaa, pixmap); if (!ret) ret = !vmwgfx_pixmap_add_present(pixmap); @@ -1146,14 +1149,17 @@ vmwgfx_scanout_ref(PixmapPtr pixmap) pixmap->devKind, vpix->gmr->handle, &vpix->fb_id); - if (!ret) { -// vmwgfx_scanout_refresh(pixmap); - } if (ret) { + box->pixmap = NULL; vpix->fb_id = -1; - --vpix->scanout_refcnt; + goto out_err; } + } + pixmap->refcnt += 1; + WSBMLISTADDTAIL(&box->scanout_head, &vpix->scanout_list); + + out_err: return vpix->fb_id; } @@ -1163,17 +1169,20 @@ vmwgfx_scanout_ref(PixmapPtr pixmap) * damage tracking and kms fbs. */ void -vmwgfx_scanout_unref(PixmapPtr pixmap) +vmwgfx_scanout_unref(struct vmwgfx_screen_box *box) { struct vmwgfx_saa *vsaa; struct vmwgfx_saa_pixmap *vpix; + PixmapPtr pixmap = box->pixmap; if (!pixmap) return; vsaa = to_vmwgfx_saa(saa_get_driver(pixmap->drawable.pScreen)); vpix = vmwgfx_saa_pixmap(pixmap); - if (--vpix->scanout_refcnt == 0) { + WSBMLISTDELINIT(&box->scanout_head); + + if (WSBMLISTEMPTY(&vpix->scanout_list)) { REGION_EMPTY(vsaa->pScreen, vpix->pending_update); drmModeRmFB(vsaa->drm_fd, vpix->fb_id); vpix->fb_id = -1; @@ -1181,4 +1190,7 @@ vmwgfx_scanout_unref(PixmapPtr pixmap) vmwgfx_pixmap_remove_present(vpix); vmwgfx_pixmap_remove_damage(pixmap); } + + box->pixmap = NULL; + pixmap->drawable.pScreen->DestroyPixmap(pixmap); } |