summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-09-14 09:49:00 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-09-14 10:00:45 +0100
commit0fc3d020f3086b5c6ecef1fed1aaedef7aa52b01 (patch)
tree44f83e0ae76e9535cdf5cbb419b210855c098e8a /src
parent35d81d97b38d05f132a4823e57fff4012e966504 (diff)
Skip adding unknown special modes
In light of the discussion on how to add stereo modes it was revealed that we would happily add modes with unknown and unhandled strange flags. Adam Jackson mentioned that he has plans to fix that with some upcoming work, but as a first step we can simply eradicate them whilst pondering how to support the stereoscopic vision of the future. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/intel_display.c9
-rw-r--r--src/sna/sna_display.c9
2 files changed, 14 insertions, 4 deletions
diff --git a/src/intel_display.c b/src/intel_display.c
index 0372f9ff..bf160492 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -52,6 +52,8 @@
#include "intel_glamor.h"
+#define KNOWN_MODE_FLAGS ((1<<14)-1)
+
struct intel_mode {
int fd;
uint32_t fb_id;
@@ -316,7 +318,7 @@ mode_from_kmode(ScrnInfoPtr scrn,
mode->VTotal = kmode->vtotal;
mode->VScan = kmode->vscan;
- mode->Flags = kmode->flags; //& FLAG_BITS;
+ mode->Flags = kmode->flags;
mode->name = strdup(kmode->name);
if (kmode->type & DRM_MODE_TYPE_DRIVER)
@@ -324,6 +326,9 @@ mode_from_kmode(ScrnInfoPtr scrn,
if (kmode->type & DRM_MODE_TYPE_PREFERRED)
mode->type |= M_T_PREFERRED;
+ if (mode->status == MODE_OK && kmode->flags & ~KNOWN_MODE_FLAGS)
+ mode->status = MODE_BAD; /* unknown flags => unhandled */
+
xf86SetModeCrtc (mode, scrn->adjustFlags);
}
@@ -347,7 +352,7 @@ mode_to_kmode(ScrnInfoPtr scrn,
kmode->vtotal = mode->VTotal;
kmode->vscan = mode->VScan;
- kmode->flags = mode->Flags; //& FLAG_BITS;
+ kmode->flags = mode->Flags;
if (mode->name)
strncpy(kmode->name, mode->name, DRM_DISPLAY_MODE_LEN);
kmode->name[DRM_DISPLAY_MODE_LEN-1] = 0;
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index a9c54409..36122e2b 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -51,6 +51,8 @@
#include "intel_options.h"
+#define KNOWN_MODE_FLAGS ((1<<14)-1)
+
#if 0
#define __DBG DBG
#else
@@ -549,7 +551,7 @@ mode_from_kmode(ScrnInfoPtr scrn,
mode->VTotal = kmode->vtotal;
mode->VScan = kmode->vscan;
- mode->Flags = kmode->flags; //& FLAG_BITS;
+ mode->Flags = kmode->flags;
mode->name = strdup(kmode->name);
if (kmode->type & DRM_MODE_TYPE_DRIVER)
@@ -557,6 +559,9 @@ mode_from_kmode(ScrnInfoPtr scrn,
if (kmode->type & DRM_MODE_TYPE_PREFERRED)
mode->type |= M_T_PREFERRED;
+ if (mode->status == MODE_OK && kmode->flags & ~KNOWN_MODE_FLAGS)
+ mode->status = MODE_BAD; /* unknown flags => unhandled */
+
xf86SetModeCrtc (mode, scrn->adjustFlags);
}
@@ -578,7 +583,7 @@ mode_to_kmode(struct drm_mode_modeinfo *kmode, DisplayModePtr mode)
kmode->vtotal = mode->VTotal;
kmode->vscan = mode->VScan;
- kmode->flags = mode->Flags; //& FLAG_BITS;
+ kmode->flags = mode->Flags;
if (mode->name)
strncpy(kmode->name, mode->name, DRM_DISPLAY_MODE_LEN);
kmode->name[DRM_DISPLAY_MODE_LEN-1] = 0;