diff options
author | Dave Airlie <airlied@linux.ie> | 2006-04-03 00:46:55 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2006-04-03 00:46:55 -0400 |
commit | 3587c50991b96fee2d26942f380e36e4f40fad71 (patch) | |
tree | 1266f26fa14b96e540a1388968a030edf264894d /drivers/video/intelfb | |
parent | 3aff13cfb8810cc228e8fdcb92103ed0b11ee38e (diff) |
intelfb: fixup pitch calculation like X does
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/video/intelfb')
-rw-r--r-- | drivers/video/intelfb/intelfbdrv.c | 17 | ||||
-rw-r--r-- | drivers/video/intelfb/intelfbhw.c | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index 9e83664e345c..2aba6a4a9eae 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c | |||
@@ -1164,16 +1164,33 @@ intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
1164 | struct fb_var_screeninfo v; | 1164 | struct fb_var_screeninfo v; |
1165 | struct intelfb_info *dinfo; | 1165 | struct intelfb_info *dinfo; |
1166 | static int first = 1; | 1166 | static int first = 1; |
1167 | int i; | ||
1168 | /* Good pitches to allow tiling. Don't care about pitches < 1024. */ | ||
1169 | static const int pitches[] = { | ||
1170 | 128 * 8, | ||
1171 | 128 * 16, | ||
1172 | 128 * 32, | ||
1173 | 128 * 64, | ||
1174 | 0 | ||
1175 | }; | ||
1167 | 1176 | ||
1168 | DBG_MSG("intelfb_check_var: accel_flags is %d\n", var->accel_flags); | 1177 | DBG_MSG("intelfb_check_var: accel_flags is %d\n", var->accel_flags); |
1169 | 1178 | ||
1170 | dinfo = GET_DINFO(info); | 1179 | dinfo = GET_DINFO(info); |
1171 | 1180 | ||
1181 | /* update the pitch */ | ||
1172 | if (intelfbhw_validate_mode(dinfo, var) != 0) | 1182 | if (intelfbhw_validate_mode(dinfo, var) != 0) |
1173 | return -EINVAL; | 1183 | return -EINVAL; |
1174 | 1184 | ||
1175 | v = *var; | 1185 | v = *var; |
1176 | 1186 | ||
1187 | for (i = 0; pitches[i] != 0; i++) { | ||
1188 | if (pitches[i] >= v.xres_virtual) { | ||
1189 | v.xres_virtual = pitches[i]; | ||
1190 | break; | ||
1191 | } | ||
1192 | } | ||
1193 | |||
1177 | /* Check for a supported bpp. */ | 1194 | /* Check for a supported bpp. */ |
1178 | if (v.bits_per_pixel <= 8) { | 1195 | if (v.bits_per_pixel <= 8) { |
1179 | v.bits_per_pixel = 8; | 1196 | v.bits_per_pixel = 8; |
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c index 2bcf249bdf22..4284c7554512 100644 --- a/drivers/video/intelfb/intelfbhw.c +++ b/drivers/video/intelfb/intelfbhw.c | |||
@@ -1210,7 +1210,7 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw, | |||
1210 | *ss = (hactive << SRC_SIZE_HORIZ_SHIFT) | | 1210 | *ss = (hactive << SRC_SIZE_HORIZ_SHIFT) | |
1211 | (vactive << SRC_SIZE_VERT_SHIFT); | 1211 | (vactive << SRC_SIZE_VERT_SHIFT); |
1212 | 1212 | ||
1213 | hw->disp_a_stride = var->xres_virtual * var->bits_per_pixel / 8; | 1213 | hw->disp_a_stride = dinfo->pitch; |
1214 | DBG_MSG("pitch is %d\n", hw->disp_a_stride); | 1214 | DBG_MSG("pitch is %d\n", hw->disp_a_stride); |
1215 | 1215 | ||
1216 | hw->disp_a_base = hw->disp_a_stride * var->yoffset + | 1216 | hw->disp_a_base = hw->disp_a_stride * var->yoffset + |