Lines Matching +full:data +full:- +full:width
2 * linux/drivers/video/tgafb.c -- DEC 21030 TGA frame buffer device
37 #define TGA_BUS_TC(dev) (dev->bus == &tc_bus_type)
116 return tgafb_register(&pdev->dev); in tgafb_pci_register()
121 tgafb_unregister(&pdev->dev); in tgafb_pci_unregister()
133 { "DEC ", "PMAGD-AA" },
167 * tgafb_check_var - Optional function. Validates a var passed in.
174 struct tga_par *par = (struct tga_par *)info->par; in tgafb_check_var()
176 if (!var->pixclock) in tgafb_check_var()
177 return -EINVAL; in tgafb_check_var()
179 if (par->tga_type == TGA_TYPE_8PLANE) { in tgafb_check_var()
180 if (var->bits_per_pixel != 8) in tgafb_check_var()
181 return -EINVAL; in tgafb_check_var()
183 if (var->bits_per_pixel != 32) in tgafb_check_var()
184 return -EINVAL; in tgafb_check_var()
186 var->red.length = var->green.length = var->blue.length = 8; in tgafb_check_var()
187 if (var->bits_per_pixel == 32) { in tgafb_check_var()
188 var->red.offset = 16; in tgafb_check_var()
189 var->green.offset = 8; in tgafb_check_var()
190 var->blue.offset = 0; in tgafb_check_var()
193 if (var->xres_virtual != var->xres || var->yres_virtual != var->yres) in tgafb_check_var()
194 return -EINVAL; in tgafb_check_var()
195 if (var->xres * var->yres * (var->bits_per_pixel >> 3) > info->fix.smem_len) in tgafb_check_var()
196 return -EINVAL; in tgafb_check_var()
197 if (var->nonstd) in tgafb_check_var()
198 return -EINVAL; in tgafb_check_var()
199 if (1000000000 / var->pixclock > TGA_PLL_MAX_FREQ) in tgafb_check_var()
200 return -EINVAL; in tgafb_check_var()
201 if ((var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED) in tgafb_check_var()
202 return -EINVAL; in tgafb_check_var()
204 /* Some of the acceleration routines assume the line width is in tgafb_check_var()
206 if (var->xres * (par->tga_type == TGA_TYPE_8PLANE ? 1 : 4) % 8) in tgafb_check_var()
207 return -EINVAL; in tgafb_check_var()
213 * tgafb_set_par - Optional function. Alters the hardware state.
244 struct tga_par *par = (struct tga_par *) info->par;
245 int tga_bus_pci = dev_is_pci(par->dev);
246 int tga_bus_tc = TGA_BUS_TC(par->dev);
252 htimings = (((info->var.xres/4) & TGA_HORIZ_ACT_LSB)
253 | (((info->var.xres/4) & 0x600 << 19) & TGA_HORIZ_ACT_MSB));
254 vtimings = (info->var.yres & TGA_VERT_ACTIVE);
255 htimings |= ((info->var.right_margin/4) << 9) & TGA_HORIZ_FP;
256 vtimings |= (info->var.lower_margin << 11) & TGA_VERT_FP;
257 htimings |= ((info->var.hsync_len/4) << 14) & TGA_HORIZ_SYNC;
258 vtimings |= (info->var.vsync_len << 16) & TGA_VERT_SYNC;
259 htimings |= ((info->var.left_margin/4) << 21) & TGA_HORIZ_BP;
260 vtimings |= (info->var.upper_margin << 22) & TGA_VERT_BP;
262 if (info->var.sync & FB_SYNC_HOR_HIGH_ACT)
264 if (info->var.sync & FB_SYNC_VERT_HIGH_ACT)
267 par->htimings = htimings;
268 par->vtimings = vtimings;
270 par->sync_on_green = !!(info->var.sync & FB_SYNC_ON_GREEN);
273 par->xres = info->var.xres;
274 par->yres = info->var.yres;
275 par->pll_freq = pll_freq = 1000000000 / info->var.pixclock;
276 par->bits_per_pixel = info->var.bits_per_pixel;
277 info->fix.line_length = par->xres * (par->bits_per_pixel >> 3);
279 tga_type = par->tga_type;
289 (par->sync_on_green ? 0x0 : 0x00010000),
315 BT485_WRITE(par, 0xa2 | (par->sync_on_green ? 0x8 : 0x0),
344 (par->sync_on_green ? 0xc0 : 0x40));
359 } else { /* 24-plane or 24plusZ */
365 (par->sync_on_green ? 0xc0 : 0x40));
419 /* Finally, enable video scan (and pray for the monitor... :-) */
428 int delta = f - (TGA_PLL_BASE_FREQ * (X)) / (r << shift); \
430 delta = -delta; \
490 m = ((n + 3) / 7) - 1;
495 m = (n / 6) - 1;
503 vr--;
516 * tgafb_setcolreg - Optional function. Sets a color register.
528 struct tga_par *par = (struct tga_par *) info->par;
529 int tga_bus_pci = dev_is_pci(par->dev);
530 int tga_bus_tc = TGA_BUS_TC(par->dev);
538 if (par->tga_type == TGA_TYPE_8PLANE && tga_bus_pci) {
544 } else if (par->tga_type == TGA_TYPE_8PLANE && tga_bus_tc) {
553 ((u32 *)info->pseudo_palette)[regno] = value;
567 * tgafb_blank - Optional function. Blanks the display.
574 struct tga_par *par = (struct tga_par *) info->par;
587 if (par->vesa_blanked) {
590 par->vesa_blanked = 0;
603 par->vesa_blanked = 1;
609 par->vesa_blanked = 1;
616 par->vesa_blanked = 1;
632 struct tga_par *par = (struct tga_par *) info->par;
633 u32 fgcolor, bgcolor, dx, dy, width, height, vxres, vyres, pixelmask; local
636 const unsigned char *data; local
640 is8bpp = info->var.bits_per_pixel == 8;
642 dx = image->dx;
643 dy = image->dy;
644 width = image->width;
645 height = image->height;
646 vxres = info->var.xres_virtual;
647 vyres = info->var.yres_virtual;
648 line_length = info->fix.line_length;
649 rincr = (width + 7) / 8;
652 if (unlikely(width == 0))
657 if (dx + width > vxres)
658 width = vxres - dx;
660 height = vyres - dy;
662 regs_base = par->tga_regs_base;
663 fb_base = par->tga_fb_base;
665 /* Expand the color values to fill 32-bits. */
668 fgcolor = image->fg_color;
669 bgcolor = image->bg_color;
677 fgcolor = ((u32 *)info->pseudo_palette)[fgcolor];
679 bgcolor = ((u32 *)info->pseudo_palette)[bgcolor];
690 pos &= -4;
694 pos &= -8;
697 data = (const unsigned char *) image->data;
705 if (width + shift <= 32) {
711 /* Avoid a shift by 32; width > 0 implied. */
712 pixelmask = (2ul << (width - 1)) - 1;
717 bwidth = (width + 7) / 8;
722 /* The image data is bit big endian; we need
725 mask |= bitrev8(data[j]) << (j * 8);
730 data += rincr;
736 const unsigned char *data0 = data;
748 bwidth = (width / 8) & -4;
752 mask |= bitrev8(data[j+0]) << (0 * 8);
753 mask |= bitrev8(data[j+1]) << (1 * 8);
754 mask |= bitrev8(data[j+2]) << (2 * 8);
755 mask |= bitrev8(data[j+3]) << (3 * 8);
759 data += rincr;
763 pixelmask = (1ul << (width & 31)) - 1;
769 data = data0 + bwidth;
770 bwidth = ((width & 31) + 7) / 8;
775 mask |= bitrev8(data[j]) << (j * 8);
778 data += rincr;
785 const unsigned char *data0 = data;
790 Here we split the write into 16-bit spans. This allows
792 be required by writing 24-bit spans. */
798 bwidth = (width / 8) & -2;
802 mask |= bitrev8(data[j+0]) << (0 * 8);
803 mask |= bitrev8(data[j+1]) << (1 * 8);
808 data += rincr;
812 pixelmask = ((1ul << (width & 15)) - 1) << shift;
818 data = data0 + bwidth;
819 bwidth = (width & 15) > 8;
822 u32 mask = bitrev8(data[0]);
824 mask |= bitrev8(data[1]) << 8;
828 data += rincr;
845 struct tga_par *par = (struct tga_par *) info->par;
846 u32 color, dx, dy, width, height, vxres, vyres; local
847 u32 *palette = ((u32 *)info->pseudo_palette);
849 const unsigned char *data; local
852 dx = image->dx;
853 dy = image->dy;
854 width = image->width;
855 height = image->height;
856 vxres = info->var.xres_virtual;
857 vyres = info->var.yres_virtual;
858 line_length = info->fix.line_length;
863 if (dx + width > vxres)
864 width = vxres - dx;
866 height = vyres - dy;
868 fb_base = par->tga_fb_base;
871 data = image->data;
875 for (j = 0; j < width; j++) {
876 color = palette[*data++];
884 * tgafb_imageblit - REQUIRED function. Can use generic routines if
894 unsigned int is8bpp = info->var.bits_per_pixel == 8;
897 if (image->depth == 1) {
905 made to pull the data from the image buffer... */
906 if (image->depth == info->var.bits_per_pixel) {
911 /* If 24-plane FB and the image is 8-plane with CLUT, we can do it. */
912 if (!is8bpp && image->depth == 8) {
921 * tgafb_fillrect - REQUIRED function. Can use generic routines if
931 struct tga_par *par = (struct tga_par *) info->par;
932 int is8bpp = info->var.bits_per_pixel == 8;
933 u32 dx, dy, width, height, vxres, vyres, color; local
938 dx = rect->dx;
939 dy = rect->dy;
940 width = rect->width;
941 height = rect->height;
942 vxres = info->var.xres_virtual;
943 vyres = info->var.yres_virtual;
944 line_length = info->fix.line_length;
945 regs_base = par->tga_regs_base;
946 fb_base = par->tga_fb_base;
949 if (dx > vxres || dy > vyres || !width || !height)
951 if (dx + width > vxres)
952 width = vxres - dx;
954 height = vyres - dy;
962 if (rect->rop != ROP_COPY) {
968 color = rect->color;
976 color = ((u32 *)info->pseudo_palette)[color];
987 /* The DATA register holds the fill mask for block fill mode.
999 the width of the screen so that we can take advantage of this
1001 if (width == line_length) {
1002 width *= height;
1008 the data word written. */
1010 pos &= -4;
1012 if (width <= 2048) {
1013 u32 data; local
1015 data = (width - 1) | align;
1018 __raw_writel(data, fb_base + pos);
1023 unsigned long nwidth = width & -2048;
1026 fdata = (2048 - 1) | align;
1027 ldata = ((width & 2047) - 1) | align;
1032 if (j < width)
1047 * tgafb_copyarea - REQUIRED function. Can use generic routines if
1062 u32 height, u32 width) argument
1064 struct tga_par *par = (struct tga_par *) info->par;
1065 void __iomem *tga_regs = par->tga_regs_base;
1073 n64 = (height * width) / 64;
1076 spos = (sy + height) * width;
1077 dpos = (dy + height) * width;
1080 spos -= 64;
1081 dpos -= 64;
1088 spos = sy * width;
1089 dpos = dy * width;
1107 u32 height, u32 width) argument
1109 struct tga_par *par = (struct tga_par *) info->par;
1110 void __iomem *tga_regs = par->tga_regs_base;
1111 void __iomem *tga_fb = par->tga_fb_base;
1121 n16 = (height * width) / 16;
1124 src = tga_fb + (sy + height) * width * 4;
1125 dst = tga_fb + (dy + height) * width * 4;
1128 src -= 64;
1129 dst -= 64;
1136 src = tga_fb + sy * width * 4;
1137 dst = tga_fb + dy * width * 4;
1156 u32 height, u32 width, u32 line_length, argument
1159 struct tga_par *par = (struct tga_par *) info->par;
1168 if ((dx | sx | width) & 7) {
1175 dy += height - 1;
1176 sy += height - 1;
1177 yincr = -yincr;
1179 backward = dy == sy && dx > sx && dx < sx + width;
1186 depos += width;
1187 sepos += width;
1191 n32 = width / 32;
1192 last_step = width % 32;
1195 mask_last = (1ul << last_step) - 1;
1201 step = -32;
1202 last_step = -last_step;
1203 sepos -= 32;
1204 depos -= 32;
1207 tga_regs = par->tga_regs_base;
1208 tga_fb = par->tga_fb_base;
1227 __raw_writel(sfb - tga_fb, tga_regs+TGA_COPY64_SRC);
1229 __raw_writel(dfb - tga_fb, tga_regs+TGA_COPY64_DST);
1235 j--;
1247 sfb += last_step - step;
1248 dfb += last_step - step;
1266 unsigned long dx, dy, width, height, sx, sy, vxres, vyres; local
1269 dx = area->dx;
1270 dy = area->dy;
1271 width = area->width;
1272 height = area->height;
1273 sx = area->sx;
1274 sy = area->sy;
1275 vxres = info->var.xres_virtual;
1276 vyres = info->var.yres_virtual;
1277 line_length = info->fix.line_length;
1284 if (dx + width > vxres)
1285 width = vxres - dx;
1287 height = vyres - dy;
1290 if (sx + width > vxres || sy + height > vyres)
1293 bpp = info->var.bits_per_pixel;
1296 if (!(line_length & 63) && width * (bpp >> 3) == line_length) {
1298 copyarea_line_8bpp(info, dy, sy, height, width);
1300 copyarea_line_32bpp(info, dy, sy, height, width);
1311 width, line_length, area);
1322 struct tga_par *par = (struct tga_par *)info->par;
1323 int tga_bus_pci = dev_is_pci(par->dev);
1324 int tga_bus_tc = TGA_BUS_TC(par->dev);
1325 u8 tga_type = par->tga_type;
1332 tga_type_name = "Digital ZLXp-E1";
1334 tga_type_name = "Digital ZLX-E1";
1339 tga_type_name = "Digital ZLXp-E2";
1341 tga_type_name = "Digital ZLX-E2";
1346 tga_type_name = "Digital ZLXp-E3";
1348 tga_type_name = "Digital ZLX-E3";
1357 strscpy(info->fix.id, tga_type_name, sizeof(info->fix.id));
1359 info->fix.type = FB_TYPE_PACKED_PIXELS;
1360 info->fix.type_aux = 0;
1361 info->fix.visual = (tga_type == TGA_TYPE_8PLANE
1365 info->fix.smem_start = (size_t) par->tga_fb_base;
1366 info->fix.smem_len = memory_size;
1367 info->fix.mmio_start = (size_t) par->tga_regs_base;
1368 info->fix.mmio_len = 512;
1370 info->fix.xpanstep = 0;
1371 info->fix.ypanstep = 0;
1372 info->fix.ywrapstep = 0;
1374 info->fix.accel = FB_ACCEL_DEC_TGA;
1378 * set them here for 24-plane cards.
1381 info->var.red.length = 8;
1382 info->var.green.length = 8;
1383 info->var.blue.length = 8;
1384 info->var.red.offset = 16;
1385 info->var.green.offset = 8;
1386 info->var.blue.offset = 0;
1427 return -ENODEV;
1433 return -ENOMEM;
1435 par = info->par;
1439 ret = -ENODEV;
1445 bar0_start = to_tc_dev(dev)->resource.start;
1446 bar0_len = to_tc_dev(dev)->resource.end - bar0_start + 1;
1462 par->dev = dev;
1463 par->tga_mem_base = mem_base;
1464 par->tga_fb_base = mem_base + fb_offset_presets[tga_type];
1465 par->tga_regs_base = mem_base + TGA_REGS_OFFSET;
1466 par->tga_type = tga_type;
1468 par->tga_chip_rev = (to_pci_dev(dev))->revision;
1470 par->tga_chip_rev = TGA_READ_REG(par, TGA_START_REG) & 0xff;
1473 info->flags = FBINFO_HWACCEL_COPYAREA |
1475 info->fbops = &tgafb_ops;
1476 info->screen_base = par->tga_fb_base;
1477 info->pseudo_palette = par->palette;
1491 ret = fb_find_mode(&info->var, info,
1497 ret = -EINVAL;
1501 if (fb_alloc_cmap(&info->cmap, 256, 0)) {
1503 ret = -ENOMEM;
1511 ret = -EINVAL;
1517 par->tga_chip_rev);
1519 to_pci_dev(dev)->bus->number,
1520 PCI_SLOT(to_pci_dev(dev)->devfn),
1521 PCI_FUNC(to_pci_dev(dev)->devfn));
1525 par->tga_chip_rev);
1527 info->fix.id, (long)bar0_start);
1532 fb_dealloc_cmap(&info->cmap);
1554 par = info->par;
1556 fb_dealloc_cmap(&info->cmap);
1557 iounmap(par->tga_mem_base);
1563 bar0_start = to_tc_dev(dev)->resource.start;
1564 bar0_len = to_tc_dev(dev)->resource.end - bar0_start + 1;
1606 return -ENODEV;
1610 return -ENODEV;