matroxfb: color setting fixes
- the pseudo_palette is only 16 elements long. - do not write to the pseudo_palette if regno (array index) is more than 15 - remove code that writes to the 17th entry of the pseudo_palette Signed-off-by: Antonino Daplas <adaplas@gmail.com> Acked-by: Petr Vandrovec <vandrove@vc.cvut.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
000d5335c6
commit
08a498de79
5 changed files with 8 additions and 15 deletions
|
@ -145,13 +145,10 @@ void matrox_cfbX_init(WPMINFO2) {
|
||||||
ACCESS_FBINFO(fbops).fb_imageblit = matroxfb_imageblit;
|
ACCESS_FBINFO(fbops).fb_imageblit = matroxfb_imageblit;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 16: if (ACCESS_FBINFO(fbcon).var.green.length == 5) {
|
case 16: if (ACCESS_FBINFO(fbcon).var.green.length == 5)
|
||||||
maccess = 0xC0000001;
|
maccess = 0xC0000001;
|
||||||
ACCESS_FBINFO(cmap[16]) = 0x7FFF7FFF;
|
else
|
||||||
} else {
|
|
||||||
maccess = 0x40000001;
|
maccess = 0x40000001;
|
||||||
ACCESS_FBINFO(cmap[16]) = 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
mopmode = M_OPMODE_16BPP;
|
mopmode = M_OPMODE_16BPP;
|
||||||
if (accel) {
|
if (accel) {
|
||||||
ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea;
|
ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea;
|
||||||
|
@ -161,7 +158,6 @@ void matrox_cfbX_init(WPMINFO2) {
|
||||||
break;
|
break;
|
||||||
case 24: maccess = 0x00000003;
|
case 24: maccess = 0x00000003;
|
||||||
mopmode = M_OPMODE_24BPP;
|
mopmode = M_OPMODE_24BPP;
|
||||||
ACCESS_FBINFO(cmap[16]) = 0xFFFFFFFF;
|
|
||||||
if (accel) {
|
if (accel) {
|
||||||
ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea;
|
ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea;
|
||||||
ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect;
|
ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect;
|
||||||
|
@ -170,7 +166,6 @@ void matrox_cfbX_init(WPMINFO2) {
|
||||||
break;
|
break;
|
||||||
case 32: maccess = 0x00000002;
|
case 32: maccess = 0x00000002;
|
||||||
mopmode = M_OPMODE_32BPP;
|
mopmode = M_OPMODE_32BPP;
|
||||||
ACCESS_FBINFO(cmap[16]) = 0xFFFFFFFF;
|
|
||||||
if (accel) {
|
if (accel) {
|
||||||
ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea;
|
ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea;
|
||||||
ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect;
|
ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect;
|
||||||
|
|
|
@ -679,6 +679,8 @@ static int matroxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
|
||||||
mga_outb(M_DAC_VAL, blue);
|
mga_outb(M_DAC_VAL, blue);
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
|
if (regno >= 16)
|
||||||
|
break;
|
||||||
{
|
{
|
||||||
u_int16_t col =
|
u_int16_t col =
|
||||||
(red << ACCESS_FBINFO(fbcon).var.red.offset) |
|
(red << ACCESS_FBINFO(fbcon).var.red.offset) |
|
||||||
|
@ -690,6 +692,8 @@ static int matroxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
case 32:
|
case 32:
|
||||||
|
if (regno >= 16)
|
||||||
|
break;
|
||||||
ACCESS_FBINFO(cmap[regno]) =
|
ACCESS_FBINFO(cmap[regno]) =
|
||||||
(red << ACCESS_FBINFO(fbcon).var.red.offset) |
|
(red << ACCESS_FBINFO(fbcon).var.red.offset) |
|
||||||
(green << ACCESS_FBINFO(fbcon).var.green.offset) |
|
(green << ACCESS_FBINFO(fbcon).var.green.offset) |
|
||||||
|
|
|
@ -518,7 +518,7 @@ struct matrox_fb_info {
|
||||||
dll:1;
|
dll:1;
|
||||||
} memory;
|
} memory;
|
||||||
} values;
|
} values;
|
||||||
u_int32_t cmap[17];
|
u_int32_t cmap[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon)
|
#define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon)
|
||||||
|
|
|
@ -163,11 +163,6 @@ static void matroxfb_dh_disable(struct matroxfb_dh_fb_info* m2info) {
|
||||||
ACCESS_FBINFO(hw).crtc2.ctl = 0x00000004;
|
ACCESS_FBINFO(hw).crtc2.ctl = 0x00000004;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void matroxfb_dh_cfbX_init(struct matroxfb_dh_fb_info* m2info) {
|
|
||||||
/* no acceleration for secondary head... */
|
|
||||||
m2info->cmap[16] = 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void matroxfb_dh_pan_var(struct matroxfb_dh_fb_info* m2info,
|
static void matroxfb_dh_pan_var(struct matroxfb_dh_fb_info* m2info,
|
||||||
struct fb_var_screeninfo* var) {
|
struct fb_var_screeninfo* var) {
|
||||||
unsigned int pos;
|
unsigned int pos;
|
||||||
|
@ -385,7 +380,6 @@ static int matroxfb_dh_set_par(struct fb_info* info) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up_read(&ACCESS_FBINFO(altout).lock);
|
up_read(&ACCESS_FBINFO(altout).lock);
|
||||||
matroxfb_dh_cfbX_init(m2info);
|
|
||||||
}
|
}
|
||||||
m2info->initialized = 1;
|
m2info->initialized = 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -28,7 +28,7 @@ struct matroxfb_dh_fb_info {
|
||||||
|
|
||||||
unsigned int interlaced:1;
|
unsigned int interlaced:1;
|
||||||
|
|
||||||
u_int32_t cmap[17];
|
u_int32_t cmap[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __MATROXFB_CRTC2_H__ */
|
#endif /* __MATROXFB_CRTC2_H__ */
|
||||||
|
|
Loading…
Reference in a new issue