diff options
author | Carl Worth <cworth@cworth.org> | 2009-04-29 14:43:56 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-05-14 17:01:53 -0700 |
commit | 128c1c3b7d57b157604788f82bf9fd389839068f (patch) | |
tree | 0c2b2d9ed8073dc3d8ecc0864bdb3ae212382905 | |
parent | 2572fcc6196aff7a2f1095d211fd85d8668647ca (diff) |
Use libdrm to lookup pipe for tear-free sync of XV
Previously, the code was trying to examine a driver_private field,
but those fields are only set by the userland-modesetting code so
would fail in the case of KMS. This fixes bug #21076:
[945GME] [KMS] XV_SYNC_TO_VBLANK does not prevent tearing of xv video
https://bugs.freedesktop.org/show_bug.cgi?id=21076
-rw-r--r-- | src/drmmode_display.c | 8 | ||||
-rw-r--r-- | src/i830.h | 1 | ||||
-rw-r--r-- | src/i830_video.c | 20 |
3 files changed, 22 insertions, 7 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 15ffc29c..7df7b6fb 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -920,3 +920,11 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp) return TRUE; } + +int +drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr crtc) +{ + drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; + + return drm_intel_get_pipe_from_crtc_id (bufmgr, drmmode_crtc->mode_crtc->crtc_id); +} @@ -679,6 +679,7 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen); void I830DRI2CloseScreen(ScreenPtr pScreen); extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp); +extern int drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr crtc); extern Bool I830AccelInit(ScreenPtr pScreen); extern void I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, diff --git a/src/i830_video.c b/src/i830_video.c index 1e05e9c0..64cea040 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -2495,15 +2495,21 @@ I830PutImage(ScrnInfoPtr pScrn, if (sync) { BoxPtr box; int y1, y2; - int event, pipe; - I830CrtcPrivatePtr intel_crtc = crtc->driver_private; + int pipe, event, load_scan_lines_pipe; - if (intel_crtc->pipe == 0) { + if (pI830->use_drm_mode) + pipe = drmmode_get_pipe_from_crtc_id(pI830->bufmgr, crtc); + else { + I830CrtcPrivatePtr intel_crtc = crtc->driver_private; + pipe = intel_crtc->pipe; + } + + if (pipe == 0) { event = MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW; - pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA; + load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA; } else { event = MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW; - pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB; + load_scan_lines_pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB; } box = REGION_EXTENTS(unused, clipBoxes); @@ -2513,9 +2519,9 @@ I830PutImage(ScrnInfoPtr pScrn, BEGIN_BATCH(5); /* The documentation says that the LOAD_SCAN_LINES command * always comes in pairs. Don't ask me why. */ - OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | pipe); + OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe); OUT_BATCH((y1 << 16) | y2); - OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | pipe); + OUT_BATCH(MI_LOAD_SCAN_LINES_INCL | load_scan_lines_pipe); OUT_BATCH((y1 << 16) | y2); OUT_BATCH(MI_WAIT_FOR_EVENT | event); ADVANCE_BATCH(); |