diff mbox series

[v2,4/5] video: Skip framebuffer reservation if already reserved

Message ID 20231031131208.435268-5-devarsht@ti.com
State Changes Requested
Delegated to: Anatolij Gustschin
Headers show
Series Move video memory reservation for SPL to the | expand

Commit Message

Devarsh Thakkar Oct. 31, 2023, 1:12 p.m. UTC
Skip framebufer reservation if it was already reserved
from previous stage and whose information was passed
using a bloblist.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
V2:
- Add debug prints
- Fix commenting style
---
 drivers/video/video-uclass.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Simon Glass Nov. 2, 2023, 10:46 p.m. UTC | #1
On Tue, 31 Oct 2023 at 13:12, Devarsh Thakkar <devarsht@ti.com> wrote:
>
> Skip framebufer reservation if it was already reserved
> from previous stage and whose information was passed
> using a bloblist.
>
> Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> V2:
> - Add debug prints
> - Fix commenting style
> ---
>  drivers/video/video-uclass.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
> index f743ed74c8..335a1a1828 100644
> --- a/drivers/video/video-uclass.c
> +++ b/drivers/video/video-uclass.c
> @@ -123,6 +123,18 @@ int video_reserve(ulong *addrp)
>         struct udevice *dev;
>         ulong size;
>
> +       if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL) {
> +               /* Skip allocation if already received a bloblist which

comment style

/*
 * Skip ...

> +                * filled below fields
> +                */
> +               if (gd->fb_base && gd->video_top && gd->video_bottom) {
> +                       debug("Found pre-reserved video memory from %lx to %lx\n",
> +                             gd->video_bottom, gd->video_top);
> +                       debug("Skipping video frame buffer allocation\n");
> +                       return 0;
> +               }
> +       }
> +
>         gd->video_top = *addrp;
>         for (uclass_find_first_device(UCLASS_VIDEO, &dev);
>              dev;
> --
> 2.34.1
>

Regards,
Simon
Devarsh Thakkar Nov. 3, 2023, 5:58 p.m. UTC | #2
Hi Simon,

Thanks for the review.

On 03/11/23 04:16, Simon Glass wrote:
> On Tue, 31 Oct 2023 at 13:12, Devarsh Thakkar <devarsht@ti.com> wrote:
>>
>> Skip framebufer reservation if it was already reserved
>> from previous stage and whose information was passed
>> using a bloblist.
>>
>> Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>> ---
>> V2:
>> - Add debug prints
>> - Fix commenting style
>> ---
>>   drivers/video/video-uclass.c | 12 ++++++++++++
>>   1 file changed, 12 insertions(+)
>>
>> diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
>> index f743ed74c8..335a1a1828 100644
>> --- a/drivers/video/video-uclass.c
>> +++ b/drivers/video/video-uclass.c
>> @@ -123,6 +123,18 @@ int video_reserve(ulong *addrp)
>>          struct udevice *dev;
>>          ulong size;
>>
>> +       if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL) {
>> +               /* Skip allocation if already received a bloblist which
> 
> comment style
> 
> /*
>   * Skip ...

Oops, thanks for the nitpick, will correct this, I wonder why checkpatch 
didn't catch this :)

Regards
Devarsh

> 
>> +                * filled below fields
>> +                */
>> +               if (gd->fb_base && gd->video_top && gd->video_bottom) {
>> +                       debug("Found pre-reserved video memory from %lx to %lx\n",
>> +                             gd->video_bottom, gd->video_top);
>> +                       debug("Skipping video frame buffer allocation\n");
>> +                       return 0;
>> +               }
>> +       }
>> +
>>          gd->video_top = *addrp;
>>          for (uclass_find_first_device(UCLASS_VIDEO, &dev);
>>               dev;
>> --
>> 2.34.1
>>
> 
> Regards,
> Simon
diff mbox series

Patch

diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index f743ed74c8..335a1a1828 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -123,6 +123,18 @@  int video_reserve(ulong *addrp)
 	struct udevice *dev;
 	ulong size;
 
+	if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL) {
+		/* Skip allocation if already received a bloblist which
+		 * filled below fields
+		 */
+		if (gd->fb_base && gd->video_top && gd->video_bottom) {
+			debug("Found pre-reserved video memory from %lx to %lx\n",
+			      gd->video_bottom, gd->video_top);
+			debug("Skipping video frame buffer allocation\n");
+			return 0;
+		}
+	}
+
 	gd->video_top = *addrp;
 	for (uclass_find_first_device(UCLASS_VIDEO, &dev);
 	     dev;