diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-04-17 23:45:20 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-04-18 12:37:42 +0100 |
commit | 7eaf593640d4479f850227252fd793bcb55be8d3 (patch) | |
tree | 7479780f4bd8c4125135d87c3bec25cde5cdcf8d /src/sna/sna.h | |
parent | 75d87762471e195dddd73056fc6a06e17db1c8b0 (diff) |
sna/present: Reuse last cached swap msc/ust during a flip chain
Querying the known swap values is much slower than not!
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna.h')
-rw-r--r-- | src/sna/sna.h | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index 51533995..e51ee14f 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -591,13 +591,51 @@ static inline void sna_present_vblank_handler(struct drm_event_vblank *event) { #endif extern bool sna_crtc_set_sprite_rotation(xf86CrtcPtr crtc, uint32_t rotation); -extern int sna_crtc_to_pipe(xf86CrtcPtr crtc); -extern int sna_crtc_to_pipe__safe(xf86CrtcPtr crtc); extern uint32_t sna_crtc_to_sprite(xf86CrtcPtr crtc); -extern uint32_t sna_crtc_id(xf86CrtcPtr crtc); -extern bool sna_crtc_is_on(xf86CrtcPtr crtc); extern bool sna_crtc_is_transformed(xf86CrtcPtr crtc); +#define CRTC_VBLANK 0x3 +#define CRTC_ON 0x80000000 + +static inline unsigned long *sna_crtc_flags(xf86CrtcPtr crtc) +{ + unsigned long *flags = crtc->driver_private; + assert(flags); + return flags; +} + +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; +} + +static inline void sna_crtc_set_vblank(xf86CrtcPtr crtc) +{ + assert((*sna_crtc_flags(crtc) & CRTC_VBLANK) < 2); + ++*sna_crtc_flags(crtc); +} + +static inline void sna_crtc_clear_vblank(xf86CrtcPtr crtc) +{ + assert(*sna_crtc_flags(crtc) & CRTC_VBLANK); + --*sna_crtc_flags(crtc); +} + +static inline bool sna_crtc_has_vblank(xf86CrtcPtr crtc) +{ + return *sna_crtc_flags(crtc) & CRTC_VBLANK; +} + CARD32 sna_format_for_depth(int depth); CARD32 sna_render_format_for_depth(int depth); |