aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-12-27 19:38:33 +0100
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-12-27 19:38:33 +0100
commit2980ec22a165bc71add7464e28a2e56b5c971d20 (patch)
tree49923e9a4e40b4a0f2e1e28dbbf411463f5468a9
parent975136d6e5adc6b6a03719499cf39fbd3f67dc90 (diff)
Allow for non-power-of-two texture pitch alignment.
-rw-r--r--shared-core/via_drm.h6
-rw-r--r--shared-core/via_verifier.c30
-rw-r--r--shared-core/via_verifier.h1
3 files changed, 25 insertions, 12 deletions
diff --git a/shared-core/via_drm.h b/shared-core/via_drm.h
index ee92ff69..16421d74 100644
--- a/shared-core/via_drm.h
+++ b/shared-core/via_drm.h
@@ -42,11 +42,11 @@
* backwards incompatibilities, (which should be avoided whenever possible).
*/
-#define VIA_DRM_DRIVER_DATE "20060616"
+#define VIA_DRM_DRIVER_DATE "20061227"
#define VIA_DRM_DRIVER_MAJOR 2
-#define VIA_DRM_DRIVER_MINOR 10
-#define VIA_DRM_DRIVER_PATCHLEVEL 2
+#define VIA_DRM_DRIVER_MINOR 11
+#define VIA_DRM_DRIVER_PATCHLEVEL 0
#define VIA_DRM_DRIVER_VERSION (((VIA_DRM_DRIVER_MAJOR) << 16) | (VIA_DRM_DRIVER_MINOR))
#define VIA_NR_SAREA_CLIPRECTS 8
diff --git a/shared-core/via_verifier.c b/shared-core/via_verifier.c
index 1a5edd4f..c9723fe1 100644
--- a/shared-core/via_verifier.c
+++ b/shared-core/via_verifier.c
@@ -311,6 +311,7 @@ static __inline__ int finish_current_sequence(drm_via_state_t * cur_seq)
unsigned long lo = ~0, hi = 0, tmp;
uint32_t *addr, *pitch, *height, tex;
unsigned i;
+ int npot;
if (end > 9)
end = 9;
@@ -321,12 +322,15 @@ static __inline__ int finish_current_sequence(drm_via_state_t * cur_seq)
&(cur_seq->t_addr[tex = cur_seq->texture][start]);
pitch = &(cur_seq->pitch[tex][start]);
height = &(cur_seq->height[tex][start]);
-
+ npot = cur_seq->tex_npot[tex];
for (i = start; i <= end; ++i) {
tmp = *addr++;
if (tmp < lo)
lo = tmp;
- tmp += (*height++ << *pitch++);
+ if (i == 0 && npot)
+ tmp += (*height++ * *pitch++);
+ else
+ tmp += (*height++ << *pitch++);
if (tmp > hi)
hi = tmp;
}
@@ -448,13 +452,21 @@ investigate_hazard(uint32_t cmd, hazard_t hz, drm_via_state_t * cur_seq)
return 0;
case check_texture_addr3:
cur_seq->unfinished = tex_address;
- tmp = ((cmd >> 24) - 0x2B);
- cur_seq->pitch[cur_seq->texture][tmp] =
- (cmd & 0x00F00000) >> 20;
- if (!tmp && (cmd & 0x000FFFFF)) {
- DRM_ERROR
- ("Unimplemented texture level 0 pitch mode.\n");
- return 2;
+ tmp = ((cmd >> 24) - HC_SubA_HTXnL0Pit);
+ if (tmp == 0 &&
+ cmd & HC_HTXnEnPit_MASK) {
+ cur_seq->pitch[cur_seq->texture][tmp] =
+ (cmd & HC_HTXnLnPit_MASK);
+ cur_seq->tex_npot[cur_seq->texture] = 1;
+ } else {
+ cur_seq->pitch[cur_seq->texture][tmp] =
+ (cmd & HC_HTXnLnPitE_MASK) >> HC_HTXnLnPitE_SHIFT;
+ cur_seq->tex_npot[cur_seq->texture] = 0;
+ if (cmd & 0x000FFFFF) {
+ DRM_ERROR
+ ("Unimplemented texture level 0 pitch mode.\n");
+ return 2;
+ }
}
return 0;
case check_texture_addr4:
diff --git a/shared-core/via_verifier.h b/shared-core/via_verifier.h
index 96708a39..84497c44 100644
--- a/shared-core/via_verifier.h
+++ b/shared-core/via_verifier.h
@@ -45,6 +45,7 @@ typedef struct {
uint32_t tex_level_lo[2];
uint32_t tex_level_hi[2];
uint32_t tex_palette_size[2];
+ uint32_t tex_npot[2];
drm_via_sequence_t unfinished;
int agp_texture;
int multitex;