xserver: Branch 'master' - 4 commits

Matthias Hopf mhopf at kemper.freedesktop.org
Thu Dec 11 09:30:42 PST 2008


 hw/xfree86/modes/xf86Crtc.c    |   60 +++++++++++++++++++++++++++++++++++++++++
 hw/xfree86/modes/xf86Crtc.h    |    6 +++-
 hw/xfree86/modes/xf86RandR12.c |   21 +++++++++++---
 randr/rrcrtc.c                 |    8 ++---
 4 files changed, 86 insertions(+), 9 deletions(-)

New commits:
commit fd77ce9f884f5ac4d36736f3a99ba86101f133ea
Author: Matthias Hopf <mhopf at suse.de>
Date:   Thu Dec 11 17:51:20 2008 +0100

    randr: Oops, miscalculated panning rectangle's coordinates

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 99f7d1e..b504b0c 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -1098,12 +1098,12 @@ ProcRRSetPanning (ClientPtr client)
 
     total.x1    = stuff->left;
     total.y1    = stuff->top;
-    total.x2    = stuff->width - total.x1;
-    total.y2    = stuff->height - total.y1;
+    total.x2    = total.x1 + stuff->width;
+    total.y2    = total.y1 + stuff->height;
     tracking.x1 = stuff->track_left;
     tracking.y1 = stuff->track_top;
-    tracking.x2 = stuff->track_width - tracking.x1;
-    tracking.y2 = stuff->track_height - tracking.y1;
+    tracking.x2 = tracking.x1 + stuff->track_width;
+    tracking.y2 = tracking.y1 + stuff->track_height;
     border[0]   = stuff->border_left;
     border[1]   = stuff->border_top;
     border[2]   = stuff->border_right;
commit f8e52f1b6d7c59d007de99a1c9c69c053d4f3cbe
Author: Matthias Hopf <mhopf at suse.de>
Date:   Thu Dec 11 16:48:40 2008 +0100

    randr: Update initial screen size if panning information is present

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 663d1a7..d668ab7 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -561,10 +561,16 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
 	int	    crtc_width = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
 	int	    crtc_height = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
 	
-	if (crtc->enabled && crtc_width > width)
-	    width = crtc_width;
-	if (crtc->enabled && crtc_height > height)
-	    height = crtc_height;
+	if (crtc->enabled) {
+	    if (crtc_width > width)
+		width = crtc_width;
+	    if (crtc_height > height)
+		height = crtc_height;
+	    if (crtc->panningTotalArea.x2 > width)
+		width = crtc->panningTotalArea.x2;
+	    if (crtc->panningTotalArea.y2 > height)
+		height = crtc->panningTotalArea.y2;
+	}
     }
     
     if (width && height)
@@ -615,6 +621,13 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		   "Setting screen physical size to %d x %d\n",
 		   mmWidth, mmHeight);
