revision 215:f432833e8303
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 215:f432833e8303 |
parent | 214:7a6501b74fbc |
child | 216:657ce4d3edd9 |
author | nkeynes |
date | Fri Aug 18 12:43:24 2006 +0000 (17 years ago) |
Implement pvr banking strategy wrt the polygon buffers
1.1 --- a/src/pvr2/rendcore.c Fri Aug 18 12:43:04 2006 +00001.2 +++ b/src/pvr2/rendcore.c Fri Aug 18 12:43:24 2006 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: rendcore.c,v 1.2 2006-08-02 06:24:08 nkeynes Exp $1.6 + * $Id: rendcore.c,v 1.3 2006-08-18 12:43:24 nkeynes Exp $1.7 *1.8 * PVR2 renderer core.1.9 *1.10 @@ -15,6 +15,7 @@1.11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1.12 * GNU General Public License for more details.1.13 */1.14 +#include <sys/time.h>1.15 #include "pvr2/pvr2.h"1.16 #include "asic.h"1.18 @@ -200,7 +201,7 @@1.19 * Render a simple (not auto-sorted) tile1.20 */1.21 void render_tile( pvraddr_t tile_entry, int render_mode, gboolean cheap_modifier_mode ) {1.22 -1.23 + uint32_t poly_bank = MMIO_READ(PVR2,RENDER_POLYBASE);1.24 uint32_t *tile_list = (uint32_t *)(video_base+tile_entry);1.25 do {1.26 uint32_t entry = *tile_list++;1.27 @@ -209,7 +210,7 @@1.28 } else if( entry >> 28 == 0x0E ) {1.29 tile_list = (uint32_t *)(video_base + (entry&0x007FFFFF));1.30 } else {1.31 - uint32_t *polygon = (uint32_t *)(video_base + ((entry & 0x001FFFFF) << 2));1.32 + uint32_t *polygon = (uint32_t *)(video_base + poly_bank + ((entry & 0x000FFFFF) << 2));1.33 int is_modified = entry & 0x01000000;1.34 int vertex_length = (entry >> 21) & 0x07;1.35 int context_length = 3;1.36 @@ -291,6 +292,9 @@1.38 struct tile_segment *segment = (struct tile_segment *)(video_base + segmentbase);1.40 + struct timeval tv_start, tv_end;1.41 + gettimeofday(&tv_start, NULL);1.42 + fprintf( stderr, "Start render at %d.%d\n", tv_start.tv_sec, tv_start.tv_usec );1.43 glEnable( GL_SCISSOR_TEST );1.44 while( (segment->control & SEGMENT_END) == 0 ) {1.45 int tilex = SEGMENT_X(segment->control);1.46 @@ -306,7 +310,7 @@1.47 segment++;1.48 continue;1.49 }1.50 -1.51 +1.52 /* Set a scissor on the visible part of the tile */1.53 int w = MIN(x1+32, clipx2) - x1;1.54 int h = MIN(y1+32, clipy2) - y1;1.55 @@ -336,6 +340,12 @@1.56 render_tile( segment->punchout_ptr, RENDER_NORMAL, cheap_shadow );1.57 }1.58 segment++;1.59 +1.60 }1.61 glDisable( GL_SCISSOR_TEST );1.62 +1.63 + gettimeofday(&tv_end, NULL);1.64 + timersub(&tv_end,&tv_start, &tv_start);1.65 + fprintf( stderr, "Frame took %d.%06ds\n", tv_start.tv_sec, tv_start.tv_usec );1.66 +1.67 }
2.1 --- a/src/pvr2/tacore.c Fri Aug 18 12:43:04 2006 +00002.2 +++ b/src/pvr2/tacore.c Fri Aug 18 12:43:24 2006 +00002.3 @@ -1,5 +1,5 @@2.4 /**2.5 - * $Id: tacore.c,v 1.8 2006-08-06 07:47:26 nkeynes Exp $2.6 + * $Id: tacore.c,v 1.9 2006-08-18 12:43:24 nkeynes Exp $2.7 *2.8 * PVR2 Tile Accelerator implementation2.9 *2.10 @@ -133,6 +133,7 @@2.11 int tilelist_dir; /* Growth direction of the tilelist, 0 = up, 1 = down */2.12 uint32_t tilelist_size; /* Size of the tilelist segments */2.13 uint32_t tilelist_start; /* Initial address of the tilelist */2.14 + int polybuf_start; /* Initial bank address of the polygon buffer (ie &0x00F00000) */2.15 int current_vertex_type;2.16 gboolean accept_vertexes;2.17 int vertex_count; /* index of last start-vertex seen, or -1 if no vertexes2.18 @@ -219,6 +220,7 @@2.19 }2.20 MMIO_WRITE( PVR2, TA_LISTPOS, plistpos );2.21 ta_status.tilelist_start = plistpos;2.22 + ta_status.polybuf_start = MMIO_READ( PVR2, TA_POLYBASE ) & 0x00F00000;2.23 }2.25 static uint32_t parse_float_colour( float a, float r, float g, float b ) {2.26 @@ -349,7 +351,9 @@2.27 // ta_status.state = STATE_ERROR;2.28 break;2.29 }2.30 - *target++ = *data++;2.31 + if( posn < PVR2_RAM_SIZE ) {2.32 + *target++ = *data++;2.33 + }2.34 posn += 4;2.35 }2.37 @@ -581,7 +585,8 @@2.38 }2.40 /* Ok, we're good to go - write out the polygon first */2.41 - uint32_t tile_entry = MMIO_READ( PVR2, TA_POLYPOS ) >> 2 | ta_status.poly_pointer;2.42 + uint32_t tile_entry = (MMIO_READ( PVR2, TA_POLYPOS ) - ta_status.polybuf_start) >> 2 |2.43 + ta_status.poly_pointer;2.45 int status = ta_write_polygon_buffer( poly_context, ta_status.poly_context_size );2.46 if( status == 0 ) {
.