@@ -204,23 +204,26 @@ void mgag200_init_registers(struct mga_device *mdev)
204
204
void mgag200_set_mode_regs (struct mga_device * mdev , const struct drm_display_mode * mode ,
205
205
bool set_vidrst )
206
206
{
207
- unsigned int hdispend , hsyncstr , hsyncend , htotal ;
208
- unsigned int vdispend , vsyncstr , vsyncend , vtotal ;
207
+ unsigned int hdispend , hsyncstr , hsyncend , htotal , hblkstr , hblkend ;
208
+ unsigned int vdispend , vsyncstr , vsyncend , vtotal , vblkstr , vblkend ;
209
209
u8 misc , crtcext1 , crtcext2 , crtcext5 ;
210
210
211
211
hdispend = mode -> crtc_hdisplay / 8 - 1 ;
212
212
hsyncstr = mode -> crtc_hsync_start / 8 - 1 ;
213
213
hsyncend = mode -> crtc_hsync_end / 8 - 1 ;
214
214
htotal = mode -> crtc_htotal / 8 - 1 ;
215
-
216
215
/* Work around hardware quirk */
217
216
if ((htotal & 0x07 ) == 0x06 || (htotal & 0x07 ) == 0x04 )
218
217
htotal ++ ;
218
+ hblkstr = mode -> crtc_hblank_start / 8 - 1 ;
219
+ hblkend = htotal ;
219
220
220
221
vdispend = mode -> crtc_vdisplay - 1 ;
221
222
vsyncstr = mode -> crtc_vsync_start - 1 ;
222
223
vsyncend = mode -> crtc_vsync_end - 1 ;
223
224
vtotal = mode -> crtc_vtotal - 2 ;
225
+ vblkstr = mode -> crtc_vblank_start ;
226
+ vblkend = vtotal + 1 ;
224
227
225
228
misc = RREG8 (MGA_MISC_IN );
226
229
@@ -235,43 +238,43 @@ void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mod
235
238
misc &= ~MGAREG_MISC_VSYNCPOL ;
236
239
237
240
crtcext1 = (((htotal - 4 ) & 0x100 ) >> 8 ) |
238
- ((hdispend & 0x100 ) >> 7 ) |
241
+ ((hblkstr & 0x100 ) >> 7 ) |
239
242
((hsyncstr & 0x100 ) >> 6 ) |
240
- (htotal & 0x40 );
243
+ (hblkend & 0x40 );
241
244
if (set_vidrst )
242
245
crtcext1 |= MGAREG_CRTCEXT1_VRSTEN |
243
246
MGAREG_CRTCEXT1_HRSTEN ;
244
247
245
248
crtcext2 = ((vtotal & 0xc00 ) >> 10 ) |
246
249
((vdispend & 0x400 ) >> 8 ) |
247
- ((vdispend & 0xc00 ) >> 7 ) |
250
+ ((vblkstr & 0xc00 ) >> 7 ) |
248
251
((vsyncstr & 0xc00 ) >> 5 ) |
249
252
((vdispend & 0x400 ) >> 3 );
250
253
crtcext5 = 0x00 ;
251
254
252
255
WREG_CRT (0x00 , htotal - 4 );
253
256
WREG_CRT (0x01 , hdispend );
254
- WREG_CRT (0x02 , hdispend );
255
- WREG_CRT (0x03 , (htotal & 0x1f ) | 0x80 );
257
+ WREG_CRT (0x02 , hblkstr );
258
+ WREG_CRT (0x03 , (hblkend & 0x1f ) | 0x80 );
256
259
WREG_CRT (0x04 , hsyncstr );
257
- WREG_CRT (0x05 , ((htotal & 0x20 ) << 2 ) | (hsyncend & 0x1f ));
260
+ WREG_CRT (0x05 , ((hblkend & 0x20 ) << 2 ) | (hsyncend & 0x1f ));
258
261
WREG_CRT (0x06 , vtotal & 0xff );
259
262
WREG_CRT (0x07 , ((vtotal & 0x100 ) >> 8 ) |
260
263
((vdispend & 0x100 ) >> 7 ) |
261
264
((vsyncstr & 0x100 ) >> 6 ) |
262
- ((vdispend & 0x100 ) >> 5 ) |
265
+ ((vblkstr & 0x100 ) >> 5 ) |
263
266
((vdispend & 0x100 ) >> 4 ) | /* linecomp */
264
267
((vtotal & 0x200 ) >> 4 ) |
265
268
((vdispend & 0x200 ) >> 3 ) |
266
269
((vsyncstr & 0x200 ) >> 2 ));
267
- WREG_CRT (0x09 , ((vdispend & 0x200 ) >> 4 ) |
270
+ WREG_CRT (0x09 , ((vblkstr & 0x200 ) >> 4 ) |
268
271
((vdispend & 0x200 ) >> 3 ));
269
272
WREG_CRT (0x10 , vsyncstr & 0xff );
270
273
WREG_CRT (0x11 , (vsyncend & 0x0f ) | 0x20 );
271
274
WREG_CRT (0x12 , vdispend & 0xff );
272
275
WREG_CRT (0x14 , 0 );
273
- WREG_CRT (0x15 , vdispend & 0xff );
274
- WREG_CRT (0x16 , ( vtotal + 1 ) & 0xff );
276
+ WREG_CRT (0x15 , vblkstr & 0xff );
277
+ WREG_CRT (0x16 , vblkend & 0xff );
275
278
WREG_CRT (0x17 , 0xc3 );
276
279
WREG_CRT (0x18 , vdispend & 0xff );
277
280
0 commit comments