Message ID | 20230728182234.10680-1-tzimmermann@suse.de (mailing list archive) |
---|---|
Headers | show |
Series | fbdev: Use I/O helpers | expand |
Hi Thomas, On Fri, Jul 28, 2023 at 06:39:43PM +0200, Thomas Zimmermann wrote: > Most fbdev drivers operate on I/O memory. And most of those use the > default implementations for file I/O and console drawing. Convert all > these low-hanging fruits to the fb_ops initializer macro and Kconfig > token for fbdev I/O helpers. > > The fbdev I/O helpers are easily grep-able. In a later patch, they can > be left to empty values if the rsp. funtionality, such as file I/O or > console, has been disabled. > > There are no functional changes. The helpers set the defaults that > the drivers already use. I have browsed all patches - they all looks good. Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Hi Thomas, On Fri, Jul 28, 2023 at 06:39:43PM +0200, Thomas Zimmermann wrote: > Most fbdev drivers operate on I/O memory. And most of those use the > default implementations for file I/O and console drawing. Convert all > these low-hanging fruits to the fb_ops initializer macro and Kconfig > token for fbdev I/O helpers. > > The fbdev I/O helpers are easily grep-able. In a later patch, they can > be left to empty values if the rsp. funtionality, such as file I/O or > console, has been disabled. Did you miss sm750 or was it left out on purpose? As it hide in staging it is easy to miss. Sam
On 7/28/23 18:39, Thomas Zimmermann wrote: > Most fbdev drivers operate on I/O memory. Just nitpicking here: What is I/O memory? Isn't it either memory, or I/O ? I mean, I would never think of the cfb* draw functions under I/O. > And most of those use the > default implementations for file I/O and console drawing. Convert all > these low-hanging fruits to the fb_ops initializer macro and Kconfig > token for fbdev I/O helpers. I do see the motivation for your patch, but I think the macro names are very misleading. You have: #define __FB_DEFAULT_IO_OPS_RDWR \ .fb_read = fb_io_read, \ .fb_write = fb_io_write #define __FB_DEFAULT_IO_OPS_DRAW \ .fb_fillrect = cfb_fillrect, \ .fb_copyarea = cfb_copyarea, \ .fb_imageblit = cfb_imageblit #define __FB_DEFAULT_IO_OPS_MMAP \ .fb_mmap = NULL /* default implementation */ #define FB_DEFAULT_IO_OPS \ __FB_DEFAULT_IO_OPS_RDWR, \ __FB_DEFAULT_IO_OPS_DRAW, \ __FB_DEFAULT_IO_OPS_MMAP I think FB_DEFAULT_IO_OPS is OK for read/write/mmap. But I would suggest to split out __FB_DEFAULT_IO_OPS_DRAW. Something like: #define FB_DEFAULT_IO_OPS \ __FB_DEFAULT_IO_OPS_RDWR, \ __FB_DEFAULT_IO_OPS_MMAP #define FB_DEFAULT_CFB_OPS \ .fb_fillrect = cfb_fillrect, \ .fb_copyarea = cfb_copyarea, \ .fb_imageblit = cfb_imageblit and then add FB_DEFAULT_IO_OPS *and* FB_DEFAULT_CFB_OPS to the various struct fb_ops in the drivers. Helge
Hi Helge, On Fri, Jul 28, 2023 at 08:46:59PM +0200, Helge Deller wrote: > On 7/28/23 18:39, Thomas Zimmermann wrote: > > Most fbdev drivers operate on I/O memory. > > Just nitpicking here: > What is I/O memory? > Isn't it either memory, or I/O ? > I mean, I would never think of the cfb* draw functions under I/O. > > > And most of those use the > > default implementations for file I/O and console drawing. Convert all > > these low-hanging fruits to the fb_ops initializer macro and Kconfig > > token for fbdev I/O helpers. > > I do see the motivation for your patch, but I think the > macro names are very misleading. > > You have: > #define __FB_DEFAULT_IO_OPS_RDWR \ > .fb_read = fb_io_read, \ > .fb_write = fb_io_write > > #define __FB_DEFAULT_IO_OPS_DRAW \ > .fb_fillrect = cfb_fillrect, \ > .fb_copyarea = cfb_copyarea, \ > .fb_imageblit = cfb_imageblit > > #define __FB_DEFAULT_IO_OPS_MMAP \ > .fb_mmap = NULL /* default implementation */ > > #define FB_DEFAULT_IO_OPS \ > __FB_DEFAULT_IO_OPS_RDWR, \ > __FB_DEFAULT_IO_OPS_DRAW, \ > __FB_DEFAULT_IO_OPS_MMAP > > I think FB_DEFAULT_IO_OPS is OK for read/write/mmap. > But I would suggest to split out __FB_DEFAULT_IO_OPS_DRAW. > Something like: > #define FB_DEFAULT_IO_OPS \ > __FB_DEFAULT_IO_OPS_RDWR, \ > __FB_DEFAULT_IO_OPS_MMAP > #define FB_DEFAULT_CFB_OPS \ > .fb_fillrect = cfb_fillrect, \ > .fb_copyarea = cfb_copyarea, \ > .fb_imageblit = cfb_imageblit The prefix cfb, I have recently learned, equals color frame buffer. They are named such for purely historical reasons. What is important is where the data are copied as we have two implementations of for example copyarea - one using system memory, the other using IO memory. The naming FB_DEFAULT_IO_OPS says this is the defaults to IO memory operations, which tell what they do and avoid the strange cfb acronym. Reserve cfb for color frame buffers only - and maybe in the end rename the three cfbcopyarea, cfbfillrect, cfbimgblt to use the io prefix. Which is much simpler to do after this series - and nice extra benefit. I hope this properly explains why I like the current naming and acked it when the macros were introduced. Sam
On 7/28/23 23:01, Sam Ravnborg wrote: > Hi Helge, > > On Fri, Jul 28, 2023 at 08:46:59PM +0200, Helge Deller wrote: >> On 7/28/23 18:39, Thomas Zimmermann wrote: >>> Most fbdev drivers operate on I/O memory. >> >> Just nitpicking here: >> What is I/O memory? >> Isn't it either memory, or I/O ? >> I mean, I would never think of the cfb* draw functions under I/O. >> >>> And most of those use the >>> default implementations for file I/O and console drawing. Convert all >>> these low-hanging fruits to the fb_ops initializer macro and Kconfig >>> token for fbdev I/O helpers. >> >> I do see the motivation for your patch, but I think the >> macro names are very misleading. >> >> You have: >> #define __FB_DEFAULT_IO_OPS_RDWR \ >> .fb_read = fb_io_read, \ >> .fb_write = fb_io_write >> >> #define __FB_DEFAULT_IO_OPS_DRAW \ >> .fb_fillrect = cfb_fillrect, \ >> .fb_copyarea = cfb_copyarea, \ >> .fb_imageblit = cfb_imageblit >> >> #define __FB_DEFAULT_IO_OPS_MMAP \ >> .fb_mmap = NULL /* default implementation */ >> >> #define FB_DEFAULT_IO_OPS \ >> __FB_DEFAULT_IO_OPS_RDWR, \ >> __FB_DEFAULT_IO_OPS_DRAW, \ >> __FB_DEFAULT_IO_OPS_MMAP >> >> I think FB_DEFAULT_IO_OPS is OK for read/write/mmap. >> But I would suggest to split out __FB_DEFAULT_IO_OPS_DRAW. >> Something like: >> #define FB_DEFAULT_IO_OPS \ >> __FB_DEFAULT_IO_OPS_RDWR, \ >> __FB_DEFAULT_IO_OPS_MMAP > > >> #define FB_DEFAULT_CFB_OPS \ >> .fb_fillrect = cfb_fillrect, \ >> .fb_copyarea = cfb_copyarea, \ >> .fb_imageblit = cfb_imageblit > > The prefix cfb, I have recently learned, equals color frame buffer. correct. > They are named such for purely historical reasons. well, they operate on MEMORY which represents a (color) frame buffer, either in host memory or memory on some card on some bus. So, the naming cfb is not historical, but even today correct. > What is important is where the data are copied as we have two > implementations of for example copyarea - one using system memory, the > other using IO memory. sys_copyarea() and cfb_copyarea(). > The naming FB_DEFAULT_IO_OPS says this is the defaults to IO memory > operations, which tell what they do This is exactly what I find misleading. IO_OPS sounds that it operates on file I/O (like file read/write), but not on iomem. > and avoid the strange cfb acronym. > Reserve cfb for color frame buffers only - and maybe in the end rename > the three cfbcopyarea, cfbfillrect, cfbimgblt to use the io prefix. Again, the io prefix is what I think is misleading. Why not name it what it really is and what is used in the kernel already, e.g. iomem_copyarea() and sysmem_copyarea(). which would lead to FB_DEFAULT_IOMEM_OPS and FB_DEFAULT_SYSMEM_OPS. > Which is much simpler to do after this series - and nice extra benefit. > > I hope this properly explains why I like the current naming and > acked it when the macros were introduced. IMHO the naming isn't perfect, but that's just nitpicking. Besides that, Thomas' patches are a nice cleanup. So, if you want add a Acked-by: Helge Deller <deller@gmx.de> to the series. Helge
Hi Sam Am 28.07.23 um 20:39 schrieb Sam Ravnborg: > Hi Thomas, > > On Fri, Jul 28, 2023 at 06:39:43PM +0200, Thomas Zimmermann wrote: >> Most fbdev drivers operate on I/O memory. And most of those use the >> default implementations for file I/O and console drawing. Convert all >> these low-hanging fruits to the fb_ops initializer macro and Kconfig >> token for fbdev I/O helpers. >> >> The fbdev I/O helpers are easily grep-able. In a later patch, they can >> be left to empty values if the rsp. funtionality, such as file I/O or >> console, has been disabled. > > Did you miss sm750 or was it left out on purpose? I did miss it indeed. I'll add the patch to the next iteration. Thanks for noticing. Best regards Thomas > As it hide in staging it is easy to miss. > > Sam
Hi Helge Am 29.07.23 um 08:51 schrieb Helge Deller: > On 7/28/23 23:01, Sam Ravnborg wrote: >> Hi Helge, >> >> On Fri, Jul 28, 2023 at 08:46:59PM +0200, Helge Deller wrote: >>> On 7/28/23 18:39, Thomas Zimmermann wrote: >>>> Most fbdev drivers operate on I/O memory. >>> >>> Just nitpicking here: >>> What is I/O memory? >>> Isn't it either memory, or I/O ? >>> I mean, I would never think of the cfb* draw functions under I/O. >>> >>>> And most of those use the >>>> default implementations for file I/O and console drawing. Convert all >>>> these low-hanging fruits to the fb_ops initializer macro and Kconfig >>>> token for fbdev I/O helpers. >>> >>> I do see the motivation for your patch, but I think the >>> macro names are very misleading. >>> >>> You have: >>> #define __FB_DEFAULT_IO_OPS_RDWR \ >>> .fb_read = fb_io_read, \ >>> .fb_write = fb_io_write >>> >>> #define __FB_DEFAULT_IO_OPS_DRAW \ >>> .fb_fillrect = cfb_fillrect, \ >>> .fb_copyarea = cfb_copyarea, \ >>> .fb_imageblit = cfb_imageblit >>> >>> #define __FB_DEFAULT_IO_OPS_MMAP \ >>> .fb_mmap = NULL /* default implementation */ >>> >>> #define FB_DEFAULT_IO_OPS \ >>> __FB_DEFAULT_IO_OPS_RDWR, \ >>> __FB_DEFAULT_IO_OPS_DRAW, \ >>> __FB_DEFAULT_IO_OPS_MMAP >>> >>> I think FB_DEFAULT_IO_OPS is OK for read/write/mmap. >>> But I would suggest to split out __FB_DEFAULT_IO_OPS_DRAW. >>> Something like: >>> #define FB_DEFAULT_IO_OPS \ >>> __FB_DEFAULT_IO_OPS_RDWR, \ >>> __FB_DEFAULT_IO_OPS_MMAP >> >> >>> #define FB_DEFAULT_CFB_OPS \ >>> .fb_fillrect = cfb_fillrect, \ >>> .fb_copyarea = cfb_copyarea, \ >>> .fb_imageblit = cfb_imageblit >> >> The prefix cfb, I have recently learned, equals color frame buffer. > > correct. > >> They are named such for purely historical reasons. > > well, they operate on MEMORY which represents a (color) frame buffer, > either in host memory or memory on some card on some bus. > So, the naming cfb is not historical, but even today correct. > >> What is important is where the data are copied as we have two >> implementations of for example copyarea - one using system memory, the >> other using IO memory. > > sys_copyarea() and cfb_copyarea(). > >> The naming FB_DEFAULT_IO_OPS says this is the defaults to IO memory >> operations, which tell what they do > > This is exactly what I find misleading. IO_OPS sounds that it operates > on file I/O (like file read/write), but not on iomem. > >> and avoid the strange cfb acronym. > >> Reserve cfb for color frame buffers only - and maybe in the end rename >> the three cfbcopyarea, cfbfillrect, cfbimgblt to use the io prefix. > > Again, the io prefix is what I think is misleading. > Why not name it what it really is and what is used in the kernel > already, e.g. > iomem_copyarea() and sysmem_copyarea(). > which would lead to > FB_DEFAULT_IOMEM_OPS and FB_DEFAULT_SYSMEM_OPS. Yes there's been a bit of confusion and discussion on the naming before. I'd be happy if we can standardize on sysmem and iomem. I can add a patch to this patchset to rename the _IO_ macros and tokens to use _IOMEM_. That's not too much change. A later patchset can address sysmem and deferred I/O helpers separately. On motivation: for now it's a cleanup to make the a bit code easier to understand. But once all drivers set their callbacks correctly, we can make the I/O mem code optional. It's currently the default and built-in unconditionally. But it's not uncommon that it's unused entirely. Best regards Thomas > >> Which is much simpler to do after this series - and nice extra benefit. >> >> I hope this properly explains why I like the current naming and >> acked it when the macros were introduced. > > IMHO the naming isn't perfect, but that's just nitpicking. > Besides that, Thomas' patches are a nice cleanup. > So, if you want add a > Acked-by: Helge Deller <deller@gmx.de> > to the series. > > Helge
On 7/29/23 15:21, Thomas Zimmermann wrote: > Hi Helge > > Am 29.07.23 um 08:51 schrieb Helge Deller: >> On 7/28/23 23:01, Sam Ravnborg wrote: >>> Hi Helge, >>> >>> On Fri, Jul 28, 2023 at 08:46:59PM +0200, Helge Deller wrote: >>>> On 7/28/23 18:39, Thomas Zimmermann wrote: >>>>> Most fbdev drivers operate on I/O memory. >>>> >>>> Just nitpicking here: >>>> What is I/O memory? >>>> Isn't it either memory, or I/O ? >>>> I mean, I would never think of the cfb* draw functions under I/O. >>>> >>>>> And most of those use the >>>>> default implementations for file I/O and console drawing. Convert all >>>>> these low-hanging fruits to the fb_ops initializer macro and Kconfig >>>>> token for fbdev I/O helpers. >>>> >>>> I do see the motivation for your patch, but I think the >>>> macro names are very misleading. >>>> >>>> You have: >>>> #define __FB_DEFAULT_IO_OPS_RDWR \ >>>> .fb_read = fb_io_read, \ >>>> .fb_write = fb_io_write >>>> >>>> #define __FB_DEFAULT_IO_OPS_DRAW \ >>>> .fb_fillrect = cfb_fillrect, \ >>>> .fb_copyarea = cfb_copyarea, \ >>>> .fb_imageblit = cfb_imageblit >>>> >>>> #define __FB_DEFAULT_IO_OPS_MMAP \ >>>> .fb_mmap = NULL /* default implementation */ >>>> >>>> #define FB_DEFAULT_IO_OPS \ >>>> __FB_DEFAULT_IO_OPS_RDWR, \ >>>> __FB_DEFAULT_IO_OPS_DRAW, \ >>>> __FB_DEFAULT_IO_OPS_MMAP >>>> >>>> I think FB_DEFAULT_IO_OPS is OK for read/write/mmap. >>>> But I would suggest to split out __FB_DEFAULT_IO_OPS_DRAW. >>>> Something like: >>>> #define FB_DEFAULT_IO_OPS \ >>>> __FB_DEFAULT_IO_OPS_RDWR, \ >>>> __FB_DEFAULT_IO_OPS_MMAP >>> >>> >>>> #define FB_DEFAULT_CFB_OPS \ >>>> .fb_fillrect = cfb_fillrect, \ >>>> .fb_copyarea = cfb_copyarea, \ >>>> .fb_imageblit = cfb_imageblit >>> >>> The prefix cfb, I have recently learned, equals color frame buffer. >> >> correct. >> >>> They are named such for purely historical reasons. >> >> well, they operate on MEMORY which represents a (color) frame buffer, >> either in host memory or memory on some card on some bus. >> So, the naming cfb is not historical, but even today correct. >> >>> What is important is where the data are copied as we have two >>> implementations of for example copyarea - one using system memory, the >>> other using IO memory. >> >> sys_copyarea() and cfb_copyarea(). >> >>> The naming FB_DEFAULT_IO_OPS says this is the defaults to IO memory >>> operations, which tell what they do >> >> This is exactly what I find misleading. IO_OPS sounds that it operates >> on file I/O (like file read/write), but not on iomem. >> >>> and avoid the strange cfb acronym. >> >>> Reserve cfb for color frame buffers only - and maybe in the end rename >>> the three cfbcopyarea, cfbfillrect, cfbimgblt to use the io prefix. >> >> Again, the io prefix is what I think is misleading. >> Why not name it what it really is and what is used in the kernel already, e.g. >> iomem_copyarea() and sysmem_copyarea(). >> which would lead to >> FB_DEFAULT_IOMEM_OPS and FB_DEFAULT_SYSMEM_OPS. > > Yes there's been a bit of confusion and discussion on the naming before. I'd be happy if we can standardize on sysmem and iomem. > > I can add a patch to this patchset to rename the _IO_ macros and tokens to use _IOMEM_. That's not too much change. A later patchset can address sysmem and deferred I/O helpers separately. Sound good. > On motivation: for now it's a cleanup to make the a bit code easier to understand. But once all drivers set their callbacks correctly, we can make the I/O mem code optional. It's currently the default and built-in unconditionally. But it's not uncommon that it's unused entirely. Probably true for x86, on others it might be useful to make the sysmem optional as well. I did not checked. Anyway, thanks for your work! Helge > > Best regards > Thomas > >> >>> Which is much simpler to do after this series - and nice extra benefit. >>> >>> I hope this properly explains why I like the current naming and >>> acked it when the macros were introduced. >> >> IMHO the naming isn't perfect, but that's just nitpicking. >> Besides that, Thomas' patches are a nice cleanup. >> So, if you want add a >> Acked-by: Helge Deller <deller@gmx.de> >> to the series. >> >> Helge >
On Fri, Jul 28, 2023 at 08:35:41PM +0200, Sam Ravnborg wrote: > Hi Thomas, > > On Fri, Jul 28, 2023 at 06:39:43PM +0200, Thomas Zimmermann wrote: > > Most fbdev drivers operate on I/O memory. And most of those use the > > default implementations for file I/O and console drawing. Convert all > > these low-hanging fruits to the fb_ops initializer macro and Kconfig > > token for fbdev I/O helpers. > > > > The fbdev I/O helpers are easily grep-able. In a later patch, they can > > be left to empty values if the rsp. funtionality, such as file I/O or > > console, has been disabled. > > > > There are no functional changes. The helpers set the defaults that > > the drivers already use. > > I have browsed all patches - they all looks good. > Reviewed-by: Sam Ravnborg <sam@ravnborg.org> When you post v2 with MEM added the review still holds true. Sam
Hi Sam Am 28.07.23 um 20:39 schrieb Sam Ravnborg: > Hi Thomas, > > On Fri, Jul 28, 2023 at 06:39:43PM +0200, Thomas Zimmermann wrote: >> Most fbdev drivers operate on I/O memory. And most of those use the >> default implementations for file I/O and console drawing. Convert all >> these low-hanging fruits to the fb_ops initializer macro and Kconfig >> token for fbdev I/O helpers. >> >> The fbdev I/O helpers are easily grep-able. In a later patch, they can >> be left to empty values if the rsp. funtionality, such as file I/O or >> console, has been disabled. > > Did you miss sm750 or was it left out on purpose? > As it hide in staging it is easy to miss. Now I remembered why I left out sm750fb. It modifies the function pointers at some point at https://elixir.bootlin.com/linux/latest/source/drivers/staging/sm750fb/sm750.c#L741 So the driver uses a non-trivial fb_ops setup and is worth a different fix. Best regards Thomas > > Sam