[PATCH v2 14/15] xfree86/modes: Provide a ModeSet hook in ScrnInfo

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


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

Add a new hook ModeSet that will be called after display mode is
changed, or after the display has been panned.

Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
---
v1->v2: ModeSet hook now also called from xf86DisableUnusedFunctions()

 hw/xfree86/common/xf86str.h |    4 +++-
 hw/xfree86/modes/xf86Crtc.c |    8 ++++++++
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index c9b261d..6c8950a 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -504,7 +504,7 @@ typedef struct _confdrirec {
 /* These values should be adjusted when new fields are added to ScrnInfoRec */
 #define NUM_RESERVED_INTS		16
 #define NUM_RESERVED_POINTERS		14
-#define NUM_RESERVED_FUNCS		11
+#define NUM_RESERVED_FUNCS		10
 
 typedef pointer (*funcPointer)(void);
 
@@ -658,6 +658,7 @@ typedef Bool xf86PMEventProc              (int, pmEvent, Bool);
 typedef void xf86DPMSSetProc		  (ScrnInfoPtr, int, int);
 typedef void xf86LoadPaletteProc   (ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
 typedef void xf86SetOverscanProc          (ScrnInfoPtr, int);
+typedef void xf86ModeSetProc              (ScrnInfoPtr);
 
 
 /*
@@ -809,6 +810,7 @@ typedef struct _ScrnInfoRec {
     xf86LoadPaletteProc			*LoadPalette;
     xf86SetOverscanProc			*SetOverscan;
     xorgDriverFuncProc			*DriverFunc;
+    xf86ModeSetProc			*ModeSet;
 
     /*
      * This can be used when the minor ABI version is incremented.
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 7f6fad3..e198642 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -371,6 +371,8 @@ done:
 	crtc->active = TRUE;
 	if (scrn->pScreen)
 	    xf86CrtcSetScreenSubpixelOrder (scrn->pScreen);
+	if (scrn->ModeSet)
+	    scrn->ModeSet(scrn);
     } else {
 	crtc->x = saved_x;
 	crtc->y = saved_y;
@@ -407,12 +409,16 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
 void
 xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y)
 {
+    ScrnInfoPtr scrn = crtc->scrn;
+
     crtc->x = x;
     crtc->y = y;
     if (crtc->funcs->set_origin) {
 	if (!xf86CrtcRotate (crtc))
 	    return;
 	crtc->funcs->set_origin (crtc, x, y);
+	if (scrn->ModeSet)
+	    scrn->ModeSet(scrn);
     }
     else
 	xf86CrtcSetMode (crtc, &crtc->mode, crtc->rotation, x, y);
@@ -2891,6 +2897,8 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
     }
     if (pScrn->pScreen)
 	xf86_crtc_notify(pScrn->pScreen);
+    if (pScrn->ModeSet)
+	pScrn->ModeSet(pScrn);
 }
 
 #ifdef RANDR_12_INTERFACE
-- 
1.7.2.2



More information about the xorg-devel mailing list