diff options
author | Dave Airlie <airlied@gmail.com> | 2012-04-10 15:47:32 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-05-21 12:58:33 +0100 |
commit | 53932b3803fa2c02949fd7d4d0e433ea58fa89f1 (patch) | |
tree | 4f9dc2132848fd021849f94c1693dc81953f361a | |
parent | 39f73e813f7d404498629f6104a9003d092af28d (diff) |
xf86: add helper functions to convert to from ScrnInfoPtr/ScreenPtr (v2)
These are just simple functions that we should start migrating drivers
to using.
The end goal is to remove xf86Screens and screenInfo from the ABI.
This includes a define XF86_HAS_SCRN_CONV that drivers can ifdef to provide
their own copies. I'll probably post a generic compat.h file for drivers later.
v2: add asserts.
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | hw/xfree86/common/xf86.h | 7 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Helper.c | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index e6d41d64b..ef99106e5 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h | |||
@@ -449,6 +449,13 @@ xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, | |||
449 | extern _X_EXPORT Bool | 449 | extern _X_EXPORT Bool |
450 | VidModeExtensionInit(ScreenPtr pScreen); | 450 | VidModeExtensionInit(ScreenPtr pScreen); |
451 | 451 | ||
452 | /* convert ScreenPtr to ScrnInfoPtr */ | ||
453 | extern _X_EXPORT ScrnInfoPtr xf86ScreenToScrn(ScreenPtr pScreen); | ||
454 | /* convert ScrnInfoPtr to ScreenPtr */ | ||
455 | extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn); | ||
456 | |||
452 | #endif /* _NO_XF86_PROTOTYPES */ | 457 | #endif /* _NO_XF86_PROTOTYPES */ |
453 | 458 | ||
459 | #define XF86_HAS_SCRN_CONV 1 /* define for drivers to use in api compat */ | ||
460 | |||
454 | #endif /* _XF86_H */ | 461 | #endif /* _XF86_H */ |
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 8c948cf6f..6834a0cb7 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c | |||
@@ -1834,3 +1834,17 @@ xf86MotionHistoryAllocate(InputInfoPtr pInfo) | |||
1834 | { | 1834 | { |
1835 | AllocateMotionHistory(pInfo->dev); | 1835 | AllocateMotionHistory(pInfo->dev); |
1836 | } | 1836 | } |
1837 | |||
1838 | ScrnInfoPtr | ||
1839 | xf86ScreenToScrn(ScreenPtr pScreen) | ||
1840 | { | ||
1841 | assert(pScreen->myNum < xf86NumScreens); | ||
1842 | return xf86Screens[pScreen->myNum]; | ||
1843 | } | ||
1844 | |||
1845 | ScreenPtr | ||
1846 | xf86ScrnToScreen(ScrnInfoPtr pScrn) | ||
1847 | { | ||
1848 | assert(pScrn->scrnIndex < screenInfo.numScreens); | ||
1849 | return screenInfo.screens[pScrn->scrnIndex]; | ||
1850 | } | ||