mbox series

[0/6] drm,fbdev: Use fbdev's I/O helpers

Message ID 20230425142846.730-1-tzimmermann@suse.de (mailing list archive)
Headers show
Series drm,fbdev: Use fbdev's I/O helpers | expand

Message

Thomas Zimmermann April 25, 2023, 2:28 p.m. UTC
Make fbdev's built-in helpers for reading and writing I/O and system
memory available to DRM. Replace DRM's internal helpers.

The first patch resolves a bug that's been in the fbdev code for
more than 15 years. Makes the read/write helpers work successfully
with the IGT tests.

Patches 2 to 4 streamline fbdev's file-I/O code and remove a few
duplicate checks.

Patch 5 moves the default-I/O code into the new helpers fb_cfb_read()
and fb_cfb_write(); patch 6 uses them in DRM. This allows us to remove
quite a bit of code from DRM's internal fbdev helpers.

Tested with i915 and simpledrm.

The next step here is to remove the drm_fb_helper_{cfb,sys}_*()
entirely. They where mostly introduced because fbdev doesn't protect
it's public interfaces with an CONFIG_FB preprocessor guards. But all
of DRM driver's fbdev emulation won't be build without CONFIG_FB, so
this is not an issue in practice. Removing the DRM wrappers will
further simplify the DRM code.

Thomas Zimmermann (6):
  fbdev: Return number of bytes read or written
  fbdev: Use screen_buffer in fb_sys_{read,write}()
  fbdev: Don't re-validate info->state in fb_ops implementations
  fbdev: Validate info->screen_{base,buffer} in fb_ops implementations
  fbdev: Move CFB read and write code into helper functions
  drm/fb-helper: Use fb_{cfb,sys}_{read, write}()

 drivers/gpu/drm/drm_fb_helper.c        | 174 +------------------------
 drivers/video/fbdev/cobalt_lcdfb.c     |   6 +
 drivers/video/fbdev/core/Makefile      |   2 +-
 drivers/video/fbdev/core/fb_cfb_fops.c | 126 ++++++++++++++++++
 drivers/video/fbdev/core/fb_sys_fops.c |  36 ++---
 drivers/video/fbdev/core/fbmem.c       | 111 +---------------
 drivers/video/fbdev/sm712fb.c          |  10 +-
 include/linux/fb.h                     |  10 ++
 8 files changed, 173 insertions(+), 302 deletions(-)
 create mode 100644 drivers/video/fbdev/core/fb_cfb_fops.c

Comments

Helge Deller April 25, 2023, 7:17 p.m. UTC | #1
On 4/25/23 16:28, Thomas Zimmermann wrote:
> Make fbdev's built-in helpers for reading and writing I/O and system
> memory available to DRM. Replace DRM's internal helpers.
>
> The first patch resolves a bug that's been in the fbdev code for
> more than 15 years. Makes the read/write helpers work successfully
> with the IGT tests.
>
> Patches 2 to 4 streamline fbdev's file-I/O code and remove a few
> duplicate checks.
>
> Patch 5 moves the default-I/O code into the new helpers fb_cfb_read()
> and fb_cfb_write(); patch 6 uses them in DRM. This allows us to remove
> quite a bit of code from DRM's internal fbdev helpers.
>
> Tested with i915 and simpledrm.
>
> The next step here is to remove the drm_fb_helper_{cfb,sys}_*()
> entirely. They where mostly introduced because fbdev doesn't protect
> it's public interfaces with an CONFIG_FB preprocessor guards. But all
> of DRM driver's fbdev emulation won't be build without CONFIG_FB, so
> this is not an issue in practice. Removing the DRM wrappers will
> further simplify the DRM code.

This series does a very nice cleanup!

You may add:
Acked-by: Helge Deller <deller@gmx.de>

Thanks!
Helge

>
> Thomas Zimmermann (6):
>    fbdev: Return number of bytes read or written
>    fbdev: Use screen_buffer in fb_sys_{read,write}()
>    fbdev: Don't re-validate info->state in fb_ops implementations
>    fbdev: Validate info->screen_{base,buffer} in fb_ops implementations
>    fbdev: Move CFB read and write code into helper functions
>    drm/fb-helper: Use fb_{cfb,sys}_{read, write}()
>
>   drivers/gpu/drm/drm_fb_helper.c        | 174 +------------------------
>   drivers/video/fbdev/cobalt_lcdfb.c     |   6 +
>   drivers/video/fbdev/core/Makefile      |   2 +-
>   drivers/video/fbdev/core/fb_cfb_fops.c | 126 ++++++++++++++++++
>   drivers/video/fbdev/core/fb_sys_fops.c |  36 ++---
>   drivers/video/fbdev/core/fbmem.c       | 111 +---------------
>   drivers/video/fbdev/sm712fb.c          |  10 +-
>   include/linux/fb.h                     |  10 ++
>   8 files changed, 173 insertions(+), 302 deletions(-)
>   create mode 100644 drivers/video/fbdev/core/fb_cfb_fops.c
>
Sui Jingfeng April 26, 2023, 10:33 a.m. UTC | #2
Hi,


The whole patch set is tested with fbdev of IGT, on LoongArch with
drm/radeon and efifb driver. Test results say SUCCESS.


