提交 0ddf7849 编写于 作者: K Krzysztof Helt 提交者: Linus Torvalds

pm3fb: improvements and cleanups

This patch contains improvements:
- it adds ROP_XOR in pm3fb_fillrect()
- it conforms closer to coding style
- it removes redundant parentheses and setting bits with 0 value
- it checks if hardware acceleration is disabled in pm3fb_imageblit
- it adds module description
Signed-off-by: NKrzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: NAntonino Daplas <adaplas@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 c79ba28c
master alk-4.19.24 alk-4.19.30 alk-4.19.34 alk-4.19.36 alk-4.19.43 alk-4.19.48 alk-4.19.57 ck-4.19.67 ck-4.19.81 ck-4.19.91 github/fork/deepanshu1422/fix-typo-in-comment github/fork/haosdent/fix-typo linux-next v4.19.91 v4.19.90 v4.19.89 v4.19.88 v4.19.87 v4.19.86 v4.19.85 v4.19.84 v4.19.83 v4.19.82 v4.19.81 v4.19.80 v4.19.79 v4.19.78 v4.19.77 v4.19.76 v4.19.75 v4.19.74 v4.19.73 v4.19.72 v4.19.71 v4.19.70 v4.19.69 v4.19.68 v4.19.67 v4.19.66 v4.19.65 v4.19.64 v4.19.63 v4.19.62 v4.19.61 v4.19.60 v4.19.59 v4.19.58 v4.19.57 v4.19.56 v4.19.55 v4.19.54 v4.19.53 v4.19.52 v4.19.51 v4.19.50 v4.19.49 v4.19.48 v4.19.47 v4.19.46 v4.19.45 v4.19.44 v4.19.43 v4.19.42 v4.19.41 v4.19.40 v4.19.39 v4.19.38 v4.19.37 v4.19.36 v4.19.35 v4.19.34 v4.19.33 v4.19.32 v4.19.31 v4.19.30 v4.19.29 v4.19.28 v4.19.27 v4.19.26 v4.19.25 v4.19.24 v4.19.23 v4.19.22 v4.19.21 v4.19.20 v4.19.19 v4.19.18 v4.19.17 v4.19.16 v4.19.15 v4.19.14 v4.19.13 v4.19.12 v4.19.11 v4.19.10 v4.19.9 v4.19.8 v4.19.7 v4.19.6 v4.19.5 v4.19.4 v4.19.3 v4.19.2 v4.19.1 v4.19 v4.19-rc8 v4.19-rc7 v4.19-rc6 v4.19-rc5 v4.19-rc4 v4.19-rc3 v4.19-rc2 v4.19-rc1 ck-release-21 ck-release-20 ck-release-19.2 ck-release-19.1 ck-release-19 ck-release-18 ck-release-17.2 ck-release-17.1 ck-release-17 ck-release-16 ck-release-15.1 ck-release-15 ck-release-14 ck-release-13.2 ck-release-13 ck-release-12 ck-release-11 ck-release-10 ck-release-9 ck-release-7 alk-release-15 alk-release-14 alk-release-13.2 alk-release-13 alk-release-12 alk-release-11 alk-release-10 alk-release-9 alk-release-7
无相关合并请求
......@@ -135,7 +135,7 @@ static void pm3fb_clear_colormap(struct pm3_par *par,
}
/* Calculating various clock parameter */
/* Calculating various clock parameters */
static void pm3fb_calculate_clock(unsigned long reqclock,
unsigned char *prescale,
unsigned char *feedback,
......@@ -166,7 +166,7 @@ static void pm3fb_calculate_clock(unsigned long reqclock,
static inline int pm3fb_depth(const struct fb_var_screeninfo *var)
{
if ( var->bits_per_pixel == 16 )
if (var->bits_per_pixel == 16)
return var->red.length + var->green.length
+ var->blue.length;
......@@ -351,7 +351,7 @@ static void pm3fb_init_engine(struct fb_info *info)
PM3_WRITE_REG(par, PM3dXDom, 0x0);
PM3_WRITE_REG(par, PM3dXSub, 0x0);
PM3_WRITE_REG(par, PM3dY, (1 << 16));
PM3_WRITE_REG(par, PM3dY, 1 << 16);
PM3_WRITE_REG(par, PM3StartXDom, 0x0);
PM3_WRITE_REG(par, PM3StartXSub, 0x0);
PM3_WRITE_REG(par, PM3StartY, 0x0);
......@@ -372,16 +372,21 @@ static void pm3fb_fillrect (struct fb_info *info,
struct pm3_par *par = info->par;
struct fb_fillrect modded;
int vxres, vyres;
int rop;
u32 color = (info->fix.visual == FB_VISUAL_TRUECOLOR) ?
((u32*)info->pseudo_palette)[region->color] : region->color;
if (info->state != FBINFO_STATE_RUNNING)
return;
if ((info->flags & FBINFO_HWACCEL_DISABLED) ||
region->rop != ROP_COPY ) {
if (info->flags & FBINFO_HWACCEL_DISABLED) {
cfb_fillrect(info, region);
return;
}
if (region->rop == ROP_COPY )
rop = PM3Config2D_ForegroundROP(0x3); /* GXcopy */
else
rop = PM3Config2D_ForegroundROP(0x6) | /* GXxor */
PM3Config2D_FBDestReadEnable;
vxres = info->var.xres_virtual;
vyres = info->var.yres_virtual;
......@@ -407,22 +412,22 @@ static void pm3fb_fillrect (struct fb_info *info,
PM3_WRITE_REG(par, PM3Config2D,
PM3Config2D_UseConstantSource |
PM3Config2D_ForegroundROPEnable |
(PM3Config2D_ForegroundROP(0x3)) |
rop |
PM3Config2D_FBWriteEnable);
PM3_WRITE_REG(par, PM3ForegroundColor, color);
PM3_WRITE_REG(par, PM3RectanglePosition,
(PM3RectanglePosition_XOffset(modded.dx)) |
(PM3RectanglePosition_YOffset(modded.dy)));
PM3RectanglePosition_XOffset(modded.dx) |
PM3RectanglePosition_YOffset(modded.dy));
PM3_WRITE_REG(par, PM3Render2D,
PM3Render2D_XPositive |
PM3Render2D_YPositive |
PM3Render2D_Operation_Normal |
PM3Render2D_SpanOperation |
(PM3Render2D_Width(modded.width)) |
(PM3Render2D_Height(modded.height)));
PM3Render2D_Width(modded.width) |
PM3Render2D_Height(modded.height));
}
static void pm3fb_copyarea(struct fb_info *info,
......@@ -470,7 +475,7 @@ static void pm3fb_copyarea(struct fb_info *info,
PM3Config2D_UserScissorEnable |
PM3Config2D_ForegroundROPEnable |
PM3Config2D_Blocking |
(PM3Config2D_ForegroundROP(0x3)) | /* Ox3 is GXcopy */
PM3Config2D_ForegroundROP(0x3) | /* Ox3 is GXcopy */
PM3Config2D_FBWriteEnable);
PM3_WRITE_REG(par, PM3ScissorMinXY,
......@@ -484,8 +489,8 @@ static void pm3fb_copyarea(struct fb_info *info,
PM3FBSourceReadBufferOffset_YOffset(o_y));
PM3_WRITE_REG(par, PM3RectanglePosition,
(PM3RectanglePosition_XOffset(modded.dx - x_align)) |
(PM3RectanglePosition_YOffset(modded.dy)));
PM3RectanglePosition_XOffset(modded.dx - x_align) |
PM3RectanglePosition_YOffset(modded.dy));
PM3_WRITE_REG(par, PM3Render2D,
((modded.sx > modded.dx) ? PM3Render2D_XPositive : 0) |
......@@ -493,8 +498,8 @@ static void pm3fb_copyarea(struct fb_info *info,
PM3Render2D_Operation_Normal |
PM3Render2D_SpanOperation |
PM3Render2D_FBSourceReadEnable |
(PM3Render2D_Width(modded.width + x_align)) |
(PM3Render2D_Height(modded.height)));
PM3Render2D_Width(modded.width + x_align) |
PM3Render2D_Height(modded.height));
}
static void pm3fb_imageblit(struct fb_info *info, const struct fb_image *image)
......@@ -504,6 +509,12 @@ static void pm3fb_imageblit(struct fb_info *info, const struct fb_image *image)
u32 fgx, bgx;
const u32 *src = (const u32*)image->data;
if (info->state != FBINFO_STATE_RUNNING)
return;
if (info->flags & FBINFO_HWACCEL_DISABLED) {
cfb_imageblit(info, image);
return;
}
switch (info->fix.visual) {
case FB_VISUAL_PSEUDOCOLOR:
fgx = image->fg_color;
......@@ -537,7 +548,7 @@ static void pm3fb_imageblit(struct fb_info *info, const struct fb_image *image)
PM3Config2D_UserScissorEnable |
PM3Config2D_UseConstantSource |
PM3Config2D_ForegroundROPEnable |
(PM3Config2D_ForegroundROP(0x3)) |
PM3Config2D_ForegroundROP(0x3) |
PM3Config2D_OpaqueSpan |
PM3Config2D_FBWriteEnable);
PM3_WRITE_REG(par, PM3ScissorMinXY,
......@@ -546,15 +557,15 @@ static void pm3fb_imageblit(struct fb_info *info, const struct fb_image *image)
(((image->dy + image->height) & 0x0fff) << 16) |
((image->dx + image->width) & 0x0fff));
PM3_WRITE_REG(par, PM3RectanglePosition,
(PM3RectanglePosition_XOffset(image->dx)) |
(PM3RectanglePosition_YOffset(image->dy)));
PM3RectanglePosition_XOffset(image->dx) |
PM3RectanglePosition_YOffset(image->dy));
PM3_WRITE_REG(par, PM3Render2D,
PM3Render2D_XPositive |
PM3Render2D_YPositive |
PM3Render2D_Operation_SyncOnBitMask |
PM3Render2D_SpanOperation |
(PM3Render2D_Width(image->width)) |
(PM3Render2D_Height(image->height)));
PM3Render2D_Width(image->width) |
PM3Render2D_Height(image->height));
while (height--) {
......@@ -783,7 +794,7 @@ static int pm3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
unsigned bpp = var->red.length + var->green.length
+ var->blue.length + var->transp.length;
if ( bpp != var->bits_per_pixel ) {
if (bpp != var->bits_per_pixel) {
/* set predefined mode for bits_per_pixel settings */
switch(var->bits_per_pixel) {
......@@ -838,7 +849,7 @@ static int pm3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
}
var->xres = (var->xres + 31) & ~31; /* could sometimes be 8 */
lpitch = var->xres * ((var->bits_per_pixel + 7)>>3);
lpitch = var->xres * ((var->bits_per_pixel + 7) >> 3);
if (var->xres < 200 || var->xres > 2048) {
DPRINTK("width not supported: %u\n", var->xres);
......@@ -890,15 +901,12 @@ static int pm3fb_set_par(struct fb_info *info)
if ((info->var.vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE)
par->video |= PM3VideoControl_LINE_DOUBLE_ON;
else
par->video |= PM3VideoControl_LINE_DOUBLE_OFF;
if ((info->var.activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW)
par->video |= PM3VideoControl_ENABLE;
else {
par->video &= ~PM3VideoControl_ENABLE;
else
DPRINTK("PM3Video disabled\n");
}
switch (bpp) {
case 8:
par->video |= PM3VideoControl_PIXELSIZE_8BIT;
......@@ -916,8 +924,7 @@ static int pm3fb_set_par(struct fb_info *info)
info->fix.visual =
(bpp == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
info->fix.line_length = ((info->var.xres_virtual + 7) & ~7)
* bpp / 8;
info->fix.line_length = ((info->var.xres_virtual + 7) >> 3) * bpp;
/* pm3fb_clear_memory(info, 0);*/
pm3fb_clear_colormap(par, 0, 0, 0);
......@@ -1035,7 +1042,7 @@ static int pm3fb_blank(int blank_mode, struct fb_info *info)
video |= PM3VideoControl_ENABLE;
break;
case FB_BLANK_NORMAL:
video &= ~(PM3VideoControl_ENABLE);
video &= ~PM3VideoControl_ENABLE;
break;
case FB_BLANK_HSYNC_SUSPEND:
video &= ~(PM3VideoControl_HSYNC_MASK |
......@@ -1367,4 +1374,5 @@ static void __exit pm3fb_exit(void)
module_init(pm3fb_init);
module_exit(pm3fb_exit);
MODULE_DESCRIPTION("Permedia3 framebuffer device driver");
MODULE_LICENSE("GPL");
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部