Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43793
b: refs/heads/master
c: fd71768
h: refs/heads/master
i:
  43791: bf3324f
v: v3
  • Loading branch information
Jeff Garzik authored and Linus Torvalds committed Dec 8, 2006
1 parent 4aa83ad commit 338c41c
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 12 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: 945f0ee257b4f91498b4061dc89b8a68c423ea6f
refs/heads/master: fd717689f46436fc212882ddc6e02a20be920634
5 changes: 5 additions & 0 deletions trunk/drivers/video/aty/aty128fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,8 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll,
if (vclk * 12 < c.ppll_min)
vclk = c.ppll_min/12;

pll->post_divider = -1;

/* now, find an acceptable divider */
for (i = 0; i < sizeof(post_dividers); i++) {
output_freq = post_dividers[i] * vclk;
Expand All @@ -1342,6 +1344,9 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll,
}
}

if (pll->post_divider < 0)
return -EINVAL;

/* calculate feedback divider */
n = c.ref_divider * output_freq;
d = c.ref_clk;
Expand Down
22 changes: 17 additions & 5 deletions trunk/drivers/video/riva/fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,11 +740,12 @@ static void riva_load_state(struct riva_par *par, struct riva_regs *regs)
* CALLED FROM:
* rivafb_set_par()
*/
static void riva_load_video_mode(struct fb_info *info)
static int riva_load_video_mode(struct fb_info *info)
{
int bpp, width, hDisplaySize, hDisplay, hStart,
hEnd, hTotal, height, vDisplay, vStart, vEnd, vTotal, dotClock;
int hBlankStart, hBlankEnd, vBlankStart, vBlankEnd;
int rc;
struct riva_par *par = info->par;
struct riva_regs newmode;

Expand Down Expand Up @@ -850,8 +851,10 @@ static void riva_load_video_mode(struct fb_info *info)
else
newmode.misc_output |= 0x80;

par->riva.CalcStateExt(&par->riva, &newmode.ext, bpp, width,
hDisplaySize, height, dotClock);
rc = CalcStateExt(&par->riva, &newmode.ext, bpp, width,
hDisplaySize, height, dotClock);
if (rc)
goto out;

newmode.ext.scale = NV_RD32(par->riva.PRAMDAC, 0x00000848) &
0xfff000ff;
Expand Down Expand Up @@ -883,8 +886,12 @@ static void riva_load_video_mode(struct fb_info *info)
par->current_state = newmode;
riva_load_state(par, &par->current_state);
par->riva.LockUnlock(&par->riva, 0); /* important for HW cursor */

out:
rivafb_blank(FB_BLANK_UNBLANK, info);
NVTRACE_LEAVE();

return rc;
}

static void riva_update_var(struct fb_var_screeninfo *var, struct fb_videomode *modedb)
Expand Down Expand Up @@ -1252,12 +1259,15 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
static int rivafb_set_par(struct fb_info *info)
{
struct riva_par *par = info->par;
int rc = 0;

NVTRACE_ENTER();
/* vgaHWunlock() + riva unlock (0x7F) */
CRTCout(par, 0x11, 0xFF);
par->riva.LockUnlock(&par->riva, 0);
riva_load_video_mode(info);
rc = riva_load_video_mode(info);
if (rc)
goto out;
if(!(info->flags & FBINFO_HWACCEL_DISABLED))
riva_setup_accel(info);

Expand All @@ -1270,8 +1280,10 @@ static int rivafb_set_par(struct fb_info *info)
info->pixmap.scan_align = 1;
else
info->pixmap.scan_align = 4;

out:
NVTRACE_LEAVE();
return 0;
return rc;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions trunk/drivers/video/riva/riva_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ static int CalcVClock
* Calculate extended mode parameters (SVGA) and save in a
* mode state structure.
*/
static void CalcStateExt
int CalcStateExt
(
RIVA_HW_INST *chip,
RIVA_HW_STATE *state,
Expand All @@ -1249,7 +1249,8 @@ static void CalcStateExt
* Extended RIVA registers.
*/
pixelDepth = (bpp + 1)/8;
CalcVClock(dotClock, &VClk, &m, &n, &p, chip);
if (!CalcVClock(dotClock, &VClk, &m, &n, &p, chip))
return -EINVAL;

switch (chip->Architecture)
{
Expand Down Expand Up @@ -1327,6 +1328,8 @@ static void CalcStateExt
state->pitch1 =
state->pitch2 =
state->pitch3 = pixelDepth * width;

return 0;
}
/*
* Load fixed function state and pre-calculated/stored state.
Expand Down Expand Up @@ -2026,7 +2029,6 @@ static void nv3GetConfig
*/
chip->Busy = nv3Busy;
chip->ShowHideCursor = ShowHideCursor;
chip->CalcStateExt = CalcStateExt;
chip->LoadStateExt = LoadStateExt;
chip->UnloadStateExt = UnloadStateExt;
chip->SetStartAddress = SetStartAddress3;
Expand Down Expand Up @@ -2084,7 +2086,6 @@ static void nv4GetConfig
*/
chip->Busy = nv4Busy;
chip->ShowHideCursor = ShowHideCursor;
chip->CalcStateExt = CalcStateExt;
chip->LoadStateExt = LoadStateExt;
chip->UnloadStateExt = UnloadStateExt;
chip->SetStartAddress = SetStartAddress;
Expand Down Expand Up @@ -2186,7 +2187,6 @@ static void nv10GetConfig
*/
chip->Busy = nv10Busy;
chip->ShowHideCursor = ShowHideCursor;
chip->CalcStateExt = CalcStateExt;
chip->LoadStateExt = LoadStateExt;
chip->UnloadStateExt = UnloadStateExt;
chip->SetStartAddress = SetStartAddress;
Expand Down
17 changes: 16 additions & 1 deletion trunk/drivers/video/riva/riva_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ typedef struct _riva_hw_inst
* Common chip functions.
*/
int (*Busy)(struct _riva_hw_inst *);
void (*CalcStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *,int,int,int,int,int);
void (*LoadStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *);
void (*UnloadStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *);
void (*SetStartAddress)(struct _riva_hw_inst *,U032);
Expand Down Expand Up @@ -528,6 +527,22 @@ typedef struct _riva_hw_state
U032 pitch2;
U032 pitch3;
} RIVA_HW_STATE;

/*
* function prototypes
*/

extern int CalcStateExt
(
RIVA_HW_INST *chip,
RIVA_HW_STATE *state,
int bpp,
int width,
int hDisplaySize,
int height,
int dotClock
);

/*
* External routines.
*/
Expand Down

0 comments on commit 338c41c

Please sign in to comment.