On 2023/4/25 22:28, Thomas Zimmermann wrote:
> Make fbdev's built-in helpers for reading and writing I/O and system
> memory available to DRM. Replace DRM's internal helpers.
>
> The first patch resolves a bug that's been in the fbdev code for
> more than 15 years. Makes the read/write helpers work successfully
> with the IGT tests.
>
> Patches 2 to 4 streamline fbdev's file-I/O code and remove a few
> duplicate checks.
>
> Patch 5 moves the default-I/O code into the new helpers fb_cfb_read()
> and fb_cfb_write(); patch 6 uses them in DRM. This allows us to remove
> quite a bit of code from DRM's internal fbdev helpers.
>
> Tested with i915 and simpledrm.
>
> The next step here is to remove the drm_fb_helper_{cfb,sys}_*()
> entirely. They where mostly introduced because fbdev doesn't protect
> it's public interfaces with an CONFIG_FB preprocessor guards. But all
> of DRM driver's fbdev emulation won't be build without CONFIG_FB, so
> this is not an issue in practice. Removing the DRM wrappers will
> further simplify the DRM code.
>
> Thomas Zimmermann (6):
>    fbdev: Return number of bytes read or written
>    fbdev: Use screen_buffer in fb_sys_{read,write}()
>    fbdev: Don't re-validate info->state in fb_ops implementations
>    fbdev: Validate info->screen_{base,buffer} in fb_ops implementations
>    fbdev: Move CFB read and write code into helper functions
>    drm/fb-helper: Use fb_{cfb,sys}_{read, write}()
>
>   drivers/gpu/drm/drm_fb_helper.c        | 174 +------------------------
>   drivers/video/fbdev/cobalt_lcdfb.c     |   6 +
>   drivers/video/fbdev/core/Makefile      |   2 +-
>   drivers/video/fbdev/core/fb_cfb_fops.c | 126 ++++++++++++++++++
>   drivers/video/fbdev/core/fb_sys_fops.c |  36 ++---
>   drivers/video/fbdev/core/fbmem.c       | 111 +---------------
>   drivers/video/fbdev/sm712fb.c          |  10 +-
>   include/linux/fb.h                     |  10 ++
>   8 files changed, 173 insertions(+), 302 deletions(-)
>   create mode 100644 drivers/video/fbdev/core/fb_cfb_fops.c
>
Thomas Zimmermann April 26, 2023, 11:22 a.m. UTC | #3
Am 26.04.23 um 12:33 schrieb Sui Jingfeng:
> Hi,
> 
> 
> The whole patch set is tested with fbdev of IGT, on LoongArch with
> drm/radeon and efifb driver. Test results say SUCCESS.

Thanks a lot.

> 
> 
> On 2023/4/25 22:28, Thomas Zimmermann wrote:
>> Make fbdev's built-in helpers for reading and writing I/O and system
>> memory available to DRM. Replace DRM's internal helpers.
>>
>> The first patch resolves a bug that's been in the fbdev code for
>> more than 15 years. Makes the read/write helpers work successfully
>> with the IGT tests.
>>
>> Patches 2 to 4 streamline fbdev's file-I/O code and remove a few
>> duplicate checks.
>>
>> Patch 5 moves the default-I/O code into the new helpers fb_cfb_read()
>> and fb_cfb_write(); patch 6 uses them in DRM. This allows us to remove
>> quite a bit of code from DRM's internal fbdev helpers.
>>
>> Tested with i915 and simpledrm.
>>
>> The next step here is to remove the drm_fb_helper_{cfb,sys}_*()
>> entirely. They where mostly introduced because fbdev doesn't protect
>> it's public interfaces with an CONFIG_FB preprocessor guards. But all
>> of DRM driver's fbdev emulation won't be build without CONFIG_FB, so
>> this is not an issue in practice. Removing the DRM wrappers will
>> further simplify the DRM code.
>>
>> Thomas Zimmermann (6):
>>    fbdev: Return number of bytes read or written
>>    fbdev: Use screen_buffer in fb_sys_{read,write}()
>>    fbdev: Don't re-validate info->state in fb_ops implementations
>>    fbdev: Validate info->screen_{base,buffer} in fb_ops implementations
>>    fbdev: Move CFB read and write code into helper functions
>>    drm/fb-helper: Use fb_{cfb,sys}_{read, write}()
>>
>>   drivers/gpu/drm/drm_fb_helper.c        | 174 +------------------------
>>   drivers/video/fbdev/cobalt_lcdfb.c     |   6 +
>>   drivers/video/fbdev/core/Makefile      |   2 +-
>>   drivers/video/fbdev/core/fb_cfb_fops.c | 126 ++++++++++++++++++
>>   drivers/video/fbdev/core/fb_sys_fops.c |  36 ++---
>>   drivers/video/fbdev/core/fbmem.c       | 111 +---------------
>>   drivers/video/fbdev/sm712fb.c          |  10 +-
>>   include/linux/fb.h                     |  10 ++
>>   8 files changed, 173 insertions(+), 302 deletions(-)
>>   create mode 100644 drivers/video/fbdev/core/fb_cfb_fops.c
>>