Skip to content

Commit

Permalink
drm/i915: fix off by one in VGA save/restore of AR & CR regs.
Browse files Browse the repository at this point in the history
turns out it's important to save/restore AR14 in particular.

Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Jesse Barnes authored and Dave Airlie committed May 7, 2008
1 parent f116cc5 commit a59e122
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions drivers/char/drm/i915_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static void i915_save_vga(struct drm_device *dev)
i915_write_indexed(cr_index, cr_data, 0x11,
i915_read_indexed(cr_index, cr_data, 0x11) &
(~0x80));
for (i = 0; i < 0x24; i++)
for (i = 0; i <= 0x24; i++)
dev_priv->saveCR[i] =
i915_read_indexed(cr_index, cr_data, i);
/* Make sure we don't turn off CR group 0 writes */
Expand All @@ -156,7 +156,7 @@ static void i915_save_vga(struct drm_device *dev)
/* Attribute controller registers */
inb(st01);
dev_priv->saveAR_INDEX = inb(VGA_AR_INDEX);
for (i = 0; i < 20; i++)
for (i = 0; i <= 0x14; i++)
dev_priv->saveAR[i] = i915_read_ar(st01, i, 0);
inb(st01);
outb(dev_priv->saveAR_INDEX, VGA_AR_INDEX);
Expand Down Expand Up @@ -206,7 +206,7 @@ static void i915_restore_vga(struct drm_device *dev)
/* CRT controller regs */
/* Enable CR group 0 writes */
i915_write_indexed(cr_index, cr_data, 0x11, dev_priv->saveCR[0x11]);
for (i = 0; i < 0x24; i++)
for (i = 0; i <= 0x24; i++)
i915_write_indexed(cr_index, cr_data, i, dev_priv->saveCR[i]);

/* Graphics controller regs */
Expand All @@ -223,7 +223,7 @@ static void i915_restore_vga(struct drm_device *dev)

/* Attribute controller registers */
inb(st01);
for (i = 0; i < 20; i++)
for (i = 0; i <= 0x14; i++)
i915_write_ar(st01, i, dev_priv->saveAR[i], 0);
inb(st01); /* switch back to index mode */
outb(dev_priv->saveAR_INDEX | 0x20, VGA_AR_INDEX);
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/drm/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ typedef struct drm_i915_private {
u8 saveSR[8];
u8 saveGR[25];
u8 saveAR_INDEX;
u8 saveAR[20];
u8 saveAR[21];
u8 saveDACMASK;
u8 saveDACDATA[256*3]; /* 256 3-byte colors */
u8 saveCR[36];
u8 saveCR[37];
} drm_i915_private_t;

extern struct drm_ioctl_desc i915_ioctls[];
Expand Down

0 comments on commit a59e122

Please sign in to comment.