[PATCH xserver 6/7] modesetting: Adapt xf86HandleColorMaps() for > 24 color depth.

Michel Dänzer michel at daenzer.net
Wed Feb 21 16:33:07 UTC 2018


On 2018-02-20 05:06 AM, Mario Kleiner wrote:
> This retains old behavior for depths <= 24, but allows gamma
> table and colormap updates to work properly at depth 30.
> 
> This needs the xf86Randr12CrtcComputeGamma() fix for depth 30
> from a previous commit to work. Otherwise the server will work,
> but gamma table updates will silently fail, iow. the server
> would always run with a default identity gamma lut.
> 
> Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
> ---
>  hw/xfree86/drivers/modesetting/drmmode_display.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
> index 9c38563..d4c3ca8 100644
> --- a/hw/xfree86/drivers/modesetting/drmmode_display.c
> +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
> @@ -2262,13 +2262,18 @@ drmmode_load_palette(ScrnInfoPtr pScrn, int numColors,
>  Bool
>  drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
>  {
> -    xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0, "Initializing kms color map\n");
> +    xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
> +                   "Initializing kms color map for depth %d, %d bpc.\n",
> +                   pScrn->depth, pScrn->rgbBits);
>      if (!miCreateDefColormap(pScreen))
>          return FALSE;
> -    /* all radeons support 10 bit CLUTs */
> -    if (!xf86HandleColormaps(pScreen, 256, 10, drmmode_load_palette, NULL,
> -                CMAP_PALETTED_TRUECOLOR |
> -                CMAP_RELOAD_ON_MODE_SWITCH))
> +
> +    /* Adapt color map size and depth to color depth of screen. */
> +    if (!xf86HandleColormaps(pScreen,
> +                             (pScrn->rgbBits > 8) ? 1 << pScrn->rgbBits : 256,

Just passing 1 << pScrn->rgbBits should always work here.


> +                             10, drmmode_load_palette, NULL,

BTW, drmmode_load_palette is never called, since
xf86CrtcFuncsRec::gamma_set is always non-NULL; it can be removed.
Doesn't have to be done by this patch, of course.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the xorg-devel mailing list