• Home
  • Raw
  • Download

Lines Matching +full:data +full:- +full:width

2  *  linux/drivers/video/tgafb.c -- DEC 21030 TGA frame buffer device
36 #define TGA_BUS_TC(dev) (dev->bus == &tc_bus_type)
109 return tgafb_register(&pdev->dev); in tgafb_pci_register()
114 tgafb_unregister(&pdev->dev); in tgafb_pci_unregister()
126 { "DEC ", "PMAGD-AA" },
160 * tgafb_check_var - Optional function. Validates a var passed in.
167 struct tga_par *par = (struct tga_par *)info->par; in tgafb_check_var()
169 if (par->tga_type == TGA_TYPE_8PLANE) { in tgafb_check_var()
170 if (var->bits_per_pixel != 8) in tgafb_check_var()
171 return -EINVAL; in tgafb_check_var()
173 if (var->bits_per_pixel != 32) in tgafb_check_var()
174 return -EINVAL; in tgafb_check_var()
176 var->red.length = var->green.length = var->blue.length = 8; in tgafb_check_var()
177 if (var->bits_per_pixel == 32) { in tgafb_check_var()
178 var->red.offset = 16; in tgafb_check_var()
179 var->green.offset = 8; in tgafb_check_var()
180 var->blue.offset = 0; in tgafb_check_var()
183 if (var->xres_virtual != var->xres || var->yres_virtual != var->yres) in tgafb_check_var()
184 return -EINVAL; in tgafb_check_var()
185 if (var->xres * var->yres * (var->bits_per_pixel >> 3) > info->fix.smem_len) in tgafb_check_var()
186 return -EINVAL; in tgafb_check_var()
187 if (var->nonstd) in tgafb_check_var()
188 return -EINVAL; in tgafb_check_var()
189 if (1000000000 / var->pixclock > TGA_PLL_MAX_FREQ) in tgafb_check_var()
190 return -EINVAL; in tgafb_check_var()
191 if ((var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED) in tgafb_check_var()
192 return -EINVAL; in tgafb_check_var()
194 /* Some of the acceleration routines assume the line width is in tgafb_check_var()
196 if (var->xres * (par->tga_type == TGA_TYPE_8PLANE ? 1 : 4) % 8) in tgafb_check_var()
197 return -EINVAL; in tgafb_check_var()
203 * tgafb_set_par - Optional function. Alters the hardware state.
234 struct tga_par *par = (struct tga_par *) info->par;
235 int tga_bus_pci = dev_is_pci(par->dev);
236 int tga_bus_tc = TGA_BUS_TC(par->dev);
242 htimings = (((info->var.xres/4) & TGA_HORIZ_ACT_LSB)
243 | (((info->var.xres/4) & 0x600 << 19) & TGA_HORIZ_ACT_MSB));
244 vtimings = (info->var.yres & TGA_VERT_ACTIVE);
245 htimings |= ((info->var.right_margin/4) << 9) & TGA_HORIZ_FP;
246 vtimings |= (info->var.lower_margin << 11) & TGA_VERT_FP;
247 htimings |= ((info->var.hsync_len/4) << 14) & TGA_HORIZ_SYNC;
248 vtimings |= (info->var.vsync_len << 16) & TGA_VERT_SYNC;
249 htimings |= ((info->var.left_margin/4) << 21) & TGA_HORIZ_BP;
250 vtimings |= (info->var.upper_margin << 22) & TGA_VERT_BP;
252 if (info->var.sync & FB_SYNC_HOR_HIGH_ACT)
254 if (info->var.sync & FB_SYNC_VERT_HIGH_ACT)
257 par->htimings = htimings;
258 par->vtimings = vtimings;
260 par->sync_on_green = !!(info->var.sync & FB_SYNC_ON_GREEN);
263 par->xres = info->var.xres;
264 par->yres = info->var.yres;
265 par->pll_freq = pll_freq = 1000000000 / info->var.pixclock;
266 par->bits_per_pixel = info->var.bits_per_pixel;
267 info->fix.line_length = par->xres * (par->bits_per_pixel >> 3);
269 tga_type = par->tga_type;
279 (par->sync_on_green ? 0x0 : 0x00010000),
305 BT485_WRITE(par, 0xa2 | (par->sync_on_green ? 0x8 : 0x0),
334 (par->sync_on_green ? 0xc0 : 0x40));
349 } else { /* 24-plane or 24plusZ */
355 (par->sync_on_green ? 0xc0 : 0x40));
409 /* Finally, enable video scan (and pray for the monitor... :-) */
418 int delta = f - (TGA_PLL_BASE_FREQ * (X)) / (r << shift); \
420 delta = -delta; \
480 m = ((n + 3) / 7) - 1;
485 m = (n / 6) - 1;
493 vr--;
506 * tgafb_setcolreg - Optional function. Sets a color register.
518 struct tga_par *par = (struct tga_par *) info->par;
519 int tga_bus_pci = dev_is_pci(par->dev);
520 int tga_bus_tc = TGA_BUS_TC(par->dev);
528 if (par->tga_type == TGA_TYPE_8PLANE && tga_bus_pci) {
534 } else if (par->tga_type == TGA_TYPE_8PLANE && tga_bus_tc) {
543 ((u32 *)info->pseudo_palette)[regno] = value;
557 * tgafb_blank - Optional function. Blanks the display.
564 struct tga_par *par = (struct tga_par *) info->par;
577 if (par->vesa_blanked) {
580 par->vesa_blanked = 0;
593 par->vesa_blanked = 1;
599 par->vesa_blanked = 1;
606 par->vesa_blanked = 1;
622 struct tga_par *par = (struct tga_par *) info->par;
623 u32 fgcolor, bgcolor, dx, dy, width, height, vxres, vyres, pixelmask; local
626 const unsigned char *data; local
630 is8bpp = info->var.bits_per_pixel == 8;
632 dx = image->dx;
633 dy = image->dy;
634 width = image->width;
635 height = image->height;
636 vxres = info->var.xres_virtual;
637 vyres = info->var.yres_virtual;
638 line_length = info->fix.line_length;
639 rincr = (width + 7) / 8;
642 if (unlikely(width == 0))
647 if (dx + width > vxres)
648 width = vxres - dx;
650 height = vyres - dy;
652 regs_base = par->tga_regs_base;
653 fb_base = par->tga_fb_base;
655 /* Expand the color values to fill 32-bits. */
658 fgcolor = image->fg_color;
659 bgcolor = image->bg_color;
667 fgcolor = ((u32 *)info->pseudo_palette)[fgcolor];
669 bgcolor = ((u32 *)info->pseudo_palette)[bgcolor];
680 pos &= -4;
684 pos &= -8;
687 data = (const unsigned char *) image->data;
695 if (width + shift <= 32) {
701 /* Avoid a shift by 32; width > 0 implied. */
702 pixelmask = (2ul << (width - 1)) - 1;
707 bwidth = (width + 7) / 8;
712 /* The image data is bit big endian; we need
715 mask |= bitrev8(data[j]) << (j * 8);
720 data += rincr;
726 const unsigned char *data0 = data;
738 bwidth = (width / 8) & -4;
742 mask |= bitrev8(data[j+0]) << (0 * 8);
743 mask |= bitrev8(data[j+1]) << (1 * 8);
744 mask |= bitrev8(data[j+2]) << (2 * 8);
745 mask |= bitrev8(data[j+3]) << (3 * 8);
749 data += rincr;
753 pixelmask = (1ul << (width & 31)) - 1;
759 data = data0 + bwidth;
760 bwidth = ((width & 31) + 7) / 8;
765 mask |= bitrev8(data[j]) << (j * 8);
768 data += rincr;
775 const unsigned char *data0 = data;
780 Here we split the write into 16-bit spans. This allows
782 be required by writing 24-bit spans. */
788 bwidth = (width / 8) & -2;
792 mask |= bitrev8(data[j+0]) << (0 * 8);
793 mask |= bitrev8(data[j+1]) << (1 * 8);
798 data += rincr;
802 pixelmask = ((1ul << (width & 15)) - 1) << shift;
808 data = data0 + bwidth;
809 bwidth = (width & 15) > 8;
812 u32 mask = bitrev8(data[0]);
814 mask |= bitrev8(data[1]) << 8;
818 data += rincr;
835 struct tga_par *par = (struct tga_par *) info->par;
836 u32 color, dx, dy, width, height, vxres, vyres; local
837 u32 *palette = ((u32 *)info->pseudo_palette);
839 const unsigned char *data; local
842 dx = image->dx;
843 dy = image->dy;
844 width = image->width;
845 height = image->height;
846 vxres = info->var.xres_virtual;
847 vyres = info->var.yres_virtual;
848 line_length = info->fix.line_length;
853 if (dx + width > vxres)
854 width = vxres - dx;
856 height = vyres - dy;
858 regs_base = par->tga_regs_base;
859 fb_base = par->tga_fb_base;
862 data = image->data;
866 for (j = 0; j < width; j++) {
867 color = palette[*data++];
875 * tgafb_imageblit - REQUIRED function. Can use generic routines if
885 unsigned int is8bpp = info->var.bits_per_pixel == 8;
888 if (image->depth == 1) {
896 made to pull the data from the image buffer... */
897 if (image->depth == info->var.bits_per_pixel) {
902 /* If 24-plane FB and the image is 8-plane with CLUT, we can do it. */
903 if (!is8bpp && image->depth == 8) {
912 * tgafb_fillrect - REQUIRED function. Can use generic routines if
922 struct tga_par *par = (struct tga_par *) info->par;
923 int is8bpp = info->var.bits_per_pixel == 8;
924 u32 dx, dy, width, height, vxres, vyres, color; local
929 dx = rect->dx;
930 dy = rect->dy;
931 width = rect->width;
932 height = rect->height;
933 vxres = info->var.xres_virtual;
934 vyres = info->var.yres_virtual;
935 line_length = info->fix.line_length;
936 regs_base = par->tga_regs_base;
937 fb_base = par->tga_fb_base;
940 if (dx > vxres || dy > vyres || !width || !height)
942 if (dx + width > vxres)
943 width = vxres - dx;
945 height = vyres - dy;
953 if (rect->rop != ROP_COPY) {
959 color = rect->color;
967 color = ((u32 *)info->pseudo_palette)[color];
978 /* The DATA register holds the fill mask for block fill mode.
990 the width of the screen so that we can take advantage of this
992 if (width == line_length) {
993 width *= height;
999 the data word written. */
1001 pos &= -4;
1003 if (width <= 2048) {
1004 u32 data; local
1006 data = (width - 1) | align;
1009 __raw_writel(data, fb_base + pos);
1014 unsigned long nwidth = width & -2048;
1017 fdata = (2048 - 1) | align;
1018 ldata = ((width & 2047) - 1) | align;
1023 if (j < width)
1038 * tgafb_copyarea - REQUIRED function. Can use generic routines if
1053 u32 height, u32 width) argument
1055 struct tga_par *par = (struct tga_par *) info->par;
1056 void __iomem *tga_regs = par->tga_regs_base;
1064 n64 = (height * width) / 64;
1067 spos = (sy + height) * width;
1068 dpos = (dy + height) * width;
1071 spos -= 64;
1072 dpos -= 64;
1079 spos = sy * width;
1080 dpos = dy * width;
1098 u32 height, u32 width) argument
1100 struct tga_par *par = (struct tga_par *) info->par;
1101 void __iomem *tga_regs = par->tga_regs_base;
1102 void __iomem *tga_fb = par->tga_fb_base;
1112 n16 = (height * width) / 16;
1115 src = tga_fb + (sy + height) * width * 4;
1116 dst = tga_fb + (dy + height) * width * 4;
1119 src -= 64;
1120 dst -= 64;
1127 src = tga_fb + sy * width * 4;
1128 dst = tga_fb + dy * width * 4;
1147 u32 height, u32 width, u32 line_length, argument
1150 struct tga_par *par = (struct tga_par *) info->par;
1159 if ((dx | sx | width) & 7) {
1166 dy += height - 1;
1167 sy += height - 1;
1168 yincr = -yincr;
1170 backward = dy == sy && dx > sx && dx < sx + width;
1177 depos += width;
1178 sepos += width;
1182 n32 = width / 32;
1183 last_step = width % 32;
1186 mask_last = (1ul << last_step) - 1;
1192 step = -32;
1193 last_step = -last_step;
1194 sepos -= 32;
1195 depos -= 32;
1198 tga_regs = par->tga_regs_base;
1199 tga_fb = par->tga_fb_base;
1218 __raw_writel(sfb - tga_fb, tga_regs+TGA_COPY64_SRC);
1220 __raw_writel(dfb - tga_fb, tga_regs+TGA_COPY64_DST);
1226 j--;
1238 sfb += last_step - step;
1239 dfb += last_step - step;
1257 unsigned long dx, dy, width, height, sx, sy, vxres, vyres; local
1260 dx = area->dx;
1261 dy = area->dy;
1262 width = area->width;
1263 height = area->height;
1264 sx = area->sx;
1265 sy = area->sy;
1266 vxres = info->var.xres_virtual;
1267 vyres = info->var.yres_virtual;
1268 line_length = info->fix.line_length;
1275 if (dx + width > vxres)
1276 width = vxres - dx;
1278 height = vyres - dy;
1281 if (sx + width > vxres || sy + height > vyres)
1284 bpp = info->var.bits_per_pixel;
1287 if (!(line_length & 63) && width * (bpp >> 3) == line_length) {
1289 copyarea_line_8bpp(info, dy, sy, height, width);
1291 copyarea_line_32bpp(info, dy, sy, height, width);
1302 width, line_length, area);
1313 struct tga_par *par = (struct tga_par *)info->par;
1314 int tga_bus_pci = dev_is_pci(par->dev);
1315 int tga_bus_tc = TGA_BUS_TC(par->dev);
1316 u8 tga_type = par->tga_type;
1323 tga_type_name = "Digital ZLXp-E1";
1325 tga_type_name = "Digital ZLX-E1";
1330 tga_type_name = "Digital ZLXp-E2";
1332 tga_type_name = "Digital ZLX-E2";
1337 tga_type_name = "Digital ZLXp-E3";
1339 tga_type_name = "Digital ZLX-E3";
1348 strlcpy(info->fix.id, tga_type_name, sizeof(info->fix.id));
1350 info->fix.type = FB_TYPE_PACKED_PIXELS;
1351 info->fix.type_aux = 0;
1352 info->fix.visual = (tga_type == TGA_TYPE_8PLANE
1356 info->fix.smem_start = (size_t) par->tga_fb_base;
1357 info->fix.smem_len = memory_size;
1358 info->fix.mmio_start = (size_t) par->tga_regs_base;
1359 info->fix.mmio_len = 512;
1361 info->fix.xpanstep = 0;
1362 info->fix.ypanstep = 0;
1363 info->fix.ywrapstep = 0;
1365 info->fix.accel = FB_ACCEL_DEC_TGA;
1369 * set them here for 24-plane cards.
1372 info->var.red.length = 8;
1373 info->var.green.length = 8;
1374 info->var.blue.length = 8;
1375 info->var.red.offset = 16;
1376 info->var.green.offset = 8;
1377 info->var.blue.offset = 0;
1418 return -ENODEV;
1424 return -ENOMEM;
1426 par = info->par;
1430 ret = -ENODEV;
1436 bar0_start = to_tc_dev(dev)->resource.start;
1437 bar0_len = to_tc_dev(dev)->resource.end - bar0_start + 1;
1453 par->dev = dev;
1454 par->tga_mem_base = mem_base;
1455 par->tga_fb_base = mem_base + fb_offset_presets[tga_type];
1456 par->tga_regs_base = mem_base + TGA_REGS_OFFSET;
1457 par->tga_type = tga_type;
1459 par->tga_chip_rev = (to_pci_dev(dev))->revision;
1461 par->tga_chip_rev = TGA_READ_REG(par, TGA_START_REG) & 0xff;
1464 info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA |
1466 info->fbops = &tgafb_ops;
1467 info->screen_base = par->tga_fb_base;
1468 info->pseudo_palette = par->palette;
1482 ret = fb_find_mode(&info->var, info,
1488 ret = -EINVAL;
1492 if (fb_alloc_cmap(&info->cmap, 256, 0)) {
1494 ret = -ENOMEM;
1502 ret = -EINVAL;
1508 par->tga_chip_rev);
1510 to_pci_dev(dev)->bus->number,
1511 PCI_SLOT(to_pci_dev(dev)->devfn),
1512 PCI_FUNC(to_pci_dev(dev)->devfn));
1516 par->tga_chip_rev);
1518 info->fix.id, (long)bar0_start);
1523 fb_dealloc_cmap(&info->cmap);
1545 par = info->par;
1547 fb_dealloc_cmap(&info->cmap);
1548 iounmap(par->tga_mem_base);
1554 bar0_start = to_tc_dev(dev)->resource.start;
1555 bar0_len = to_tc_dev(dev)->resource.end - bar0_start + 1;
1596 return -ENODEV;