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)
118 return tgafb_register(&pdev->dev); in tgafb_pci_register()
123 tgafb_unregister(&pdev->dev); in tgafb_pci_unregister()
135 { "DEC ", "PMAGD-AA" },
169 * tgafb_check_var - Optional function. Validates a var passed in.
176 struct tga_par *par = (struct tga_par *)info->par; in tgafb_check_var()
178 if (!var->pixclock) in tgafb_check_var()
179 return -EINVAL; in tgafb_check_var()
181 if (par->tga_type == TGA_TYPE_8PLANE) { in tgafb_check_var()
182 if (var->bits_per_pixel != 8) in tgafb_check_var()
183 return -EINVAL; in tgafb_check_var()
185 if (var->bits_per_pixel != 32) in tgafb_check_var()
186 return -EINVAL; in tgafb_check_var()
188 var->red.length = var->green.length = var->blue.length = 8; in tgafb_check_var()
189 if (var->bits_per_pixel == 32) { in tgafb_check_var()
190 var->red.offset = 16; in tgafb_check_var()
191 var->green.offset = 8; in tgafb_check_var()
192 var->blue.offset = 0; in tgafb_check_var()
195 if (var->xres_virtual != var->xres || var->yres_virtual != var->yres) in tgafb_check_var()
196 return -EINVAL; in tgafb_check_var()
197 if (var->xres * var->yres * (var->bits_per_pixel >> 3) > info->fix.smem_len) in tgafb_check_var()
198 return -EINVAL; in tgafb_check_var()
199 if (var->nonstd) in tgafb_check_var()
200 return -EINVAL; in tgafb_check_var()
201 if (1000000000 / var->pixclock > TGA_PLL_MAX_FREQ) in tgafb_check_var()
202 return -EINVAL; in tgafb_check_var()
203 if ((var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED) in tgafb_check_var()
204 return -EINVAL; in tgafb_check_var()
206 /* Some of the acceleration routines assume the line width is in tgafb_check_var()
208 if (var->xres * (par->tga_type == TGA_TYPE_8PLANE ? 1 : 4) % 8) in tgafb_check_var()
209 return -EINVAL; in tgafb_check_var()
215 * tgafb_set_par - Optional function. Alters the hardware state.
246 struct tga_par *par = (struct tga_par *) info->par;
247 int tga_bus_pci = dev_is_pci(par->dev);
248 int tga_bus_tc = TGA_BUS_TC(par->dev);
254 htimings = (((info->var.xres/4) & TGA_HORIZ_ACT_LSB)
255 | (((info->var.xres/4) & 0x600 << 19) & TGA_HORIZ_ACT_MSB));
256 vtimings = (info->var.yres & TGA_VERT_ACTIVE);
257 htimings |= ((info->var.right_margin/4) << 9) & TGA_HORIZ_FP;
258 vtimings |= (info->var.lower_margin << 11) & TGA_VERT_FP;
259 htimings |= ((info->var.hsync_len/4) << 14) & TGA_HORIZ_SYNC;
260 vtimings |= (info->var.vsync_len << 16) & TGA_VERT_SYNC;
261 htimings |= ((info->var.left_margin/4) << 21) & TGA_HORIZ_BP;
262 vtimings |= (info->var.upper_margin << 22) & TGA_VERT_BP;
264 if (info->var.sync & FB_SYNC_HOR_HIGH_ACT)
266 if (info->var.sync & FB_SYNC_VERT_HIGH_ACT)
269 par->htimings = htimings;
270 par->vtimings = vtimings;
272 par->sync_on_green = !!(info->var.sync & FB_SYNC_ON_GREEN);
275 par->xres = info->var.xres;
276 par->yres = info->var.yres;
277 par->pll_freq = pll_freq = 1000000000 / info->var.pixclock;
278 par->bits_per_pixel = info->var.bits_per_pixel;
279 info->fix.line_length = par->xres * (par->bits_per_pixel >> 3);
281 tga_type = par->tga_type;
291 (par->sync_on_green ? 0x0 : 0x00010000),
317 BT485_WRITE(par, 0xa2 | (par->sync_on_green ? 0x8 : 0x0),
346 (par->sync_on_green ? 0xc0 : 0x40));
361 } else { /* 24-plane or 24plusZ */
367 (par->sync_on_green ? 0xc0 : 0x40));
421 /* Finally, enable video scan (and pray for the monitor... :-) */
430 int delta = f - (TGA_PLL_BASE_FREQ * (X)) / (r << shift); \
432 delta = -delta; \
492 m = ((n + 3) / 7) - 1;
497 m = (n / 6) - 1;
505 vr--;
518 * tgafb_setcolreg - Optional function. Sets a color register.
530 struct tga_par *par = (struct tga_par *) info->par;
531 int tga_bus_pci = dev_is_pci(par->dev);
532 int tga_bus_tc = TGA_BUS_TC(par->dev);
540 if (par->tga_type == TGA_TYPE_8PLANE && tga_bus_pci) {
546 } else if (par->tga_type == TGA_TYPE_8PLANE && tga_bus_tc) {
555 ((u32 *)info->pseudo_palette)[regno] = value;
569 * tgafb_blank - Optional function. Blanks the display.
576 struct tga_par *par = (struct tga_par *) info->par;
589 if (par->vesa_blanked) {
592 par->vesa_blanked = 0;
605 par->vesa_blanked = 1;
611 par->vesa_blanked = 1;
618 par->vesa_blanked = 1;
634 struct tga_par *par = (struct tga_par *) info->par;
635 u32 fgcolor, bgcolor, dx, dy, width, height, vxres, vyres, pixelmask; local
638 const unsigned char *data; local
642 is8bpp = info->var.bits_per_pixel == 8;
644 dx = image->dx;
645 dy = image->dy;
646 width = image->width;
647 height = image->height;
648 vxres = info->var.xres_virtual;
649 vyres = info->var.yres_virtual;
650 line_length = info->fix.line_length;
651 rincr = (width + 7) / 8;
654 if (unlikely(width == 0))
659 if (dx + width > vxres)
660 width = vxres - dx;
662 height = vyres - dy;
664 regs_base = par->tga_regs_base;
665 fb_base = par->tga_fb_base;
667 /* Expand the color values to fill 32-bits. */
670 fgcolor = image->fg_color;
671 bgcolor = image->bg_color;
679 fgcolor = ((u32 *)info->pseudo_palette)[fgcolor];
681 bgcolor = ((u32 *)info->pseudo_palette)[bgcolor];
692 pos &= -4;
696 pos &= -8;
699 data = (const unsigned char *) image->data;
707 if (width + shift <= 32) {
713 /* Avoid a shift by 32; width > 0 implied. */
714 pixelmask = (2ul << (width - 1)) - 1;
719 bwidth = (width + 7) / 8;
724 /* The image data is bit big endian; we need
727 mask |= bitrev8(data[j]) << (j * 8);
732 data += rincr;
738 const unsigned char *data0 = data;
750 bwidth = (width / 8) & -4;
754 mask |= bitrev8(data[j+0]) << (0 * 8);
755 mask |= bitrev8(data[j+1]) << (1 * 8);
756 mask |= bitrev8(data[j+2]) << (2 * 8);
757 mask |= bitrev8(data[j+3]) << (3 * 8);
761 data += rincr;
765 pixelmask = (1ul << (width & 31)) - 1;
771 data = data0 + bwidth;
772 bwidth = ((width & 31) + 7) / 8;
777 mask |= bitrev8(data[j]) << (j * 8);
780 data += rincr;
787 const unsigned char *data0 = data;
792 Here we split the write into 16-bit spans. This allows
794 be required by writing 24-bit spans. */
800 bwidth = (width / 8) & -2;
804 mask |= bitrev8(data[j+0]) << (0 * 8);
805 mask |= bitrev8(data[j+1]) << (1 * 8);
810 data += rincr;
814 pixelmask = ((1ul << (width & 15)) - 1) << shift;
820 data = data0 + bwidth;
821 bwidth = (width & 15) > 8;
824 u32 mask = bitrev8(data[0]);
826 mask |= bitrev8(data[1]) << 8;
830 data += rincr;
847 struct tga_par *par = (struct tga_par *) info->par;
848 u32 color, dx, dy, width, height, vxres, vyres; local
849 u32 *palette = ((u32 *)info->pseudo_palette);
851 const unsigned char *data; local
854 dx = image->dx;
855 dy = image->dy;
856 width = image->width;
857 height = image->height;
858 vxres = info->var.xres_virtual;
859 vyres = info->var.yres_virtual;
860 line_length = info->fix.line_length;
865 if (dx + width > vxres)
866 width = vxres - dx;
868 height = vyres - dy;
870 fb_base = par->tga_fb_base;
873 data = image->data;
877 for (j = 0; j < width; j++) {
878 color = palette[*data++];
886 * tgafb_imageblit - REQUIRED function. Can use generic routines if
896 unsigned int is8bpp = info->var.bits_per_pixel == 8;
899 if (image->depth == 1) {
907 made to pull the data from the image buffer... */
908 if (image->depth == info->var.bits_per_pixel) {
913 /* If 24-plane FB and the image is 8-plane with CLUT, we can do it. */
914 if (!is8bpp && image->depth == 8) {
923 * tgafb_fillrect - REQUIRED function. Can use generic routines if
933 struct tga_par *par = (struct tga_par *) info->par;
934 int is8bpp = info->var.bits_per_pixel == 8;
935 u32 dx, dy, width, height, vxres, vyres, color; local
940 dx = rect->dx;
941 dy = rect->dy;
942 width = rect->width;
943 height = rect->height;
944 vxres = info->var.xres_virtual;
945 vyres = info->var.yres_virtual;
946 line_length = info->fix.line_length;
947 regs_base = par->tga_regs_base;
948 fb_base = par->tga_fb_base;
951 if (dx > vxres || dy > vyres || !width || !height)
953 if (dx + width > vxres)
954 width = vxres - dx;
956 height = vyres - dy;
964 if (rect->rop != ROP_COPY) {
970 color = rect->color;
978 color = ((u32 *)info->pseudo_palette)[color];
989 /* The DATA register holds the fill mask for block fill mode.
1001 the width of the screen so that we can take advantage of this
1003 if (width == line_length) {
1004 width *= height;
1010 the data word written. */
1012 pos &= -4;
1014 if (width <= 2048) {
1015 u32 data; local
1017 data = (width - 1) | align;
1020 __raw_writel(data, fb_base + pos);
1025 unsigned long nwidth = width & -2048;
1028 fdata = (2048 - 1) | align;
1029 ldata = ((width & 2047) - 1) | align;
1034 if (j < width)
1049 * tgafb_copyarea - REQUIRED function. Can use generic routines if
1064 u32 height, u32 width) argument
1066 struct tga_par *par = (struct tga_par *) info->par;
1067 void __iomem *tga_regs = par->tga_regs_base;
1075 n64 = (height * width) / 64;
1078 spos = (sy + height) * width;
1079 dpos = (dy + height) * width;
1082 spos -= 64;
1083 dpos -= 64;
1090 spos = sy * width;
1091 dpos = dy * width;
1109 u32 height, u32 width) argument
1111 struct tga_par *par = (struct tga_par *) info->par;
1112 void __iomem *tga_regs = par->tga_regs_base;
1113 void __iomem *tga_fb = par->tga_fb_base;
1123 n16 = (height * width) / 16;
1126 src = tga_fb + (sy + height) * width * 4;
1127 dst = tga_fb + (dy + height) * width * 4;
1130 src -= 64;
1131 dst -= 64;
1138 src = tga_fb + sy * width * 4;
1139 dst = tga_fb + dy * width * 4;
1158 u32 height, u32 width, u32 line_length, argument
1161 struct tga_par *par = (struct tga_par *) info->par;
1170 if ((dx | sx | width) & 7) {
1177 dy += height - 1;
1178 sy += height - 1;
1179 yincr = -yincr;
1181 backward = dy == sy && dx > sx && dx < sx + width;
1188 depos += width;
1189 sepos += width;
1193 n32 = width / 32;
1194 last_step = width % 32;
1197 mask_last = (1ul << last_step) - 1;
1203 step = -32;
1204 last_step = -last_step;
1205 sepos -= 32;
1206 depos -= 32;
1209 tga_regs = par->tga_regs_base;
1210 tga_fb = par->tga_fb_base;
1229 __raw_writel(sfb - tga_fb, tga_regs+TGA_COPY64_SRC);
1231 __raw_writel(dfb - tga_fb, tga_regs+TGA_COPY64_DST);
1237 j--;
1249 sfb += last_step - step;
1250 dfb += last_step - step;
1268 unsigned long dx, dy, width, height, sx, sy, vxres, vyres; local
1271 dx = area->dx;
1272 dy = area->dy;
1273 width = area->width;
1274 height = area->height;
1275 sx = area->sx;
1276 sy = area->sy;
1277 vxres = info->var.xres_virtual;
1278 vyres = info->var.yres_virtual;
1279 line_length = info->fix.line_length;
1286 if (dx + width > vxres)
1287 width = vxres - dx;
1289 height = vyres - dy;
1292 if (sx + width > vxres || sy + height > vyres)
1295 bpp = info->var.bits_per_pixel;
1298 if (!(line_length & 63) && width * (bpp >> 3) == line_length) {
1300 copyarea_line_8bpp(info, dy, sy, height, width);
1302 copyarea_line_32bpp(info, dy, sy, height, width);
1313 width, line_length, area);
1324 struct tga_par *par = (struct tga_par *)info->par;
1325 int tga_bus_pci = dev_is_pci(par->dev);
1326 int tga_bus_tc = TGA_BUS_TC(par->dev);
1327 u8 tga_type = par->tga_type;
1334 tga_type_name = "Digital ZLXp-E1";
1336 tga_type_name = "Digital ZLX-E1";
1341 tga_type_name = "Digital ZLXp-E2";
1343 tga_type_name = "Digital ZLX-E2";
1348 tga_type_name = "Digital ZLXp-E3";
1350 tga_type_name = "Digital ZLX-E3";
1359 strscpy(info->fix.id, tga_type_name, sizeof(info->fix.id));
1361 info->fix.type = FB_TYPE_PACKED_PIXELS;
1362 info->fix.type_aux = 0;
1363 info->fix.visual = (tga_type == TGA_TYPE_8PLANE
1367 info->fix.smem_start = (size_t) par->tga_fb_base;
1368 info->fix.smem_len = memory_size;
1369 info->fix.mmio_start = (size_t) par->tga_regs_base;
1370 info->fix.mmio_len = 512;
1372 info->fix.xpanstep = 0;
1373 info->fix.ypanstep = 0;
1374 info->fix.ywrapstep = 0;
1376 info->fix.accel = FB_ACCEL_DEC_TGA;
1380 * set them here for 24-plane cards.
1383 info->var.red.length = 8;
1384 info->var.green.length = 8;
1385 info->var.blue.length = 8;
1386 info->var.red.offset = 16;
1387 info->var.green.offset = 8;
1388 info->var.blue.offset = 0;
1429 return -ENODEV;
1435 return -ENOMEM;
1437 par = info->par;
1441 ret = -ENODEV;
1447 bar0_start = to_tc_dev(dev)->resource.start;
1448 bar0_len = to_tc_dev(dev)->resource.end - bar0_start + 1;
1464 par->dev = dev;
1465 par->tga_mem_base = mem_base;
1466 par->tga_fb_base = mem_base + fb_offset_presets[tga_type];
1467 par->tga_regs_base = mem_base + TGA_REGS_OFFSET;
1468 par->tga_type = tga_type;
1470 par->tga_chip_rev = (to_pci_dev(dev))->revision;
1472 par->tga_chip_rev = TGA_READ_REG(par, TGA_START_REG) & 0xff;
1475 info->flags = FBINFO_HWACCEL_COPYAREA |
1477 info->fbops = &tgafb_ops;
1478 info->screen_base = par->tga_fb_base;
1479 info->pseudo_palette = par->palette;
1493 ret = fb_find_mode(&info->var, info,
1499 ret = -EINVAL;
1503 if (fb_alloc_cmap(&info->cmap, 256, 0)) {
1505 ret = -ENOMEM;
1513 ret = -EINVAL;
1519 par->tga_chip_rev);
1521 to_pci_dev(dev)->bus->number,
1522 PCI_SLOT(to_pci_dev(dev)->devfn),
1523 PCI_FUNC(to_pci_dev(dev)->devfn));
1527 par->tga_chip_rev);
1529 info->fix.id, (long)bar0_start);
1534 fb_dealloc_cmap(&info->cmap);
1556 par = info->par;
1558 fb_dealloc_cmap(&info->cmap);
1559 iounmap(par->tga_mem_base);
1565 bar0_start = to_tc_dev(dev)->resource.start;
1566 bar0_len = to_tc_dev(dev)->resource.end - bar0_start + 1;
1608 return -ENODEV;
1612 return -ENODEV;