Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH xf86-video-intel] sna/uxa: Fix colormap handling at screen depth 30. (v2)
Date: Mon, 15 Oct 2018 19:21:39 +0300	[thread overview]
Message-ID: <20181015162139.GC9144@intel.com> (raw)
In-Reply-To: <1528820435-2732-2-git-send-email-mario.kleiner.de@gmail.com>

On Tue, Jun 12, 2018 at 06:20:35PM +0200, Mario Kleiner wrote:
> The various clut handling functions like a setup
> consistent with the x-screen color depth. Otherwise
> we observe improper sampling in the gamma tables
> at depth 30.
> 
> Therefore replace hard-coded bitsPerRGB = 8 by actual
> bits per channel scrn->rgbBits. Also use this for call
> to xf86HandleColormaps().
> 
> Tested for uxa and sna at depths 8, 16, 24 and 30 on
> IvyBridge, and tested at depth 24 and 30 that xgamma
> and gamma table animations work, and with measurement
> equipment to make sure identity gamma ramps actually
> are identity mappings at the output.
> 
> v2: Also deal with X-Server 1.19 and earlier, which as of
>     v1.19.6 lack a fix to color palette handling and can
>     not deal with depths/bpc > 24/8 bpc. On < 1.20 we skip
>     xf86HandleColormaps() setup at > 8 bpc. This disables
>     color palette handling on such servers at > 8 bpc, but
>     still keeps RandR gamma table handling intact.
> 
>     Tested on 1.19.6 and 1.20.0 to do the right thing.
> 
> Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>

Forgot this didn't get applied. It did make sense to me at the
time when I was looking at the explosions with depth 30.
Still seems to do the trick on 1.19, and redshit still works
so

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  src/sna/sna_driver.c   | 9 ++++++---
>  src/uxa/intel_driver.c | 6 +++++-
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
> index 2007e354..8c79d43b 100644
> --- a/src/sna/sna_driver.c
> +++ b/src/sna/sna_driver.c
> @@ -1152,7 +1152,7 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL)
>  	if (!miInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
>  			   &defaultVisual,
>  			   ((unsigned long)1 << (scrn->bitsPerPixel - 1)),
> -			   8, -1))
> +			   scrn->rgbBits, -1))
>  		return FALSE;
>  
>  	if (!miScreenInit(screen, NULL,
> @@ -1223,8 +1223,11 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL)
>  	if (!miCreateDefColormap(screen))
>  		return FALSE;
>  
> -	if (sna->mode.num_real_crtc &&
> -	    !xf86HandleColormaps(screen, 256, 8, sna_load_palette, NULL,
> +	/* X-Server < 1.20 mishandles > 256 slots / > 8 bpc color maps. */
> +	if (sna->mode.num_real_crtc && (scrn->rgbBits <= 8 ||
> +	    XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,20,0,0,0)) &&
> +	    !xf86HandleColormaps(screen, 1 << scrn->rgbBits, scrn->rgbBits,
> +				 sna_load_palette, NULL,
>  				 CMAP_RELOAD_ON_MODE_SWITCH |
>  				 CMAP_PALETTED_TRUECOLOR))
>  		return FALSE;
> diff --git a/src/uxa/intel_driver.c b/src/uxa/intel_driver.c
> index 3703c412..77c0dc00 100644
> --- a/src/uxa/intel_driver.c
> +++ b/src/uxa/intel_driver.c
> @@ -991,7 +991,11 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
>  	if (!miCreateDefColormap(screen))
>  		return FALSE;
>  
> -	if (!xf86HandleColormaps(screen, 256, 8, I830LoadPalette, NULL,
> +	/* X-Server < 1.20 mishandles > 256 slots / > 8 bpc color maps. */
> +	if ((scrn->rgbBits <= 8 ||
> +	    XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,20,0,0,0)) &&
> +	    !xf86HandleColormaps(screen, 1 << scrn->rgbBits, scrn->rgbBits,
> +				 I830LoadPalette, NULL,
>  				 CMAP_RELOAD_ON_MODE_SWITCH |
>  				 CMAP_PALETTED_TRUECOLOR)) {
>  		return FALSE;
> -- 
> 2.17.1

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-10-15 16:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12 16:20 Depth 30 colormap handling fixes for servers 1.20+ and < 1.20 Mario Kleiner
2018-06-12 16:20 ` [PATCH xf86-video-intel] sna/uxa: Fix colormap handling at screen depth 30. (v2) Mario Kleiner
2018-10-15 16:21   ` Ville Syrjälä [this message]
2019-01-20 19:45     ` Mario Kleiner
2019-01-21  7:58       ` Chris Wilson
2019-01-21 14:54       ` Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181015162139.GC9144@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mario.kleiner.de@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox