Skip to content

Commit

Permalink
Merge branch 'pan-fixes' of git://linuxtv.org/pinchartl/fbdev into fb…
Browse files Browse the repository at this point in the history
…dev-next
  • Loading branch information
Florian Tobias Schandinat authored and Florian Tobias Schandinat committed Aug 24, 2011
2 parents fcb8ce5 + 0d5c6ca commit 3c470f3
Show file tree
Hide file tree
Showing 28 changed files with 92 additions and 106 deletions.
22 changes: 6 additions & 16 deletions drivers/staging/xgifb/XGI_main_26.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,26 +1364,16 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
}

#ifdef XGIFB_PAN
static int XGIfb_pan_var(struct fb_var_screeninfo *var)
static int XGIfb_pan_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
unsigned int base;

/* printk("Inside pan_var"); */

if (var->xoffset > (var->xres_virtual - var->xres)) {
/* printk("Pan: xo: %d xv %d xr %d\n",
var->xoffset, var->xres_virtual, var->xres); */
return -EINVAL;
}
if (var->yoffset > (var->yres_virtual - var->yres)) {
/* printk("Pan: yo: %d yv %d yr %d\n",
var->yoffset, var->yres_virtual, var->yres); */
return -EINVAL;
}
base = var->yoffset * var->xres_virtual + var->xoffset;
base = var->yoffset * info->var.xres_virtual + var->xoffset;

/* calculate base bpp dep. */
switch (var->bits_per_pixel) {
switch (info->var.bits_per_pixel) {
case 16:
base >>= 1;
break;
Expand Down Expand Up @@ -1681,9 +1671,9 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var,

/* printk("\nInside pan_display:\n"); */

if (var->xoffset > (var->xres_virtual - var->xres))
if (var->xoffset > (info->var.xres_virtual - info->var.xres))
return -EINVAL;
if (var->yoffset > (var->yres_virtual - var->yres))
if (var->yoffset > (info->var.yres_virtual - info->var.yres))
return -EINVAL;

if (var->vmode & FB_VMODE_YWRAP) {
Expand All @@ -1696,7 +1686,7 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var,
> info->var.yres_virtual)
return -EINVAL;
}
err = XGIfb_pan_var(var);
err = XGIfb_pan_var(var, info);
if (err < 0)
return err;

Expand Down
4 changes: 2 additions & 2 deletions drivers/video/68328fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ static int mc68x328fb_pan_display(struct fb_var_screeninfo *var,
|| var->xoffset)
return -EINVAL;
} else {
if (var->xoffset + var->xres > info->var.xres_virtual ||
var->yoffset + var->yres > info->var.yres_virtual)
if (var->xoffset + info->var.xres > info->var.xres_virtual ||
var->yoffset + info->var.yres > info->var.yres_virtual)
return -EINVAL;
}
info->var.xoffset = var->xoffset;
Expand Down
5 changes: 3 additions & 2 deletions drivers/video/acornfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,10 @@ acornfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
u_int y_bottom = var->yoffset;

if (!(var->vmode & FB_VMODE_YWRAP))
y_bottom += var->yres;
y_bottom += info->var.yres;

BUG_ON(y_bottom > var->yres_virtual);
if (y_bottom > info->var.yres_virtual)
return -EINVAL;

acornfb_update_dma(info, var);

Expand Down
9 changes: 5 additions & 4 deletions drivers/video/arkfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,13 +908,14 @@ static int arkfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info
unsigned int offset;

/* Calculate the offset */
if (var->bits_per_pixel == 0) {
offset = (var->yoffset / 16) * (var->xres_virtual / 2) + (var->xoffset / 2);
if (info->var.bits_per_pixel == 0) {
offset = (var->yoffset / 16) * (info->var.xres_virtual / 2)
+ (var->xoffset / 2);
offset = offset >> 2;
} else {
offset = (var->yoffset * info->fix.line_length) +
(var->xoffset * var->bits_per_pixel / 8);
offset = offset >> ((var->bits_per_pixel == 4) ? 2 : 3);
(var->xoffset * info->var.bits_per_pixel / 8);
offset = offset >> ((info->var.bits_per_pixel == 4) ? 2 : 3);
}

/* Set the offset */
Expand Down
15 changes: 9 additions & 6 deletions drivers/video/atmel_lcdfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
| FBINFO_HWACCEL_YPAN)

