forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/video/fbdev/stifb.c
....@@ -999,7 +999,7 @@
999999 case S9000_ID_HCRX:
10001000 HYPER_ENABLE_DISABLE_DISPLAY(fb, enable);
10011001 break;
1002
- case S9000_ID_A1659A: /* fall through */
1002
+ case S9000_ID_A1659A:
10031003 case S9000_ID_TIMBER:
10041004 case CRX24_OVERLAY_PLANES:
10051005 default:
....@@ -1037,6 +1037,48 @@
10371037 WRITE_WORD(((area->sx << 16) | area->sy), fb, REG_24);
10381038 WRITE_WORD(((area->width << 16) | area->height), fb, REG_7);
10391039 WRITE_WORD(((area->dx << 16) | area->dy), fb, REG_25);
1040
+
1041
+ SETUP_FB(fb);
1042
+}
1043
+
1044
+#define ARTIST_VRAM_SIZE 0x000804
1045
+#define ARTIST_VRAM_SRC 0x000808
1046
+#define ARTIST_VRAM_SIZE_TRIGGER_WINFILL 0x000a04
1047
+#define ARTIST_VRAM_DEST_TRIGGER_BLOCKMOVE 0x000b00
1048
+#define ARTIST_SRC_BM_ACCESS 0x018008
1049
+#define ARTIST_FGCOLOR 0x018010
1050
+#define ARTIST_BGCOLOR 0x018014
1051
+#define ARTIST_BITMAP_OP 0x01801c
1052
+
1053
+static void
1054
+stifb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
1055
+{
1056
+ struct stifb_info *fb = container_of(info, struct stifb_info, info);
1057
+
1058
+ if (rect->rop != ROP_COPY ||
1059
+ (fb->id == S9000_ID_HCRX && fb->info.var.bits_per_pixel == 32))
1060
+ return cfb_fillrect(info, rect);
1061
+
1062
+ SETUP_HW(fb);
1063
+
1064
+ if (fb->info.var.bits_per_pixel == 32) {
1065
+ WRITE_WORD(0xBBA0A000, fb, REG_10);
1066
+
1067
+ NGLE_REALLY_SET_IMAGE_PLANEMASK(fb, 0xffffffff);
1068
+ } else {
1069
+ WRITE_WORD(fb->id == S9000_ID_HCRX ? 0x13a02000 : 0x13a01000, fb, REG_10);
1070
+
1071
+ NGLE_REALLY_SET_IMAGE_PLANEMASK(fb, 0xff);
1072
+ }
1073
+
1074
+ WRITE_WORD(0x03000300, fb, ARTIST_BITMAP_OP);
1075
+ WRITE_WORD(0x2ea01000, fb, ARTIST_SRC_BM_ACCESS);
1076
+ NGLE_QUICK_SET_DST_BM_ACCESS(fb, 0x2ea01000);
1077
+ NGLE_REALLY_SET_IMAGE_FG_COLOR(fb, rect->color);
1078
+ WRITE_WORD(0, fb, ARTIST_BGCOLOR);
1079
+
1080
+ NGLE_SET_DSTXY(fb, (rect->dx << 16) | (rect->dy));
1081
+ SET_LENXY_START_RECFILL(fb, (rect->width << 16) | (rect->height));
10401082
10411083 SETUP_FB(fb);
10421084 }
....@@ -1101,11 +1143,11 @@
11011143
11021144 /* ------------ Interfaces to hardware functions ------------ */
11031145
1104
-static struct fb_ops stifb_ops = {
1146
+static const struct fb_ops stifb_ops = {
11051147 .owner = THIS_MODULE,
11061148 .fb_setcolreg = stifb_setcolreg,
11071149 .fb_blank = stifb_blank,
1108
- .fb_fillrect = cfb_fillrect,
1150
+ .fb_fillrect = stifb_fillrect,
11091151 .fb_copyarea = stifb_copyarea,
11101152 .fb_imageblit = cfb_imageblit,
11111153 };
....@@ -1157,7 +1199,7 @@
11571199 dev_name);
11581200 goto out_err0;
11591201 }
1160
- /* fall through */
1202
+ fallthrough;
11611203 case S9000_ID_ARTIST:
11621204 case S9000_ID_HCRX:
11631205 case S9000_ID_TIMBER:
....@@ -1198,7 +1240,7 @@
11981240 case S9000_ID_TOMCAT: /* Dual CRX, behaves else like a CRX */
11991241 /* FIXME: TomCat supports two heads:
12001242 * fb.iobase = REGION_BASE(fb_info,3);
1201
- * fb.screen_base = ioremap_nocache(REGION_BASE(fb_info,2),xxx);
1243
+ * fb.screen_base = ioremap(REGION_BASE(fb_info,2),xxx);
12021244 * for now we only support the left one ! */
12031245 xres = fb->ngle_rom.x_size_visible;
12041246 yres = fb->ngle_rom.y_size_visible;
....@@ -1257,7 +1299,7 @@
12571299
12581300 /* limit fbsize to max visible screen size */
12591301 if (fix->smem_len > yres*fix->line_length)
1260
- fix->smem_len = yres*fix->line_length;
1302
+ fix->smem_len = ALIGN(yres*fix->line_length, 4*1024*1024);
12611303
12621304 fix->accel = FB_ACCEL_NONE;
12631305
....@@ -1291,13 +1333,13 @@
12911333
12921334 strcpy(fix->id, "stifb");
12931335 info->fbops = &stifb_ops;
1294
- info->screen_base = ioremap_nocache(REGION_BASE(fb,1), fix->smem_len);
1336
+ info->screen_base = ioremap(REGION_BASE(fb,1), fix->smem_len);
12951337 if (!info->screen_base) {
12961338 printk(KERN_ERR "stifb: failed to map memory\n");
12971339 goto out_err0;
12981340 }
12991341 info->screen_size = fix->smem_len;
1300
- info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA;
1342
+ info->flags = FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT;
13011343 info->pseudo_palette = &fb->pseudo_palette;
13021344
13031345 /* This has to be done !!! */
....@@ -1317,10 +1359,10 @@
13171359 goto out_err3;
13181360 }
13191361
1362
+ /* save for primary gfx device detection & unregister_framebuffer() */
1363
+ sti->info = info;
13201364 if (register_framebuffer(&fb->info) < 0)
13211365 goto out_err4;
1322
-
1323
- sti->info = info; /* save for unregister_framebuffer() */
13241366
13251367 fb_info(&fb->info, "%s %dx%d-%d frame buffer device, %s, id: %04x, mmio: 0x%04lx\n",
13261368 fix->id,