From: Antonino Daplas <adaplas@pol.net>
To: Linux Fbdev development list <linux-fbdev-devel@lists.sourceforge.net>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] FBDev: vga16fb port
Date: 28 Nov 2002 12:24:12 +0500 [thread overview]
Message-ID: <1038468176.1091.46.camel@localhost.localdomain> (raw)
[-- Attachment #1: Type: text/plain, Size: 187 bytes --]
Attached is a patch against 2.5.49 + James Simmons' latest fbdev.diff.
Added support for logo drawing.
Fixed vga16fb_imageblit() limitation of 8-pixel wide bitmap blitting
only.
Tony
[-- Attachment #2: vga16fb.diff --]
[-- Type: text/x-patch, Size: 6370 bytes --]
diff -Naur linux-2.5.49/drivers/video/vga16fb.c linux/drivers/video/vga16fb.c
--- linux-2.5.49/drivers/video/vga16fb.c 2002-11-28 06:44:07.000000000 +0000
+++ linux/drivers/video/vga16fb.c 2002-11-28 06:47:06.000000000 +0000
@@ -1062,8 +1062,10 @@
}
} else {
line_ofs = info->fix.line_length - area->width;
- dest = info->screen_base + area->dx + area->width + (area->dy + height - 1) * info->fix.line_length;
- src = info->screen_base + area->sx + area->width + (area->sy + height - 1) * info->fix.line_length;
+ dest = info->screen_base + area->dx + area->width +
+ (area->dy + height - 1) * info->fix.line_length;
+ src = info->screen_base + area->sx + area->width +
+ (area->sy + height - 1) * info->fix.line_length;
while (height--) {
for (x = 0; x < area->width; x++) {
--src;
@@ -1147,8 +1149,10 @@
dst += line_ofs;
}
} else {
- dst = info->screen_base + (area->dx/8) + width + (area->dy + height - 1) * info->fix.line_length;
- src = info->screen_base + (area->sx/8) + width + (area->sy + height - 1) * info->fix.line_length;
+ dst = info->screen_base + (area->dx/8) + width +
+ (area->dy + height - 1) * info->fix.line_length;
+ src = info->screen_base + (area->sx/8) + width +
+ (area->sy + height - 1) * info->fix.line_length;
while (height--) {
for (x = 0; x < width; x++) {
dst--;
@@ -1222,65 +1226,123 @@
setindex(oldindex);
}
-void vga16fb_imageblit(struct fb_info *info, struct fb_image *image)
+void vga_imageblit_expand(struct fb_info *info, struct fb_image *image)
{
- char *where = info->screen_base + (image->dx/image->width) + image->dy * info->fix.line_length;
+ char *where = info->screen_base + (image->dx/8) +
+ image->dy * info->fix.line_length;
struct vga16fb_par *par = (struct vga16fb_par *) info->par;
- u8 *cdat = image->data;
- int y;
+ u8 *cdat = image->data, *dst;
+ int x, y;
switch (info->fix.type) {
- case FB_TYPE_VGA_PLANES:
- if (info->fix.type_aux == FB_AUX_VGA_PLANES_VGA4) {
- if (par->isVGA) {
- setmode(2);
- setop(0);
- setsr(0xf);
- setcolor(image->fg_color);
- selectmask();
+ case FB_TYPE_VGA_PLANES:
+ if (info->fix.type_aux == FB_AUX_VGA_PLANES_VGA4) {
+ if (par->isVGA) {
+ setmode(2);
+ setop(0);
+ setsr(0xf);
+ setcolor(image->fg_color);
+ selectmask();
+
+ setmask(0xff);
+ writeb(image->bg_color, where);
+ rmb();
+ readb(where); /* fill latches */
+ setmode(3);
+ wmb();
+ for (y = 0; y < image->height; y++) {
+ dst = where;
+ for (x = image->width/8; x--;)
+ writeb(*cdat++, dst++);
+ where += info->fix.line_length;
+ }
+ wmb();
+ } else {
+ setmode(0);
+ setop(0);
+ setsr(0xf);
+ setcolor(image->bg_color);
+ selectmask();
+
+ setmask(0xff);
+ for (y = 0; y < image->height; y++) {
+ dst = where;
+ for (x=image->width/8; x--;){
+ rmw(dst);
+ setcolor(image->fg_color);
+ selectmask();
+ if (*cdat) {
+ setmask(*cdat++);
+ rmw(dst++);
+ }
+ }
+ where += info->fix.line_length;
+ }
+ }
+ } else
+ vga_8planes_imageblit(info, image);
+ break;
+#ifdef FBCON_HAS_VGA
+ case FB_TYPE_TEXT:
+ break;
+#endif
+ case FB_TYPE_PACKED_PIXELS:
+ default:
+ cfb_imageblit(info, image);
+ break;
+ }
+}
- setmask(0xff);
- writeb(image->bg_color, where);
- rmb();
- readb(where); /* fill latches */
- setmode(3);
- wmb();
- for (y = 0; y < image->height; y++, where += info->fix.line_length)
- writeb(cdat[y], where);
- wmb();
- } else {
- setmode(0);
- setop(0);
- setsr(0xf);
- setcolor(image->bg_color);
- selectmask();
+void vga_imageblit_color(struct fb_info *info, struct fb_image *image)
+{
+ /*
+ * Draw logo
+ */
+ struct vga16fb_par *par = (struct vga16fb_par *) info->par;
+ char *where = info->screen_base + image->dy * info->fix.line_length +
+ image->dx/8;
+ char *cdat = image->data, *dst;
+ int x, y;
- setmask(0xff);
- for (y = 0; y < image->height; y++, where += info->fix.line_length)
- rmw(where);
+ switch (info->fix.type) {
+ case FB_TYPE_VGA_PLANES:
+ if (info->fix.type_aux == FB_AUX_VGA_PLANES_VGA4 &&
+ par->isVGA) {
+ setsr(0xf);
+ setop(0);
+ setmode(0);
+
+ for (y = 0; y < image->height; y++) {
+ for (x = 0; x < image->width; x++) {
+ dst = where + x/8;
- where -= info->fix.line_length * y;
- setcolor(image->fg_color);
+ setcolor(*cdat);
selectmask();
- for (y = 0; y < image->height; y++, where += info->fix.line_length)
- if (cdat[y]) {
- setmask(cdat[y]);
- rmw(where);
- }
+ setmask(1 << (7 - (x % 8)));
+ fb_readb(dst);
+ fb_writeb(0, dst);
+
+ cdat++;
}
- } else
- vga_8planes_imageblit(info, image);
- break;
-#ifdef FBCON_HAS_VGA
- case FB_TYPE_TEXT:
- break;
-#endif
- case FB_TYPE_PACKED_PIXELS:
- default:
- cfb_imageblit(info, image);
- break;
+ where += info->fix.line_length;
+ }
+ }
+ break;
+ case FB_TYPE_PACKED_PIXELS:
+ cfb_imageblit(info, image);
+ break;
+ default:
+ break;
}
}
+
+void vga16fb_imageblit(struct fb_info *info, struct fb_image *image)
+{
+ if (image->depth == 1)
+ vga_imageblit_expand(info, image);
+ else if (image->depth == info->var.bits_per_pixel)
+ vga_imageblit_color(info, image);
+}
static struct fb_ops vga16fb_ops = {
.owner = THIS_MODULE,
@@ -1292,6 +1354,7 @@
.fb_fillrect = vga16fb_fillrect,
.fb_copyarea = vga16fb_copyarea,
.fb_imageblit = vga16fb_imageblit,
+ .fb_cursor = soft_cursor,
};
int vga16fb_setup(char *options)
@@ -1343,6 +1406,11 @@
i = (vga16fb_defined.bits_per_pixel == 8) ? 256 : 16;
fb_alloc_cmap(&vga16fb.cmap, i, 0);
+ if (vga16fb_check_var(&vga16fb.var, &vga16fb))
+ return -EINVAL;
+
+ vga16fb_update_fix(&vga16fb);
+
if (register_framebuffer(&vga16fb) < 0) {
iounmap(vga16fb.screen_base);
return -EINVAL;
next reply other threads:[~2002-11-28 7:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-28 7:24 Antonino Daplas [this message]
2002-12-02 20:31 ` [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port James Simmons
2002-12-03 12:22 ` Antonino Daplas
2002-12-03 15:47 ` Alan Cox
2002-12-03 20:50 ` Antonino Daplas
2002-12-03 22:01 ` James Simmons
2002-12-03 22:02 ` James Simmons
2002-12-04 3:19 ` Tomas Szepe
2002-12-04 7:32 ` Sven Luther
2002-12-04 12:08 ` Antonino Daplas
2002-12-04 10:28 ` Sven Luther
2002-12-04 17:27 ` Antonino Daplas
2002-12-04 16:47 ` Sven Luther
2002-12-05 1:04 ` Antonino Daplas
2002-12-05 17:35 ` James Simmons
2002-12-05 18:03 ` Sven Luther
2002-12-05 20:37 ` James Simmons
2002-12-05 20:44 ` Sven Luther
2002-12-06 0:50 ` James Simmons
2002-12-06 1:36 ` Antonino Daplas
2002-12-03 20:49 ` Antonino Daplas
2002-12-04 23:44 ` James Simmons
-- strict thread matches above, loose matches on Subject: below --
2002-12-05 5:40 Greg Haerr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1038468176.1091.46.camel@localhost.localdomain \
--to=adaplas@pol.net \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.