xserver: Branch 'randr-1.2'

Keith Packard keithp at kemper.freedesktop.org
Wed Nov 1 10:29:51 EET 2006


 randr/mirandr.c   |    2 --
 randr/randrstr.h  |    7 +++++++
 randr/rrcrtc.c    |   12 ++++++++++--
 randr/rrinfo.c    |    2 --
 randr/rrmode.c    |    2 --
 randr/rroutput.c  |   23 +++++++++++++++++++++++
 randr/rrpointer.c |    2 +-
 randr/rrscreen.c  |   15 +++++++++------
 8 files changed, 50 insertions(+), 15 deletions(-)

New commits:
diff-tree 4056e6e79a4e37101d298ae29139c83d3816368b (from e21604914dccece6bc64c69b55512d1f1a969235)
Author: Keith Packard <keithp at mandolin.keithp.com>
Date:   Wed Nov 1 00:29:46 2006 -0800

    Move physical size from mode to output.
    
    Modes can be shared across different sized monitors this way.
    
    Also caught some missing byteswapping and an incorrect return type.

diff --git a/randr/mirandr.c b/randr/mirandr.c
index 8d79e8a..11c2991 100644
--- a/randr/mirandr.c
+++ b/randr/mirandr.c
@@ -111,8 +111,6 @@ miRandRInit (ScreenPtr pScreen)
     memset (&modeInfo, '\0', sizeof (modeInfo));
     modeInfo.width = pScreen->width;
     modeInfo.height = pScreen->height;
-    modeInfo.mmWidth = pScreen->mmWidth;
-    modeInfo.mmHeight = pScreen->mmHeight;
     modeInfo.nameLength = strlen (name);
     
     mode = RRModeGet (pScreen, &modeInfo, name);
