randr: Factor out shared pixmap creation
The old version of rrCreateSharedPixmap(), in addition to actually creating a shared pixmap with scanout, also set up pixmap tracking on the source driver. I will be needing to create multiple shared pixmaps for PRIME double buffering, so factor the part that does shared pixmap creation into its own function, the new rrCreateSharedPixmap(). Rename the old rrCreateSharedPixmap() to rrSetupPixmapSharing(), a function that replicates the old functionality of rrCreateSharedPixmap() using the new rrCreateSharedPixmap(). Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Alex Goins <agoins@nvidia.com>
This commit is contained in:
parent
cf5d6414e0
commit
7006b4e7ff
|
@ -392,17 +392,46 @@ RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc)
|
||||||
RRCrtcChanged(crtc, TRUE);
|
RRCrtcChanged(crtc, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static PixmapPtr
|
||||||
rrCreateSharedPixmap(RRCrtcPtr crtc, int width, int height,
|
rrCreateSharedPixmap(RRCrtcPtr crtc, ScreenPtr master,
|
||||||
|
int width, int height, int depth,
|
||||||
int x, int y, Rotation rotation)
|
int x, int y, Rotation rotation)
|
||||||
{
|
{
|
||||||
PixmapPtr mpix, spix;
|
|
||||||
ScreenPtr master = crtc->pScreen->current_master;
|
|
||||||
Bool ret;
|
Bool ret;
|
||||||
|
PixmapPtr mpix, spix;
|
||||||
|
rrScrPriv(crtc->pScreen);
|
||||||
|
|
||||||
|
mpix = master->CreatePixmap(master, width, height, depth,
|
||||||
|
CREATE_PIXMAP_USAGE_SHARED);
|
||||||
|
if (!mpix)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
spix = PixmapShareToSlave(mpix, crtc->pScreen);
|
||||||
|
if (spix == NULL) {
|
||||||
|
master->DestroyPixmap(mpix);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = pScrPriv->rrCrtcSetScanoutPixmap(crtc, spix);
|
||||||
|
if (ret == FALSE) {
|
||||||
|
rrDestroySharedPixmap(crtc, spix);
|
||||||
|
ErrorF("randr: failed to set shadow slave pixmap\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return spix;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Bool
|
||||||
|
rrSetupPixmapSharing(RRCrtcPtr crtc, int width, int height,
|
||||||
|
int x, int y, Rotation rotation)
|
||||||
|
{
|
||||||
|
ScreenPtr master = crtc->pScreen->current_master;
|
||||||
int depth;
|
int depth;
|
||||||
PixmapPtr mscreenpix;
|
PixmapPtr mscreenpix;
|
||||||
PixmapPtr protopix = master->GetScreenPixmap(master);
|
PixmapPtr protopix = master->GetScreenPixmap(master);
|
||||||
rrScrPriv(crtc->pScreen);
|
rrScrPriv(crtc->pScreen);
|
||||||
|
PixmapPtr spix;
|
||||||
|
|
||||||
/* create a pixmap on the master screen,
|
/* create a pixmap on the master screen,
|
||||||
then get a shared handle for it
|
then get a shared handle for it
|
||||||
|
@ -422,20 +451,10 @@ rrCreateSharedPixmap(RRCrtcPtr crtc, int width, int height,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mpix = master->CreatePixmap(master, width, height, depth,
|
spix = rrCreateSharedPixmap(crtc, master,
|
||||||
CREATE_PIXMAP_USAGE_SHARED);
|
width, height, depth,
|
||||||
if (!mpix)
|
x, y, rotation);
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
spix = PixmapShareToSlave(mpix, crtc->pScreen);
|
|
||||||
if (spix == NULL) {
|
if (spix == NULL) {
|
||||||
master->DestroyPixmap(mpix);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = pScrPriv->rrCrtcSetScanoutPixmap(crtc, spix);
|
|
||||||
if (ret == FALSE) {
|
|
||||||
ErrorF("randr: failed to set shadow slave pixmap\n");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,7 +618,7 @@ RRCrtcSet(RRCrtcPtr crtc,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (pScreen->current_master) {
|
if (pScreen->current_master) {
|
||||||
ret = rrCreateSharedPixmap(crtc, width, height, x, y, rotation);
|
ret = rrSetupPixmapSharing(crtc, width, height, x, y, rotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if RANDR_12_INTERFACE
|
#if RANDR_12_INTERFACE
|
||||||
|
|
Loading…
Reference in New Issue