<div dir="ltr">It's not broken, it's just 1 value per 65535 unused for red and blue. The difference between the red 65534 and the red 65535 is insignificant. The real fix is more significant when we run on target with 126Mb of RAM or less. Don't forget that on PC Desktop you find very big video card which runs with A8R8G8B8 pixel format in lot of cases.<br>
<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/6/11 Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, 11 Jun 2013 16:31:17 +0200<br>
Marc Chalain <<a href="mailto:marc.chalain@gmail.com">marc.chalain@gmail.com</a>> wrote:<br>
<br>
> Theoretically you have right.<br>
> But the pixel formats are defined to contains the same amounts of values<br>
> for each colors except for 16bpp format (r5g6b5 and b5g6r5 one value more<br>
> for green) and the alpha. My code is optimized for a lot of cases.<br>
> For the use of rcols instead cols, you have right. It's a mistake.<br>
<br>
</div>So, you think it's ok to be presumably broken on 565 formats?<br>
The fix really is not that hard, and the "optimizations" here are<br>
totally insignificant.<br>
<div class="im"><br>
> Sorry "git send-email" fails on my computer (I think it's come from the<br>
> proxy).<br>
<br>
</div>There are other ways to send email without messing up whitespace,<br>
any of them will do. Take a look at other people's patch series on<br>
the mailing list, how they look, and try to replicate that.<br>
<br>
Until then, I think I've reviewed enough here for now.<br>
<br>
Btw. the idle-time man page patch should be part of the same commit<br>
as the idle-time config implementation.<br>
<br>
<br>
Thanks,<br>
pq<br>
<div class="HOEnZb"><div class="h5"><br>
> [PATCH] fbdev: directcolor support<br>
> The backend accepts to use TRUECOLOR and DIRECTCOLOR which are similares.<br>
> DIRECTCOLOR has better results if the application applies a Colors<br>
> map before to use it.<br>
> The colors map is just a list of gradients for each colors and alpha.<br>
><br>
> ---<br>
> src/compositor-fbdev.c | 43 ++++++++++++++++++++++++++++++++++++++++++-<br>
> 1 file changed, 42 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c<br>
> index 9c3d17e..7a3374e 100644<br>
> --- a/src/compositor-fbdev.c<br>
> +++ b/src/compositor-fbdev.c<br>
> @@ -203,6 +203,43 @@ finish_frame_handler(void *data)<br>
> return 1;<br>
> }<br>
><br>
> +static int<br>
> +set_cmap(int fd, struct fb_var_screeninfo *vinfo)<br>
> +{<br>
> + struct fb_cmap cmap;<br>
> + uint16_t *colors;<br>
> + int i;<br>
> + int rcols = 1 << vinfo->red.length;<br>
> + int gcols = 1 << vinfo->green.length;<br>
> + int bcols = 1 << vinfo->blue.length;<br>
> +<br>
> + memset(&cmap, 0, sizeof(cmap));<br>
> +<br>
> + /* Make our palette the length of the deepest color */<br>
> + int cols = (rcols > gcols ? rcols : gcols);<br>
> + cols = (cols > bcols ? cols : bcols);<br>
> +<br>
> + colors = malloc(sizeof(uint16_t) * cols);<br>
> + if (!colors) return -1;<br>
> +<br>
> + for (i = 0; i < cols; i++)<br>
> + colors[i] = (UINT16_MAX / (cols - 1)) * i;<br>
> +<br>
> + cmap.start = 0;<br>
> + cmap.len = cols;<br>
> + cmap.red = colors;<br>
> + cmap.blue = colors;<br>
> + cmap.green = colors;<br>
> + if (vinfo->transp.length)<br>
> + cmap.transp = colors;<br>
> + else<br>
> + cmap.transp = NULL;<br>
> + ioctl(fd, FBIOPUTCMAP, &cmap);<br>
> +<br>
> + free(colors);<br>
> + return 0;<br>
> +}<br>
> +<br>
> static pixman_format_code_t<br>
> calculate_pixman_format(struct fb_var_screeninfo *vinfo,<br>
> struct fb_fix_screeninfo *finfo)<br>
> @@ -242,7 +279,8 @@ calculate_pixman_format(struct fb_var_screeninfo *vinfo,<br>
> return 0;<br>
><br>
> /* We only handle true-colour frame buffers at the moment. */<br>
> - if (finfo->visual != FB_VISUAL_TRUECOLOR || vinfo->grayscale != 0)<br>
> + if (!(finfo->visual == FB_VISUAL_TRUECOLOR || finfo->visual ==<br>
> FB_VISUAL_DIRECTCOLOR)<br>
> + || vinfo->grayscale != 0)<br>
> return 0;<br>
><br>
> /* We only support formats with MSBs on the left. */<br>
> @@ -325,6 +363,9 @@ fbdev_query_screen_info(struct fbdev_output *output,<br>
> int fd,<br>
> info->pixel_format = calculate_pixman_format(&varinfo, &fixinfo);<br>
> info->refresh_rate = calculate_refresh_rate(&varinfo);<br>
><br>
> + if (fixinfo.visual == FB_VISUAL_DIRECTCOLOR)<br>
> + set_cmap(fd, &varinfo);<br>
> +<br>
> if (info->pixel_format == 0) {<br>
> weston_log("Frame buffer uses an unsupported format.\n");<br>
> return -1;<br>
> --<br>
> 1.7.9.5<br>
><br>
><br>
><br>
><br>
> 2013/6/11 Pekka Paalanen <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>><br>
><br>
> > On Tue, 11 Jun 2013 15:15:29 +0200<br>
> > Marc Chalain <<a href="mailto:marc.chalain@gmail.com">marc.chalain@gmail.com</a>> wrote:<br>
> ><br>
> > > Hello,<br>
> > > OK this patch now checks FB_VISUAL_DIRECTCOLOR twice but set the cmap<br>
> > > inside the fbdev_query_screen_info function.<br>
> > > I use "malloc" instead "table" declaration because it takes less memory<br>
> > and<br>
> > > it's used only once, it's useless to be faster.<br>
> > > After I set the same values for each colors, because it's a default map.<br>
> > To<br>
> > > set more finely we have to know the screen and it's capabilities.<br>
> ><br>
> > What I meant is, if rcols = 32 and gcols = 64, you allocate a 64-long<br>
> > array, and fill it with 64 step values. Does that not mean, that the<br>
> > maximum red color will be only 50% intensity, because it goes only up to<br>
> > 32 steps, and the remaining 32 steps will never be used?<br>
> ><br>
> > Or am I misunderstanding how fbdev colormap works?<br>
> ><br>
> > > I don't set the alpha when it's required (no alpha => no alpha map)<br>
> > ><br>
> > > [PATCH] [compositor-fbdev]: DirectColor support<br>
> > > The backend accepts to use TRUECOLOR and DIRECTCOLOR which are similares.<br>
> > > DIRECTCOLOR has better results if the application applies a Colors map<br>
> > > before to use it.<br>
> > > The colors map is just a list of gradients for each colors and alpha.<br>
> > ><br>
> > > ---<br>
> > > src/compositor-fbdev.c | 43<br>
> > ++++++++++++++++++++++++++++++++++++++++++-<br>
> > > 1 file changed, 42 insertions(+), 1 deletion(-)<br>
> > ><br>
> > > diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c<br>
> > > index 9c3d17e..c966d5a 100644<br>
> > > --- a/src/compositor-fbdev.c<br>
> > > +++ b/src/compositor-fbdev.c<br>
> > > @@ -203,6 +203,43 @@ finish_frame_handler(void *data)<br>
> > > return 1;<br>
> > > }<br>
> > ><br>
> > > +static int<br>
> > > +set_cmap(int fd, struct fb_var_screeninfo *vinfo)<br>
> > > +{<br>
> > > + struct fb_cmap cmap;<br>
> > > + uint16_t *colors;<br>
> > > + int i;<br>
> > > + int rcols = 1 << vinfo->red.length;<br>
> > > + int gcols = 1 << vinfo->green.length;<br>
> > > + int bcols = 1 << vinfo->blue.length;<br>
> > > +<br>
> > > + memset(&cmap, 0, sizeof(cmap));<br>
> > > +<br>
> > > + /* Make our palette the length of the deepest color */<br>
> > > + int cols = (rcols > gcols ? rcols : gcols);<br>
> > > + cols = (cols > bcols ? cols : bcols);<br>
> > > +<br>
> > > + colors = malloc(sizeof(uint16_t) * cols);<br>
> > > + if (!colors) return -1;<br>
> > > +<br>
> > > + for (i = 0; i < rcols; i++)<br>
> > > + colors[i] = (UINT16_MAX / (rcols - 1)) * i;<br>
> ><br>
> > IOW, should this divisor not be per channel, instead of using the same<br>
> > for all channels?<br>
> ><br>
> > In fact, you are using rcols in the divisor here, so if cols > rcols...<br>
> > no wait...<br>
> ><br>
> > > +<br>
> > > + cmap.start = 0;<br>
> > > + cmap.len = cols;<br>
> ><br>
> > Here you use cols, but the loop uses rcols. How does this make sense?<br>
> ><br>
> > > + cmap.red = colors;<br>
</div></div></blockquote></div><br></div>