diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2007-07-17 07:05:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 13:23:13 -0400 |
commit | 08a498de79727d63a011f2583e9aba4d3083c3a0 (patch) | |
tree | 4b45181fe347c6e7ee3efc1648e182bc65969b41 /drivers | |
parent | 000d5335c6e7f5dbcd849b62b4be7ae005aa6974 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/matrox/matroxfb_accel.c | 9 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_base.c | 4 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_base.h | 2 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_crtc2.c | 6 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_crtc2.h | 2 |
5 files changed, 8 insertions, 15 deletions
diff --git a/drivers/video/matrox/matroxfb_accel.c b/drivers/video/matrox/matroxfb_accel.c index c57aaadf410c..209fe697ecc7 100644 --- a/drivers/video/matrox/matroxfb_accel.c +++ b/drivers/video/matrox/matroxfb_accel.c | |||
@@ -145,13 +145,10 @@ void matrox_cfbX_init(WPMINFO2) { | |||
145 | ACCESS_FBINFO(fbops).fb_imageblit = matroxfb_imageblit; | 145 | ACCESS_FBINFO(fbops).fb_imageblit = matroxfb_imageblit; |
146 | } | 146 | } |
147 | break; | 147 | break; |
148 | case 16: if (ACCESS_FBINFO(fbcon).var.green.length == 5) { | 148 | case 16: if (ACCESS_FBINFO(fbcon).var.green.length == 5) |
149 | maccess = 0xC0000001; | 149 | maccess = 0xC0000001; |
150 | ACCESS_FBINFO(cmap[16]) = 0x7FFF7FFF; | 150 | else |
151 | } else { | ||
152 | maccess = 0x40000001; | 151 | maccess = 0x40000001; |
153 | ACCESS_FBINFO(cmap[16]) = 0xFFFFFFFF; | ||
154 | } | ||
155 | mopmode = M_OPMODE_16BPP; | 152 | mopmode = M_OPMODE_16BPP; |
156 | if (accel) { | 153 | if (accel) { |
157 | ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; | 154 | ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; |
@@ -161,7 +158,6 @@ void matrox_cfbX_init(WPMINFO2) { | |||
161 | break; | 158 | break; |
162 | case 24: maccess = 0x00000003; | 159 | case 24: maccess = 0x00000003; |
163 | mopmode = M_OPMODE_24BPP; | 160 | mopmode = M_OPMODE_24BPP; |
164 | ACCESS_FBINFO(cmap[16]) = 0xFFFFFFFF; | ||
165 | if (accel) { | 161 | if (accel) { |
166 | ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; | 162 | ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; |
167 | ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect; | 163 | ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect; |
@@ -170,7 +166,6 @@ void matrox_cfbX_init(WPMINFO2) { | |||
170 | break; | 166 | break; |
171 | case 32: maccess = 0x00000002; | 167 | case 32: maccess = 0x00000002; |
172 | mopmode = M_OPMODE_32BPP; | 168 | mopmode = M_OPMODE_32BPP; |
173 | ACCESS_FBINFO(cmap[16]) = 0xFFFFFFFF; | ||
174 | if (accel) { | 169 | if (accel) { |
175 | ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; | 170 | ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; |
176 | ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect; | 171 | ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect; |
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index 886e475f22f2..86ca7b179000 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c | |||
@@ -679,6 +679,8 @@ static int matroxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
679 | mga_outb(M_DAC_VAL, blue); | 679 | mga_outb(M_DAC_VAL, blue); |
680 | break; | 680 | break; |
681 | case 16: | 681 | case 16: |
682 | if (regno >= 16) | ||
683 | break; | ||
682 | { | 684 | { |
683 | u_int16_t col = | 685 | u_int16_t col = |
684 | (red << ACCESS_FBINFO(fbcon).var.red.offset) | | 686 | (red << ACCESS_FBINFO(fbcon).var.red.offset) | |
@@ -690,6 +692,8 @@ static int matroxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
690 | break; | 692 | break; |
691 | case 24: | 693 | case 24: |
692 | case 32: | 694 | case 32: |
695 | if (regno >= 16) | ||
696 | break; | ||
693 | ACCESS_FBINFO(cmap[regno]) = | 697 | ACCESS_FBINFO(cmap[regno]) = |
694 | (red << ACCESS_FBINFO(fbcon).var.red.offset) | | 698 | (red << ACCESS_FBINFO(fbcon).var.red.offset) | |
695 | (green << ACCESS_FBINFO(fbcon).var.green.offset) | | 699 | (green << ACCESS_FBINFO(fbcon).var.green.offset) | |
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index 9c25c2f7966b..d59577c8de86 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h | |||
@@ -518,7 +518,7 @@ struct matrox_fb_info { | |||
518 | dll:1; | 518 | dll:1; |
519 | } memory; | 519 | } memory; |
520 | } values; | 520 | } values; |
521 | u_int32_t cmap[17]; | 521 | u_int32_t cmap[16]; |
522 | }; | 522 | }; |
523 | 523 | ||
524 | #define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon) | 524 | #define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon) |
diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c index 03ae55b168ff..4b3344e03695 100644 --- a/drivers/video/matrox/matroxfb_crtc2.c +++ b/drivers/video/matrox/matroxfb_crtc2.c | |||
@@ -163,11 +163,6 @@ static void matroxfb_dh_disable(struct matroxfb_dh_fb_info* m2info) { | |||
163 | ACCESS_FBINFO(hw).crtc2.ctl = 0x00000004; | 163 | ACCESS_FBINFO(hw).crtc2.ctl = 0x00000004; |
164 | } | 164 | } |
165 | 165 | ||
166 | static void matroxfb_dh_cfbX_init(struct matroxfb_dh_fb_info* m2info) { | ||
167 | /* no acceleration for secondary head... */ | ||
168 | m2info->cmap[16] = 0xFFFFFFFF; | ||
169 | } | ||
170 | |||
171 | static void matroxfb_dh_pan_var(struct matroxfb_dh_fb_info* m2info, | 166 | static void matroxfb_dh_pan_var(struct matroxfb_dh_fb_info* m2info, |
172 | struct fb_var_screeninfo* var) { | 167 | struct fb_var_screeninfo* var) { |
173 | unsigned int pos; | 168 | unsigned int pos; |
@@ -385,7 +380,6 @@ static int matroxfb_dh_set_par(struct fb_info* info) { | |||
385 | } | 380 | } |
386 | } | 381 | } |
387 | up_read(&ACCESS_FBINFO(altout).lock); | 382 | up_read(&ACCESS_FBINFO(altout).lock); |
388 | matroxfb_dh_cfbX_init(m2info); | ||
389 | } | 383 | } |
390 | m2info->initialized = 1; | 384 | m2info->initialized = 1; |
391 | return 0; | 385 | return 0; |
diff --git a/drivers/video/matrox/matroxfb_crtc2.h b/drivers/video/matrox/matroxfb_crtc2.h index 177177609be7..1005582e843e 100644 --- a/drivers/video/matrox/matroxfb_crtc2.h +++ b/drivers/video/matrox/matroxfb_crtc2.h | |||
@@ -28,7 +28,7 @@ struct matroxfb_dh_fb_info { | |||
28 | 28 | ||
29 | unsigned int interlaced:1; | 29 | unsigned int interlaced:1; |
30 | 30 | ||
31 | u_int32_t cmap[17]; | 31 | u_int32_t cmap[16]; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | #endif /* __MATROXFB_CRTC2_H__ */ | 34 | #endif /* __MATROXFB_CRTC2_H__ */ |