summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-11-04 00:10:08 -0800
committerKeith Packard <keithp@keithp.com>2008-11-24 13:24:35 -0800
commit9c7ac47b871a71e42d2f6933749ca462f1a65b40 (patch)
treea7909a89698952e148c8cdbc5dceab674dc2b522
parent554592cd70543f87cd8bee5ff47cc8281511e041 (diff)
Notify DRI when crtc regions change
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 hook in the mode setting code that is invoked whenever any configuration is done to the screen. Use this new hook in the DRI code so that DRI clients are notified and receive updated information. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--hw/xfree86/dri/Makefile.am5
-rw-r--r--hw/xfree86/dri/dri.c19
-rw-r--r--hw/xfree86/dri/dristruct.h2
-rw-r--r--hw/xfree86/loader/xf86sym.c3
-rw-r--r--hw/xfree86/modes/xf86Crtc.c33
-rw-r--r--hw/xfree86/modes/xf86Crtc.h14
6 files changed, 76 insertions, 0 deletions
diff --git a/hw/xfree86/dri/Makefile.am b/hw/xfree86/dri/Makefile.am
index e17cea7fd..3ec30beec 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 37136590b..1a3e09111 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -302,6 +302,18 @@ DRIOpenDRMMaster(ScrnInfoPtr pScrn,
return FALSE;
}
+static void
+DRIClipNotifyAllDrawables(ScreenPtr pScreen);
+
+static void
+dri_crtc_notify(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIClipNotifyAllDrawables(pScreen);
+ xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify);
+ xf86_crtc_notify(pScreen);
+ pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen, dri_crtc_notify);
+}
Bool
DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
@@ -605,6 +617,9 @@ DRIFinishScreenInit(ScreenPtr pScreen)
pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DRIDestroyWindow;
+ pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen,
+ dri_crtc_notify);
+
if (pDRIInfo->wrap.CopyWindow) {
pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = pDRIInfo->wrap.CopyWindow;
@@ -658,6 +673,9 @@ DRICloseScreen(ScreenPtr pScreen)
pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
pDRIPriv->DestroyWindow = NULL;
}
+
+ xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify);
+
if (pDRIInfo->wrap.CopyWindow) {
pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow;
pDRIPriv->wrap.CopyWindow = NULL;
@@ -671,6 +689,7 @@ DRICloseScreen(ScreenPtr pScreen)
pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame;
pDRIPriv->wrap.AdjustFrame = NULL;
}
+
pDRIPriv->wrapped = FALSE;
}
diff --git a/hw/xfree86/dri/dristruct.h b/hw/xfree86/dri/dristruct.h
index ae970d834..fc929c2f9 100644
--- a/hw/xfree86/dri/dristruct.h
+++ b/hw/xfree86/dri/dristruct.h
@@ -35,6 +35,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define DRI_STRUCT_H
#include "xf86drm.h"
+#include "xf86Crtc.h"
#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
@@ -106,6 +107,7 @@ typedef struct _DRIScreenPrivRec
XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */
int* pLockRefCount;
int* pLockingContext;
+ xf86_crtc_notify_proc_ptr xf86_crtc_notify;
} DRIScreenPrivRec, *DRIScreenPrivPtr;
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index f2b7e93ec..234635600 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -914,6 +914,9 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86_hide_cursors)
SYMFUNC(xf86_cursors_fini)
SYMFUNC(xf86_crtc_clip_video_helper)
+ SYMFUNC(xf86_wrap_crtc_notify)
+ SYMFUNC(xf86_unwrap_crtc_notify)
+ SYMFUNC(xf86_crtc_notify)
SYMFUNC(xf86DoEDID_DDC1)
SYMFUNC(xf86DoEDID_DDC2)
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 251b80073..a71f5c756 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2609,6 +2609,8 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
memset(&crtc->mode, 0, sizeof(crtc->mode));
}
}
+ if (pScrn->pScreen)
+ xf86_crtc_notify(pScrn->pScreen);
}
#ifdef RANDR_12_INTERFACE
@@ -2863,3 +2865,34 @@ xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
return ret;
}
+
+xf86_crtc_notify_proc_ptr
+xf86_wrap_crtc_notify (ScreenPtr screen, xf86_crtc_notify_proc_ptr new)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86_crtc_notify_proc_ptr old;
+
+ old = config->xf86_crtc_notify;
+ config->xf86_crtc_notify = new;
+ return old;
+}
+
+void
+xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ config->xf86_crtc_notify = old;
+}
+
+void
+xf86_crtc_notify(ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (config->xf86_crtc_notify)
+ config->xf86_crtc_notify(screen);
+}
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 83b1f13e8..ef8589ed1 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -569,6 +569,8 @@ typedef struct _xf86CrtcConfigFuncs {
int height);
} xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr;
+typedef void (*xf86_crtc_notify_proc_ptr) (ScreenPtr pScreen);
+
typedef struct _xf86CrtcConfig {
int num_output;
xf86OutputPtr *output;
@@ -621,6 +623,9 @@ typedef struct _xf86CrtcConfig {
/* wrap screen BlockHandler for rotation */
ScreenBlockHandlerProcPtr BlockHandler;
+ /* callback when crtc configuration changes */
+ xf86_crtc_notify_proc_ptr xf86_crtc_notify;
+
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
extern int xf86CrtcConfigPrivateIndex;
@@ -838,4 +843,13 @@ xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
INT32 width,
INT32 height);
+xf86_crtc_notify_proc_ptr
+xf86_wrap_crtc_notify (ScreenPtr pScreen, xf86_crtc_notify_proc_ptr new);
+
+void
+xf86_unwrap_crtc_notify(ScreenPtr pScreen, xf86_crtc_notify_proc_ptr old);
+
+void
+xf86_crtc_notify(ScreenPtr pScreen);
+
#endif /* _XF86CRTC_H_ */