All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bastian.Ruppert at sewerin.de <Bastian.Ruppert@sewerin.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/6] video: cfb_console: logo can be positioned via the splashpos variable
Date: Wed, 5 Sep 2012 12:52:59 +0200	[thread overview]
Message-ID: <OF10D7C3FF.F3F2D35A-ONC1257A70.003AD336-C1257A70.003BEB1B@sewerin.de> (raw)
In-Reply-To: <1346538565-1821-1-git-send-email-agust@denx.de>

Hello Anatolij,

> [U-Boot] [PATCH v2 3/6] video: cfb_console: logo can be positioned
> via the splashpos variable
>
> From: Bastian Ruppert <Bastian.Ruppert@Sewerin.de>
>
> Extend the driver for placing the video/bmp logo as specified
> by "splashpos" environment variable.
>
> Signed-off-by: Bastian Ruppert <Bastian.Ruppert@Sewerin.de>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> CC: Tom Rini <trini@ti.com>
> CC: Stefano Babic <sbabic@denx.de>
> ---
> v2:
>  - remove some ifdefs
>  - revise commit log
>  - adjust video_logo_height by video_logo_ypos and thus
>    fix return address for video console offset
>  - add BMP_ALIGN_CENTER case to logo_plot() for proper logo
>    offset calculation if "m" specifier is used in splashpos
>
>  drivers/video/cfb_console.c |   88 +++++++++++++++++++++++++++++
+------------
>  1 files changed, 63 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
> index 19d061f..81e5e08 100644
> --- a/drivers/video/cfb_console.c
> +++ b/drivers/video/cfb_console.c
> @@ -66,7 +66,11 @@
>   * CONFIG_CONSOLE_TIME         - display time/date in upper right
>   *            corner, needs CONFIG_CMD_DATE and
>   *            CONFIG_CONSOLE_CURSOR
> - * CONFIG_VIDEO_LOGO         - display Linux Logo in upper left corner
> + * CONFIG_VIDEO_LOGO         - display Linux Logo in upper left corner.
> + *            Use CONFIG_SPLASH_SCREEN_ALIGN with
> + *            environment variable "splashpos" to place
> + *            the logo on other position. In this case
> + *            no CONSOLE_EXTRA_INFO is possible.
>   * CONFIG_VIDEO_BMP_LOGO      - use bmp_logo instead of linux_logo
>   * CONFIG_CONSOLE_EXTRA_INFO  - display additional board information
>   *            strings that normaly goes to serial
> @@ -369,6 +373,8 @@ static void *video_fb_address;   /* frame
bufferaddress */
>  static void *video_console_address;   /* console buffer start address */
>
>  static int video_logo_height = VIDEO_LOGO_HEIGHT;
> +static int video_logo_xpos;
> +static int video_logo_ypos;
>
>  static int __maybe_unused cursor_state;
>  static int __maybe_unused old_col;
> @@ -1488,8 +1494,21 @@ void logo_plot(void *screen, int width, int x, int
y)
>     int ycount = video_logo_height;
>     unsigned char r, g, b, *logo_red, *logo_blue, *logo_green;
>     unsigned char *source;
> -   unsigned char *dest = (unsigned char *) screen +
> -      ((y * width * VIDEO_PIXEL_SIZE) + x * VIDEO_PIXEL_SIZE);
> +   unsigned char *dest;
> +
> +#ifdef CONFIG_SPLASH_SCREEN_ALIGN
> +   if (x == BMP_ALIGN_CENTER)
> +      x = max(0, (VIDEO_VISIBLE_COLS - VIDEO_LOGO_WIDTH) / 2);
> +   else if (x < 0)
> +      x = max(0, VIDEO_VISIBLE_COLS - VIDEO_LOGO_WIDTH + x + 1);
> +
> +   if (y == BMP_ALIGN_CENTER)
> +      y = max(0, (VIDEO_VISIBLE_ROWS - VIDEO_LOGO_HEIGHT) / 2);
> +   else if (y < 0)
> +      y = max(0, VIDEO_VISIBLE_ROWS - VIDEO_LOGO_HEIGHT + y + 1);
> +#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
> +
> +   dest = (unsigned char *)screen + (y * width  + x) * VIDEO_PIXEL_SIZE;
>
>  #ifdef CONFIG_VIDEO_BMP_LOGO
>     source = bmp_logo_bitmap;
> @@ -1592,42 +1611,61 @@ static void *video_logo(void)
>     char info[128];
>     int space, len;
>     __maybe_unused int y_off = 0;
> +   __maybe_unused ulong addr;
> +   __maybe_unused char *s;
>
> -#ifdef CONFIG_SPLASH_SCREEN
> -   char *s;
> -   ulong addr;
> -
> -   s = getenv("splashimage");
> +#ifdef CONFIG_SPLASH_SCREEN_ALIGN
> +   s = getenv("splashpos");
>     if (s != NULL) {
> -      int x = 0, y = 0;
> +      if (s[0] == 'm')
> +         video_logo_xpos = BMP_ALIGN_CENTER;
> +      else
> +         video_logo_xpos = simple_strtol(s, NULL, 0);
>
> -      addr = simple_strtoul(s, NULL, 16);
> -#ifdef CONFIG_SPLASH_SCREEN_ALIGN
> -      s = getenv("splashpos");
> +      s = strchr(s + 1, ',');
>        if (s != NULL) {
> -         if (s[0] == 'm')
> -            x = BMP_ALIGN_CENTER;
> +         if (s[1] == 'm')
> +            video_logo_ypos = BMP_ALIGN_CENTER;
>           else
> -            x = simple_strtol(s, NULL, 0);
> -
> -         s = strchr(s + 1, ',');
> -         if (s != NULL) {
> -            if (s[1] == 'm')
> -               y = BMP_ALIGN_CENTER;
> -            else
> -               y = simple_strtol(s + 1, NULL, 0);
> -         }
> +            video_logo_ypos = simple_strtol(s + 1, NULL, 0);
>        }
> +   }
>  #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
>
> -      if (video_display_bitmap(addr, x, y) == 0) {
> +#ifdef CONFIG_SPLASH_SCREEN
> +   s = getenv("splashimage");
> +   if (s != NULL) {
> +
> +      addr = simple_strtoul(s, NULL, 16);
> +
> +
> +      if (video_display_bitmap(addr,
> +               video_logo_xpos,
> +               video_logo_ypos) == 0) {
>           video_logo_height = 0;
>           return ((void *) (video_fb_address));
>        }
>     }
>  #endif /* CONFIG_SPLASH_SCREEN */
>
> -   logo_plot(video_fb_address, VIDEO_COLS, 0, 0);
> +   logo_plot(video_fb_address, VIDEO_COLS,
> +        video_logo_xpos, video_logo_ypos);
> +
> +#ifdef CONFIG_SPLASH_SCREEN_ALIGN
> +   /*
> +    * when using splashpos for video_logo, skip any info
> +    * output on video console if the logo is not at 0,0
> +    */
> +   if (video_logo_xpos || video_logo_ypos) {
> +      /*
> +       * video_logo_height is used in text and cursor offset
> +       * calculations. Since the console is below the logo,
> +       * we need to adjust the logo height
> +       */
> +      video_logo_height += video_logo_ypos;
> +      return video_fb_address + video_logo_height * VIDEO_LINE_LEN;
> +   }
> +#endif

I have some trouble with this version when using splashpos = m,m .
In this case video_logo_ypos is 32767 (BMP_ALIGN_CENTER) here.
Following extension isworking for me:


#ifdef CONFIG_SPLASH_SCREEN_ALIGN
       /*
        * when using splashpos for video_logo, skip any info
        * output on video console if the logo is not at 0,0
        */
       if (video_logo_xpos || video_logo_ypos) {
               /*
                * video_logo_height is used in text and cursor offset
                * calculations. Since the console is below the logo,
                * we need to adjust the logo height
                */
               if (video_logo_ypos == BMP_ALIGN_CENTER)
                       video_logo_height += max(0, (VIDEO_VISIBLE_ROWS - \
                                                    VIDEO_LOGO_HEIGHT) /
2);
               else if (video_logo_ypos >= 0)
                       video_logo_height += video_logo_ypos;

               return video_fb_address + video_logo_height *
VIDEO_LINE_LEN;
       }
#endif


Should i post a version 3 for this patch?

>
>     sprintf(info, " %s", version_string);
>
> --
> 1.7.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

Regards,

Bastian.

  reply	other threads:[~2012-09-05 10:52 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-10  7:26 [U-Boot] [PATCH 1/6] davinci: ea20: reorganisation LCD startup Bastian Ruppert
2012-08-10  7:26 ` [U-Boot] [PATCH 2/6] davinci: ea20: the console is always set to the serial line Bastian Ruppert
2012-08-15 17:04   ` Stefano Babic
2012-08-10  7:26 ` [U-Boot] [PATCH 3/6] video: cfb_console: logo can be positioned via the splashpos variable Bastian Ruppert
2012-09-01 22:29   ` [U-Boot] [PATCH v2 " Anatolij Gustschin
2012-09-05 10:52     ` Bastian.Ruppert at sewerin.de [this message]
2012-09-05 11:11       ` Anatolij Gustschin
2012-09-06  6:07     ` [U-Boot] [PATCH v3 1/6] davinci: ea20: reorganisation LCD startup Bastian Ruppert
2012-09-06  6:07     ` [U-Boot] [PATCH v3 2/6] davinci: ea20: the console is always set to the serial line Bastian Ruppert
2012-09-06  6:07     ` [U-Boot] [PATCH v3 3/6] video: cfb_console: logo can be positioned via the splashpos variable Bastian Ruppert
2012-09-06 18:55       ` Anatolij Gustschin
2012-09-06  6:07     ` [U-Boot] [PATCH v3 4/6] video: cfb_console: add function to plot the logo area black Bastian Ruppert
2012-09-06 18:56       ` Anatolij Gustschin
2012-09-06  6:07     ` [U-Boot] [PATCH v3 5/6] da850/omap-l138: davinci_emac: Suppress auto negotiation if needed Bastian Ruppert
2012-09-07  8:08       ` Prabhakar Lad
2012-09-09  2:14         ` Tom Rini
2012-09-10  6:01           ` Bastian.Ruppert at sewerin.de
2012-09-10 16:08             ` Tom Rini
2012-09-11  4:16               ` Prabhakar Lad
2012-09-11  5:32                 ` Bastian.Ruppert at sewerin.de
2012-09-12 16:15                   ` Tom Rini
2012-09-06  6:07     ` [U-Boot] [PATCH v3 6/6] davinci: ea20: add some configs and default environmet variables Bastian Ruppert
2012-09-01 22:50   ` [U-Boot] [PATCH 3/6] video: cfb_console: logo can be positioned via the splashpos variable Anatolij Gustschin
2012-09-05 10:52     ` Bastian.Ruppert at sewerin.de
2012-09-14  8:28     ` [U-Boot] [PATCH v4 1/6] davinci: ea20: reorganisation LCD startup Bastian Ruppert
2012-09-14  8:29     ` [U-Boot] [PATCH v4 2/6] davinci: ea20: the console is always set to the serial line Bastian Ruppert
2012-09-14  8:29     ` [U-Boot] [PATCH v4 3/6] video: cfb_console: logo can be positioned via the splashpos variable Bastian Ruppert
2012-09-14  8:29     ` [U-Boot] [PATCH v4 4/6] video: cfb_console: add function to plot the logo area black Bastian Ruppert
2012-09-14  8:29     ` [U-Boot] [PATCH v4 5/6] da850/omap-l138: davinci_emac: Suppress auto negotiation if needed Bastian Ruppert
2012-09-17  5:19       ` Prabhakar Lad
2012-09-14  8:29     ` [U-Boot] [PATCH v4 6/6] davinci: ea20: add some configs and default environmet variables Bastian Ruppert
2012-08-10  7:26 ` [U-Boot] [PATCH 4/6] video: cfb_console: add function to plot the logo area black Bastian Ruppert
2012-08-10  7:26 ` [U-Boot] [PATCH 5/6] da850/omap-l138: davinci_emac: Suppress auto negotiation if needed Bastian Ruppert
2012-08-15 17:04   ` Stefano Babic
2012-08-10  7:26 ` [U-Boot] [PATCH 6/6] davinci: ea20: add some configs and default environmet variables Bastian Ruppert
2012-08-15 17:03   ` Stefano Babic
2012-08-15 16:55 ` [U-Boot] [PATCH 1/6] davinci: ea20: reorganisation LCD startup Tom Rini
2012-08-24 17:55   ` Tom Rini
2012-09-07  4:48     ` Bastian.Ruppert at sewerin.de
2012-08-15 17:04 ` Stefano Babic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OF10D7C3FF.F3F2D35A-ONC1257A70.003AD336-C1257A70.003BEB1B@sewerin.de \
    --to=bastian.ruppert@sewerin.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.