]> www.infradead.org Git - nvme.git/commitdiff
fbdev: wmt_ge_rops: Remove fb_draw.h includes
authorZsolt Kajtar <soci@c64.rulez.org>
Mon, 10 Mar 2025 06:59:45 +0000 (07:59 +0100)
committerHelge Deller <deller@gmx.de>
Wed, 26 Mar 2025 21:39:21 +0000 (22:39 +0100)
Remove dependency on fb_draw.h to allow fbcon packed pixel drawing refactoring.

Signed-off-by: Zsolt Kajtar <soci@c64.rulez.org>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/wmt_ge_rops.c

index 69106299ab47cb75a4c1c5c923950ddabde836b0..92fbb3f3a0d316f29083930ac4fb893eb5b091ed 100644 (file)
@@ -12,7 +12,6 @@
 #include <linux/io.h>
 #include <linux/platform_device.h>
 
-#include "core/fb_draw.h"
 #include "wmt_ge_rops.h"
 
 #define GE_COMMAND_OFF         0x00
 
 static void __iomem *regbase;
 
+/* from the spec it seems more like depth than bits per pixel */
+static inline unsigned long pixel_to_pat(u32 depth, u32 pixel, struct fb_info *p)
+{
+       switch (depth) {
+       case 1:
+               return ~0ul*pixel;
+       case 2:
+               return ~0ul/3*pixel;
+       case 4:
+               return ~0ul/15*pixel;
+       case 8:
+               return ~0ul/255*pixel;
+       case 12:
+       case 15:
+       case 16:
+               return ~0ul/0xffff*pixel;
+       case 18:
+       case 24:
+               return 0x1000001ul*pixel;
+       case 32:
+               return pixel;
+       default:
+               fb_warn_once(p, "%s: unsupported pixelformat %d\n", __func__, depth);
+               return 0;
+       }
+}
+
 void wmt_ge_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
 {
        unsigned long fg, pat;
@@ -54,7 +80,7 @@ void wmt_ge_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
        else
                fg = rect->color;
 
-       pat = pixel_to_pat(p->var.bits_per_pixel, fg);
+       pat = pixel_to_pat(p->var.bits_per_pixel, fg, p);
 
        if (p->fbops->fb_sync)
                p->fbops->fb_sync(p);