Re: handle bogus sparc64 frame buffers

2016-03-29 Thread Mark Kettenis
> Date: Mon, 28 Mar 2016 14:21:33 +
> From: Miod Vallat 
> 
> Some sparc64 pci frame buffers incorrectly have the `depth' property
> spelled `depth ' with a trailing space.
> 
> This can be found in this E450 eeprom -p output:
>   http://pastebin.com/P4ab4Xt4
> 
> Because of this, gfxp(4) attaches believing the display is only 8bpp,
> and the display gets garbled.
> 
> The following diff will fix this issue. I don't think sparc needs a
> similar fix as there are no Sun sparc systems with pci slots.

Thanks,

Committed.

> Index: fb.c
> ===
> RCS file: /OpenBSD/src/sys/arch/sparc64/dev/fb.c,v
> retrieving revision 1.25
> diff -u -p -r1.25 fb.c
> --- fb.c  21 Oct 2013 10:36:19 -  1.25
> +++ fb.c  28 Mar 2016 12:54:32 -
> @@ -131,7 +131,12 @@ fb_setsize(struct sunfb *sf, int def_dep
>  {
>   int def_linebytes;
>  
> - sf->sf_depth = getpropint(node, "depth", def_depth);
> + /*
> +  * Some PCI devices lack the `depth' property, but have a `depth '
> +  * property (with a trailing space) instead.
> +  */
> + sf->sf_depth = getpropint(node, "depth",
> + getpropint(node, "depth ", def_depth));
>   sf->sf_width = getpropint(node, "width", def_width);
>   sf->sf_height = getpropint(node, "height", def_height);
>  
> 
> 



handle bogus sparc64 frame buffers

2016-03-28 Thread Miod Vallat
Some sparc64 pci frame buffers incorrectly have the `depth' property
spelled `depth ' with a trailing space.

This can be found in this E450 eeprom -p output:
  http://pastebin.com/P4ab4Xt4

Because of this, gfxp(4) attaches believing the display is only 8bpp,
and the display gets garbled.

The following diff will fix this issue. I don't think sparc needs a
similar fix as there are no Sun sparc systems with pci slots.

Index: fb.c
===
RCS file: /OpenBSD/src/sys/arch/sparc64/dev/fb.c,v
retrieving revision 1.25
diff -u -p -r1.25 fb.c
--- fb.c21 Oct 2013 10:36:19 -  1.25
+++ fb.c28 Mar 2016 12:54:32 -
@@ -131,7 +131,12 @@ fb_setsize(struct sunfb *sf, int def_dep
 {
int def_linebytes;
 
-   sf->sf_depth = getpropint(node, "depth", def_depth);
+   /*
+* Some PCI devices lack the `depth' property, but have a `depth '
+* property (with a trailing space) instead.
+*/
+   sf->sf_depth = getpropint(node, "depth",
+   getpropint(node, "depth ", def_depth));
sf->sf_width = getpropint(node, "width", def_width);
sf->sf_height = getpropint(node, "height", def_height);