[PATCH v2 15/15] xfree86/xv: Provide a ModeSet hook

ville.syrjala at nokia.com ville.syrjala at nokia.com
Tue Nov 2 11:06:01 PDT 2010


From: Ville Syrjälä <ville.syrjala at nokia.com>

Reput all ports when the display mode or panning has been changed by
RandR code. This makes the overlays appear in the correct position
on the screen.

Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
---
 hw/xfree86/common/xf86xv.c     |   24 ++++++++++++++++++++++++
 hw/xfree86/common/xf86xvpriv.h |    1 +
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index fb42efb..ee761dd 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -104,6 +104,7 @@ static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
 static Bool xf86XVEnterVT(int, int);
 static void xf86XVLeaveVT(int, int);
 static void xf86XVAdjustFrame(int index, int x, int y, int flags);
+static void xf86XVModeSet(ScrnInfoPtr pScrn);
 
 /* misc */
 
@@ -287,6 +288,7 @@ xf86XVScreenInit(
   ScreenPriv->EnterVT = pScrn->EnterVT;
   ScreenPriv->LeaveVT = pScrn->LeaveVT;
   ScreenPriv->AdjustFrame = pScrn->AdjustFrame;
+  ScreenPriv->ModeSet = pScrn->ModeSet;
 
   pScreen->DestroyWindow = xf86XVDestroyWindow;
   pScreen->WindowExposures = xf86XVWindowExposures;
@@ -295,6 +297,7 @@ xf86XVScreenInit(
   pScrn->LeaveVT = xf86XVLeaveVT;
   if(pScrn->AdjustFrame)
      pScrn->AdjustFrame = xf86XVAdjustFrame;
+  pScrn->ModeSet = xf86XVModeSet;
 
   if(!xf86XVInitAdaptors(pScreen, adaptors, num))
 	return FALSE;
@@ -1244,6 +1247,7 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen)
   pScrn->EnterVT = ScreenPriv->EnterVT;
   pScrn->LeaveVT = ScreenPriv->LeaveVT;
   pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
+  pScrn->ModeSet = ScreenPriv->ModeSet;
 
   for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
        xf86XVFreeAdaptor(pa);
@@ -1339,6 +1343,26 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
   xf86XVReputOrStopAllPorts(pScrn);
 }
 
+static void
+xf86XVModeSet(ScrnInfoPtr pScrn)
+{
+    ScreenPtr pScreen = pScrn->pScreen;
+    XF86XVScreenPtr ScreenPriv;
+
+    /* Can be called before pScrn->pScreen is set */
+    if (!pScreen)
+	return;
+
+    ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+
+    if (ScreenPriv->ModeSet) {
+	pScrn->ModeSet = ScreenPriv->ModeSet;
+	(*pScrn->ModeSet)(pScrn);
+	pScrn->ModeSet = xf86XVModeSet;
+    }
+
+    xf86XVReputOrStopAllPorts(pScrn);
+}
 
 /**** XvAdaptorRec fields ****/
 
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index 3191c4c..88e7a0e 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -44,6 +44,7 @@ typedef struct {
    Bool                         (*EnterVT)(int, int);
    void                         (*LeaveVT)(int, int);
    GCPtr			videoGC;
+   xf86ModeSetProc		*ModeSet;
 } XF86XVScreenRec, *XF86XVScreenPtr;
 
 typedef struct {
-- 
1.7.2.2



More information about the xorg-devel mailing list