[PATCH 3/3] Separate out screen size and screen pixmap sizes in RRScreenSizeSet
Keith Packard
keithp at keithp.com
Sun Dec 5 21:05:50 PST 2010
This provides for separate sizes for the screen scanout and rendering
buffer and the application-visible screen size.
Signed-off-by: Keith Packard <keithp at keithp.com>
---
hw/xfree86/common/xf86Helper.c | 6 ++-
hw/xfree86/modes/xf86RandR12.c | 105 ++++++++++++++++++++++++++++-----------
randr/mirrcrtc.c | 7 +--
randr/randrstr.h | 4 ++
randr/rrcrtc.c | 9 ++--
randr/rrscreen.c | 6 ++-
6 files changed, 96 insertions(+), 41 deletions(-)
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 78e6b20..c509413 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1038,7 +1038,12 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable)
RegionInit(&pWin->winSize, &box, 1);
RegionInit(&pWin->borderSize, &box, 1);
if (WasViewable)
+ {
+ PixmapPtr pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+ box.x2 = pPixmap->drawable.width;
+ box.y2 = pPixmap->drawable.height;
RegionReset(&pWin->borderClip, &box);
+ }
pWin->drawable.width = pScreen->width;
pWin->drawable.height = pScreen->height;
RegionBreak(&pWin->clipList);
@@ -1116,7 +1121,6 @@ xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
*/
if (!xf86Resetting)
xf86SetRootClip (pScreen, TRUE);
-
}
else
{
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index dfe2cc3..407bf35 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -659,10 +659,12 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
static Bool
xf86RandR12ScreenSetSize (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD32 mmWidth,
- CARD32 mmHeight)
+ CARD16 width,
+ CARD16 height,
+ CARD16 pixWidth,
+ CARD16 pixHeight,
+ CARD32 mmWidth,
+ CARD32 mmHeight)
{
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
@@ -670,6 +672,8 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
WindowPtr pRoot = pScreen->root;
PixmapPtr pScrnPix;
Bool ret = FALSE;
+ Bool pixSizeChanged = FALSE;
+ Bool winSizeChanged = FALSE;
int c;
if (xf86RandR12Key) {
@@ -677,46 +681,85 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
{
randrp->virtualX = pScrn->virtualX;
randrp->virtualY = pScrn->virtualY;
+ pixSizeChanged = TRUE;
}
}
- if (pRoot && pScrn->vtSema)
- (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
- /* Let the driver update virtualX and virtualY */
- if (!(*config->funcs->resize)(pScrn, width, height))
- goto finish;
+ pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
+ if (pixWidth != pScrnPix->drawable.width ||
+ pixHeight != pScrnPix->drawable.height)
+ pixSizeChanged = TRUE;
+
+ if (width != pScreen->width || height != pScreen->height)
+ winSizeChanged = TRUE;
+
+ if (pixSizeChanged)
+ {
+ if (pRoot && pScrn->vtSema)
+ (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+
+ /* Let the driver update virtualX and virtualY */
+ if (!(*config->funcs->resize)(pScrn, pixWidth, pixHeight))
+ goto finish;
+ }
ret = TRUE;
- /* Update panning information */
- for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
- if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1 ||
- crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
- if (crtc->panningTotalArea.x2 > crtc->panningTrackingArea.x1)
- crtc->panningTotalArea.x2 += width - pScreen->width;
- if (crtc->panningTotalArea.y2 > crtc->panningTrackingArea.y1)
- crtc->panningTotalArea.y2 += height - pScreen->height;
- if (crtc->panningTrackingArea.x2 > crtc->panningTrackingArea.x1)
- crtc->panningTrackingArea.x2 += width - pScreen->width;
- if (crtc->panningTrackingArea.y2 > crtc->panningTrackingArea.y1)
- crtc->panningTrackingArea.y2 += height - pScreen->height;
- xf86RandR13VerifyPanningArea (crtc, width, height);
- xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY);
+
+ if (winSizeChanged)
+ {
+ /* Update panning information */
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+ if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1 ||
+ crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
+ if (crtc->panningTotalArea.x2 > crtc->panningTrackingArea.x1)
+ crtc->panningTotalArea.x2 += width - pScreen->width;
+ if (crtc->panningTotalArea.y2 > crtc->panningTrackingArea.y1)
+ crtc->panningTotalArea.y2 += height - pScreen->height;
+ if (crtc->panningTrackingArea.x2 > crtc->panningTrackingArea.x1)
+ crtc->panningTrackingArea.x2 += width - pScreen->width;
+ if (crtc->panningTrackingArea.y2 > crtc->panningTrackingArea.y1)
+ crtc->panningTrackingArea.y2 += height - pScreen->height;
+ xf86RandR13VerifyPanningArea (crtc, width, height);
+ xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY);
+ }
}
}
pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
- pScreen->width = pScrnPix->drawable.width = width;
- pScreen->height = pScrnPix->drawable.height = height;
+ pScreen->width = width;
+ pScreen->height = height;
+ if (pRoot)
+ {
+ BoxRec box;
+
+ pRoot->drawable.width = width;
+ pRoot->drawable.height = height;
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = width;
+ box.y2 = height;
+ RegionInit(&pRoot->winSize, &box, 1);
+ RegionInit(&pRoot->borderSize, &box, 1);
+ }
+ pScrnPix->drawable.width = pixWidth;
+ pScrnPix->drawable.height = pixHeight;
randrp->mmWidth = pScreen->mmWidth = mmWidth;
randrp->mmHeight = pScreen->mmHeight = mmHeight;
- xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1);
- xf86SetViewport (pScreen, 0, 0);
+ if (winSizeChanged)
+ {
+ xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1);
+ xf86SetViewport (pScreen, 0, 0);
+ }
finish:
- if (pRoot && pScrn->vtSema)
- (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+ if (pixSizeChanged)
+ {
+ if (pRoot && pScrn->vtSema)
+ (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+ }
+
#if RANDR_12_INTERFACE
if (xf86RandR12Key && pScreen->root && ret)
RRScreenSizeNotify (pScreen);
@@ -818,6 +861,8 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
xf86RandR12ScreenSetSize (pScreen,
width,
height,
+ width,
+ height,
mmWidth,
mmHeight);
}
diff --git a/randr/mirrcrtc.c b/randr/mirrcrtc.c
index d493a0e..a9ee6b4 100644
--- a/randr/mirrcrtc.c
+++ b/randr/mirrcrtc.c
@@ -28,11 +28,6 @@ miRRSetScreenConfig(ScreenPtr screen,
{
RRScreenConfigRec old_screen_config;
- /* XXX deal with separate pixmap/screen sizes */
- if (screen_config->screen_pixmap_width != screen_config->screen_width ||
- screen_config->screen_pixmap_height != screen_config->screen_height)
- return FALSE;
-
RRScreenCurrentConfig(screen, &old_screen_config);
/* Check and see if nothing has changed */
@@ -47,6 +42,8 @@ miRRSetScreenConfig(ScreenPtr screen,
return RRScreenSizeSet(screen,
screen_config->screen_width,
screen_config->screen_height,
+ screen_config->screen_pixmap_width,
+ screen_config->screen_pixmap_height,
screen_config->mm_width,
screen_config->mm_height);
}
diff --git a/randr/randrstr.h b/randr/randrstr.h
index 8240824..7c553f2 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -191,6 +191,8 @@ struct _rrOutput {
typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
CARD16 width,
CARD16 height,
+ CARD16 pixWidth,
+ CARD16 pixHeight,
CARD32 mmWidth,
CARD32 mmHeight);
@@ -478,6 +480,8 @@ extern _X_EXPORT Bool
RRScreenSizeSet (ScreenPtr pScreen,
CARD16 width,
CARD16 height,
+ CARD16 pixWidth,
+ CARD16 pixHeight,
CARD32 mmWidth,
CARD32 mmHeight);
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 0b2bc28..97aa3d7 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -435,10 +435,9 @@ RRCrtcCurrentConfig(RRCrtcPtr crtc,
crtc_config->sprite_position_f_transform = crtc->client_sprite_f_position_transform;
crtc_config->sprite_image_f_transform = crtc->client_sprite_f_image_transform;
- /* XXX add pixmap stuff */
- crtc_config->pixmap = NULL;
- crtc_config->pixmap_x = 0;
- crtc_config->pixmap_y = 0;
+ crtc_config->pixmap = crtc->scanoutPixmap;
+ crtc_config->pixmap_x = crtc->x;
+ crtc_config->pixmap_y = crtc->y;
return TRUE;
}
@@ -1510,6 +1509,8 @@ RRConvertCrtcConfig(ClientPtr client, ScreenPtr screen,
if (x->pixmap == None)
pixmap = NULL;
+ else if (x->pixmap == RR_CurrentScanoutPixmap)
+ pixmap = crtc->scanoutPixmap;
else
{
rc = dixLookupResourceByType((pointer *) &pixmap, x->pixmap,
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 0c52347..292163f 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -168,6 +168,8 @@ Bool
RRScreenSizeSet (ScreenPtr pScreen,
CARD16 width,
CARD16 height,
+ CARD16 pixWidth,
+ CARD16 pixHeight,
CARD32 mmWidth,
CARD32 mmHeight)
{
@@ -178,6 +180,7 @@ RRScreenSizeSet (ScreenPtr pScreen,
{
return (*pScrPriv->rrScreenSetSize) (pScreen,
width, height,
+ pixWidth, pixHeight,
mmWidth, mmHeight);
}
#endif
@@ -318,6 +321,7 @@ ProcRRSetScreenSize (ClientPtr client)
}
if (!RRScreenSizeSet (pScreen,
stuff->width, stuff->height,
+ stuff->width, stuff->height,
stuff->widthInMillimeters,
stuff->heightInMillimeters))
{
@@ -949,7 +953,7 @@ ProcRRSetScreenConfig (ClientPtr client)
goto sendReply;
}
}
- if (!RRScreenSizeSet (pScreen, width, height,
+ if (!RRScreenSizeSet (pScreen, width, height, width, height,
pScreen->mmWidth, pScreen->mmHeight))
{
rep.status = RRSetConfigFailed;
--
1.7.2.3
More information about the xorg-devel
mailing list