Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83577
b: refs/heads/master
c: 633bd11
h: refs/heads/master
i:
  83575: 224ae45
v: v3
  • Loading branch information
Geert Uytterhoeven authored and Linus Torvalds committed Feb 6, 2008
1 parent f8e30cf commit 4057f0e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7974f72a21a246051b3dd84d7158974fc4785150
refs/heads/master: 633bd111bafa346d0bb5137bd1e71b92cf1ca594
71 changes: 50 additions & 21 deletions trunk/drivers/video/ps3fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,32 +270,57 @@ module_param(ps3fb_mode, int, 0);

static char *mode_option __devinitdata;

static unsigned int ps3fb_find_mode(const struct fb_var_screeninfo *var,
static int ps3fb_cmp_mode(const struct fb_videomode *vmode,
const struct fb_var_screeninfo *var)
{
/* resolution + black border must match a native resolution */
if (vmode->left_margin + vmode->xres + vmode->right_margin !=
var->left_margin + var->xres + var->right_margin ||
vmode->upper_margin + vmode->yres + vmode->lower_margin !=
var->upper_margin + var->yres + var->lower_margin)
return -1;

/* minimum limits for margins */
if (vmode->left_margin > var->left_margin ||
vmode->right_margin > var->right_margin ||
vmode->upper_margin > var->upper_margin ||
vmode->lower_margin > var->lower_margin)
return -1;

/* these fields must match exactly */
if (vmode->pixclock != var->pixclock ||
vmode->hsync_len != var->hsync_len ||
vmode->vsync_len != var->vsync_len ||
vmode->sync != var->sync ||
vmode->vmode != (var->vmode & FB_VMODE_MASK))
return -1;

return 0;
}

static unsigned int ps3fb_find_mode(struct fb_var_screeninfo *var,
u32 *ddr_line_length, u32 *xdr_line_length)
{
unsigned int i, fi, mode;

for (i = 0; i < ARRAY_SIZE(ps3fb_modedb); i++)
if (var->xres == ps3fb_modedb[i].xres &&
var->yres == ps3fb_modedb[i].yres &&
var->pixclock == ps3fb_modedb[i].pixclock &&
var->hsync_len == ps3fb_modedb[i].hsync_len &&
var->vsync_len == ps3fb_modedb[i].vsync_len &&
var->left_margin == ps3fb_modedb[i].left_margin &&
var->right_margin == ps3fb_modedb[i].right_margin &&
var->upper_margin == ps3fb_modedb[i].upper_margin &&
var->lower_margin == ps3fb_modedb[i].lower_margin &&
var->sync == ps3fb_modedb[i].sync &&
(var->vmode & FB_VMODE_MASK) == ps3fb_modedb[i].vmode)
unsigned int i, mode;

for (i = PS3AV_MODE_1080P50; i < ARRAY_SIZE(ps3fb_modedb); i++)
if (!ps3fb_cmp_mode(&ps3fb_modedb[i], var))
goto found;

pr_debug("ps3fb_find_mode: mode not found\n");
return 0;

found:
/* Cropped broadcast modes use the full line length */
fi = i < PS3AV_MODE_1080P50 ? i + PS3AV_MODE_WUXGA : i;
*ddr_line_length = ps3fb_modedb[fi].xres * BPP;
*ddr_line_length = ps3fb_modedb[i].xres * BPP;

if (!var->xres) {
var->xres = 1;
var->right_margin--;
}
if (!var->yres) {
var->yres = 1;
var->lower_margin--;
}

if (ps3_compare_firmware_version(1, 9, 0) >= 0) {
*xdr_line_length = GPU_ALIGN_UP(max(var->xres,
Expand All @@ -305,10 +330,14 @@ static unsigned int ps3fb_find_mode(const struct fb_var_screeninfo *var,
} else
*xdr_line_length = *ddr_line_length;

/* Full broadcast modes have the full mode bit set */
mode = i+1;
if (mode > PS3AV_MODE_WUXGA)
mode = (mode - PS3AV_MODE_WUXGA) | PS3AV_MODE_FULL;
if (mode > PS3AV_MODE_WUXGA) {
mode -= PS3AV_MODE_WUXGA;
/* Full broadcast modes have the full mode bit set */
if (ps3fb_modedb[i].xres == var->xres &&
ps3fb_modedb[i].yres == var->yres)
mode |= PS3AV_MODE_FULL;
}

pr_debug("ps3fb_find_mode: mode %u\n", mode);

Expand Down

0 comments on commit 4057f0e

Please sign in to comment.