aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/modes
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/modes')
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c11
-rw-r--r--xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c171
-rw-r--r--xorg-server/hw/xfree86/modes/xf86EdidModes.c122
-rw-r--r--xorg-server/hw/xfree86/modes/xf86RandR12.c38
4 files changed, 179 insertions, 163 deletions
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index 2628409d2..154f684c4 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -734,9 +734,6 @@ xf86CrtcCloseScreen(ScreenPtr screen)
for (c = 0; c < config->num_crtc; c++) {
xf86CrtcPtr crtc = config->crtc[c];
- if (crtc->randr_crtc->scanout_pixmap)
- RRCrtcDetachScanoutPixmap(crtc->randr_crtc);
-
crtc->randr_crtc = NULL;
}
/* detach any providers */
@@ -2073,12 +2070,13 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
/*
* If there's no preferred mode, but only one monitor, pick the
- * biggest mode for its aspect ratio, assuming one exists.
+ * biggest mode for its aspect ratio or 4:3, assuming one exists.
*/
if (!ret)
do {
int i = 0;
float aspect = 0.0;
+ DisplayModePtr a = NULL, b = NULL;
/* count the number of enabled outputs */
for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++);
@@ -2092,8 +2090,11 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
aspect = (float) config->output[p]->mm_width /
(float) config->output[p]->mm_height;
+ a = bestModeForAspect(config, enabled, 4.0/3.0);
if (aspect)
- preferred_match[p] = bestModeForAspect(config, enabled, aspect);
+ b = bestModeForAspect(config, enabled, aspect);
+
+ preferred_match[p] = biggestMode(a, b);
if (preferred_match[p])
ret = TRUE;
diff --git a/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c b/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c
index 781c806bc..bead1265a 100644
--- a/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c
+++ b/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c
@@ -184,105 +184,96 @@ static const struct did_dmt {
short w, h, r, f;
} did_dmt[] = {
/* byte 3 */
- {
- 640, 350, 85, 0}, {
- 640, 400, 85, 0}, {
- 720, 400, 85, 0}, {
- 640, 480, 60, 0}, {
- 640, 480, 72, 0}, {
- 640, 480, 75, 0}, {
- 640, 480, 85, 0}, {
- 800, 600, 56, 0},
+ {640, 350, 85, 0},
+ {640, 400, 85, 0},
+ {720, 400, 85, 0},
+ {640, 480, 60, 0},
+ {640, 480, 72, 0},
+ {640, 480, 75, 0},
+ {640, 480, 85, 0},
+ {800, 600, 56, 0},
/* byte 4 */
- {
- 800, 600, 60, 0}, {
- 800, 600, 72, 0}, {
- 800, 600, 75, 0}, {
- 800, 600, 85, 0}, {
- 800, 600, 120, RB}, {
- 848, 480, 60, 0}, {
- 1024, 768, 43, INT}, {
- 1024, 768, 60, 0},
+ {800, 600, 60, 0},
+ {800, 600, 72, 0},
+ {800, 600, 75, 0},
+ {800, 600, 85, 0},
+ {800, 600, 120, RB},
+ {848, 480, 60, 0},
+ {1024, 768, 43, INT},
+ {1024, 768, 60, 0},
/* byte 5 */
- {
- 1024, 768, 70, 0}, {
- 1024, 768, 75, 0}, {
- 1024, 768, 85, 0}, {
- 1024, 768, 120, RB}, {
- 1152, 864, 75, 0}, {
- 1280, 768, 60, RB}, {
- 1280, 768, 60, 0}, {
- 1280, 768, 75, 0},
+ {1024, 768, 70, 0},
+ {1024, 768, 75, 0},
+ {1024, 768, 85, 0},
+ {1024, 768, 120, RB},
+ {1152, 864, 75, 0},
+ {1280, 768, 60, RB},
+ {1280, 768, 60, 0},
+ {1280, 768, 75, 0},
/* byte 6 */
- {
- 1280, 768, 85, 0}, {
- 1280, 768, 120, RB}, {
- 1280, 800, 60, RB}, {
- 1280, 800, 60, 0}, {
- 1280, 800, 75, 0}, {
- 1280, 800, 85, 0}, {
- 1280, 800, 120, RB}, {
- 1280, 960, 60, 0},
+ {1280, 768, 85, 0},
+ {1280, 768, 120, RB},
+ {1280, 800, 60, RB},
+ {1280, 800, 60, 0},
+ {1280, 800, 75, 0},
+ {1280, 800, 85, 0},
+ {1280, 800, 120, RB},
+ {1280, 960, 60, 0},
/* byte 7 */
- {
- 1280, 960, 85, 0}, {
- 1280, 960, 120, RB}, {
- 1280, 1024, 60, 0}, {
- 1280, 1024, 75, 0}, {
- 1280, 1024, 85, 0}, {
- 1280, 1024, 120, RB}, {
- 1360, 768, 60, 0}, {
- 1360, 768, 120, RB},
+ {1280, 960, 85, 0},
+ {1280, 960, 120, RB},
+ {1280, 1024, 60, 0},
+ {1280, 1024, 75, 0},
+ {1280, 1024, 85, 0},
+ {1280, 1024, 120, RB},
+ {1360, 768, 60, 0},
+ {1360, 768, 120, RB},
/* byte 8 */
- {
- 1400, 1050, 60, RB}, {
- 1400, 1050, 60, 0}, {
- 1400, 1050, 75, 0}, {
- 1400, 1050, 85, 0}, {
- 1400, 1050, 120, RB}, {
- 1440, 900, 60, RB}, {
- 1440, 900, 60, 0}, {
- 1440, 900, 75, 0},
+ {1400, 1050, 60, RB},
+ {1400, 1050, 60, 0},
+ {1400, 1050, 75, 0},
+ {1400, 1050, 85, 0},
+ {1400, 1050, 120, RB},
+ {1440, 900, 60, RB},
+ {1440, 900, 60, 0},
+ {1440, 900, 75, 0},
/* byte 9 */
- {
- 1440, 900, 85, 0}, {
- 1440, 900, 120, RB}, {
- 1600, 1200, 60, 0}, {
- 1600, 1200, 65, 0}, {
- 1600, 1200, 70, 0}, {
- 1600, 1200, 75, 0}, {
- 1600, 1200, 85, 0}, {
- 1600, 1200, 120, RB},
+ {1440, 900, 85, 0},
+ {1440, 900, 120, RB},
+ {1600, 1200, 60, 0},
+ {1600, 1200, 65, 0},
+ {1600, 1200, 70, 0},
+ {1600, 1200, 75, 0},
+ {1600, 1200, 85, 0},
+ {1600, 1200, 120, RB},
/* byte a */
- {
- 1680, 1050, 60, RB}, {
- 1680, 1050, 60, 0}, {
- 1680, 1050, 75, 0}, {
- 1680, 1050, 85, 0}, {
- 1680, 1050, 120, RB}, {
- 1792, 1344, 60, 0}, {
- 1792, 1344, 75, 0}, {
- 1792, 1344, 120, RB},
+ {1680, 1050, 60, RB},
+ {1680, 1050, 60, 0},
+ {1680, 1050, 75, 0},
+ {1680, 1050, 85, 0},
+ {1680, 1050, 120, RB},
+ {1792, 1344, 60, 0},
+ {1792, 1344, 75, 0},
+ {1792, 1344, 120, RB},
/* byte b */
- {
- 1856, 1392, 60, 0}, {
- 1856, 1392, 75, 0}, {
- 1856, 1392, 120, RB}, {
- 1920, 1200, 60, RB}, {
- 1920, 1200, 60, 0}, {
- 1920, 1200, 75, 0}, {
- 1920, 1200, 85, 0}, {
- 1920, 1200, 120, RB},
+ {1856, 1392, 60, 0},
+ {1856, 1392, 75, 0},
+ {1856, 1392, 120, RB},
+ {1920, 1200, 60, RB},
+ {1920, 1200, 60, 0},
+ {1920, 1200, 75, 0},
+ {1920, 1200, 85, 0},
+ {1920, 1200, 120, RB},
/* byte c */
- {
- 1920, 1440, 60, 0}, {
- 1920, 1440, 75, 0}, {
- 1920, 1440, 120, RB}, {
- 2560, 1600, 60, RB}, {
- 2560, 1600, 60, 0}, {
- 2560, 1600, 75, 0}, {
- 2560, 1600, 85, 0}, {
-2560, 1600, 120, RB},};
+ {1920, 1440, 60, 0},
+ {1920, 1440, 75, 0},
+ {1920, 1440, 120, RB},
+ {2560, 1600, 60, RB},
+ {2560, 1600, 60, 0},
+ {2560, 1600, 75, 0},
+ {2560, 1600, 85, 0},
+ {2560, 1600, 120, RB},
+};
static void
didVesaTiming(int scrn, unsigned char *x, MonPtr mon)
diff --git a/xorg-server/hw/xfree86/modes/xf86EdidModes.c b/xorg-server/hw/xfree86/modes/xf86EdidModes.c
index 258ada5b4..4ee862da0 100644
--- a/xorg-server/hw/xfree86/modes/xf86EdidModes.c
+++ b/xorg-server/hw/xfree86/modes/xf86EdidModes.c
@@ -513,14 +513,14 @@ DDCModeDoInterlaceQuirks(DisplayModePtr mode)
static const struct {
int w, h;
} cea_interlaced[] = {
- {
- 1920, 1080}, {
- 720, 480}, {
- 1440, 480}, {
- 2880, 480}, {
- 720, 576}, {
- 1440, 576}, {
- 2880, 576},};
+ {1920, 1080},
+ {720, 480},
+ {1440, 480},
+ {2880, 480},
+ {720, 576},
+ {1440, 576},
+ {2880, 576},
+ };
static const int n_modes =
sizeof(cea_interlaced) / sizeof(cea_interlaced[0]);
int i;
@@ -668,68 +668,62 @@ static const struct {
short r;
short rb;
} EstIIIModes[] = {
- /* byte 6 */
- {
- 640, 350, 85, 0}, {
- 640, 400, 85, 0}, {
- 720, 400, 85, 0}, {
- 640, 480, 85, 0}, {
- 848, 480, 60, 0}, {
- 800, 600, 85, 0}, {
- 1024, 768, 85, 0}, {
- 1152, 864, 75, 0},
+ /* byte 6 */
+ {640, 350, 85, 0},
+ {640, 400, 85, 0},
+ {720, 400, 85, 0},
+ {640, 480, 85, 0},
+ {848, 480, 60, 0},
+ {800, 600, 85, 0},
+ {1024, 768, 85, 0},
+ {1152, 864, 75, 0},
/* byte 7 */
- {
- 1280, 768, 60, 1}, {
- 1280, 768, 60, 0}, {
- 1280, 768, 75, 0}, {
- 1280, 768, 85, 0}, {
- 1280, 960, 60, 0}, {
- 1280, 960, 85, 0}, {
- 1280, 1024, 60, 0}, {
- 1280, 1024, 85, 0},
+ {1280, 768, 60, 1},
+ {1280, 768, 60, 0},
+ {1280, 768, 75, 0},
+ {1280, 768, 85, 0},
+ {1280, 960, 60, 0},
+ {1280, 960, 85, 0},
+ {1280, 1024, 60, 0},
+ {1280, 1024, 85, 0},
/* byte 8 */
- {
- 1360, 768, 60, 0}, {
- 1440, 900, 60, 1}, {
- 1440, 900, 60, 0}, {
- 1440, 900, 75, 0}, {
- 1440, 900, 85, 0}, {
- 1400, 1050, 60, 1}, {
- 1400, 1050, 60, 0}, {
- 1400, 1050, 75, 0},
+ {1360, 768, 60, 0},
+ {1440, 900, 60, 1},
+ {1440, 900, 60, 0},
+ {1440, 900, 75, 0},
+ {1440, 900, 85, 0},
+ {1400, 1050, 60, 1},
+ {1400, 1050, 60, 0},
+ {1400, 1050, 75, 0},
/* byte 9 */
- {
- 1400, 1050, 85, 0}, {
- 1680, 1050, 60, 1}, {
- 1680, 1050, 60, 0}, {
- 1680, 1050, 75, 0}, {
- 1680, 1050, 85, 0}, {
- 1600, 1200, 60, 0}, {
- 1600, 1200, 65, 0}, {
- 1600, 1200, 70, 0},
+ {1400, 1050, 85, 0},
+ {1680, 1050, 60, 1},
+ {1680, 1050, 60, 0},
+ {1680, 1050, 75, 0},
+ {1680, 1050, 85, 0},
+ {1600, 1200, 60, 0},
+ {1600, 1200, 65, 0},
+ {1600, 1200, 70, 0},
/* byte 10 */
- {
- 1600, 1200, 75, 0}, {
- 1600, 1200, 85, 0}, {
- 1792, 1344, 60, 0}, {
- 1792, 1344, 85, 0}, {
- 1856, 1392, 60, 0}, {
- 1856, 1392, 75, 0}, {
- 1920, 1200, 60, 1}, {
- 1920, 1200, 60, 0},
+ {1600, 1200, 75, 0},
+ {1600, 1200, 85, 0},
+ {1792, 1344, 60, 0},
+ {1792, 1344, 85, 0},
+ {1856, 1392, 60, 0},
+ {1856, 1392, 75, 0},
+ {1920, 1200, 60, 1},
+ {1920, 1200, 60, 0},
/* byte 11 */
- {
- 1920, 1200, 75, 0}, {
- 1920, 1200, 85, 0}, {
- 1920, 1440, 60, 0}, {
- 1920, 1440, 75, 0},
+ {1920, 1200, 75, 0},
+ {1920, 1200, 85, 0},
+ {1920, 1440, 60, 0},
+ {1920, 1440, 75, 0},
/* fill up last byte */
- {
- 0,0,0,0}, {
- 0,0,0,0}, {
- 0,0,0,0}, {
- 0,0,0,0}, };
+ {0,0,0,0},
+ {0,0,0,0},
+ {0,0,0,0},
+ {0,0,0,0},
+};
static DisplayModePtr
DDCModesFromEstIII(unsigned char *est)
diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c
index 4be0ea32f..3530abf24 100644
--- a/xorg-server/hw/xfree86/modes/xf86RandR12.c
+++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c
@@ -60,6 +60,9 @@ typedef struct _xf86RandR12Info {
* See https://bugs.freedesktop.org/show_bug.cgi?id=21554
*/
xf86EnterVTProc *orig_EnterVT;
+
+ Bool panning;
+ ConstrainCursorHarderProcPtr orig_ConstrainCursorHarder;
} XF86RandRInfoRec, *XF86RandRInfoPtr;
#ifdef RANDR_12_INTERFACE
@@ -665,6 +668,10 @@ xf86RandR12SetConfig(ScreenPtr pScreen,
return TRUE;
}
+#define PANNING_ENABLED(crtc) \
+ ((crtc)->panningTotalArea.x2 > (crtc)->panningTotalArea.x1 || \
+ (crtc)->panningTotalArea.y2 > (crtc)->panningTotalArea.y1)
+
static Bool
xf86RandR12ScreenSetSize(ScreenPtr pScreen,
CARD16 width,
@@ -676,6 +683,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
WindowPtr pRoot = pScreen->root;
PixmapPtr pScrnPix;
Bool ret = FALSE;
+ Bool panning = FALSE;
int c;
if (xf86RandR12Key) {
@@ -696,8 +704,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
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 (PANNING_ENABLED (crtc)) {
if (crtc->panningTotalArea.x2 > crtc->panningTrackingArea.x1)
crtc->panningTotalArea.x2 += width - pScreen->width;
if (crtc->panningTotalArea.y2 > crtc->panningTrackingArea.y1)
@@ -708,6 +715,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
crtc->panningTrackingArea.y2 += height - pScreen->height;
xf86RandR13VerifyPanningArea(crtc, width, height);
xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY);
+ panning = TRUE;
}
}
@@ -903,6 +911,7 @@ xf86RandR12CloseScreen(ScreenPtr pScreen)
randrp = XF86RANDRINFO(pScreen);
#if RANDR_12_INTERFACE
xf86ScreenToScrn(pScreen)->EnterVT = randrp->orig_EnterVT;
+ pScreen->ConstrainCursorHarder = randrp->orig_ConstrainCursorHarder;
#endif
free(randrp);
@@ -1216,6 +1225,7 @@ xf86RandR12CrtcSet(ScreenPtr pScreen,
}
xf86RandR13VerifyPanningArea(crtc, pScreen->width, pScreen->height);
xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY);
+ randrp->panning = PANNING_ENABLED (crtc);
/*
* Save the last successful setting for EnterVT
*/
@@ -1650,6 +1660,7 @@ xf86RandR13SetPanning(ScreenPtr pScreen,
BoxRec oldTotalArea;
BoxRec oldTrackingArea;
INT16 oldBorder[4];
+ Bool oldPanning = randrp->panning;
if (crtc->version < 2)
return FALSE;
@@ -1667,6 +1678,7 @@ xf86RandR13SetPanning(ScreenPtr pScreen,
if (xf86RandR13VerifyPanningArea(crtc, pScreen->width, pScreen->height)) {
xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY);
+ randrp->panning = PANNING_ENABLED (crtc);
return TRUE;
}
else {
@@ -1674,6 +1686,7 @@ xf86RandR13SetPanning(ScreenPtr pScreen,
memcpy(&crtc->panningTotalArea, &oldTotalArea, sizeof(BoxRec));
memcpy(&crtc->panningTrackingArea, &oldTrackingArea, sizeof(BoxRec));
memcpy(crtc->panningBorder, oldBorder, 4 * sizeof(INT16));
+ randrp->panning = oldPanning;
return FALSE;
}
}
@@ -1762,8 +1775,6 @@ xf86RandR14ProviderSetOutputSource(ScreenPtr pScreen,
RRProviderPtr provider,
RRProviderPtr source_provider)
{
-
-
if (!source_provider) {
if (provider->output_source) {
ScreenPtr cmScreen = pScreen->current_master;
@@ -1859,6 +1870,21 @@ xf86CrtcSetScanoutPixmap(RRCrtcPtr randr_crtc, PixmapPtr pixmap)
return crtc->funcs->set_scanout_pixmap(crtc, pixmap);
}
+static void
+xf86RandR13ConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, int *x, int *y)
+{
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(screen);
+
+ if (randrp->panning)
+ return;
+
+ if (randrp->orig_ConstrainCursorHarder) {
+ screen->ConstrainCursorHarder = randrp->orig_ConstrainCursorHarder;
+ screen->ConstrainCursorHarder(dev, screen, mode, x, y);
+ screen->ConstrainCursorHarder = xf86RandR13ConstrainCursorHarder;
+ }
+}
+
static Bool
xf86RandR12Init12(ScreenPtr pScreen)
{
@@ -1895,6 +1921,10 @@ xf86RandR12Init12(ScreenPtr pScreen)
randrp->orig_EnterVT = pScrn->EnterVT;
pScrn->EnterVT = xf86RandR12EnterVT;
+ randrp->panning = FALSE;
+ randrp->orig_ConstrainCursorHarder = pScreen->ConstrainCursorHarder;
+ pScreen->ConstrainCursorHarder = xf86RandR13ConstrainCursorHarder;
+
if (!xf86RandR12CreateObjects12(pScreen))
return FALSE;