diff --git a/randr/randrstr.h b/randr/randrstr.h
index a8a9950..60877a3 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -107,6 +107,8 @@ struct _rrOutput {
     int		    nameLength;
     CARD8	    connection;
     CARD8	    subpixelOrder;
+    int		    mmWidth;
+    int		    mmHeight;
     RRCrtcPtr	    crtc;
     CARD32	    currentOptions;
     CARD32	    possibleOptions;
@@ -642,6 +644,11 @@ Bool
 RROutputSetCurrentOptions (RROutputPtr output,
 			   CARD32      currentOptions);
 
+Bool
+RROutputSetPhysicalSize (RROutputPtr	output,
+			 int		mmWidth,
+			 int		mmHeight);
+
 void
 RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
 
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index ee51cc2..c40dac1 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -270,8 +270,16 @@ RRCrtcSet (RRCrtcPtr    crtc,
 
 	size.width = mode->mode.width;
 	size.height = mode->mode.height;
-	size.mmWidth = mode->mode.mmWidth;
-	size.mmHeight = mode->mode.mmHeight;
+	if (outputs[0].output->mmWidth && outputs[0].output->mmHeight)
+	{
+	    size.mmWidth = outputs[0].output->mmWidth;
+	    size.mmHeight = outputs[0].output->mmHeight;
+	}
+	else
+	{
+	    size.mmWidth = pScreen->mmWidth;
+	    size.mmHeight = pScreen->mmHeight;
+	}
 	size.nRates = 1;
 	rate.rate = RRVerticalRefresh (&mode->mode);
 	size.pRates = &rate;
diff --git a/randr/rrinfo.c b/randr/rrinfo.c
index 6fd4ee5..e92caad 100644
--- a/randr/rrinfo.c
+++ b/randr/rrinfo.c
@@ -39,8 +39,6 @@ RROldModeAdd (RROutputPtr output, RRScre
     
     modeInfo.width = size->width;
     modeInfo.height = size->height;
-    modeInfo.mmWidth = size->mmWidth;
-    modeInfo.mmHeight = size->mmHeight;
     modeInfo.hTotal = size->width;
     modeInfo.vTotal = size->height;
     modeInfo.dotClock = ((CARD32) size->width * (CARD32) size->height *
diff --git a/randr/rrmode.c b/randr/rrmode.c
index 07cd0c1..fb4b5eb 100644
--- a/randr/rrmode.c
+++ b/randr/rrmode.c
@@ -29,8 +29,6 @@ RRModeEqual (xRRModeInfo *a, xRRModeInfo
 {
     if (a->width != b->width) return FALSE;
     if (a->height != b->height) return FALSE;
-    if (a->mmWidth != b->mmWidth) return FALSE;
-    if (a->mmHeight != b->mmHeight) return FALSE;
     if (a->dotClock != b->dotClock) return FALSE;
     if (a->hSyncStart != b->hSyncStart) return FALSE;
     if (a->hSyncEnd != b->hSyncEnd) return FALSE;
diff --git a/randr/rroutput.c b/randr/rroutput.c
index fc84ec1..1f6f330 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -72,6 +72,8 @@ RROutputCreate (ScreenPtr   pScreen,
     output->name[nameLength] = '\0';
     output->connection = RR_UnknownConnection;
     output->subpixelOrder = SubPixelUnknown;
+    output->mmWidth = 0;
+    output->mmHeight = 0;
     output->crtc = NULL;
     output->currentOptions = 0;
     output->possibleOptions = 0;
@@ -262,6 +264,20 @@ RROutputSetCurrentOptions (RROutputPtr o
     return TRUE;
 }
 
+Bool
+RROutputSetPhysicalSize (RROutputPtr	output,
+			 int		mmWidth,
+			 int		mmHeight)
+{
+    if (output->mmWidth == mmWidth && output->mmHeight == mmHeight)
+	return TRUE;
+    output->mmWidth = mmWidth;
+    output->mmHeight = mmHeight;
+    RROutputChanged (output);
+    return TRUE;
+}
+
+
 void
 RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
 {
@@ -381,6 +397,8 @@ ProcRRGetOutputInfo (ClientPtr client)
     rep.timestamp = pScrPriv->lastSetTime.milliseconds;
     rep.crtc = output->crtc ? output->crtc->id : None;
     rep.currentOptions = output->currentOptions;
+    rep.mmWidth = output->mmWidth;
+    rep.mmHeight = output->mmHeight;
     rep.connection = output->connection;
     rep.subpixelOrder = output->subpixelOrder;
     rep.nCrtcs = output->numCrtcs;
@@ -434,10 +452,15 @@ ProcRRGetOutputInfo (ClientPtr client)
 	swapl(&rep.length, n);
 	swapl(&rep.timestamp, n);
 	swapl(&rep.crtc, n);
+	swapl(&rep.currentOptions, n);
+	swapl(&rep.mmWidth, n);
+	swapl(&rep.mmHeight, n);
 	swaps(&rep.nCrtcs, n);
 	swaps(&rep.nModes, n);
 	swaps(&rep.nClones, n);
+	swapl(&rep.possibleOptions, n);
 	swaps(&rep.nameLength, n);
+	swapl(&rep.possibleOptions, n);
     }
     WriteToClient(client, sizeof(xRRGetOutputInfoReply), (char *)&rep);
     if (extraLen)
diff --git a/randr/rrpointer.c b/randr/rrpointer.c
index 7ba0460..c092e49 100644
--- a/randr/rrpointer.c
+++ b/randr/rrpointer.c
@@ -131,7 +131,7 @@ RRPointerScreenConfigured (ScreenPtr pSc
     int		x, y;
 
     if (pScreen != pCurrentScreen)
-	return FALSE;
+	return;
     GetSpritePosition (&x, &y);
     RRPointerToNearestCrtc (pScreen, x, y, NULL);
 }
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index b4d3618..705e7d7 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -126,8 +126,8 @@ RRDeliverScreenEvent (ClientPtr client, 
 	    }
 	se.widthInPixels = mode->mode.width;
 	se.heightInPixels = mode->mode.height;
-	se.widthInMillimeters = mode->mode.mmWidth;
-	se.heightInMillimeters = mode->mode.mmHeight;
+	se.widthInMillimeters = pScreen->mmWidth;
+	se.heightInMillimeters = pScreen->mmHeight;
     }
     else
     {
@@ -415,8 +415,6 @@ ProcRRGetScreenResources (ClientPtr clie
 		swapl (&modeinfos[i].id, n);
 		swaps (&modeinfos[i].width, n);
 		swaps (&modeinfos[i].height, n);
-		swapl (&modeinfos[i].mmWidth, n);
-		swapl (&modeinfos[i].mmHeight, n);
 		swapl (&modeinfos[i].dotClock, n);
 		swaps (&modeinfos[i].hSyncStart, n);
 		swaps (&modeinfos[i].hSyncEnd, n);
@@ -501,8 +499,13 @@ RR10GetData (ScreenPtr pScreen, RROutput
 	    size[j].id = j;
 	    size[j].width = mode->mode.width;
 	    size[j].height = mode->mode.height;
-	    size[j].mmWidth = mode->mode.mmWidth;
-	    size[j].mmHeight = mode->mode.mmHeight;
+	    if (output->mmWidth && output->mmHeight) {
+		size[j].mmWidth = output->mmWidth;
+		size[j].mmHeight = output->mmHeight;
+	    } else {
+		size[j].mmWidth = pScreen->mmWidth;
+		size[j].mmHeight = pScreen->mmHeight;
+	    }
 	    size[j].nRates = 0;
 	    size[j].pRates = &refresh[data->nrefresh];
 	    data->nsize++;



More information about the xorg-commit mailing list