summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <rob@ti.com>2011-02-27 16:23:03 -0600
committerAndy Doan <doanac@gmail.com>2011-04-13 15:27:14 -0700
commit26d0dba2db2f403d62761060ef4012e1c7ba991b (patch)
treeb8abf88b1816a3671efcf496011be117f806bfb1
parent482d3449110c8316cafa6c27c31d4e105227d1e4 (diff)
fbops support for framebuffers with alpha channel
Signed-off-by: Rob Clark <rob@ti.com> Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
-rw-r--r--drivers/video/cfbfillrect.c2
-rw-r--r--drivers/video/cfbimgblt.c5
-rw-r--r--drivers/video/fb_draw.h14
-rw-r--r--drivers/video/sysfillrect.c2
-rw-r--r--drivers/video/sysimgblt.c6
5 files changed, 23 insertions, 6 deletions
diff --git a/drivers/video/cfbfillrect.c b/drivers/video/cfbfillrect.c
index ba9f58b2a5e..eb7a164f318 100644
--- a/drivers/video/cfbfillrect.c
+++ b/drivers/video/cfbfillrect.c
@@ -291,7 +291,7 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
p->fix.visual == FB_VISUAL_DIRECTCOLOR )
fg = ((u32 *) (p->pseudo_palette))[rect->color];
else
- fg = rect->color;
+ fg = solid_color(p, rect->color);
pat = pixel_to_pat(bpp, fg);
diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c
index baed57d3cff..a12e545b92c 100644
--- a/drivers/video/cfbimgblt.c
+++ b/drivers/video/cfbimgblt.c
@@ -106,6 +106,7 @@ static inline void color_imageblit(const struct fb_image *image,
else
color = *src;
color <<= FB_LEFT_POS(p, bpp);
+ color = solid_color(p, color);
val |= FB_SHIFT_HIGH(p, color, shift ^ bswapmask);
if (shift >= null_bits) {
FB_WRITEL(val, dst++);
@@ -290,8 +291,8 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image)
fgcolor = ((u32*)(p->pseudo_palette))[image->fg_color];
bgcolor = ((u32*)(p->pseudo_palette))[image->bg_color];
} else {
- fgcolor = image->fg_color;
- bgcolor = image->bg_color;
+ fgcolor = solid_color(p, image->fg_color);
+ bgcolor = solid_color(p, image->bg_color);
}
if (32 % bpp == 0 && !start_index && !pitch_index &&
diff --git a/drivers/video/fb_draw.h b/drivers/video/fb_draw.h
index 04c01faaf77..4ba0e0b1f16 100644
--- a/drivers/video/fb_draw.h
+++ b/drivers/video/fb_draw.h
@@ -15,6 +15,20 @@ comp(unsigned long a, unsigned long b, unsigned long mask)
return ((a ^ b) & mask) ^ b;
}
+/* if framebuffer has alpha channel, mask in the appropriate
+ * bit(s) to make the specified color opaque
+ */
+static inline unsigned long
+solid_color(struct fb_info *p, unsigned long color)
+{
+ if (p->var.transp.length > 0) {
+ u32 mask = (1 << p->var.transp.length) - 1;
+ mask <<= p->var.transp.offset;
+ color |= mask;
+ }
+ return color;
+}
+
/*
* Create a pattern with the given pixel's color
*/
diff --git a/drivers/video/sysfillrect.c b/drivers/video/sysfillrect.c
index 33ee3d34f9d..92fe0be25f6 100644
--- a/drivers/video/sysfillrect.c
+++ b/drivers/video/sysfillrect.c
@@ -256,7 +256,7 @@ void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
p->fix.visual == FB_VISUAL_DIRECTCOLOR )
fg = ((u32 *) (p->pseudo_palette))[rect->color];
else
- fg = rect->color;
+ fg = solid_color(p, rect->color);
pat = pixel_to_pat( bpp, fg);
diff --git a/drivers/video/sysimgblt.c b/drivers/video/sysimgblt.c
index 186c6f607be..bdc45dca24e 100644
--- a/drivers/video/sysimgblt.c
+++ b/drivers/video/sysimgblt.c
@@ -14,6 +14,7 @@
#include <linux/string.h>
#include <linux/fb.h>
#include <asm/types.h>
+#include "fb_draw.h"
#define DEBUG
@@ -80,6 +81,7 @@ static void color_imageblit(const struct fb_image *image, struct fb_info *p,
else
color = *src;
color <<= FB_LEFT_POS(p, bpp);
+ color = solid_color(p, color);
val |= FB_SHIFT_HIGH(p, color, shift);
if (shift >= null_bits) {
*dst++ = val;
@@ -265,8 +267,8 @@ void sys_imageblit(struct fb_info *p, const struct fb_image *image)
fgcolor = ((u32*)(p->pseudo_palette))[image->fg_color];
bgcolor = ((u32*)(p->pseudo_palette))[image->bg_color];
} else {
- fgcolor = image->fg_color;
- bgcolor = image->bg_color;
+ fgcolor = solid_color(p, image->fg_color);
+ bgcolor = solid_color(p, image->bg_color);
}
if (32 % bpp == 0 && !start_index && !pitch_index &&