summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-01-26 11:35:49 +0000
committerDave Airlie <airlied@redhat.com>2012-01-26 11:37:38 +0000
commitdc23959c94fbba9928b0e4a14ae38d9fb60f595f (patch)
treeffef01e73b473080490ee43e41e9947529cdebaa /hw
parentf442fd39fd167622676c5006a36e31a55372f459 (diff)
xf86: add rgb ordering helper
At least the intel, nouveau and radeon driver contain this chunk of code. We should move it into the server just for the sake of stopping further cut-n-paste. Drivers can be adapted to use it later. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/common/xf86.h1
-rw-r--r--hw/xfree86/common/xf86Helper.c16
2 files changed, 17 insertions, 0 deletions
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index b711f0555..00dd2297b 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -227,6 +227,7 @@ extern _X_EXPORT Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int
extern _X_EXPORT void xf86PrintDepthBpp(ScrnInfoPtr scrp);
extern _X_EXPORT Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask);
extern _X_EXPORT Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual);
+extern _X_EXPORT void xf86FixupRGBOrdering(ScrnInfoPtr scrn, ScreenPtr screen);
extern _X_EXPORT Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma);
extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen);
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 248ccf47e..0cfbece82 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -808,6 +808,22 @@ xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual)
}
}
+void xf86FixupRGBOrdering(ScrnInfoPtr scrn, ScreenPtr screen)
+{
+ VisualPtr visual;
+ visual = screen->visuals + screen->numVisuals;
+ while (--visual >= screen->visuals) {
+ if ((visual->class | DynamicClass) == DirectColor) {
+ visual->offsetRed = scrn->offset.red;
+ visual->offsetGreen = scrn->offset.green;
+ visual->offsetBlue = scrn->offset.blue;
+ visual->redMask = scrn->mask.red;
+ visual->greenMask = scrn->mask.green;
+ visual->blueMask = scrn->mask.blue;
+ }
+ }
+}
+
#define TEST_GAMMA(g) \
(g).red > GAMMA_ZERO || (g).green > GAMMA_ZERO || (g).blue > GAMMA_ZERO