Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Depth 30 colormap handling fixes for servers 1.20+ and < 1.20
@ 2018-06-12 16:20 Mario Kleiner
  2018-06-12 16:20 ` [PATCH xf86-video-intel] sna/uxa: Fix colormap handling at screen depth 30. (v2) Mario Kleiner
  0 siblings, 1 reply; 6+ messages in thread
From: Mario Kleiner @ 2018-06-12 16:20 UTC (permalink / raw)
  To: intel-gfx

Hi,

finally here's an updated patch that for depth 30 now works on both
Server 1.20 with the full colormap + gamma table handling, and for
servers < 1.20 with the RandR gamma tables working fine and the colormap
processing skipped.

This one successfully tested on sna and uxa with both server 1.20.0 and
server 1.19.6.

I assume this one will be replaced by Ville's ddx+kmswork anyway soonish,
but until that is done, this one keeps things at least testable without
crashes and other problems. I use it with my own intel-kms 10 bit lut poc
hacks for measurements and to test that Mesa's depth 30 stuff doesn't
break.

Thanks,
-mario

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH xf86-video-intel] sna/uxa: Fix colormap handling at screen depth 30. (v2)
  2018-06-12 16:20 Depth 30 colormap handling fixes for servers 1.20+ and < 1.20 Mario Kleiner
@ 2018-06-12 16:20 ` Mario Kleiner
  2018-10-15 16:21   ` Ville Syrjälä
  0 siblings, 1 reply; 6+ messages in thread
From: Mario Kleiner @ 2018-06-12 16:20 UTC (permalink / raw)
  To: intel-gfx

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>
---
 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

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH xf86-video-intel] sna/uxa: Fix colormap handling at screen depth 30. (v2)
  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ä
  2019-01-20 19:45     ` Mario Kleiner
  0 siblings, 1 reply; 6+ messages in thread
From: Ville Syrjälä @ 2018-10-15 16:21 UTC (permalink / raw)
  To: Mario Kleiner; +Cc: intel-gfx

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH xf86-video-intel] sna/uxa: Fix colormap handling at screen depth 30. (v2)
  2018-10-15 16:21   ` Ville Syrjälä
@ 2019-01-20 19:45     ` Mario Kleiner
  2019-01-21  7:58       ` Chris Wilson
  2019-01-21 14:54       ` Ville Syrjälä
  0 siblings, 2 replies; 6+ messages in thread
From: Mario Kleiner @ 2019-01-20 19:45 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 4372 bytes --]

On Mon, Oct 15, 2018 at 6:21 PM Ville Syrjälä <ville.syrjala@linux.intel.com>
wrote:

> 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>
>
>
Thanks Ville!

Now it just needs to get merged, please. Chris?

One last missing piece is support for 1024 slot gamma tables in i965-kms,
or gamma table bypass for such high bit depth framebuffers to make them
actually useful. Ville, i think you mentioned working on that around spring
last year?

Thanks,
-mario

> ---
> >  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
>

[-- Attachment #1.2: Type: text/html, Size: 5870 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH xf86-video-intel] sna/uxa: Fix colormap handling at screen depth 30. (v2)
  2019-01-20 19:45     ` Mario Kleiner
@ 2019-01-21  7:58       ` Chris Wilson
  2019-01-21 14:54       ` Ville Syrjälä
  1 sibling, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2019-01-21  7:58 UTC (permalink / raw)
  To: Ville Syrjälä, Mario Kleiner; +Cc: intel-gfx

Quoting Mario Kleiner (2019-01-20 19:45:18)
> On Mon, Oct 15, 2018 at 6:21 PM Ville Syrjälä <ville.syrjala@linux.intel.com>
> wrote:
> 
>     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>
> 
> 
> 
> Thanks Ville!
> 
> Now it just needs to get merged, please. Chris?

Pushed, thanks for the reminder.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH xf86-video-intel] sna/uxa: Fix colormap handling at screen depth 30. (v2)
  2019-01-20 19:45     ` Mario Kleiner
  2019-01-21  7:58       ` Chris Wilson
@ 2019-01-21 14:54       ` Ville Syrjälä
  1 sibling, 0 replies; 6+ messages in thread
From: Ville Syrjälä @ 2019-01-21 14:54 UTC (permalink / raw)
  To: Mario Kleiner; +Cc: intel-gfx

On Sun, Jan 20, 2019 at 08:45:18PM +0100, Mario Kleiner wrote:
> On Mon, Oct 15, 2018 at 6:21 PM Ville Syrjälä <ville.syrjala@linux.intel.com>
> wrote:
> 
> > 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>
> >
> >
> Thanks Ville!
> 
> Now it just needs to get merged, please. Chris?
> 
> One last missing piece is support for 1024 slot gamma tables in i965-kms,
> or gamma table bypass for such high bit depth framebuffers to make them
> actually useful. Ville, i think you mentioned working on that around spring
> last year?

Kernel bits for gamma table bypass are on the list:
https://patchwork.freedesktop.org/series/55081/

Apart from that I've not had any real time to work on it.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-01-21 14:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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ä
2019-01-20 19:45     ` Mario Kleiner
2019-01-21  7:58       ` Chris Wilson
2019-01-21 14:54       ` Ville Syrjälä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox