[PATCH] xf86: add rgb ordering helper
Aaron Plattner
aplattner at nvidia.com
Thu Jan 26 12:47:36 PST 2012
On 01/26/2012 03:36 AM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> At least the intel, nouveau and radeon driver contain this chunk of code.
vesa, nv, and tegra do too.
They explicitly check for pScrn->bitsPerPixel > 8, but I don't see why any of
the visuals would match the (visual->class | DynamicClass) == DirectColor check
in that case...
> We should move it into the server just for the sake of stopping further cut-n-paste.
Yes.
> Drivers can be adapted to use it later.
>
> Signed-off-by: Dave Airlie<airlied at redhat.com>
Reviewed-by: Aaron Plattner <aplattner at nvidia.com>
> ---
> hw/xfree86/common/xf86.h | 1 +
> hw/xfree86/common/xf86Helper.c | 16 ++++++++++++++++
> 2 files changed, 17 insertions(+), 0 deletions(-)
>
> diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
> index b711f05..00dd229 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 248ccf4..0cfbece 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
>
More information about the xorg-devel
mailing list