diff mbox series

[5/6] efi_loader: GOP: Add damage notification on BLT

Message ID 20220606234336.5021-6-agraf@csgraf.de
State Superseded
Delegated to: Anatolij Gustschin
Headers show
Series Add video damage tracking | expand

Commit Message

Alexander Graf June 6, 2022, 11:43 p.m. UTC
Now that we have a damage tracking API, let's populate damage done by
UEFI payloads when they BLT data onto the screen.

Signed-off-by: Alexander Graf <agraf@csgraf.de>
Reported-by: Da Xue <da@libre.computer>
---
 lib/efi_loader/efi_gop.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Heinrich Schuchardt June 7, 2022, 7:12 a.m. UTC | #1
On 6/7/22 01:43, Alexander Graf wrote:
> Now that we have a damage tracking API, let's populate damage done by
> UEFI payloads when they BLT data onto the screen.
>
> Signed-off-by: Alexander Graf <agraf@csgraf.de>
> Reported-by: Da Xue <da@libre.computer>
> ---
>   lib/efi_loader/efi_gop.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
> index 2c81859807..67286c9a60 100644
> --- a/lib/efi_loader/efi_gop.c
> +++ b/lib/efi_loader/efi_gop.c
> @@ -33,6 +33,9 @@ struct efi_gop_obj {
>   	struct efi_gop ops;
>   	struct efi_gop_mode_info info;
>   	struct efi_gop_mode mode;
> +#ifdef CONFIG_DM_VIDEO

Please, heed the warnings provided by scripts/checkpatch.pl:

WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef'
where possible
#174: FILE: lib/efi_loader/efi_gop.c:36:
+#ifdef CONFIG_DM_VIDEO


> +	struct udevice *vdev;
> +#endif
>   	/* Fields we only have access to during init */
>   	u32 bpix;
>   	void *fb;
> @@ -244,6 +247,10 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this,
>   		dlineoff += dwidth;
>   	}
>
> +#ifdef CONFIG_DM_VIDEO

WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef'
where possible
#184: FILE: lib/efi_loader/efi_gop.c:250:
+#ifdef CONFIG_DM_VIDEO

> +	video_damage(gopobj->vdev, dx, dy, width, height);
> +#endif
> +
>   	return EFI_SUCCESS;
>   }
>
> @@ -583,5 +590,9 @@ efi_status_t efi_gop_register(void)
>   	gopobj->bpix = bpix;
>   	gopobj->fb = fb;
>
> +#ifdef CONFIG_DM_VIDEO

WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef'
where possible
#195: FILE: lib/efi_loader/efi_gop.c:593:
+#ifdef CONFIG_DM_VIDEO

Best regards

Heinrich

> +	gopobj->vdev = vdev;
> +#endif
> +
>   	return EFI_SUCCESS;
>   }
Alexander Graf June 9, 2022, 2:55 p.m. UTC | #2
Hey Heinrich,

On 07.06.22 09:12, Heinrich Schuchardt wrote:
> On 6/7/22 01:43, Alexander Graf wrote:
>> Now that we have a damage tracking API, let's populate damage done by
>> UEFI payloads when they BLT data onto the screen.
>>
>> Signed-off-by: Alexander Graf <agraf@csgraf.de>
>> Reported-by: Da Xue <da@libre.computer>
>> ---
>>   lib/efi_loader/efi_gop.c | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
>> index 2c81859807..67286c9a60 100644
>> --- a/lib/efi_loader/efi_gop.c
>> +++ b/lib/efi_loader/efi_gop.c
>> @@ -33,6 +33,9 @@ struct efi_gop_obj {
>>       struct efi_gop ops;
>>       struct efi_gop_mode_info info;
>>       struct efi_gop_mode mode;
>> +#ifdef CONFIG_DM_VIDEO
>
> Please, heed the warnings provided by scripts/checkpatch.pl:
>
> WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef'
> where possible
> #174: FILE: lib/efi_loader/efi_gop.c:36:
> +#ifdef CONFIG_DM_VIDEO


I was mostly afraid of adding a dependency on struct udevice here. But 
since we already include video.h, I believe we're good. Happy to change 
it to only runtime checks.

Alex
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
index 2c81859807..67286c9a60 100644
--- a/lib/efi_loader/efi_gop.c
+++ b/lib/efi_loader/efi_gop.c
@@ -33,6 +33,9 @@  struct efi_gop_obj {
 	struct efi_gop ops;
 	struct efi_gop_mode_info info;
 	struct efi_gop_mode mode;
+#ifdef CONFIG_DM_VIDEO
+	struct udevice *vdev;
+#endif
 	/* Fields we only have access to during init */
 	u32 bpix;
 	void *fb;
@@ -244,6 +247,10 @@  static __always_inline efi_status_t gop_blt_int(struct efi_gop *this,
 		dlineoff += dwidth;
 	}
 
+#ifdef CONFIG_DM_VIDEO
+	video_damage(gopobj->vdev, dx, dy, width, height);
+#endif
+
 	return EFI_SUCCESS;
 }
 
@@ -583,5 +590,9 @@  efi_status_t efi_gop_register(void)
 	gopobj->bpix = bpix;
 	gopobj->fb = fb;
 
+#ifdef CONFIG_DM_VIDEO
+	gopobj->vdev = vdev;
+#endif
+
 	return EFI_SUCCESS;
 }