diff mbox series

[v4,12/15] common: Enable splash functions at SPL

Message ID 20230329120119.72886-13-n-jain1@ti.com
State Superseded
Delegated to: Anatolij Gustschin
Headers show
Series Add splash screen support at u-boot SPL | expand

Commit Message

Nikhil Jain March 29, 2023, 12:01 p.m. UTC
To support splash screen at SPL use CONFIG_IS_ENABLED and CONFIG_VAL. To
check for stage specific configs at u-boot proper and SPL.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
---
V4:
- No change

V3 (patch introduced):
- Enable splash functions at SPL

 common/bmp.c    | 10 +++++-----
 common/splash.c | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

Comments

Devarsh Thakkar March 30, 2023, 10:45 a.m. UTC | #1
Hi Nikhil

Thanks for the patch,

On 29/03/23 17:31, Nikhil M Jain wrote:
> To support splash screen at SPL use CONFIG_IS_ENABLED and CONFIG_VAL. To
> check for stage specific configs at u-boot proper and SPL.
> 
> Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
> ---
> V4:
> - No change
> 
> V3 (patch introduced):
> - Enable splash functions at SPL
> 
>  common/bmp.c    | 10 +++++-----
>  common/splash.c | 10 +++++-----
>  2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/common/bmp.c b/common/bmp.c
> index 540d06e63f..51766b3c21 100644
> --- a/common/bmp.c
> +++ b/common/bmp.c
> @@ -33,7 +33,7 @@
>   * Returns NULL if decompression failed, or if the decompressed data
>   * didn't contain a valid BMP signature.
>   */
> -#ifdef CONFIG_VIDEO_BMP_GZIP
> +#if CONFIG_IS_ENABLED(VIDEO_BMP_GZIP)
>  struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
>  			     void **alloc_addr)
>  {
> @@ -44,9 +44,9 @@ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
>  	/*
>  	 * Decompress bmp image
>  	 */
> -	len = CONFIG_VIDEO_LOGO_MAX_SIZE;
> +	len = CONFIG_VAL(VIDEO_LOGO_MAX_SIZE);
>  	/* allocate extra 3 bytes for 32-bit-aligned-address + 2 alignment */
> -	dst = malloc(CONFIG_VIDEO_LOGO_MAX_SIZE + 3);
> +	dst = malloc(CONFIG_VAL(VIDEO_LOGO_MAX_SIZE) + 3);
>  	if (!dst) {
>  		puts("Error: malloc in gunzip failed!\n");
>  		return NULL;
> @@ -55,12 +55,12 @@ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
>  	/* align to 32-bit-aligned-address + 2 */
>  	bmp = dst + 2;
>  
> -	if (gunzip(bmp, CONFIG_VIDEO_LOGO_MAX_SIZE, map_sysmem(addr, 0),
> +	if (gunzip(bmp, CONFIG_VAL(VIDEO_LOGO_MAX_SIZE), map_sysmem(addr, 0),
>  		   &len)) {
>  		free(dst);
>  		return NULL;
>  	}
> -	if (len == CONFIG_VIDEO_LOGO_MAX_SIZE)
> +	if (len == CONFIG_VAL(VIDEO_LOGO_MAX_SIZE))
>  		puts("Image could be truncated (increase CONFIG_VIDEO_LOGO_MAX_SIZE)!\n");
>  
>  	/*
> diff --git a/common/splash.c b/common/splash.c
> index 245ff680eb..9bb2c1121e 100644
> --- a/common/splash.c
> +++ b/common/splash.c
> @@ -89,14 +89,14 @@ static inline int splash_video_logo_load(void) { return -ENOSYS; }
>  
>  __weak int splash_screen_prepare(void)
>  {
> -	if (IS_ENABLED(CONFIG_SPLASH_SOURCE))
> +	if (CONFIG_IS_ENABLED(SPLASH_SOURCE))
>  		return splash_source_load(default_splash_locations,
>  					  ARRAY_SIZE(default_splash_locations));
>  
>  	return splash_video_logo_load();
>  }
>  
> -#ifdef CONFIG_SPLASH_SCREEN_ALIGN
> +#if CONFIG_IS_ENABLED(SPLASH_SCREEN_ALIGN)
>  void splash_get_pos(int *x, int *y)
>  {
>  	char *s = env_get("splashpos");
> @@ -119,7 +119,7 @@ void splash_get_pos(int *x, int *y)
>  }
>  #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
>  
> -#if defined(CONFIG_VIDEO) && !defined(CONFIG_HIDE_LOGO_VERSION)
> +#if CONFIG_IS_ENABLED(VIDEO) && !CONFIG_IS_ENABLED(HIDE_LOGO_VERSION)
>  
>  #ifdef CONFIG_VIDEO_LOGO
>  #include <bmp_logo.h>
> @@ -157,7 +157,7 @@ void splash_display_banner(void)
>   * Common function to show a splash image if env("splashimage") is set.
>   * For additional details please refer to doc/README.splashprepare.
>   */
> -#if defined(CONFIG_SPLASH_SCREEN) && defined(CONFIG_CMD_BMP)
> +#if CONFIG_IS_ENABLED(SPLASH_SCREEN) && defined(CONFIG_CMD_BMP)
I thought you don't set CONFIG_CMD_BMP for SPL ?
If so you should add an or for CONFIG_SPL_BMP ?
I am not sure how it works today then without this change.

Regards
Devarsh

>  int splash_display(void)
>  {
>  	ulong addr;
> @@ -181,7 +181,7 @@ int splash_display(void)
>  	if (x || y)
>  		goto end;
>  
> -#if defined(CONFIG_VIDEO) && !defined(CONFIG_HIDE_LOGO_VERSION)
> +#if CONFIG_IS_ENABLED(VIDEO) && CONFIG_IS_ENABLED(HIDE_LOGO_VERSION)
>  	splash_display_banner();
>  #endif
>  end:
Nikhil Jain March 30, 2023, 11:52 a.m. UTC | #2
Hi Devarsh

On 30/03/23 16:15, Devarsh Thakkar wrote:
> Hi Nikhil
> 
> Thanks for the patch,
> 
> On 29/03/23 17:31, Nikhil M Jain wrote:
>> To support splash screen at SPL use CONFIG_IS_ENABLED and CONFIG_VAL. To
>> check for stage specific configs at u-boot proper and SPL.
>>
>> Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
>> ---
>> V4:
>> - No change
>>
>> V3 (patch introduced):
>> - Enable splash functions at SPL
>>
>>   common/bmp.c    | 10 +++++-----
>>   common/splash.c | 10 +++++-----
>>   2 files changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/common/bmp.c b/common/bmp.c
>> index 540d06e63f..51766b3c21 100644
>> --- a/common/bmp.c
>> +++ b/common/bmp.c
>> @@ -33,7 +33,7 @@
>>    * Returns NULL if decompression failed, or if the decompressed data
>>    * didn't contain a valid BMP signature.
>>    */
>> -#ifdef CONFIG_VIDEO_BMP_GZIP
>> +#if CONFIG_IS_ENABLED(VIDEO_BMP_GZIP)
>>   struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
>>   			     void **alloc_addr)
>>   {
>> @@ -44,9 +44,9 @@ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
>>   	/*
>>   	 * Decompress bmp image
>>   	 */
>> -	len = CONFIG_VIDEO_LOGO_MAX_SIZE;
>> +	len = CONFIG_VAL(VIDEO_LOGO_MAX_SIZE);
>>   	/* allocate extra 3 bytes for 32-bit-aligned-address + 2 alignment */
>> -	dst = malloc(CONFIG_VIDEO_LOGO_MAX_SIZE + 3);
>> +	dst = malloc(CONFIG_VAL(VIDEO_LOGO_MAX_SIZE) + 3);
>>   	if (!dst) {
>>   		puts("Error: malloc in gunzip failed!\n");
>>   		return NULL;
>> @@ -55,12 +55,12 @@ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
>>   	/* align to 32-bit-aligned-address + 2 */
>>   	bmp = dst + 2;
>>   
>> -	if (gunzip(bmp, CONFIG_VIDEO_LOGO_MAX_SIZE, map_sysmem(addr, 0),
>> +	if (gunzip(bmp, CONFIG_VAL(VIDEO_LOGO_MAX_SIZE), map_sysmem(addr, 0),
>>   		   &len)) {
>>   		free(dst);
>>   		return NULL;
>>   	}
>> -	if (len == CONFIG_VIDEO_LOGO_MAX_SIZE)
>> +	if (len == CONFIG_VAL(VIDEO_LOGO_MAX_SIZE))
>>   		puts("Image could be truncated (increase CONFIG_VIDEO_LOGO_MAX_SIZE)!\n");
>>   
>>   	/*
>> diff --git a/common/splash.c b/common/splash.c
>> index 245ff680eb..9bb2c1121e 100644
>> --- a/common/splash.c
>> +++ b/common/splash.c
>> @@ -89,14 +89,14 @@ static inline int splash_video_logo_load(void) { return -ENOSYS; }
>>   
>>   __weak int splash_screen_prepare(void)
>>   {
>> -	if (IS_ENABLED(CONFIG_SPLASH_SOURCE))
>> +	if (CONFIG_IS_ENABLED(SPLASH_SOURCE))
>>   		return splash_source_load(default_splash_locations,
>>   					  ARRAY_SIZE(default_splash_locations));
>>   
>>   	return splash_video_logo_load();
>>   }
>>   
>> -#ifdef CONFIG_SPLASH_SCREEN_ALIGN
>> +#if CONFIG_IS_ENABLED(SPLASH_SCREEN_ALIGN)
>>   void splash_get_pos(int *x, int *y)
>>   {
>>   	char *s = env_get("splashpos");
>> @@ -119,7 +119,7 @@ void splash_get_pos(int *x, int *y)
>>   }
>>   #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
>>   
>> -#if defined(CONFIG_VIDEO) && !defined(CONFIG_HIDE_LOGO_VERSION)
>> +#if CONFIG_IS_ENABLED(VIDEO) && !CONFIG_IS_ENABLED(HIDE_LOGO_VERSION)
>>   
>>   #ifdef CONFIG_VIDEO_LOGO
>>   #include <bmp_logo.h>
>> @@ -157,7 +157,7 @@ void splash_display_banner(void)
>>    * Common function to show a splash image if env("splashimage") is set.
>>    * For additional details please refer to doc/README.splashprepare.
>>    */
>> -#if defined(CONFIG_SPLASH_SCREEN) && defined(CONFIG_CMD_BMP)
>> +#if CONFIG_IS_ENABLED(SPLASH_SCREEN) && defined(CONFIG_CMD_BMP)
> I thought you don't set CONFIG_CMD_BMP for SPL ?
> If so you should add an or for CONFIG_SPL_BMP ?
> I am not sure how it works today then without this change.
> 
I have done the change in
patch 14  common: splash: Replace CONFIG_CMD_BMP

> Regards
> Devarsh
> 
>>   int splash_display(void)
>>   {
>>   	ulong addr;
>> @@ -181,7 +181,7 @@ int splash_display(void)
>>   	if (x || y)
>>   		goto end;
>>   
>> -#if defined(CONFIG_VIDEO) && !defined(CONFIG_HIDE_LOGO_VERSION)
>> +#if CONFIG_IS_ENABLED(VIDEO) && CONFIG_IS_ENABLED(HIDE_LOGO_VERSION)
>>   	splash_display_banner();
>>   #endif
>>   end:

Thanks,
Nikhil
diff mbox series

Patch

diff --git a/common/bmp.c b/common/bmp.c
index 540d06e63f..51766b3c21 100644
--- a/common/bmp.c
+++ b/common/bmp.c
@@ -33,7 +33,7 @@ 
  * Returns NULL if decompression failed, or if the decompressed data
  * didn't contain a valid BMP signature.
  */
-#ifdef CONFIG_VIDEO_BMP_GZIP
+#if CONFIG_IS_ENABLED(VIDEO_BMP_GZIP)
 struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
 			     void **alloc_addr)
 {
@@ -44,9 +44,9 @@  struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
 	/*
 	 * Decompress bmp image
 	 */
-	len = CONFIG_VIDEO_LOGO_MAX_SIZE;
+	len = CONFIG_VAL(VIDEO_LOGO_MAX_SIZE);
 	/* allocate extra 3 bytes for 32-bit-aligned-address + 2 alignment */
-	dst = malloc(CONFIG_VIDEO_LOGO_MAX_SIZE + 3);
+	dst = malloc(CONFIG_VAL(VIDEO_LOGO_MAX_SIZE) + 3);
 	if (!dst) {
 		puts("Error: malloc in gunzip failed!\n");
 		return NULL;
@@ -55,12 +55,12 @@  struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
 	/* align to 32-bit-aligned-address + 2 */
 	bmp = dst + 2;
 
-	if (gunzip(bmp, CONFIG_VIDEO_LOGO_MAX_SIZE, map_sysmem(addr, 0),
+	if (gunzip(bmp, CONFIG_VAL(VIDEO_LOGO_MAX_SIZE), map_sysmem(addr, 0),
 		   &len)) {
 		free(dst);
 		return NULL;
 	}
-	if (len == CONFIG_VIDEO_LOGO_MAX_SIZE)
+	if (len == CONFIG_VAL(VIDEO_LOGO_MAX_SIZE))
 		puts("Image could be truncated (increase CONFIG_VIDEO_LOGO_MAX_SIZE)!\n");
 
 	/*
diff --git a/common/splash.c b/common/splash.c
index 245ff680eb..9bb2c1121e 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -89,14 +89,14 @@  static inline int splash_video_logo_load(void) { return -ENOSYS; }
 
 __weak int splash_screen_prepare(void)
 {
-	if (IS_ENABLED(CONFIG_SPLASH_SOURCE))
+	if (CONFIG_IS_ENABLED(SPLASH_SOURCE))
 		return splash_source_load(default_splash_locations,
 					  ARRAY_SIZE(default_splash_locations));
 
 	return splash_video_logo_load();
 }
 
-#ifdef CONFIG_SPLASH_SCREEN_ALIGN
+#if CONFIG_IS_ENABLED(SPLASH_SCREEN_ALIGN)
 void splash_get_pos(int *x, int *y)
 {
 	char *s = env_get("splashpos");
@@ -119,7 +119,7 @@  void splash_get_pos(int *x, int *y)
 }
 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
 
-#if defined(CONFIG_VIDEO) && !defined(CONFIG_HIDE_LOGO_VERSION)
+#if CONFIG_IS_ENABLED(VIDEO) && !CONFIG_IS_ENABLED(HIDE_LOGO_VERSION)
 
 #ifdef CONFIG_VIDEO_LOGO
 #include <bmp_logo.h>
@@ -157,7 +157,7 @@  void splash_display_banner(void)
  * Common function to show a splash image if env("splashimage") is set.
  * For additional details please refer to doc/README.splashprepare.
  */
-#if defined(CONFIG_SPLASH_SCREEN) && defined(CONFIG_CMD_BMP)
+#if CONFIG_IS_ENABLED(SPLASH_SCREEN) && defined(CONFIG_CMD_BMP)
 int splash_display(void)
 {
 	ulong addr;
@@ -181,7 +181,7 @@  int splash_display(void)
 	if (x || y)
 		goto end;
 
-#if defined(CONFIG_VIDEO) && !defined(CONFIG_HIDE_LOGO_VERSION)
+#if CONFIG_IS_ENABLED(VIDEO) && CONFIG_IS_ENABLED(HIDE_LOGO_VERSION)
 	splash_display_banner();
 #endif
 end: