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_ */