From 9e42f3bafee919966098e9e127871010c2e709c9 Mon Sep 17 00:00:00 2001 From: JM Ibanez Date: Sun, 15 Apr 2007 05:31:20 +0800 Subject: [PATCH] Bug #10645: Perform pipe selection for XV, based on where clip rect is. Bug #10645 is caused by the XV code using just pipe 0 (A) instead of selecting the pipe based on where the clip rectangle is. The following patch introduces logic that checks where the clip rectangle really is and selects that pipe for display via XVideo. This should also fix #10158. --- src/i830_video.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 62 insertions(+), 0 deletions(-) diff --git a/src/i830_video.c b/src/i830_video.c index d2f9724..aad65f3 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -500,6 +500,68 @@ I830ResetVideo(ScrnInfoPtr pScrn) I830OverlayRegPtr overlay = (I830OverlayRegPtr) (pI830->FbBase + pI830->overlay_regs->offset); + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + int pipe = -1; + + /* + * Following is a hack to determine the pipe based on the clip + * region as defined. It uses the CRTC location to determine + * this. + */ + + /* + * First, check which one is enabled -- favor the enabled one + * only. + */ + if(xf86_config->crtc[0]->enabled + && !xf86_config->crtc[1]->enabled) { + pipe = 0; + } else if(!xf86_config->crtc[0]->enabled + && xf86_config->crtc[1]->enabled) { + pipe = 1; + } else { + int ax = xf86_config->crtc[0]->x; + int ay = xf86_config->crtc[0]->y; + + int bx = xf86_config->crtc[1]->x; + int by = xf86_config->crtc[1]->y; + + /* + * Check if the regions overlap; if they do, set pipe the one on LVDS + */ + if(ax == bx && ay == by) { + int i; + + for (i = 0; i < xf86_config->num_crtc; i++) { + xf86CrtcPtr crtc = xf86_config->crtc[i]; + if(i830PipeHasType(crtc, I830_OUTPUT_LVDS)) { + pipe = i; + } + } + } else { + RegionRec clipReg = pPriv->clip; + + /* + * Resort to checking clip region + */ + if(ax > bx) { + pipe = (clipReg.extents.x1 > ax) ? 0 : 1; + } else if(bx > ax) { + pipe = (clipReg.extents.x1 > bx) ? 1 : 0; + } else if(ay > by) { + pipe = (clipReg.extents.y1 > ay) ? 0 : 1; + } else if(by > ay) { + pipe = (clipReg.extents.y1 > by) ? 1 : 0; + } + } + + } + + if(pipe > -1) + { + pPriv->pipe = pipe; + } + OVERLAY_DEBUG("I830ResetVideo: base: %p, offset: 0x%lx, obase: %p\n", pI830->FbBase, pI830->overlay_regs->offset, overlay); /* -- 1.5.0.5