static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
struct fb_var_screeninfo *var)
struct fb_var_screeninfo *var,
struct fb_info *info)
{

}
Expand All @@ -50,14 +51,16 @@ static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
| FBINFO_HWACCEL_YPAN)

static void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
struct fb_var_screeninfo *var)
struct fb_var_screeninfo *var,
struct fb_info *info)
{
u32 dma2dcfg;
u32 pixeloff;

pixeloff = (var->xoffset * var->bits_per_pixel) & 0x1f;
pixeloff = (var->xoffset * info->var.bits_per_pixel) & 0x1f;

dma2dcfg = ((var->xres_virtual - var->xres) * var->bits_per_pixel) / 8;
dma2dcfg = (info->var.xres_virtual - info->var.xres)
* info->var.bits_per_pixel / 8;
dma2dcfg |= pixeloff << ATMEL_LCDC_PIXELOFF_OFFSET;
lcdc_writel(sinfo, ATMEL_LCDC_DMA2DCFG, dma2dcfg);

Expand Down Expand Up @@ -249,14 +252,14 @@ static void atmel_lcdfb_update_dma(struct fb_info *info,
unsigned long dma_addr;

dma_addr = (fix->smem_start + var->yoffset * fix->line_length
+ var->xoffset * var->bits_per_pixel / 8);
+ var->xoffset * info->var.bits_per_pixel / 8);

dma_addr &= ~3UL;

/* Set framebuffer DMA base address and pixel offset */
lcdc_writel(sinfo, ATMEL_LCDC_DMABADDR1, dma_addr);

atmel_lcdfb_update_dma2d(sinfo, var);
atmel_lcdfb_update_dma2d(sinfo, var, info);
}