+	/*
+	 * This is the initial setting of the screen size.
+	 * We have to pre-set it here, otherwise panning would be adapted
+	 * to the new screen size.
+	 */
+	pScreen->width  = width;
+	pScreen->height = height;
 	xf86RandR12ScreenSetSize (pScreen,
 				  width,
 				  height,
commit 24d6b7d1c5fc5d07c2eb06a9fc4406e393d59b17
Author: Matthias Hopf <mhopf at suse.de>
Date:   Thu Dec 11 16:48:11 2008 +0100

    randr: Fix error message for bad panning config

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 5b39293..8e6cef0 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1365,7 +1365,7 @@ xf86InitialPanning (ScrnInfoPtr scrn)
 	    output->initialTotalArea.y2 = output->initialTotalArea.y1 + height;
 	    break;
 	default:
-	    xf86DrvMsg (output->scrn->scrnIndex, X_ERROR,
+	    xf86DrvMsg (scrn->scrnIndex, X_ERROR,
 			"Broken panning specification '%s' for output %s in config file\n",
 			panning, output->name);
 	}
commit fdbbe65a7e777b7777bfae5a161efb89d4fb9a8d
Author: Matthias Hopf <mhopf at suse.de>
Date:   Thu Dec 11 14:56:51 2008 +0100

    randr: Add monitor option "Panning" for initial panning configuration

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 50ed158..5b39293 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -457,6 +457,7 @@ typedef enum {
     OPTION_MAX_CLOCK,
     OPTION_IGNORE,
     OPTION_ROTATE,
+    OPTION_PANNING,
 } OutputOpts;
 
 static OptionInfoRec xf86OutputOptions[] = {
@@ -472,6 +473,7 @@ static OptionInfoRec xf86OutputOptions[] = {
     {OPTION_MAX_CLOCK,	    "MaxClock",		OPTV_FREQ,    {0}, FALSE },
     {OPTION_IGNORE,	    "Ignore",		OPTV_BOOLEAN, {0}, FALSE },
     {OPTION_ROTATE,	    "Rotate",		OPTV_STRING,  {0}, FALSE },
+    {OPTION_PANNING,	    "Panning",		OPTV_STRING,  {0}, FALSE },
     {-1,		    NULL,		OPTV_NONE,    {0}, FALSE },
 };
 
@@ -1320,6 +1322,56 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
     return TRUE;
 }
 
+static void
+xf86InitialPanning (ScrnInfoPtr scrn)
+{
+    xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(scrn);
+    int			o;
+    
+    for (o = 0; o < config->num_output; o++)
+    {
+	xf86OutputPtr	output = config->output[o];
+	char	       *panning = xf86GetOptValString (output->options, OPTION_PANNING);
+	int		width, height, left, top;
+	int		track_width, track_height, track_left, track_top;
+	int		brdr[4];
+
+	memset (&output->initialTotalArea,    0, sizeof(BoxRec));
+	memset (&output->initialTrackingArea, 0, sizeof(BoxRec));
+	memset (output->initialBorder,        0, 4*sizeof(INT16));
+
+	if (! panning)
+	    continue;
+
+	switch (sscanf (panning, "%dx%d+%d+%d/%dx%d+%d+%d/%d/%d/%d/%d",
+			&width, &height, &left, &top,
+			&track_width, &track_height, &track_left, &track_top,
+			&brdr[0], &brdr[1], &brdr[2], &brdr[3])) {
+	case 12:
+	    memcpy (output->initialBorder, brdr, 4*sizeof(INT16));
+	    /* fall through */
+	case 8:
+	    output->initialTrackingArea.x1 = track_left;
+	    output->initialTrackingArea.y1 = track_top;
+	    output->initialTrackingArea.x2 = track_left + track_width;
+	    output->initialTrackingArea.y2 = track_top  + track_height;
+	    /* fall through */
+	case 4:
+	    output->initialTotalArea.x1 = left;
+	    output->initialTotalArea.y1 = top;
+	    /* fall through */
+	case 2:
+	    output->initialTotalArea.x2 = output->initialTotalArea.x1 + width;
+	    output->initialTotalArea.y2 = output->initialTotalArea.y1 + height;
+	    break;
+	default:
+	    xf86DrvMsg (output->scrn->scrnIndex, X_ERROR,
+			"Broken panning specification '%s' for output %s in config file\n",
+			panning, output->name);
+	}
+    }
+}
+
 /*
  * XXX walk the monitor mode list and prune out duplicates that
  * are inserted by xf86DDCMonitorSet. In an ideal world, that
@@ -2246,6 +2298,11 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
 	xfree (modes);
 	return FALSE;
     }
+
+    /*
+     * Set initial panning of each output
+     */
+    xf86InitialPanning (scrn);
 	
     /*
      * Assign CRTCs to fit output configuration
@@ -2289,6 +2346,9 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
 	    crtc->enabled = TRUE;
 	    crtc->x = output->initial_x;
 	    crtc->y = output->initial_y;
+	    memcpy (&crtc->panningTotalArea,    &output->initialTotalArea,    sizeof(BoxRec));
+	    memcpy (&crtc->panningTrackingArea, &output->initialTrackingArea, sizeof(BoxRec));
+	    memcpy (crtc->panningBorder,        output->initialBorder,        4*sizeof(INT16));
 	    output->crtc = crtc;
 	} else {
 	    output->crtc = NULL;
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 21038aa..fcf022b 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -466,7 +466,7 @@ typedef struct _xf86OutputFuncs {
 } xf86OutputFuncsRec, *xf86OutputFuncsPtr;
 
 
-#define XF86_OUTPUT_VERSION 1
+#define XF86_OUTPUT_VERSION 2
 
 struct _xf86Output {
     /**
@@ -574,6 +574,10 @@ struct _xf86Output {
 #else
     void		*randr_output;
 #endif
+    /** Desired initial panning */
+    BoxRec          initialTotalArea;
+    BoxRec          initialTrackingArea;
+    INT16           initialBorder[4];
 };
 
 typedef struct _xf86CrtcConfigFuncs {


More information about the xorg-commit mailing list