diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2014-01-23 14:39:04 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-13 07:59:42 -0400 |
commit | 709b6a943bd0a1a3e0b49206230981f8d48ec532 (patch) | |
tree | 14bb87a4de45efa3d12004a46dac4fccb3561279 | |
parent | 2b984ea1f20cdd2eb84879defa4df9ebe85ce680 (diff) |
matroxfb: restore the registers M_ACCESS and M_PITCH
commit a772d4736641ec1b421ad965e13457c17379fc86 upstream.
When X11 is running and the user switches back to console, the card
modifies the content of registers M_MACCESS and M_PITCH in periodic
intervals.
This patch fixes it by restoring the content of these registers before
issuing any accelerator command.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/video/matrox/matroxfb_accel.c | 38 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_base.h | 2 |
2 files changed, 30 insertions, 10 deletions
diff --git a/drivers/video/matrox/matroxfb_accel.c b/drivers/video/matrox/matroxfb_accel.c index 8335a6fe303e..0d5cb85d071a 100644 --- a/drivers/video/matrox/matroxfb_accel.c +++ b/drivers/video/matrox/matroxfb_accel.c | |||
@@ -192,10 +192,18 @@ void matrox_cfbX_init(struct matrox_fb_info *minfo) | |||
192 | minfo->accel.m_dwg_rect = M_DWG_TRAP | M_DWG_SOLID | M_DWG_ARZERO | M_DWG_SGNZERO | M_DWG_SHIFTZERO; | 192 | minfo->accel.m_dwg_rect = M_DWG_TRAP | M_DWG_SOLID | M_DWG_ARZERO | M_DWG_SGNZERO | M_DWG_SHIFTZERO; |
193 | if (isMilleniumII(minfo)) minfo->accel.m_dwg_rect |= M_DWG_TRANSC; | 193 | if (isMilleniumII(minfo)) minfo->accel.m_dwg_rect |= M_DWG_TRANSC; |
194 | minfo->accel.m_opmode = mopmode; | 194 | minfo->accel.m_opmode = mopmode; |
195 | minfo->accel.m_access = maccess; | ||
196 | minfo->accel.m_pitch = mpitch; | ||
195 | } | 197 | } |
196 | 198 | ||
197 | EXPORT_SYMBOL(matrox_cfbX_init); | 199 | EXPORT_SYMBOL(matrox_cfbX_init); |
198 | 200 | ||
201 | static void matrox_accel_restore_maccess(struct matrox_fb_info *minfo) | ||
202 | { | ||
203 | mga_outl(M_MACCESS, minfo->accel.m_access); | ||
204 | mga_outl(M_PITCH, minfo->accel.m_pitch); | ||
205 | } | ||
206 | |||
199 | static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, | 207 | static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, |
200 | int sx, int dy, int dx, int height, int width) | 208 | int sx, int dy, int dx, int height, int width) |
201 | { | 209 | { |
@@ -207,7 +215,8 @@ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, | |||
207 | CRITBEGIN | 215 | CRITBEGIN |
208 | 216 | ||
209 | if ((dy < sy) || ((dy == sy) && (dx <= sx))) { | 217 | if ((dy < sy) || ((dy == sy) && (dx <= sx))) { |
210 | mga_fifo(2); | 218 | mga_fifo(4); |
219 | matrox_accel_restore_maccess(minfo); | ||
211 | mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO | | 220 | mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO | |
212 | M_DWG_BFCOL | M_DWG_REPLACE); | 221 | M_DWG_BFCOL | M_DWG_REPLACE); |
213 | mga_outl(M_AR5, vxres); | 222 | mga_outl(M_AR5, vxres); |
@@ -215,7 +224,8 @@ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, | |||
215 | start = sy*vxres+sx+curr_ydstorg(minfo); | 224 | start = sy*vxres+sx+curr_ydstorg(minfo); |
216 | end = start+width; | 225 | end = start+width; |
217 | } else { | 226 | } else { |
218 | mga_fifo(3); | 227 | mga_fifo(5); |
228 | matrox_accel_restore_maccess(minfo); | ||
219 | mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_BFCOL | M_DWG_REPLACE); | 229 | mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_BFCOL | M_DWG_REPLACE); |
220 | mga_outl(M_SGN, 5); | 230 | mga_outl(M_SGN, 5); |
221 | mga_outl(M_AR5, -vxres); | 231 | mga_outl(M_AR5, -vxres); |
@@ -224,7 +234,8 @@ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, | |||
224 | start = end+width; | 234 | start = end+width; |
225 | dy += height-1; | 235 | dy += height-1; |
226 | } | 236 | } |
227 | mga_fifo(4); | 237 | mga_fifo(6); |
238 | matrox_accel_restore_maccess(minfo); | ||
228 | mga_outl(M_AR0, end); | 239 | mga_outl(M_AR0, end); |
229 | mga_outl(M_AR3, start); | 240 | mga_outl(M_AR3, start); |
230 | mga_outl(M_FXBNDRY, ((dx+width)<<16) | dx); | 241 | mga_outl(M_FXBNDRY, ((dx+width)<<16) | dx); |
@@ -246,7 +257,8 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres, | |||
246 | CRITBEGIN | 257 | CRITBEGIN |
247 | 258 | ||
248 | if ((dy < sy) || ((dy == sy) && (dx <= sx))) { | 259 | if ((dy < sy) || ((dy == sy) && (dx <= sx))) { |
249 | mga_fifo(2); | 260 | mga_fifo(4); |
261 | matrox_accel_restore_maccess(minfo); | ||
250 | mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO | | 262 | mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO | |
251 | M_DWG_BFCOL | M_DWG_REPLACE); | 263 | M_DWG_BFCOL | M_DWG_REPLACE); |
252 | mga_outl(M_AR5, vxres); | 264 | mga_outl(M_AR5, vxres); |
@@ -254,7 +266,8 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres, | |||
254 | start = sy*vxres+sx+curr_ydstorg(minfo); | 266 | start = sy*vxres+sx+curr_ydstorg(minfo); |
255 | end = start+width; | 267 | end = start+width; |
256 | } else { | 268 | } else { |
257 | mga_fifo(3); | 269 | mga_fifo(5); |
270 | matrox_accel_restore_maccess(minfo); | ||
258 | mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_BFCOL | M_DWG_REPLACE); | 271 | mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_BFCOL | M_DWG_REPLACE); |
259 | mga_outl(M_SGN, 5); | 272 | mga_outl(M_SGN, 5); |
260 | mga_outl(M_AR5, -vxres); | 273 | mga_outl(M_AR5, -vxres); |
@@ -263,7 +276,8 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres, | |||
263 | start = end+width; | 276 | start = end+width; |
264 | dy += height-1; | 277 | dy += height-1; |
265 | } | 278 | } |
266 | mga_fifo(5); | 279 | mga_fifo(7); |
280 | matrox_accel_restore_maccess(minfo); | ||
267 | mga_outl(M_AR0, end); | 281 | mga_outl(M_AR0, end); |
268 | mga_outl(M_AR3, start); | 282 | mga_outl(M_AR3, start); |
269 | mga_outl(M_FXBNDRY, ((dx+width)<<16) | dx); | 283 | mga_outl(M_FXBNDRY, ((dx+width)<<16) | dx); |
@@ -298,7 +312,8 @@ static void matroxfb_accel_clear(struct matrox_fb_info *minfo, u_int32_t color, | |||
298 | 312 | ||
299 | CRITBEGIN | 313 | CRITBEGIN |
300 | 314 | ||
301 | mga_fifo(5); | 315 | mga_fifo(7); |
316 | matrox_accel_restore_maccess(minfo); | ||
302 | mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE); | 317 | mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE); |
303 | mga_outl(M_FCOL, color); | 318 | mga_outl(M_FCOL, color); |
304 | mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx); | 319 | mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx); |
@@ -341,7 +356,8 @@ static void matroxfb_cfb4_clear(struct matrox_fb_info *minfo, u_int32_t bgx, | |||
341 | width >>= 1; | 356 | width >>= 1; |
342 | sx >>= 1; | 357 | sx >>= 1; |
343 | if (width) { | 358 | if (width) { |
344 | mga_fifo(5); | 359 | mga_fifo(7); |
360 | matrox_accel_restore_maccess(minfo); | ||
345 | mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE2); | 361 | mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE2); |
346 | mga_outl(M_FCOL, bgx); | 362 | mga_outl(M_FCOL, bgx); |
347 | mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx); | 363 | mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx); |
@@ -415,7 +431,8 @@ static void matroxfb_1bpp_imageblit(struct matrox_fb_info *minfo, u_int32_t fgx, | |||
415 | 431 | ||
416 | CRITBEGIN | 432 | CRITBEGIN |
417 | 433 | ||
418 | mga_fifo(3); | 434 | mga_fifo(5); |
435 | matrox_accel_restore_maccess(minfo); | ||
419 | if (easy) | 436 | if (easy) |
420 | mga_outl(M_DWGCTL, M_DWG_ILOAD | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_LINEAR | M_DWG_REPLACE); | 437 | mga_outl(M_DWGCTL, M_DWG_ILOAD | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_LINEAR | M_DWG_REPLACE); |
421 | else | 438 | else |
@@ -425,7 +442,8 @@ static void matroxfb_1bpp_imageblit(struct matrox_fb_info *minfo, u_int32_t fgx, | |||
425 | fxbndry = ((xx + width - 1) << 16) | xx; | 442 | fxbndry = ((xx + width - 1) << 16) | xx; |
426 | mmio = minfo->mmio.vbase; | 443 | mmio = minfo->mmio.vbase; |
427 | 444 | ||
428 | mga_fifo(6); | 445 | mga_fifo(8); |
446 | matrox_accel_restore_maccess(minfo); | ||
429 | mga_writel(mmio, M_FXBNDRY, fxbndry); | 447 | mga_writel(mmio, M_FXBNDRY, fxbndry); |
430 | mga_writel(mmio, M_AR0, ar0); | 448 | mga_writel(mmio, M_AR0, ar0); |
431 | mga_writel(mmio, M_AR3, 0); | 449 | mga_writel(mmio, M_AR3, 0); |
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index 11ed57bb704e..556d96ce40bf 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h | |||
@@ -307,6 +307,8 @@ struct matrox_accel_data { | |||
307 | #endif | 307 | #endif |
308 | u_int32_t m_dwg_rect; | 308 | u_int32_t m_dwg_rect; |
309 | u_int32_t m_opmode; | 309 | u_int32_t m_opmode; |
310 | u_int32_t m_access; | ||
311 | u_int32_t m_pitch; | ||
310 | }; | 312 | }; |
311 | 313 | ||
312 | struct v4l2_queryctrl; | 314 | struct v4l2_queryctrl; |