Commit a772d473 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Tomi Valkeinen

matroxfb: restore the registers M_ACCESS and M_PITCH

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: default avatarMikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent a2317e6a
...@@ -192,10 +192,18 @@ void matrox_cfbX_init(struct matrox_fb_info *minfo) ...@@ -192,10 +192,18 @@ void matrox_cfbX_init(struct matrox_fb_info *minfo)
minfo->accel.m_dwg_rect = M_DWG_TRAP | M_DWG_SOLID | M_DWG_ARZERO | M_DWG_SGNZERO | M_DWG_SHIFTZERO; minfo->accel.m_dwg_rect = M_DWG_TRAP | M_DWG_SOLID | M_DWG_ARZERO | M_DWG_SGNZERO | M_DWG_SHIFTZERO;
if (isMilleniumII(minfo)) minfo->accel.m_dwg_rect |= M_DWG_TRANSC; if (isMilleniumII(minfo)) minfo->accel.m_dwg_rect |= M_DWG_TRANSC;
minfo->accel.m_opmode = mopmode; minfo->accel.m_opmode = mopmode;
minfo->accel.m_access = maccess;
minfo->accel.m_pitch = mpitch;
} }
EXPORT_SYMBOL(matrox_cfbX_init); EXPORT_SYMBOL(matrox_cfbX_init);
static void matrox_accel_restore_maccess(struct matrox_fb_info *minfo)
{
mga_outl(M_MACCESS, minfo->accel.m_access);
mga_outl(M_PITCH, minfo->accel.m_pitch);
}
static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy,
int sx, int dy, int dx, int height, int width) int sx, int dy, int dx, int height, int width)
{ {
...@@ -207,7 +215,8 @@ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, ...@@ -207,7 +215,8 @@ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy,
CRITBEGIN CRITBEGIN
if ((dy < sy) || ((dy == sy) && (dx <= sx))) { if ((dy < sy) || ((dy == sy) && (dx <= sx))) {
mga_fifo(2); mga_fifo(4);
matrox_accel_restore_maccess(minfo);
mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO | mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO |
M_DWG_BFCOL | M_DWG_REPLACE); M_DWG_BFCOL | M_DWG_REPLACE);
mga_outl(M_AR5, vxres); mga_outl(M_AR5, vxres);
...@@ -215,7 +224,8 @@ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, ...@@ -215,7 +224,8 @@ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy,
start = sy*vxres+sx+curr_ydstorg(minfo); start = sy*vxres+sx+curr_ydstorg(minfo);
end = start+width; end = start+width;
} else { } else {
mga_fifo(3); mga_fifo(5);
matrox_accel_restore_maccess(minfo);
mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_BFCOL | M_DWG_REPLACE); mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_BFCOL | M_DWG_REPLACE);
mga_outl(M_SGN, 5); mga_outl(M_SGN, 5);
mga_outl(M_AR5, -vxres); mga_outl(M_AR5, -vxres);
...@@ -224,7 +234,8 @@ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, ...@@ -224,7 +234,8 @@ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy,
start = end+width; start = end+width;
dy += height-1; dy += height-1;
} }
mga_fifo(4); mga_fifo(6);
matrox_accel_restore_maccess(minfo);
mga_outl(M_AR0, end); mga_outl(M_AR0, end);
mga_outl(M_AR3, start); mga_outl(M_AR3, start);
mga_outl(M_FXBNDRY, ((dx+width)<<16) | dx); 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,7 +257,8 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres,
CRITBEGIN CRITBEGIN
if ((dy < sy) || ((dy == sy) && (dx <= sx))) { if ((dy < sy) || ((dy == sy) && (dx <= sx))) {
mga_fifo(2); mga_fifo(4);
matrox_accel_restore_maccess(minfo);
mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO | mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO |
M_DWG_BFCOL | M_DWG_REPLACE); M_DWG_BFCOL | M_DWG_REPLACE);
mga_outl(M_AR5, vxres); mga_outl(M_AR5, vxres);
...@@ -254,7 +266,8 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres, ...@@ -254,7 +266,8 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres,
start = sy*vxres+sx+curr_ydstorg(minfo); start = sy*vxres+sx+curr_ydstorg(minfo);
end = start+width; end = start+width;
} else { } else {
mga_fifo(3); mga_fifo(5);
matrox_accel_restore_maccess(minfo);
mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_BFCOL | M_DWG_REPLACE); mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_BFCOL | M_DWG_REPLACE);
mga_outl(M_SGN, 5); mga_outl(M_SGN, 5);
mga_outl(M_AR5, -vxres); mga_outl(M_AR5, -vxres);
...@@ -263,7 +276,8 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres, ...@@ -263,7 +276,8 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres,
start = end+width; start = end+width;
dy += height-1; dy += height-1;
} }
mga_fifo(5); mga_fifo(7);
matrox_accel_restore_maccess(minfo);
mga_outl(M_AR0, end); mga_outl(M_AR0, end);
mga_outl(M_AR3, start); mga_outl(M_AR3, start);
mga_outl(M_FXBNDRY, ((dx+width)<<16) | dx); 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,7 +312,8 @@ static void matroxfb_accel_clear(struct matrox_fb_info *minfo, u_int32_t color,
CRITBEGIN CRITBEGIN
mga_fifo(5); mga_fifo(7);
matrox_accel_restore_maccess(minfo);
mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE); mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE);
mga_outl(M_FCOL, color); mga_outl(M_FCOL, color);
mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx); 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,7 +356,8 @@ static void matroxfb_cfb4_clear(struct matrox_fb_info *minfo, u_int32_t bgx,
width >>= 1; width >>= 1;
sx >>= 1; sx >>= 1;
if (width) { if (width) {
mga_fifo(5); mga_fifo(7);
matrox_accel_restore_maccess(minfo);
mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE2); mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE2);
mga_outl(M_FCOL, bgx); mga_outl(M_FCOL, bgx);
mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx); 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,7 +431,8 @@ static void matroxfb_1bpp_imageblit(struct matrox_fb_info *minfo, u_int32_t fgx,
CRITBEGIN CRITBEGIN
mga_fifo(3); mga_fifo(5);
matrox_accel_restore_maccess(minfo);
if (easy) if (easy)
mga_outl(M_DWGCTL, M_DWG_ILOAD | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_LINEAR | M_DWG_REPLACE); mga_outl(M_DWGCTL, M_DWG_ILOAD | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_LINEAR | M_DWG_REPLACE);
else else
...@@ -425,7 +442,8 @@ static void matroxfb_1bpp_imageblit(struct matrox_fb_info *minfo, u_int32_t fgx, ...@@ -425,7 +442,8 @@ static void matroxfb_1bpp_imageblit(struct matrox_fb_info *minfo, u_int32_t fgx,
fxbndry = ((xx + width - 1) << 16) | xx; fxbndry = ((xx + width - 1) << 16) | xx;
mmio = minfo->mmio.vbase; mmio = minfo->mmio.vbase;
mga_fifo(6); mga_fifo(8);
matrox_accel_restore_maccess(minfo);
mga_writel(mmio, M_FXBNDRY, fxbndry); mga_writel(mmio, M_FXBNDRY, fxbndry);
mga_writel(mmio, M_AR0, ar0); mga_writel(mmio, M_AR0, ar0);
mga_writel(mmio, M_AR3, 0); mga_writel(mmio, M_AR3, 0);
......
...@@ -307,6 +307,8 @@ struct matrox_accel_data { ...@@ -307,6 +307,8 @@ struct matrox_accel_data {
#endif #endif
u_int32_t m_dwg_rect; u_int32_t m_dwg_rect;
u_int32_t m_opmode; u_int32_t m_opmode;
u_int32_t m_access;
u_int32_t m_pitch;
}; };
struct v4l2_queryctrl; struct v4l2_queryctrl;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment