summaryrefslogtreecommitdiff
path: root/src/sna
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-04-07 21:55:13 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-04-07 21:57:00 +0100
commit59d371a9b215fdcd6139279435af7e1f6803309e (patch)
treea55b8413ad53e09cfcb14cbbafab80629a627542 /src/sna
parent28e3bdd7584c5c5a441f19d5cda64024a9cebf5c (diff)
sna: Don't limit CRTC id
Don't bake in the assumption that the CRTCs will always be allocated in the low byte of the identifiers range. It is only used in a pair of other functions (Xv plane updates), so not a big deal. Reported-by: Mark Kettenis <kettenis@openbsd.org> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r--src/sna/sna.h7
-rw-r--r--src/sna/sna_display.c11
2 files changed, 10 insertions, 8 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index c9612b42..664308f2 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -617,6 +617,8 @@ extern bool sna_crtc_is_transformed(xf86CrtcPtr crtc);
#define CRTC_VBLANK 0x3
#define CRTC_ON 0x80000000
+uint32_t sna_crtc_id(xf86CrtcPtr crtc);
+
static inline unsigned long *sna_crtc_flags(xf86CrtcPtr crtc)
{
unsigned long *flags = crtc->driver_private;
@@ -629,11 +631,6 @@ static inline unsigned sna_crtc_pipe(xf86CrtcPtr crtc)
return *sna_crtc_flags(crtc) >> 8 & 0xff;
}
-static inline unsigned sna_crtc_id(xf86CrtcPtr crtc)
-{
- return *sna_crtc_flags(crtc) >> 16 & 0xff;
-}
-
static inline bool sna_crtc_is_on(xf86CrtcPtr crtc)
{
return *sna_crtc_flags(crtc) & CRTC_ON;
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 6d1d4461..dd1466c2 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -192,6 +192,7 @@ struct sna_cursor {
struct sna_crtc {
unsigned long flags;
+ uint32_t id;
xf86CrtcPtr base;
struct drm_mode_modeinfo kmode;
PixmapPtr slave_pixmap;
@@ -414,7 +415,12 @@ static inline unsigned __sna_crtc_pipe(struct sna_crtc *crtc)
static inline unsigned __sna_crtc_id(struct sna_crtc *crtc)
{
- return crtc->flags >> 16 & 0xff;
+ return crtc->id;
+}
+
+uint32_t sna_crtc_id(xf86CrtcPtr crtc)
+{
+ return __sna_crtc_id(to_sna_crtc(crtc));
}
static inline bool event_pending(int fd)
@@ -3260,8 +3266,7 @@ sna_crtc_add(ScrnInfoPtr scrn, unsigned id)
if (sna_crtc == NULL)
return false;
- assert(id < 256);
- sna_crtc->flags = id << 16;
+ sna_crtc->id = id;
VG_CLEAR(get_pipe);
get_pipe.pipe = 0;