[RFC PATCH 00/12] Deduplicate cfb/sys drawing fbops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everyone!

A series on de-duplicating the common cfb and sys drawing routines will
follow.

Some background:

It happens that I need to use both cfb and sys drawing routines.

At low resolution where the aperture is large enough the framebuffer
memory is directly mapped. As usual the cfb routines are used.

In the high resolution scenario defio is used to make banking
transparent, there the sys drawing routines are used.

There are packed pixels, of course in the wrong order. So that needs
CFB_REV_PIXELS_IN_BYTE, fine. Or almost.

While the sys routines are based on cfb for some reason the former lacks
pixel order reversing support. The result is that at low resolution the
console is fine, but it's unreadable at high resolution due to the wrong
pixel ordering.

First I added the pixel reversal support to sys, console looks fine.
Still I might have made mistakes when doing so, that might need
further testing just to be sure. Hacked fillrect to run in userspace,
wasn't easy and now I have to come up with edge cases...

Had another look at the cfb routines and sys is basically a straight
copy. Minus the pixel reversing, FB_READ/WRITE macro inlining by hand,
comment style updates and a few changes here and there for I/O vs.
system memory. The memory access differences could have been easily
covered with a few small macros, strange.

Cfb has a working pixel reversal as far as I know. Now all it needs is a
few changes for the memory access differences and then I have the sys
routines with pixel reversal. And can also be reasonably confident that
it actually does what it needs to in special drawing scenarios.

So the patches below take a copy of the cfb routines as header files,
and add macros for the access, text and other differences. The comment
style changes were taken from sys so that it's less different when
compared. Then the cfb and sys files were cut down to just an include
of the common code in the header plus a few defines for the macros used
in the headers.

I was thinking what to do with copyright/credits now. On the new headers
it's clear as it's basically cfb, but the new cfb and sys suffered
significant changes and not much remained. I kept the original authors
but it might be questionable on sys, it just an includes cfb code now.

I know at the moment there are no users for the pixel reversal function
in sys and could have sent such changes later when truly required.

However there are some maintainability benefits as it removes lots of
duplicate code which might be worth to have meanwhile. The pixel
reversal gets optimized out when not in use so I don't worry about that
much.

Zsolt Kajtar (12):
  fbdev: core: Copy cfbcopyarea to fb_copyarea
  fbdev: core: Make fb_copyarea generic
  fbdev: core: Use generic copyarea for as cfb_copyarea
  fbdev: core: Use generic copyarea for as sys_copyarea
  fbdev: core: Copy cfbfillrect to fb_fillrect
  fbdev: core: Make fb_fillrect generic
  fbdev: core: Use generic fillrect for as cfb_fillrect
  fbdev: core: Use generic fillrect for as sys_fillrect
  fbdev: core: Copy cfbimgblt to fb_imageblit
  fbdev: core: Make fb_imageblit generic
  fbdev: core: Use generic imageblit for as cfb_imageblit
  fbdev: core: Use generic imageblit for as sys_imageblit

 drivers/video/fbdev/core/cfbcopyarea.c  | 425 +-----------------------
 drivers/video/fbdev/core/cfbfillrect.c  | 362 +-------------------
 drivers/video/fbdev/core/cfbimgblt.c    | 356 +-------------------
 drivers/video/fbdev/core/fb_copyarea.h  | 421 +++++++++++++++++++++++
 drivers/video/fbdev/core/fb_fillrect.h  | 359 ++++++++++++++++++++
 drivers/video/fbdev/core/fb_imageblit.h | 356 ++++++++++++++++++++
 drivers/video/fbdev/core/syscopyarea.c  | 356 +-------------------
 drivers/video/fbdev/core/sysfillrect.c  | 314 +----------------
 drivers/video/fbdev/core/sysimgblt.c    | 324 +-----------------
 9 files changed, 1190 insertions(+), 2083 deletions(-)
 create mode 100644 drivers/video/fbdev/core/fb_copyarea.h
 create mode 100644 drivers/video/fbdev/core/fb_fillrect.h
 create mode 100644 drivers/video/fbdev/core/fb_imageblit.h

-- 
2.30.2


Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Tourism]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux