randr: Add monitor option "Panning" for initial panning configuration
This commit is contained in:
parent
27261a950d
commit
fdbbe65a7e
|
@ -457,6 +457,7 @@ typedef enum {
|
||||||
OPTION_MAX_CLOCK,
|
OPTION_MAX_CLOCK,
|
||||||
OPTION_IGNORE,
|
OPTION_IGNORE,
|
||||||
OPTION_ROTATE,
|
OPTION_ROTATE,
|
||||||
|
OPTION_PANNING,
|
||||||
} OutputOpts;
|
} OutputOpts;
|
||||||
|
|
||||||
static OptionInfoRec xf86OutputOptions[] = {
|
static OptionInfoRec xf86OutputOptions[] = {
|
||||||
|
@ -472,6 +473,7 @@ static OptionInfoRec xf86OutputOptions[] = {
|
||||||
{OPTION_MAX_CLOCK, "MaxClock", OPTV_FREQ, {0}, FALSE },
|
{OPTION_MAX_CLOCK, "MaxClock", OPTV_FREQ, {0}, FALSE },
|
||||||
{OPTION_IGNORE, "Ignore", OPTV_BOOLEAN, {0}, FALSE },
|
{OPTION_IGNORE, "Ignore", OPTV_BOOLEAN, {0}, FALSE },
|
||||||
{OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
|
{OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
|
||||||
|
{OPTION_PANNING, "Panning", OPTV_STRING, {0}, FALSE },
|
||||||
{-1, NULL, OPTV_NONE, {0}, FALSE },
|
{-1, NULL, OPTV_NONE, {0}, FALSE },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1320,6 +1322,56 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
|
||||||
return TRUE;
|
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
|
* XXX walk the monitor mode list and prune out duplicates that
|
||||||
* are inserted by xf86DDCMonitorSet. In an ideal world, that
|
* are inserted by xf86DDCMonitorSet. In an ideal world, that
|
||||||
|
@ -2246,6 +2298,11 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
||||||
xfree (modes);
|
xfree (modes);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set initial panning of each output
|
||||||
|
*/
|
||||||
|
xf86InitialPanning (scrn);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assign CRTCs to fit output configuration
|
* Assign CRTCs to fit output configuration
|
||||||
|
@ -2289,6 +2346,9 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
||||||
crtc->enabled = TRUE;
|
crtc->enabled = TRUE;
|
||||||
crtc->x = output->initial_x;
|
crtc->x = output->initial_x;
|
||||||
crtc->y = output->initial_y;
|
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;
|
output->crtc = crtc;
|
||||||
} else {
|
} else {
|
||||||
output->crtc = NULL;
|
output->crtc = NULL;
|
||||||
|
|
|
@ -466,7 +466,7 @@ typedef struct _xf86OutputFuncs {
|
||||||
} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
|
} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
|
||||||
|
|
||||||
|
|
||||||
#define XF86_OUTPUT_VERSION 1
|
#define XF86_OUTPUT_VERSION 2
|
||||||
|
|
||||||
struct _xf86Output {
|
struct _xf86Output {
|
||||||
/**
|
/**
|
||||||
|
@ -574,6 +574,10 @@ struct _xf86Output {
|
||||||
#else
|
#else
|
||||||
void *randr_output;
|
void *randr_output;
|
||||||
#endif
|
#endif
|
||||||
|
/** Desired initial panning */
|
||||||
|
BoxRec initialTotalArea;
|
||||||
|
BoxRec initialTrackingArea;
|
||||||
|
INT16 initialBorder[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _xf86CrtcConfigFuncs {
|
typedef struct _xf86CrtcConfigFuncs {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user