[PATCH] desktop-shell: provide an option, background-bpp , for specifing the bit depth of the wallpaper

Pekka Paalanen ppaalanen at gmail.com
Tue May 26 02:30:35 PDT 2015


On Mon, 25 May 2015 09:19:39 -0400
nerdopolis <bluescreen_avenger at verizon.net> wrote:

> ---
>  clients/desktop-shell.c       | 13 +++++++++++--
>  man/weston.ini.man            |  5 +++++
>  tests/internal-screenshot.ini |  1 +
>  3 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
> index 777a50a..d620daf 100644
> --- a/clients/desktop-shell.c
> +++ b/clients/desktop-shell.c
> @@ -94,6 +94,7 @@ struct background {
>  	char *image;
>  	int type;
>  	uint32_t color;
> +	uint32_t bpp;
>  };
>  
>  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_uint(s, "background-bpp",
> +					 &background->bpp, 16);
> +	/* TODO After Weston 1.8, change default to 32 bit bpp on the wallpaper*/
> +	if (background->low_bpp != 32) {
> +	  window_set_preferred_format(background->window,
> +				      WINDOW_PREFERRED_FORMAT_RGB565);
> +	} elseif (background->low_bpp != 16 && background->low_bpp != 32 ) {
> +	  weston_log("invalid background bpp specified in ini file\n");
> +	}
> +
>  	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..2f60c15 100644
> --- a/man/weston.ini.man
> +++ b/man/weston.ini.man
> @@ -216,6 +216,11 @@ 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-bpp=" true
> +specify to set the background to 16 bit or 32 color (unsigned integer).
> +Setting this option to 16 bit color is useful for low memory platforms,
> +such as embedded devices. This only affects the background.
> +.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:
> diff --git a/tests/internal-screenshot.ini b/tests/internal-screenshot.ini
> index abc046e..be68345 100644
> --- a/tests/internal-screenshot.ini
> +++ b/tests/internal-screenshot.ini
> @@ -1,3 +1,4 @@
>  [shell]
>  startup-animation=none
>  background-color=0xCC336699
> +background-bpp=16

Not strictly necessary now that we aim to be weston-desktop-shell
independent with the test.

This patch has not been even build-tested:

  CC       clients/weston_desktop_shell-desktop-shell.o
/home/pq/git/weston/clients/desktop-shell.c: In function ‘background_create’:
/home/pq/git/weston/clients/desktop-shell.c:1024:16: error: ‘struct background’ has no member named ‘low_bpp’
/home/pq/git/weston/clients/desktop-shell.c:1027:2: warning: implicit declaration of function ‘elseif’ [-Wimplicit-function-declaration]
/home/pq/git/weston/clients/desktop-shell.c:1027:22: error: ‘struct background’ has no member named ‘low_bpp’
/home/pq/git/weston/clients/desktop-shell.c:1027:51: error: ‘struct background’ has no member named ‘low_bpp’
/home/pq/git/weston/clients/desktop-shell.c:1027:69: error: expected ‘;’ before ‘{’ token
Makefile:5130: recipe for target 'clients/weston_desktop_shell-desktop-shell.o' failed

Build fixed, this is Acked-by me.


Thanks,
pq


More information about the wayland-devel mailing list