Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 25595
b: refs/heads/master
c: 89ec4c2
h: refs/heads/master
i:
  25593: 38dc61b
  25591: 7bd4dc0
v: v3
  • Loading branch information
Antonino A. Daplas authored and Linus Torvalds committed Apr 11, 2006
1 parent 9a47646 commit b5549f0
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 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: ac50ab3e45436900b5d73edd0c6b0744af560535
refs/heads/master: 89ec4c238e7a3d7e660291f3f1a8181381baad77
5 changes: 5 additions & 0 deletions trunk/arch/i386/boot/video.S
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
#define PARAM_VESAPM_OFF 0x30
#define PARAM_LFB_PAGES 0x32
#define PARAM_VESA_ATTRIB 0x34
#define PARAM_CAPABILITIES 0x36

/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
#ifdef CONFIG_VIDEO_RETAIN
Expand Down Expand Up @@ -233,6 +234,10 @@ mopar_gr:
movw 18(%di), %ax
movl %eax, %fs:(PARAM_LFB_SIZE)

# store mode capabilities
movl 10(%di), %eax
movl %eax, %fs:(PARAM_CAPABILITIES)

# switching the DAC to 8-bit is for <= 8 bpp only
movw %fs:(PARAM_LFB_DEPTH), %ax
cmpw $8, %ax
Expand Down
5 changes: 5 additions & 0 deletions trunk/arch/x86_64/boot/video.S
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
#define PARAM_VESAPM_OFF 0x30
#define PARAM_LFB_PAGES 0x32
#define PARAM_VESA_ATTRIB 0x34
#define PARAM_CAPABILITIES 0x36

/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
#ifdef CONFIG_VIDEO_RETAIN
Expand Down Expand Up @@ -233,6 +234,10 @@ mopar_gr:
movw 18(%di), %ax
movl %eax, %fs:(PARAM_LFB_SIZE)

# store mode capabilities
movl 10(%di), %eax
movl %eax, %fs:(PARAM_CAPABILITIES)

# switching the DAC to 8-bit is for <= 8 bpp only
movw %fs:(PARAM_LFB_DEPTH), %ax
cmpw $8, %ax
Expand Down
27 changes: 21 additions & 6 deletions trunk/drivers/video/vesafb.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static unsigned short *pmi_base = NULL;
static void (*pmi_start)(void);
static void (*pmi_pal)(void);
static int depth;

static int vga_compat;
/* --------------------------------------------------------------------- */

static int vesafb_pan_display(struct fb_var_screeninfo *var,
Expand All @@ -83,9 +83,10 @@ static int vesafb_pan_display(struct fb_var_screeninfo *var,
static void vesa_setpalette(int regno, unsigned red, unsigned green,
unsigned blue)
{
int shift = 16 - depth;

#ifdef __i386__
struct { u_char blue, green, red, pad; } entry;
int shift = 16 - depth;

if (pmi_setpal) {
entry.red = red >> shift;
Expand All @@ -101,14 +102,20 @@ static void vesa_setpalette(int regno, unsigned red, unsigned green,
"d" (regno), /* EDX */
"D" (&entry), /* EDI */
"S" (&pmi_pal)); /* ESI */
} else {
/* without protected mode interface, try VGA registers... */
return;
}
#endif

/*
* without protected mode interface and if VGA compatible,
* try VGA registers...
*/
if (vga_compat) {
outb_p(regno, dac_reg);
outb_p(red >> shift, dac_val);
outb_p(green >> shift, dac_val);
outb_p(blue >> shift, dac_val);
}
#endif
}

static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
Expand Down Expand Up @@ -214,6 +221,7 @@ static int __init vesafb_probe(struct platform_device *dev)
if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB)
return -ENODEV;

vga_compat = (screen_info.capabilities & 2) ? 0 : 1;
vesafb_fix.smem_start = screen_info.lfb_base;
vesafb_defined.bits_per_pixel = screen_info.lfb_depth;
if (15 == vesafb_defined.bits_per_pixel)
Expand Down Expand Up @@ -318,6 +326,12 @@ static int __init vesafb_probe(struct platform_device *dev)
}
}

if (vesafb_defined.bits_per_pixel == 8 && !pmi_setpal && !vga_compat) {
printk(KERN_WARNING "vesafb: hardware palette is unchangeable,\n"
" colors may be incorrect\n");
vesafb_fix.visual = FB_VISUAL_STATIC_PSEUDOCOLOR;
}

vesafb_defined.xres_virtual = vesafb_defined.xres;
vesafb_defined.yres_virtual = vesafb_fix.smem_len / vesafb_fix.line_length;
if (ypan && vesafb_defined.yres_virtual > vesafb_defined.yres) {
Expand Down Expand Up @@ -354,7 +368,8 @@ static int __init vesafb_probe(struct platform_device *dev)
printk(KERN_INFO "vesafb: %s: "
"size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
(vesafb_defined.bits_per_pixel > 8) ?
"Truecolor" : "Pseudocolor",
"Truecolor" : (vga_compat || pmi_setpal) ?
"Pseudocolor" : "Static Pseudocolor",
screen_info.rsvd_size,
screen_info.red_size,
screen_info.green_size,
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/linux/screen_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ struct screen_info {
u16 vesapm_off; /* 0x30 */
u16 pages; /* 0x32 */
u16 vesa_attributes; /* 0x34 */
/* 0x36 -- 0x3f reserved for future expansion */
u32 capabilities; /* 0x36 */
/* 0x3a -- 0x3f reserved for future expansion */
};

extern struct screen_info screen_info;
Expand Down

0 comments on commit b5549f0

Please sign in to comment.