Skip to content

Commit 564f180

Browse files
Mikulas Patockabzolnier
authored andcommitted
udlfb: don't switch if we are switching to the same videomode
The udlfb driver reprograms the hardware everytime the user switches the console, that makes quite unusable when working on the console. This patch makes the driver remember the videomode we are in and avoid reprogramming the hardware if we switch to the same videomode. We mask the "activate" field and the "FB_VMODE_SMOOTH_XPAN" flag when comparing the videomode, because they cause spurious switches when switching to and from the Xserver. Signed-off-by: Mikulas Patocka <[email protected]> Cc: [email protected] Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
1 parent 4e705e1 commit 564f180

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

drivers/video/fbdev/udlfb.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,10 +1041,24 @@ static int dlfb_ops_set_par(struct fb_info *info)
10411041
int result;
10421042
u16 *pix_framebuffer;
10431043
int i;
1044+
struct fb_var_screeninfo fvs;
1045+
1046+
/* clear the activate field because it causes spurious miscompares */
1047+
fvs = info->var;
1048+
fvs.activate = 0;
1049+
fvs.vmode &= ~FB_VMODE_SMOOTH_XPAN;
1050+
1051+
if (!memcmp(&dlfb->current_mode, &fvs, sizeof(struct fb_var_screeninfo)))
1052+
return 0;
10441053

10451054
result = dlfb_set_video_mode(dlfb, &info->var);
10461055

1047-
if ((result == 0) && (dlfb->fb_count == 0)) {
1056+
if (result)
1057+
return result;
1058+
1059+
dlfb->current_mode = fvs;
1060+
1061+
if (dlfb->fb_count == 0) {
10481062

10491063
/* paint greenscreen */
10501064

@@ -1056,7 +1070,7 @@ static int dlfb_ops_set_par(struct fb_info *info)
10561070
info->screen_base);
10571071
}
10581072

1059-
return result;
1073+
return 0;
10601074
}
10611075

10621076
/* To fonzi the jukebox (e.g. make blanking changes take effect) */

include/video/udlfb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ struct dlfb_data {
5656
atomic_t bytes_identical; /* saved effort with backbuffer comparison */
5757
atomic_t bytes_sent; /* to usb, after compression including overhead */
5858
atomic_t cpu_kcycles_used; /* transpired during pixel processing */
59+
struct fb_var_screeninfo current_mode;
5960
};
6061

6162
#define NR_USB_REQUEST_I2C_SUB_IO 0x02

0 commit comments

Comments
 (0)