[PATCH] Notify DRI when crtc regions change

Keith Packard keithp at keithp.com
Tue Nov 4 02:07:35 PST 2008


Drivers that care about crtc positions on the screen to ensure that
vblank works correctly need to be notified when crtcs are changed. Provide a
dri-specific hook in the mode setting code that is invoked whenever any
configuration is done to the screen so that DRI clients are notified and
receive updated information.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 hw/xfree86/dri/Makefile.am  |    5 +++++
 hw/xfree86/dri/dri.c        |    5 +++++
 hw/xfree86/loader/xf86sym.c |    1 +
 hw/xfree86/modes/xf86Crtc.c |   10 ++++++++++
 hw/xfree86/modes/xf86Crtc.h |    3 +++
 5 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/dri/Makefile.am b/hw/xfree86/dri/Makefile.am
index e17cea7..3ec30be 100644
--- a/hw/xfree86/dri/Makefile.am
+++ b/hw/xfree86/dri/Makefile.am
@@ -1,6 +1,11 @@
 libdri_la_LTLIBRARIES = libdri.la
 libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
                    -I$(top_srcdir)/hw/xfree86/os-support \
+                   -I$(top_srcdir)/hw/xfree86/modes \
+                   -I$(top_srcdir)/hw/xfree86/ddc \
+                   -I$(top_srcdir)/hw/xfree86/i2c \
+                   -I$(top_srcdir)/hw/xfree86/parser \
+                   -I$(top_srcdir)/hw/xfree86/ramdac \
                    -I$(top_srcdir)/hw/xfree86/os-support/bus \
                    -I$(top_srcdir)/glx \
                    -I$(top_srcdir)/GL/include \
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 3713659..13468dd 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -71,6 +71,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "mipointer.h"
 #include "xf86_OSproc.h"
 #include "inputstr.h"
+#include "xf86Crtc.h"
 
 #define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
 
@@ -302,6 +303,8 @@ DRIOpenDRMMaster(ScrnInfoPtr pScrn,
     return FALSE;
 }
 
+static void
+DRIClipNotifyAllDrawables(ScreenPtr pScreen);
 
 Bool
 DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
@@ -579,6 +582,8 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
 	break;
     }
 
+    xf86_set_dri_crtc_notify_hook(DRIClipNotifyAllDrawables);
+
     return TRUE;
 }
 
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 4891be2..7569fd6 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -914,6 +914,7 @@ _X_HIDDEN void *xfree86LookupTab[] = {
     SYMFUNC(xf86_hide_cursors)
     SYMFUNC(xf86_cursors_fini)
     SYMFUNC(xf86_crtc_clip_video_helper)
+    SYMFUNC(xf86_set_dri_crtc_notify_hook)
 
     SYMFUNC(xf86DoEDID_DDC1)
     SYMFUNC(xf86DoEDID_DDC2)
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index df47598..0ae1e4d 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2545,6 +2545,14 @@ xf86SaveScreen(ScreenPtr pScreen, int mode)
     return TRUE;
 }
 
+static void (*dri_crtc_notify_hook) (ScreenPtr pScreen);
+
+_X_EXPORT void
+xf86_set_dri_crtc_notify_hook (void (*hook) (ScreenPtr pScreen))
+{
+    dri_crtc_notify_hook = hook;
+}
+
 /**
  * Disable all inactive crtcs and outputs
  */
@@ -2571,6 +2579,8 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
 	    memset(&crtc->mode, 0, sizeof(crtc->mode));
 	}
     }
+    if (dri_crtc_notify_hook && pScrn->pScreen)
+	dri_crtc_notify_hook (pScrn->pScreen);
 }
 
 #ifdef RANDR_12_INTERFACE
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 83b1f13..0ed6768 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -722,6 +722,9 @@ Bool
 xf86SaveScreen(ScreenPtr pScreen, int mode);
 
 void
+xf86_set_dri_crtc_notify_hook (void (*hook) (ScreenPtr pScreen));
+    
+void
 xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
 
 DisplayModePtr
-- 
1.5.6.5




More information about the xorg mailing list