diff options
author | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2007-01-08 05:21:41 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2007-02-07 21:24:25 -0500 |
commit | 9b8d9d0e0181286c0608e6426da1eac45463ecd2 (patch) | |
tree | 4614fe9c303ba3c50b40f90b2bdc1923aa1996a6 /drivers/char/drm/via_verifier.c | |
parent | 689692e73ea4b95c9fa5d5913eade33147db2e5a (diff) |
via: allow for npot texture pitch alignment
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/via_verifier.c')
-rw-r--r-- | drivers/char/drm/via_verifier.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/char/drm/via_verifier.c b/drivers/char/drm/via_verifier.c index 24fc7cb6e7da..2e7e08078287 100644 --- a/drivers/char/drm/via_verifier.c +++ b/drivers/char/drm/via_verifier.c | |||
@@ -306,6 +306,7 @@ static __inline__ int finish_current_sequence(drm_via_state_t * cur_seq) | |||
306 | unsigned long lo = ~0, hi = 0, tmp; | 306 | unsigned long lo = ~0, hi = 0, tmp; |
307 | uint32_t *addr, *pitch, *height, tex; | 307 | uint32_t *addr, *pitch, *height, tex; |
308 | unsigned i; | 308 | unsigned i; |
309 | int npot; | ||
309 | 310 | ||
310 | if (end > 9) | 311 | if (end > 9) |
311 | end = 9; | 312 | end = 9; |
@@ -316,12 +317,15 @@ static __inline__ int finish_current_sequence(drm_via_state_t * cur_seq) | |||
316 | &(cur_seq->t_addr[tex = cur_seq->texture][start]); | 317 | &(cur_seq->t_addr[tex = cur_seq->texture][start]); |
317 | pitch = &(cur_seq->pitch[tex][start]); | 318 | pitch = &(cur_seq->pitch[tex][start]); |
318 | height = &(cur_seq->height[tex][start]); | 319 | height = &(cur_seq->height[tex][start]); |
319 | 320 | npot = cur_seq->tex_npot[tex]; | |
320 | for (i = start; i <= end; ++i) { | 321 | for (i = start; i <= end; ++i) { |
321 | tmp = *addr++; | 322 | tmp = *addr++; |
322 | if (tmp < lo) | 323 | if (tmp < lo) |
323 | lo = tmp; | 324 | lo = tmp; |
324 | tmp += (*height++ << *pitch++); | 325 | if (i == 0 && npot) |
326 | tmp += (*height++ * *pitch++); | ||
327 | else | ||
328 | tmp += (*height++ << *pitch++); | ||
325 | if (tmp > hi) | 329 | if (tmp > hi) |
326 | hi = tmp; | 330 | hi = tmp; |
327 | } | 331 | } |
@@ -443,13 +447,21 @@ investigate_hazard(uint32_t cmd, hazard_t hz, drm_via_state_t * cur_seq) | |||
443 | return 0; | 447 | return 0; |
444 | case check_texture_addr3: | 448 | case check_texture_addr3: |
445 | cur_seq->unfinished = tex_address; | 449 | cur_seq->unfinished = tex_address; |
446 | tmp = ((cmd >> 24) - 0x2B); | 450 | tmp = ((cmd >> 24) - HC_SubA_HTXnL0Pit); |
447 | cur_seq->pitch[cur_seq->texture][tmp] = | 451 | if (tmp == 0 && |
448 | (cmd & 0x00F00000) >> 20; | 452 | (cmd & HC_HTXnEnPit_MASK)) { |
449 | if (!tmp && (cmd & 0x000FFFFF)) { | 453 | cur_seq->pitch[cur_seq->texture][tmp] = |
450 | DRM_ERROR | 454 | (cmd & HC_HTXnLnPit_MASK); |
451 | ("Unimplemented texture level 0 pitch mode.\n"); | 455 | cur_seq->tex_npot[cur_seq->texture] = 1; |
452 | return 2; | 456 | } else { |
457 | cur_seq->pitch[cur_seq->texture][tmp] = | ||
458 | (cmd & HC_HTXnLnPitE_MASK) >> HC_HTXnLnPitE_SHIFT; | ||
459 | cur_seq->tex_npot[cur_seq->texture] = 0; | ||
460 | if (cmd & 0x000FFFFF) { | ||
461 | DRM_ERROR | ||
462 | ("Unimplemented texture level 0 pitch mode.\n"); | ||
463 | return 2; | ||
464 | } | ||
453 | } | 465 | } |
454 | return 0; | 466 | return 0; |
455 | case check_texture_addr4: | 467 | case check_texture_addr4: |