[PATCH] desktop-shell: support an option to use 16 bit color or not, instead of using it by default

Pekka Paalanen ppaalanen at gmail.com
Wed May 20 06:58:39 PDT 2015


On Wed, 20 May 2015 07:55:17 -0400
nerdopolis <bluescreen_avenger at verizon.net> wrote:

> ---
>  clients/desktop-shell.c | 13 +++++++++++--
>  man/weston.ini.man      |  4 ++++
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
> index e2f9f80..970b9f0 100644
> --- a/clients/desktop-shell.c
> +++ b/clients/desktop-shell.c
> @@ -94,6 +94,7 @@ struct background {
>  	char *image;
>  	int type;
>  	uint32_t color;
> +	int32_t low_bitrate;
>  };
>  
>  struct output {
> @@ -1015,10 +1016,18 @@ background_create(struct desktop *desktop)
>  	window_set_user_data(background->window, background);
>  	widget_set_redraw_handler(background->widget, background_draw);
>  	widget_set_transparent(background->widget, 0);
> -	window_set_preferred_format(background->window,
> -				    WINDOW_PREFERRED_FORMAT_RGB565);
>  
>  	s = weston_config_get_section(desktop->config, "shell", NULL, NULL);
> +	weston_config_section_get_bool(s, "background-low-bitrate",
> +					 &background->low_bitrate, NULL);
> +	if (!background->low_bitrate) {
> +	  window_set_preferred_format(background->window,
> +				      WINDOW_PREFERRED_FORMAT_NONE);

No need to call this at all.

> +	} else {
> +	  window_set_preferred_format(background->window,
> +				      WINDOW_PREFERRED_FORMAT_RGB565);
> +	}
> +
>  	weston_config_section_get_string(s, "background-image",
>  					 &background->image, NULL);
>  	weston_config_section_get_uint(s, "background-color",
> diff --git a/man/weston.ini.man b/man/weston.ini.man
> index fe86bb6..240fbd8 100644
> --- a/man/weston.ini.man
> +++ b/man/weston.ini.man
> @@ -216,6 +216,10 @@ output. Tile repeats the background image to fill the output.
>  sets the color of the background (unsigned integer). The hexadecimal
>  digit pairs are in order alpha, red, green, and blue.
>  .TP 7
> +.BI "background-low-bitrate=" true
> +specify to reduce the background to 16 bit color (boolean). This option is
> +useful for low memory platforms.
> +.TP 7
>  .BI "panel-color=" 0xAARRGGBB
>  sets the color of the panel (unsigned integer). The hexadecimal
>  digit pairs are in order transparency, red, green, and blue. Examples:

Technically the patch is ok.

Bikeshedding on the wording a bit, bitrate is a little far-fetched. It
does reduce used memory bandwidth on the rpi, but not elsewhere without
overlays. Reducing memory consumption is the main point. I'd be happier
with "background-default-bpp" or such choosing between 32 and 16. And a
note that this does not affect Weston's framebuffer depth.


Thanks,
pq


More information about the wayland-devel mailing list