diff mbox series

[v2,01/47] media/vivid: Use fbdev I/O helpers

Message ID 20230801101541.900-2-tzimmermann@suse.de (mailing list archive)
State Superseded
Headers show
Series fbdev: Use I/O helpers | expand

Commit Message

Thomas Zimmermann Aug. 1, 2023, 10:13 a.m. UTC
Set struct fb_ops and with FB_DEFAULT_IO_OPS, fbdev's initializer
for I/O memory. Sets the callbacks to the cfb_ and fb_io_ functions.
Select the correct modules with Kconfig's FB_IO_HELPERS token.

The macro and token set the currently selected values, so there is
no functional change.

v2:
	* updated to use _IOMEM_ tokens

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Helge Deller <deller@gmx.de>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 drivers/media/test-drivers/vivid/Kconfig     | 4 +---
 drivers/media/test-drivers/vivid/vivid-osd.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

Comments

Hans Verkuil Aug. 1, 2023, 11:22 a.m. UTC | #1
On 01/08/2023 12:13, Thomas Zimmermann wrote:
> Set struct fb_ops and with FB_DEFAULT_IO_OPS, fbdev's initializer
> for I/O memory. Sets the callbacks to the cfb_ and fb_io_ functions.
> Select the correct modules with Kconfig's FB_IO_HELPERS token.
> 
> The macro and token set the currently selected values, so there is
> no functional change.
> 
> v2:
> 	* updated to use _IOMEM_ tokens
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> Acked-by: Helge Deller <deller@gmx.de>
> Cc: Hans Verkuil <hverkuil@xs4all.nl>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> ---
>  drivers/media/test-drivers/vivid/Kconfig     | 4 +---
>  drivers/media/test-drivers/vivid/vivid-osd.c | 4 +---
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/test-drivers/vivid/Kconfig b/drivers/media/test-drivers/vivid/Kconfig
> index 318799d317ba..5b08a5ad291e 100644
> --- a/drivers/media/test-drivers/vivid/Kconfig
> +++ b/drivers/media/test-drivers/vivid/Kconfig
> @@ -3,11 +3,9 @@ config VIDEO_VIVID
>  	tristate "Virtual Video Test Driver"
>  	depends on VIDEO_DEV && !SPARC32 && !SPARC64 && FB
>  	depends on HAS_DMA
> +	select FB_IOMEM_HELPERS
>  	select FONT_SUPPORT
>  	select FONT_8x16
> -	select FB_CFB_FILLRECT
> -	select FB_CFB_COPYAREA
> -	select FB_CFB_IMAGEBLIT
>  	select VIDEOBUF2_VMALLOC
>  	select VIDEOBUF2_DMA_CONTIG
>  	select VIDEO_V4L2_TPG
> diff --git a/drivers/media/test-drivers/vivid/vivid-osd.c b/drivers/media/test-drivers/vivid/vivid-osd.c
> index 051f1805a16d..5c931b94a7b5 100644
> --- a/drivers/media/test-drivers/vivid/vivid-osd.c
> +++ b/drivers/media/test-drivers/vivid/vivid-osd.c
> @@ -246,12 +246,10 @@ static int vivid_fb_blank(int blank_mode, struct fb_info *info)
>  
>  static const struct fb_ops vivid_fb_ops = {
>  	.owner = THIS_MODULE,
> +	FB_DEFAULT_IOMEM_OPS,

This macro also sets fb_read and fb_write ops here, in addition to the
cfb_* ops, based on this patch:

https://lore.kernel.org/all/20230729193157.15446-2-tzimmermann@suse.de/#Z2e.:20230729193157.15446-2-tzimmermann::40suse.de:1include:linux:fb.h

But those two ops were never set in this driver before.

It's been ages since I last worked with this, so I can't tell whether that's
good or bad, all I know is that it makes what appears to be a functional change.

Can you explain a bit more? Am I missing something?

Regards,

	Hans

>  	.fb_check_var   = vivid_fb_check_var,
>  	.fb_set_par     = vivid_fb_set_par,
>  	.fb_setcolreg   = vivid_fb_setcolreg,
> -	.fb_fillrect    = cfb_fillrect,
> -	.fb_copyarea    = cfb_copyarea,
> -	.fb_imageblit   = cfb_imageblit,
>  	.fb_cursor      = NULL,
>  	.fb_ioctl       = vivid_fb_ioctl,
>  	.fb_pan_display = vivid_fb_pan_display,
Thomas Zimmermann Aug. 1, 2023, 4:54 p.m. UTC | #2
Hi

Am 01.08.23 um 13:22 schrieb Hans Verkuil:
> On 01/08/2023 12:13, Thomas Zimmermann wrote:
>> Set struct fb_ops and with FB_DEFAULT_IO_OPS, fbdev's initializer
>> for I/O memory. Sets the callbacks to the cfb_ and fb_io_ functions.
>> Select the correct modules with Kconfig's FB_IO_HELPERS token.
>>
>> The macro and token set the currently selected values, so there is
>> no functional change.
>>
>> v2:
>> 	* updated to use _IOMEM_ tokens
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
>> Acked-by: Helge Deller <deller@gmx.de>
>> Cc: Hans Verkuil <hverkuil@xs4all.nl>
>> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
>> ---
>>   drivers/media/test-drivers/vivid/Kconfig     | 4 +---
>>   drivers/media/test-drivers/vivid/vivid-osd.c | 4 +---
>>   2 files changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/media/test-drivers/vivid/Kconfig b/drivers/media/test-drivers/vivid/Kconfig
>> index 318799d317ba..5b08a5ad291e 100644
>> --- a/drivers/media/test-drivers/vivid/Kconfig
>> +++ b/drivers/media/test-drivers/vivid/Kconfig
>> @@ -3,11 +3,9 @@ config VIDEO_VIVID
>>   	tristate "Virtual Video Test Driver"
>>   	depends on VIDEO_DEV && !SPARC32 && !SPARC64 && FB
>>   	depends on HAS_DMA
>> +	select FB_IOMEM_HELPERS
>>   	select FONT_SUPPORT
>>   	select FONT_8x16
>> -	select FB_CFB_FILLRECT
>> -	select FB_CFB_COPYAREA
>> -	select FB_CFB_IMAGEBLIT
>>   	select VIDEOBUF2_VMALLOC
>>   	select VIDEOBUF2_DMA_CONTIG
>>   	select VIDEO_V4L2_TPG
>> diff --git a/drivers/media/test-drivers/vivid/vivid-osd.c b/drivers/media/test-drivers/vivid/vivid-osd.c
>> index 051f1805a16d..5c931b94a7b5 100644
>> --- a/drivers/media/test-drivers/vivid/vivid-osd.c
>> +++ b/drivers/media/test-drivers/vivid/vivid-osd.c
>> @@ -246,12 +246,10 @@ static int vivid_fb_blank(int blank_mode, struct fb_info *info)
>>   
>>   static const struct fb_ops vivid_fb_ops = {
>>   	.owner = THIS_MODULE,
>> +	FB_DEFAULT_IOMEM_OPS,
> 
> This macro also sets fb_read and fb_write ops here, in addition to the
> cfb_* ops, based on this patch:
> 
> https://lore.kernel.org/all/20230729193157.15446-2-tzimmermann@suse.de/#Z2e.:20230729193157.15446-2-tzimmermann::40suse.de:1include:linux:fb.h
> 
> But those two ops were never set in this driver before.
> 
> It's been ages since I last worked with this, so I can't tell whether that's
> good or bad, all I know is that it makes what appears to be a functional change.
> 
> Can you explain a bit more? Am I missing something?

That change is intentional and welcome. If no fb_read/fb_write pointers 
are given fbdev uses them as their default. See

 
https://elixir.bootlin.com/linux/v6.5-rc1/source/drivers/video/fbdev/core/fbmem.c#L773

and below. Once all drivers set these pointers explicitly, we can drop 
the default and make the helpers optional and modular. For the drivers 
in this patchset there's no functional change.

Best regards
Thomas

> 
> Regards,
> 
> 	Hans
> 
>>   	.fb_check_var   = vivid_fb_check_var,
>>   	.fb_set_par     = vivid_fb_set_par,
>>   	.fb_setcolreg   = vivid_fb_setcolreg,
>> -	.fb_fillrect    = cfb_fillrect,
>> -	.fb_copyarea    = cfb_copyarea,
>> -	.fb_imageblit   = cfb_imageblit,
>>   	.fb_cursor      = NULL,
>>   	.fb_ioctl       = vivid_fb_ioctl,
>>   	.fb_pan_display = vivid_fb_pan_display,
>
Hans Verkuil Aug. 2, 2023, 7:34 a.m. UTC | #3
On 01/08/2023 18:54, Thomas Zimmermann wrote:
> Hi
> 
> Am 01.08.23 um 13:22 schrieb Hans Verkuil:
>> On 01/08/2023 12:13, Thomas Zimmermann wrote:
>>> Set struct fb_ops and with FB_DEFAULT_IO_OPS, fbdev's initializer
>>> for I/O memory. Sets the callbacks to the cfb_ and fb_io_ functions.
>>> Select the correct modules with Kconfig's FB_IO_HELPERS token.
>>>
>>> The macro and token set the currently selected values, so there is
>>> no functional change.
>>>
>>> v2:
>>>     * updated to use _IOMEM_ tokens
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
>>> Acked-by: Helge Deller <deller@gmx.de>
>>> Cc: Hans Verkuil <hverkuil@xs4all.nl>
>>> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
>>> ---
>>>   drivers/media/test-drivers/vivid/Kconfig     | 4 +---
>>>   drivers/media/test-drivers/vivid/vivid-osd.c | 4 +---
>>>   2 files changed, 2 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/media/test-drivers/vivid/Kconfig b/drivers/media/test-drivers/vivid/Kconfig
>>> index 318799d317ba..5b08a5ad291e 100644
>>> --- a/drivers/media/test-drivers/vivid/Kconfig
>>> +++ b/drivers/media/test-drivers/vivid/Kconfig
>>> @@ -3,11 +3,9 @@ config VIDEO_VIVID
>>>       tristate "Virtual Video Test Driver"
>>>       depends on VIDEO_DEV && !SPARC32 && !SPARC64 && FB
>>>       depends on HAS_DMA
>>> +    select FB_IOMEM_HELPERS
>>>       select FONT_SUPPORT
>>>       select FONT_8x16
>>> -    select FB_CFB_FILLRECT
>>> -    select FB_CFB_COPYAREA
>>> -    select FB_CFB_IMAGEBLIT
>>>       select VIDEOBUF2_VMALLOC
>>>       select VIDEOBUF2_DMA_CONTIG
>>>       select VIDEO_V4L2_TPG
>>> diff --git a/drivers/media/test-drivers/vivid/vivid-osd.c b/drivers/media/test-drivers/vivid/vivid-osd.c
>>> index 051f1805a16d..5c931b94a7b5 100644
>>> --- a/drivers/media/test-drivers/vivid/vivid-osd.c
>>> +++ b/drivers/media/test-drivers/vivid/vivid-osd.c
>>> @@ -246,12 +246,10 @@ static int vivid_fb_blank(int blank_mode, struct fb_info *info)
>>>     static const struct fb_ops vivid_fb_ops = {
>>>       .owner = THIS_MODULE,
>>> +    FB_DEFAULT_IOMEM_OPS,
>>
>> This macro also sets fb_read and fb_write ops here, in addition to the
>> cfb_* ops, based on this patch:
>>
>> https://lore.kernel.org/all/20230729193157.15446-2-tzimmermann@suse.de/#Z2e.:20230729193157.15446-2-tzimmermann::40suse.de:1include:linux:fb.h
>>
>> But those two ops were never set in this driver before.
>>
>> It's been ages since I last worked with this, so I can't tell whether that's
>> good or bad, all I know is that it makes what appears to be a functional change.
>>
>> Can you explain a bit more? Am I missing something?
> 
> That change is intentional and welcome. If no fb_read/fb_write pointers are given fbdev uses them as their default. See
> 
> 
> https://elixir.bootlin.com/linux/v6.5-rc1/source/drivers/video/fbdev/core/fbmem.c#L773
> 
> and below. Once all drivers set these pointers explicitly, we can drop the default and make the helpers optional and modular. For the drivers in this patchset there's no functional change.

Ah, that explains it!

I wonder if it wouldn't be a good idea to include that information in the commit log.

In any case, for this patch:

Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Regards,

	Hans

> 
> Best regards
> Thomas
> 
>>
>> Regards,
>>
>>     Hans
>>
>>>       .fb_check_var   = vivid_fb_check_var,
>>>       .fb_set_par     = vivid_fb_set_par,
>>>       .fb_setcolreg   = vivid_fb_setcolreg,
>>> -    .fb_fillrect    = cfb_fillrect,
>>> -    .fb_copyarea    = cfb_copyarea,
>>> -    .fb_imageblit   = cfb_imageblit,
>>>       .fb_cursor      = NULL,
>>>       .fb_ioctl       = vivid_fb_ioctl,
>>>       .fb_pan_display = vivid_fb_pan_display,
>>
>
diff mbox series

Patch

diff --git a/drivers/media/test-drivers/vivid/Kconfig b/drivers/media/test-drivers/vivid/Kconfig
index 318799d317ba..5b08a5ad291e 100644
--- a/drivers/media/test-drivers/vivid/Kconfig
+++ b/drivers/media/test-drivers/vivid/Kconfig
@@ -3,11 +3,9 @@  config VIDEO_VIVID
 	tristate "Virtual Video Test Driver"
 	depends on VIDEO_DEV && !SPARC32 && !SPARC64 && FB
 	depends on HAS_DMA
+	select FB_IOMEM_HELPERS
 	select FONT_SUPPORT
 	select FONT_8x16
-	select FB_CFB_FILLRECT
-	select FB_CFB_COPYAREA
-	select FB_CFB_IMAGEBLIT
 	select VIDEOBUF2_VMALLOC
 	select VIDEOBUF2_DMA_CONTIG
 	select VIDEO_V4L2_TPG
diff --git a/drivers/media/test-drivers/vivid/vivid-osd.c b/drivers/media/test-drivers/vivid/vivid-osd.c
index 051f1805a16d..5c931b94a7b5 100644
--- a/drivers/media/test-drivers/vivid/vivid-osd.c
+++ b/drivers/media/test-drivers/vivid/vivid-osd.c
@@ -246,12 +246,10 @@  static int vivid_fb_blank(int blank_mode, struct fb_info *info)
 
 static const struct fb_ops vivid_fb_ops = {
 	.owner = THIS_MODULE,
+	FB_DEFAULT_IOMEM_OPS,
 	.fb_check_var   = vivid_fb_check_var,
 	.fb_set_par     = vivid_fb_set_par,
 	.fb_setcolreg   = vivid_fb_setcolreg,
-	.fb_fillrect    = cfb_fillrect,
-	.fb_copyarea    = cfb_copyarea,
-	.fb_imageblit   = cfb_imageblit,
 	.fb_cursor      = NULL,
 	.fb_ioctl       = vivid_fb_ioctl,
 	.fb_pan_display = vivid_fb_pan_display,