diff mbox

[xf86-video-intel] sna/uxa: Fix colormap handling at screen depth 30. (v2)

Message ID 1528820435-2732-2-git-send-email-mario.kleiner.de@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mario Kleiner June 12, 2018, 4:20 p.m. UTC
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(-)

Comments

Ville Syrjälä Oct. 15, 2018, 4:21 p.m. UTC | #1
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
Mario Kleiner Jan. 20, 2019, 7:45 p.m. UTC | #2
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
>
<div dir="ltr"><div dir="ltr">On Mon, Oct 15, 2018 at 6:21 PM Ville Syrjälä &lt;<a href="mailto:ville.syrjala@linux.intel.com">ville.syrjala@linux.intel.com</a>&gt; wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, Jun 12, 2018 at 06:20:35PM +0200, Mario Kleiner wrote:<br>
&gt; The various clut handling functions like a setup<br>
&gt; consistent with the x-screen color depth. Otherwise<br>
&gt; we observe improper sampling in the gamma tables<br>
&gt; at depth 30.<br>
&gt; <br>
&gt; Therefore replace hard-coded bitsPerRGB = 8 by actual<br>
&gt; bits per channel scrn-&gt;rgbBits. Also use this for call<br>
&gt; to xf86HandleColormaps().<br>
&gt; <br>
&gt; Tested for uxa and sna at depths 8, 16, 24 and 30 on<br>
&gt; IvyBridge, and tested at depth 24 and 30 that xgamma<br>
&gt; and gamma table animations work, and with measurement<br>
&gt; equipment to make sure identity gamma ramps actually<br>
&gt; are identity mappings at the output.<br>
&gt; <br>
&gt; v2: Also deal with X-Server 1.19 and earlier, which as of<br>
&gt;     v1.19.6 lack a fix to color palette handling and can<br>
&gt;     not deal with depths/bpc &gt; 24/8 bpc. On &lt; 1.20 we skip<br>
&gt;     xf86HandleColormaps() setup at &gt; 8 bpc. This disables<br>
&gt;     color palette handling on such servers at &gt; 8 bpc, but<br>
&gt;     still keeps RandR gamma table handling intact.<br>
&gt; <br>
&gt;     Tested on 1.19.6 and 1.20.0 to do the right thing.<br>
&gt; <br>
&gt; Signed-off-by: Mario Kleiner &lt;<a href="mailto:mario.kleiner.de@gmail.com" target="_blank">mario.kleiner.de@gmail.com</a>&gt;<br>
<br>
Forgot this didn&#39;t get applied. It did make sense to me at the<br>
time when I was looking at the explosions with depth 30.<br>
Still seems to do the trick on 1.19, and redshit still works<br>
so<br>
<br>
Reviewed-by: Ville Syrjälä &lt;<a href="mailto:ville.syrjala@linux.intel.com" target="_blank">ville.syrjala@linux.intel.com</a>&gt;<br>
<br></blockquote><div><br></div><div>Thanks Ville!</div><div><br></div><div>Now it just needs to get merged, please. Chris?<br></div><div><br></div><div>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?<br></div><div><br></div><div>Thanks,</div><div>-mario</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt; ---<br>
&gt;  src/sna/sna_driver.c   | 9 ++++++---<br>
&gt;  src/uxa/intel_driver.c | 6 +++++-<br>
&gt;  2 files changed, 11 insertions(+), 4 deletions(-)<br>
&gt; <br>
&gt; diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c<br>
&gt; index 2007e354..8c79d43b 100644<br>
&gt; --- a/src/sna/sna_driver.c<br>
&gt; +++ b/src/sna/sna_driver.c<br>
&gt; @@ -1152,7 +1152,7 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL)<br>
&gt;       if (!miInitVisuals(&amp;visuals, &amp;depths, &amp;nvisuals, &amp;ndepths, &amp;rootdepth,<br>
&gt;                          &amp;defaultVisual,<br>
&gt;                          ((unsigned long)1 &lt;&lt; (scrn-&gt;bitsPerPixel - 1)),<br>
&gt; -                        8, -1))<br>
&gt; +                        scrn-&gt;rgbBits, -1))<br>
&gt;               return FALSE;<br>
&gt;  <br>
&gt;       if (!miScreenInit(screen, NULL,<br>
&gt; @@ -1223,8 +1223,11 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL)<br>
&gt;       if (!miCreateDefColormap(screen))<br>
&gt;               return FALSE;<br>
&gt;  <br>
&gt; -     if (sna-&gt;mode.num_real_crtc &amp;&amp;<br>
&gt; -         !xf86HandleColormaps(screen, 256, 8, sna_load_palette, NULL,<br>
&gt; +     /* X-Server &lt; 1.20 mishandles &gt; 256 slots / &gt; 8 bpc color maps. */<br>
&gt; +     if (sna-&gt;mode.num_real_crtc &amp;&amp; (scrn-&gt;rgbBits &lt;= 8 ||<br>
&gt; +         XORG_VERSION_CURRENT &gt;= XORG_VERSION_NUMERIC(1,20,0,0,0)) &amp;&amp;<br>
&gt; +         !xf86HandleColormaps(screen, 1 &lt;&lt; scrn-&gt;rgbBits, scrn-&gt;rgbBits,<br>
&gt; +                              sna_load_palette, NULL,<br>
&gt;                                CMAP_RELOAD_ON_MODE_SWITCH |<br>
&gt;                                CMAP_PALETTED_TRUECOLOR))<br>
&gt;               return FALSE;<br>
&gt; diff --git a/src/uxa/intel_driver.c b/src/uxa/intel_driver.c<br>
&gt; index 3703c412..77c0dc00 100644<br>
&gt; --- a/src/uxa/intel_driver.c<br>
&gt; +++ b/src/uxa/intel_driver.c<br>
&gt; @@ -991,7 +991,11 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)<br>
&gt;       if (!miCreateDefColormap(screen))<br>
&gt;               return FALSE;<br>
&gt;  <br>
&gt; -     if (!xf86HandleColormaps(screen, 256, 8, I830LoadPalette, NULL,<br>
&gt; +     /* X-Server &lt; 1.20 mishandles &gt; 256 slots / &gt; 8 bpc color maps. */<br>
&gt; +     if ((scrn-&gt;rgbBits &lt;= 8 ||<br>
&gt; +         XORG_VERSION_CURRENT &gt;= XORG_VERSION_NUMERIC(1,20,0,0,0)) &amp;&amp;<br>
&gt; +         !xf86HandleColormaps(screen, 1 &lt;&lt; scrn-&gt;rgbBits, scrn-&gt;rgbBits,<br>
&gt; +                              I830LoadPalette, NULL,<br>
&gt;                                CMAP_RELOAD_ON_MODE_SWITCH |<br>
&gt;                                CMAP_PALETTED_TRUECOLOR)) {<br>
&gt;               return FALSE;<br>
&gt; -- <br>
&gt; 2.17.1<br>
<br>
-- <br>
Ville Syrjälä<br>
Intel<br>
</blockquote></div></div>
Chris Wilson Jan. 21, 2019, 7:58 a.m. UTC | #3
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
Ville Syrjälä Jan. 21, 2019, 2:54 p.m. UTC | #4
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.
diff mbox

Patch

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;