static inline void atmel_lcdfb_free_video_memory(struct atmel_lcdfb_info *sinfo)
Expand Down
10 changes: 5 additions & 5 deletions drivers/video/aty/radeon_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,16 +845,16 @@ static int radeonfb_pan_display (struct fb_var_screeninfo *var,
{
struct radeonfb_info *rinfo = info->par;

if ((var->xoffset + var->xres > var->xres_virtual)
|| (var->yoffset + var->yres > var->yres_virtual))
return -EINVAL;
if ((var->xoffset + info->var.xres > info->var.xres_virtual)
|| (var->yoffset + info->var.yres > info->var.yres_virtual))
return -EINVAL;

if (rinfo->asleep)
return 0;

radeon_fifo_wait(2);
OUTREG(CRTC_OFFSET, ((var->yoffset * var->xres_virtual + var->xoffset)
* var->bits_per_pixel / 8) & ~7);
OUTREG(CRTC_OFFSET, (var->yoffset * info->fix.line_length +
var->xoffset * info->var.bits_per_pixel / 8) & ~7);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/video/da8xx-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,8 +877,8 @@ static int da8xx_pan_display(struct fb_var_screeninfo *var,

start = fix->smem_start +
new_var.yoffset * fix->line_length +
new_var.xoffset * var->bits_per_pixel / 8;
end = start + var->yres * fix->line_length - 1;
new_var.xoffset * fbi->var.bits_per_pixel / 8;
end = start + fbi->var.yres * fix->line_length - 1;
par->dma_start = start;
par->dma_end = end;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/video/fb-puv3.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,8 @@ static int unifb_pan_display(struct fb_var_screeninfo *var,
|| var->xoffset)
return -EINVAL;
} else {
if (var->xoffset + var->xres > info->var.xres_virtual ||
var->yoffset + var->yres > info->var.yres_virtual)
if (var->xoffset + info->var.xres > info->var.xres_virtual ||
var->yoffset + info->var.yres > info->var.yres_virtual)
return -EINVAL;
}
info->var.xoffset = var->xoffset;
Expand Down
5 changes: 3 additions & 2 deletions drivers/video/g364fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,11 @@ int g364fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
static int g364fb_pan_display(struct fb_var_screeninfo *var,
struct fb_info *info)
{
if (var->xoffset || var->yoffset + var->yres > var->yres_virtual)
if (var->xoffset ||
var->yoffset + info->var.yres > info->var.yres_virtual)
return -EINVAL;

*(unsigned int *) TOP_REG = var->yoffset * var->xres;
*(unsigned int *) TOP_REG = var->yoffset * info->var.xres;
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/video/gxt4500.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ static int gxt4500_pan_display(struct fb_var_screeninfo *var,

if (var->xoffset & 7)
return -EINVAL;
if (var->xoffset + var->xres > var->xres_virtual ||
var->yoffset + var->yres > var->yres_virtual)
if (var->xoffset + info->var.xres > info->var.xres_virtual ||
var->yoffset + info->var.yres > info->var.yres_virtual)
return -EINVAL;

writereg(par, REFRESH_START, (var->xoffset << 16) | var->yoffset);
Expand Down
4 changes: 2 additions & 2 deletions drivers/video/hgafb.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@ static int hgafb_pan_display(struct fb_var_screeninfo *var,
var->xoffset)
return -EINVAL;
} else {
if (var->xoffset + var->xres > info->var.xres_virtual
|| var->yoffset + var->yres > info->var.yres_virtual
if (var->xoffset + info->var.xres > info->var.xres_virtual
|| var->yoffset + info->var.yres > info->var.yres_virtual
|| var->yoffset % 8)
return -EINVAL;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/imsttfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ set_offset (struct fb_var_screeninfo *var, struct fb_info *info)
{
struct imstt_par *par = info->par;
__u32 off = var->yoffset * (info->fix.line_length >> 3)
+ ((var->xoffset * (var->bits_per_pixel >> 3)) >> 3);
+ ((var->xoffset * (info->var.bits_per_pixel >> 3)) >> 3);
write_reg_le32(par->dc_regs, SSR, off);
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/video/intelfb/intelfbhw.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,12 @@ int intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
xoffset = ROUND_DOWN_TO(var->xoffset, 8);
yoffset = var->yoffset;

if ((xoffset + var->xres > var->xres_virtual) ||
(yoffset + var->yres > var->yres_virtual))
if ((xoffset + info->var.xres > info->var.xres_virtual) ||
(yoffset + info->var.yres > info->var.yres_virtual))
return -EINVAL;

offset = (yoffset * dinfo->pitch) +
(xoffset * var->bits_per_pixel) / 8;
(xoffset * info->var.bits_per_pixel) / 8;

offset += dinfo->fb.offset << 12;

Expand Down
2 changes: 1 addition & 1 deletion drivers/video/mb862xx/mb862xxfbdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ static int mb862xxfb_pan(struct fb_var_screeninfo *var,
reg = pack(var->yoffset, var->xoffset);
outreg(disp, GC_L0WY_L0WX, reg);

reg = pack(var->yres_virtual, var->xres_virtual);
reg = pack(info->var.yres_virtual, info->var.xres_virtual);
outreg(disp, GC_L0WH_L0WW, reg);
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/video/mx3fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1062,15 +1062,15 @@ static int mx3fb_pan_display(struct fb_var_screeninfo *var,
y_bottom = var->yoffset;

if (!(var->vmode & FB_VMODE_YWRAP))
y_bottom += var->yres;
y_bottom += fbi->var.yres;

if (y_bottom > fbi->var.yres_virtual)
return -EINVAL;

mutex_lock(&mx3_fbi->mutex);

offset = (var->yoffset * var->xres_virtual + var->xoffset) *
(var->bits_per_pixel / 8);
offset = var->yoffset * fbi->fix.line_length
+ var->xoffset * (fbi->var.bits_per_pixel / 8);
base = fbi->fix.smem_start + offset;

dev_dbg(fbi->device, "Updating SDC BG buf %d address=0x%08lX\n",
Expand Down
4 changes: 2 additions & 2 deletions drivers/video/neofb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,8 +1185,8 @@ static int neofb_pan_display(struct fb_var_screeninfo *var,

DBG("neofb_update_start");

Base = (var->yoffset * var->xres_virtual + var->xoffset) >> 2;
Base *= (var->bits_per_pixel + 7) / 8;
Base = (var->yoffset * info->var.xres_virtual + var->xoffset) >> 2;
Base *= (info->var.bits_per_pixel + 7) / 8;

neoUnlock();

Expand Down
4 changes: 2 additions & 2 deletions drivers/video/pm2fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,8 +973,8 @@ static int pm2fb_pan_display(struct fb_var_screeninfo *var,
{
struct pm2fb_par *p = info->par;
u32 base;
u32 depth = (var->bits_per_pixel + 7) & ~7;
u32 xres = (var->xres + 31) & ~31;
u32 depth = (info->var.bits_per_pixel + 7) & ~7;
u32 xres = (info->var.xres + 31) & ~31;

depth = (depth > 32) ? 32 : depth;
base = to3264(var->yoffset * xres + var->xoffset, depth, 1);
Expand Down
4 changes: 2 additions & 2 deletions drivers/video/pm3fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1147,9 +1147,9 @@ static int pm3fb_pan_display(struct fb_var_screeninfo *var,
struct fb_info *info)
{
struct pm3_par *par = info->par;
const u32 xres = (var->xres + 31) & ~31;
const u32 xres = (info->var.xres + 31) & ~31;

par->base = pm3fb_shift_bpp(var->bits_per_pixel,
par->base = pm3fb_shift_bpp(info->var.bits_per_pixel,
(var->yoffset * xres)
+ var->xoffset);
PM3_WAIT(par, 1);
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/s3c-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ static int s3c_fb_pan_display(struct fb_var_screeninfo *var,
}
}
/* Offset in bytes to the end of the displayed area */
end_boff = start_boff + var->yres * info->fix.line_length;
end_boff = start_boff + info->var.yres * info->fix.line_length;

/* Temporarily turn off per-vsync update from shadow registers until
* both start and end addresses are updated to prevent corruption */
Expand Down
7 changes: 4 additions & 3 deletions drivers/video/s3fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,12 +1019,13 @@ static int s3fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
unsigned int offset;

/* Calculate the offset */
if (var->bits_per_pixel == 0) {
offset = (var->yoffset / 16) * (var->xres_virtual / 2) + (var->xoffset / 2);
if (info->var.bits_per_pixel == 0) {
offset = (var->yoffset / 16) * (info->var.xres_virtual / 2)
+ (var->xoffset / 2);
offset = offset >> 2;
} else {
offset = (var->yoffset * info->fix.line_length) +
(var->xoffset * var->bits_per_pixel / 8);
(var->xoffset * info->var.bits_per_pixel / 8);
offset = offset >> 2;
}

Expand Down
16 changes: 7 additions & 9 deletions drivers/video/savage/savagefb_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1477,15 +1477,9 @@ static void savagefb_set_par_int(struct savagefb_par *par, struct savage_reg *r
vgaHWProtect(par, 0);
}

static void savagefb_update_start(struct savagefb_par *par,
struct fb_var_screeninfo *var)
static void savagefb_update_start(struct savagefb_par *par, int base)
{
int base;

base = ((var->yoffset * var->xres_virtual + (var->xoffset & ~1))
* ((var->bits_per_pixel+7) / 8)) >> 2;

/* now program the start address registers */
/* program the start address registers */
vga_out16(0x3d4, (base & 0x00ff00) | 0x0c, par);
vga_out16(0x3d4, ((base & 0x00ff) << 8) | 0x0d, par);
vga_out8(0x3d4, 0x69, par);
Expand Down Expand Up @@ -1550,8 +1544,12 @@ static int savagefb_pan_display(struct fb_var_screeninfo *var,
struct fb_info *info)
{
struct savagefb_par *par = info->par;
int base;

base = (var->yoffset * info->fix.line_length
+ (var->xoffset & ~1) * ((info->var.bits_per_pixel+7) / 8)) >> 2;

savagefb_update_start(par, var);
savagefb_update_start(par, base);
return 0;
}

Expand Down
Loading

0 comments on commit 3c470f3

Please sign in to comment.