Search
lxdream.org :: lxdream :: r100:995e42e96cc9
lxdream 0.9.1
released Jun 29
Download Now
changeset100:995e42e96cc9
parent99:78cbd52afb8d
child101:5a22f3699b67
authornkeynes
dateWed Feb 15 13:11:50 2006 +0000 (13 years ago)
Split pvr2.c out to separate files for TA and renderer, minor renames
change pvrdma to use mem_copy_to_sh4
src/Makefile.am
src/Makefile.in
src/asic.c
src/pvr2/pvr2.c
src/pvr2/pvr2.h
src/pvr2/render.c
src/pvr2/ta.c
src/sh4/sh4mem.c
1.1 --- a/src/Makefile.am Wed Feb 15 12:41:02 2006 +0000
1.2 +++ b/src/Makefile.am Wed Feb 15 13:11:50 2006 +0000
1.3 @@ -21,6 +21,7 @@
1.4 aica/armcore.c aica/armcore.h aica/armdasm.c aica/armmem.c \
1.5 aica/aica.c aica/aica.h aica/audio.c aica/audio.h \
1.6 pvr2/pvr2.c pvr2/pvr2.h \
1.7 + pvr2/ta.c pvr2/render.c \
1.8 maple/maple.c maple/maple.h \
1.9 maple/controller.c maple/controller.h \
1.10 gui/support.c gui/support.h \
2.1 --- a/src/Makefile.in Wed Feb 15 12:41:02 2006 +0000
2.2 +++ b/src/Makefile.in Wed Feb 15 13:11:50 2006 +0000
2.3 @@ -148,6 +148,7 @@
2.4 aica/armcore.c aica/armcore.h aica/armdasm.c aica/armmem.c \
2.5 aica/aica.c aica/aica.h aica/audio.c aica/audio.h \
2.6 pvr2/pvr2.c pvr2/pvr2.h \
2.7 + pvr2/ta.c pvr2/render.c \
2.8 maple/maple.c maple/maple.h \
2.9 maple/controller.c maple/controller.h \
2.10 gui/support.c gui/support.h \
2.11 @@ -179,12 +180,13 @@
2.12 sh4core.$(OBJEXT) sh4dasm.$(OBJEXT) sh4mmio.$(OBJEXT) \
2.13 scif.$(OBJEXT) armcore.$(OBJEXT) armdasm.$(OBJEXT) \
2.14 armmem.$(OBJEXT) aica.$(OBJEXT) audio.$(OBJEXT) pvr2.$(OBJEXT) \
2.15 - maple.$(OBJEXT) controller.$(OBJEXT) support.$(OBJEXT) \
2.16 - interface.$(OBJEXT) callbacks.$(OBJEXT) gui.$(OBJEXT) \
2.17 - mmr_win.$(OBJEXT) debug_win.$(OBJEXT) dump_win.$(OBJEXT) \
2.18 - loader.$(OBJEXT) bootstrap.$(OBJEXT) util.$(OBJEXT) \
2.19 - audio_null.$(OBJEXT) audio_esd.$(OBJEXT) video_gtk.$(OBJEXT) \
2.20 - video_x11.$(OBJEXT) gl_glx.$(OBJEXT)
2.21 + ta.$(OBJEXT) render.$(OBJEXT) maple.$(OBJEXT) \
2.22 + controller.$(OBJEXT) support.$(OBJEXT) interface.$(OBJEXT) \
2.23 + callbacks.$(OBJEXT) gui.$(OBJEXT) mmr_win.$(OBJEXT) \
2.24 + debug_win.$(OBJEXT) dump_win.$(OBJEXT) loader.$(OBJEXT) \
2.25 + bootstrap.$(OBJEXT) util.$(OBJEXT) audio_null.$(OBJEXT) \
2.26 + audio_esd.$(OBJEXT) video_gtk.$(OBJEXT) video_x11.$(OBJEXT) \
2.27 + gl_glx.$(OBJEXT)
2.28 dream_OBJECTS = $(am_dream_OBJECTS)
2.29 dream_DEPENDENCIES =
2.30 dream_LDFLAGS =
2.31 @@ -205,10 +207,11 @@
2.32 @AMDEP_TRUE@ ./$(DEPDIR)/interface.Po ./$(DEPDIR)/loader.Po \
2.33 @AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/maple.Po \
2.34 @AMDEP_TRUE@ ./$(DEPDIR)/mem.Po ./$(DEPDIR)/mmr_win.Po \
2.35 -@AMDEP_TRUE@ ./$(DEPDIR)/pvr2.Po ./$(DEPDIR)/scif.Po \
2.36 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4core.Po ./$(DEPDIR)/sh4dasm.Po \
2.37 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4mem.Po ./$(DEPDIR)/sh4mmio.Po \
2.38 -@AMDEP_TRUE@ ./$(DEPDIR)/support.Po ./$(DEPDIR)/timer.Po \
2.39 +@AMDEP_TRUE@ ./$(DEPDIR)/pvr2.Po ./$(DEPDIR)/render.Po \
2.40 +@AMDEP_TRUE@ ./$(DEPDIR)/scif.Po ./$(DEPDIR)/sh4core.Po \
2.41 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4dasm.Po ./$(DEPDIR)/sh4mem.Po \
2.42 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4mmio.Po ./$(DEPDIR)/support.Po \
2.43 +@AMDEP_TRUE@ ./$(DEPDIR)/ta.Po ./$(DEPDIR)/timer.Po \
2.44 @AMDEP_TRUE@ ./$(DEPDIR)/util.Po ./$(DEPDIR)/video_gtk.Po \
2.45 @AMDEP_TRUE@ ./$(DEPDIR)/video_x11.Po ./$(DEPDIR)/watch.Po
2.46 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
2.47 @@ -289,12 +292,14 @@
2.48 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Po@am__quote@
2.49 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmr_win.Po@am__quote@
2.50 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvr2.Po@am__quote@
2.51 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/render.Po@am__quote@
2.52 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scif.Po@am__quote@
2.53 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh4core.Po@am__quote@
2.54 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh4dasm.Po@am__quote@
2.55 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh4mem.Po@am__quote@
2.56 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh4mmio.Po@am__quote@
2.57 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/support.Po@am__quote@
2.58 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ta.Po@am__quote@
2.59 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Po@am__quote@
2.60 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
2.61 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/video_gtk.Po@am__quote@
2.62 @@ -653,6 +658,50 @@
2.63 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.64 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pvr2.obj `if test -f 'pvr2/pvr2.c'; then $(CYGPATH_W) 'pvr2/pvr2.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/pvr2.c'; fi`
2.65
2.66 +ta.o: pvr2/ta.c
2.67 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ta.o -MD -MP -MF "$(DEPDIR)/ta.Tpo" \
2.68 +@am__fastdepCC_TRUE@ -c -o ta.o `test -f 'pvr2/ta.c' || echo '$(srcdir)/'`pvr2/ta.c; \
2.69 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ta.Tpo" "$(DEPDIR)/ta.Po"; \
2.70 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/ta.Tpo"; exit 1; \
2.71 +@am__fastdepCC_TRUE@ fi
2.72 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/ta.c' object='ta.o' libtool=no @AMDEPBACKSLASH@
2.73 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ta.Po' tmpdepfile='$(DEPDIR)/ta.TPo' @AMDEPBACKSLASH@
2.74 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.75 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ta.o `test -f 'pvr2/ta.c' || echo '$(srcdir)/'`pvr2/ta.c
2.76 +
2.77 +ta.obj: pvr2/ta.c
2.78 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ta.obj -MD -MP -MF "$(DEPDIR)/ta.Tpo" \
2.79 +@am__fastdepCC_TRUE@ -c -o ta.obj `if test -f 'pvr2/ta.c'; then $(CYGPATH_W) 'pvr2/ta.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/ta.c'; fi`; \
2.80 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ta.Tpo" "$(DEPDIR)/ta.Po"; \
2.81 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/ta.Tpo"; exit 1; \
2.82 +@am__fastdepCC_TRUE@ fi
2.83 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/ta.c' object='ta.obj' libtool=no @AMDEPBACKSLASH@
2.84 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ta.Po' tmpdepfile='$(DEPDIR)/ta.TPo' @AMDEPBACKSLASH@
2.85 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.86 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ta.obj `if test -f 'pvr2/ta.c'; then $(CYGPATH_W) 'pvr2/ta.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/ta.c'; fi`
2.87 +
2.88 +render.o: pvr2/render.c
2.89 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT render.o -MD -MP -MF "$(DEPDIR)/render.Tpo" \
2.90 +@am__fastdepCC_TRUE@ -c -o render.o `test -f 'pvr2/render.c' || echo '$(srcdir)/'`pvr2/render.c; \
2.91 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/render.Tpo" "$(DEPDIR)/render.Po"; \
2.92 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/render.Tpo"; exit 1; \
2.93 +@am__fastdepCC_TRUE@ fi
2.94 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/render.c' object='render.o' libtool=no @AMDEPBACKSLASH@
2.95 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/render.Po' tmpdepfile='$(DEPDIR)/render.TPo' @AMDEPBACKSLASH@
2.96 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.97 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o render.o `test -f 'pvr2/render.c' || echo '$(srcdir)/'`pvr2/render.c
2.98 +
2.99 +render.obj: pvr2/render.c
2.100 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT render.obj -MD -MP -MF "$(DEPDIR)/render.Tpo" \
2.101 +@am__fastdepCC_TRUE@ -c -o render.obj `if test -f 'pvr2/render.c'; then $(CYGPATH_W) 'pvr2/render.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/render.c'; fi`; \
2.102 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/render.Tpo" "$(DEPDIR)/render.Po"; \
2.103 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/render.Tpo"; exit 1; \
2.104 +@am__fastdepCC_TRUE@ fi
2.105 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/render.c' object='render.obj' libtool=no @AMDEPBACKSLASH@
2.106 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/render.Po' tmpdepfile='$(DEPDIR)/render.TPo' @AMDEPBACKSLASH@
2.107 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.108 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o render.obj `if test -f 'pvr2/render.c'; then $(CYGPATH_W) 'pvr2/render.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/render.c'; fi`
2.109 +
2.110 maple.o: maple/maple.c
2.111 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT maple.o -MD -MP -MF "$(DEPDIR)/maple.Tpo" \
2.112 @am__fastdepCC_TRUE@ -c -o maple.o `test -f 'maple/maple.c' || echo '$(srcdir)/'`maple/maple.c; \
3.1 --- a/src/asic.c Wed Feb 15 12:41:02 2006 +0000
3.2 +++ b/src/asic.c Wed Feb 15 13:11:50 2006 +0000
3.3 @@ -1,5 +1,5 @@
3.4 /**
3.5 - * $Id: asic.c,v 1.11 2006-02-05 04:05:27 nkeynes Exp $
3.6 + * $Id: asic.c,v 1.12 2006-02-15 13:11:42 nkeynes Exp $
3.7 *
3.8 * Support for the miscellaneous ASIC functions (Primarily event multiplexing,
3.9 * and DMA).
3.10 @@ -83,9 +83,7 @@
3.11 uint32_t rcount = DMAC_get_buffer( 2, data, count );
3.12 if( rcount != count )
3.13 WARN( "PVR received %08X bytes from DMA, expected %08X", rcount, count );
3.14 - if( (dest_addr &0xF0000000) == 0x10000000 ) { /* TA */
3.15 - pvr2ta_write( data, rcount );
3.16 - }
3.17 + mem_copy_to_sh4( dest_addr, data, rcount );
3.18 asic_event( EVENT_PVR_DMA );
3.19 }
3.20 break;
4.1 --- a/src/pvr2/pvr2.c Wed Feb 15 12:41:02 2006 +0000
4.2 +++ b/src/pvr2/pvr2.c Wed Feb 15 13:11:50 2006 +0000
4.3 @@ -1,7 +1,7 @@
4.4 /**
4.5 - * $Id: pvr2.c,v 1.15 2006-02-15 12:40:20 nkeynes Exp $
4.6 + * $Id: pvr2.c,v 1.16 2006-02-15 13:11:46 nkeynes Exp $
4.7 *
4.8 - * PVR2 (Video) MMIO and supporting functions.
4.9 + * PVR2 (Video) Core MMIO registers.
4.10 *
4.11 * Copyright (c) 2005 Nathan Keynes.
4.12 *
4.13 @@ -107,7 +107,7 @@
4.14 buffer->colour_format );
4.15 }
4.16 if( MMIO_READ( PVR2, VIDCFG2 ) & 0x08 ) { /* Blanked */
4.17 - uint32_t colour = MMIO_READ( PVR2, BORDERCOL );
4.18 + uint32_t colour = MMIO_READ( PVR2, DISPBORDER );
4.19 video_driver->display_blank_frame( colour );
4.20 } else {
4.21 video_driver->display_frame( buffer );
4.22 @@ -135,6 +135,10 @@
4.23 MMIO_REGID(PVR2,reg), MMIO_REGDESC(PVR2,reg) );
4.24
4.25 switch(reg) {
4.26 + case TAINIT:
4.27 + if( val & 0x80000000 )
4.28 + pvr2_ta_init();
4.29 + break;
4.30 case RENDSTART:
4.31 if( val == 0xFFFFFFFF )
4.32 pvr2_render_scene();
4.33 @@ -161,84 +165,17 @@
4.34 }
4.35
4.36
4.37 -void pvr2_render_scene( void )
4.38 -{
4.39 - /* Actual rendering goes here :) */
4.40 - asic_event( EVENT_PVR_RENDER_DONE );
4.41 - DEBUG( "Rendered frame %d", pvr2_frame_counter );
4.42 -}
4.43
4.44 -/** Tile Accelerator */
4.45 -
4.46 -struct tacmd {
4.47 - uint32_t command;
4.48 - uint32_t param1;
4.49 - uint32_t param2;
4.50 - uint32_t texture;
4.51 - float alpha;
4.52 - float red;
4.53 - float green;
4.54 - float blue;
4.55 -};
4.56 -
4.57 -struct vertex_type1 {
4.58 - uint32_t command;
4.59 - float x, y, z;
4.60 - uint32_t blank, blank2;
4.61 - uint32_t col;
4.62 - float f;
4.63 -};
4.64
4.65 int32_t mmio_region_PVR2TA_read( uint32_t reg )
4.66 {
4.67 return 0xFFFFFFFF;
4.68 }
4.69
4.70 -char pvr2ta_remainder[8];
4.71 -
4.72 void mmio_region_PVR2TA_write( uint32_t reg, uint32_t val )
4.73 {
4.74 - DEBUG( "Direct write to TA %08X", val );
4.75 + pvr2_ta_write( &val, sizeof(uint32_t) );
4.76 }
4.77
4.78 -unsigned int pvr2_last_poly_type = 0;
4.79
4.80 -void pvr2ta_write( char *buf, uint32_t length )
4.81 -{
4.82 - int i;
4.83 - struct tacmd *cmd_list = (struct tacmd *)buf;
4.84 - int count = length >> 5;
4.85 - for( i=0; i<count; i++ ){
4.86 - unsigned int type = (cmd_list[i].command >> 24) & 0xFF;
4.87 - if( type == 0xE0 || type == 0xF0 ) {
4.88 - struct vertex_type1 *vert = (struct vertex_type1 *)&cmd_list[i];
4.89 - DEBUG( "PVR2 vrt: %f %f %f %08X %08X %08X %f", vert->x, vert->y, vert->z, vert->blank, vert->blank2, vert->col, vert->f );
4.90 - } else {
4.91 - DEBUG( "PVR2 cmd: %08X %08X %08X %08X %08X %08X %08X %08X", cmd_list[i].command, cmd_list[i].param1, cmd_list[i].param2, cmd_list[i].texture, cmd_list[i].alpha, cmd_list[i].red, cmd_list[i].green, cmd_list[i].blue );
4.92 - }
4.93 - if( type == 0 ) {
4.94 - /* End of list */
4.95 - switch( pvr2_last_poly_type ) {
4.96 - case 0x80: /* Opaque polys */
4.97 - asic_event( EVENT_PVR_OPAQUE_DONE );
4.98 - break;
4.99 - case 0x81: /* Opaque poly modifier */
4.100 - asic_event( EVENT_PVR_OPAQUEMOD_DONE );
4.101 - break;
4.102 - case 0x82: /* Transparent polys */
4.103 - asic_event( EVENT_PVR_TRANS_DONE );
4.104 - break;
4.105 - case 0x83: /* Transparent poly modifier */
4.106 - asic_event( EVENT_PVR_TRANSMOD_DONE );
4.107 - break;
4.108 - case 0x84: /* Punchthrough */
4.109 - asic_event( EVENT_PVR_PUNCHOUT_DONE );
4.110 - break;
4.111 - }
4.112 - pvr2_last_poly_type = 0;
4.113 - } else if( type >= 0x80 && type <= 0x84 ) {
4.114 - pvr2_last_poly_type = type;
4.115 - }
4.116 - }
4.117 -}
4.118
5.1 --- a/src/pvr2/pvr2.h Wed Feb 15 12:41:02 2006 +0000
5.2 +++ b/src/pvr2/pvr2.h Wed Feb 15 13:11:50 2006 +0000
5.3 @@ -1,5 +1,5 @@
5.4 /**
5.5 - * $Id: pvr2.h,v 1.7 2006-02-05 04:05:27 nkeynes Exp $
5.6 + * $Id: pvr2.h,v 1.8 2006-02-15 13:11:46 nkeynes Exp $
5.7 *
5.8 * PVR2 (video chip) MMIO registers and functions.
5.9 *
5.10 @@ -25,7 +25,7 @@
5.11 LONG_PORT( 0x014, RENDSTART, PORT_W, 0, "Start render" )
5.12 LONG_PORT( 0x020, OBJBASE, PORT_MRW, 0, "Object buffer base offset" )
5.13 LONG_PORT( 0x02C, TILEBASE, PORT_MRW, 0, "Tile buffer base offset" )
5.14 - LONG_PORT( 0x040, BORDERCOL, PORT_MRW, 0, "Border Colour (RGB)" )
5.15 + LONG_PORT( 0x040, DISPBORDER, PORT_MRW, 0, "Border Colour (RGB)" )
5.16 LONG_PORT( 0x044, DISPMODE, PORT_MRW, 0, "Display Mode" )
5.17 LONG_PORT( 0x048, RENDMODE, PORT_MRW, 0, "Rendering Mode" )
5.18 LONG_PORT( 0x04C, RENDSIZE, PORT_MRW, 0, "Rendering width (bytes/2)" )
5.19 @@ -110,4 +110,8 @@
5.20 * Process the data in the supplied buffer as an array of TA command lists.
5.21 * Any excess bytes are held pending until a complete list is sent
5.22 */
5.23 -void pvr2ta_write( char *buf, uint32_t length );
5.24 +void pvr2_ta_write( char *buf, uint32_t length );
5.25 +
5.26 +void pvr2_init( void );
5.27 +
5.28 +void pvr2_render_scene( void );
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/src/pvr2/render.c Wed Feb 15 13:11:50 2006 +0000
6.3 @@ -0,0 +1,37 @@
6.4 +/**
6.5 + * $Id: render.c,v 1.1 2006-02-15 13:11:46 nkeynes Exp $
6.6 + *
6.7 + * PVR2 Renderer support. This is where the real work happens.
6.8 + *
6.9 + * Copyright (c) 2005 Nathan Keynes.
6.10 + *
6.11 + * This program is free software; you can redistribute it and/or modify
6.12 + * it under the terms of the GNU General Public License as published by
6.13 + * the Free Software Foundation; either version 2 of the License, or
6.14 + * (at your option) any later version.
6.15 + *
6.16 + * This program is distributed in the hope that it will be useful,
6.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.19 + * GNU General Public License for more details.
6.20 + */
6.21 +
6.22 +#include "pvr2/pvr2.h"
6.23 +#include "asic.h"
6.24 +#include "dream.h"
6.25 +
6.26 +extern uint32_t pvr2_frame_counter;
6.27 +
6.28 +/**
6.29 + * Render a complete scene into an OpenGL buffer.
6.30 + * Note: this may need to be broken up eventually once timings are
6.31 + * determined.
6.32 + */
6.33 +void pvr2_render_scene( void )
6.34 +{
6.35 + /* Actual rendering goes here :) */
6.36 +
6.37 + /* End of render event */
6.38 + asic_event( EVENT_PVR_RENDER_DONE );
6.39 + DEBUG( "Rendered frame %d", pvr2_frame_counter );
6.40 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/src/pvr2/ta.c Wed Feb 15 13:11:50 2006 +0000
7.3 @@ -0,0 +1,99 @@
7.4 +/**
7.5 + * $Id: ta.c,v 1.1 2006-02-15 13:11:46 nkeynes Exp $
7.6 + *
7.7 + * PVR2 Tile Accelerator support. In principle this does a lot more work
7.8 + * than is currently implemented - we cheat. A lot.
7.9 + *
7.10 + * Copyright (c) 2005 Nathan Keynes.
7.11 + *
7.12 + * This program is free software; you can redistribute it and/or modify
7.13 + * it under the terms of the GNU General Public License as published by
7.14 + * the Free Software Foundation; either version 2 of the License, or
7.15 + * (at your option) any later version.
7.16 + *
7.17 + * This program is distributed in the hope that it will be useful,
7.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7.20 + * GNU General Public License for more details.
7.21 + */
7.22 +
7.23 +#include "pvr2/pvr2.h"
7.24 +#include "asic.h"
7.25 +#include "dream.h"
7.26 +
7.27 +/** Tile Accelerator */
7.28 +
7.29 +struct tacmd {
7.30 + uint32_t command;
7.31 + uint32_t param1;
7.32 + uint32_t param2;
7.33 + uint32_t texture;
7.34 + float alpha;
7.35 + float red;
7.36 + float green;
7.37 + float blue;
7.38 +};
7.39 +
7.40 +struct vertex_type1 {
7.41 + uint32_t command;
7.42 + float x, y, z;
7.43 + uint32_t blank, blank2;
7.44 + uint32_t col;
7.45 + float f;
7.46 +};
7.47 +
7.48 +/**
7.49 + * (Re)initialize the tile accelerator in preparation for the next scene.
7.50 + * Normally called immediately before commencing polygon transmission.
7.51 + */
7.52 +void pvr2_ta_init( void )
7.53 +{
7.54 +
7.55 +}
7.56 +
7.57 +char pvr2ta_remainder[8];
7.58 +unsigned int pvr2_last_poly_type = 0;
7.59 +
7.60 +/**
7.61 + * Write a block of data to the tile accelerator, adding the data to the
7.62 + * current scene. We don't make any particular attempt to interpret the data
7.63 + * at this stage, deferring that until render time.
7.64 + */
7.65 +void pvr2_ta_write( char *buf, uint32_t length )
7.66 +{
7.67 + int i;
7.68 + struct tacmd *cmd_list = (struct tacmd *)buf;
7.69 + int count = length >> 5;
7.70 + for( i=0; i<count; i++ ){
7.71 + unsigned int type = (cmd_list[i].command >> 24) & 0xFF;
7.72 + if( type == 0xE0 || type == 0xF0 ) {
7.73 + struct vertex_type1 *vert = (struct vertex_type1 *)&cmd_list[i];
7.74 + DEBUG( "PVR2 vrt: %f %f %f %08X %08X %08X %f", vert->x, vert->y, vert->z, vert->blank, vert->blank2, vert->col, vert->f );
7.75 + } else {
7.76 + DEBUG( "PVR2 cmd: %08X %08X %08X %08X %08X %08X %08X %08X", cmd_list[i].command, cmd_list[i].param1, cmd_list[i].param2, cmd_list[i].texture, cmd_list[i].alpha, cmd_list[i].red, cmd_list[i].green, cmd_list[i].blue );
7.77 + }
7.78 + if( type == 0 ) {
7.79 + /* End of list */
7.80 + switch( pvr2_last_poly_type ) {
7.81 + case 0x80: /* Opaque polys */
7.82 + asic_event( EVENT_PVR_OPAQUE_DONE );
7.83 + break;
7.84 + case 0x81: /* Opaque poly modifier */
7.85 + asic_event( EVENT_PVR_OPAQUEMOD_DONE );
7.86 + break;
7.87 + case 0x82: /* Transparent polys */
7.88 + asic_event( EVENT_PVR_TRANS_DONE );
7.89 + break;
7.90 + case 0x83: /* Transparent poly modifier */
7.91 + asic_event( EVENT_PVR_TRANSMOD_DONE );
7.92 + break;
7.93 + case 0x84: /* Punchthrough */
7.94 + asic_event( EVENT_PVR_PUNCHOUT_DONE );
7.95 + break;
7.96 + }
7.97 + pvr2_last_poly_type = 0;
7.98 + } else if( type >= 0x80 && type <= 0x84 ) {
7.99 + pvr2_last_poly_type = type;
7.100 + }
7.101 + }
7.102 +}
8.1 --- a/src/sh4/sh4mem.c Wed Feb 15 12:41:02 2006 +0000
8.2 +++ b/src/sh4/sh4mem.c Wed Feb 15 13:11:50 2006 +0000
8.3 @@ -1,5 +1,5 @@
8.4 /**
8.5 - * $Id: sh4mem.c,v 1.6 2006-01-22 22:42:53 nkeynes Exp $
8.6 + * $Id: sh4mem.c,v 1.7 2006-02-15 13:11:50 nkeynes Exp $
8.7 * sh4mem.c is responsible for the SH4's access to memory (including memory
8.8 * mapped I/O), using the page maps created in mem.c
8.9 *
8.10 @@ -26,6 +26,7 @@
8.11 #include "sh4core.h"
8.12 #include "sh4mmio.h"
8.13 #include "dreamcast.h"
8.14 +#include "pvr2/pvr2.h"
8.15
8.16 #define OC_BASE 0x1C000000
8.17 #define OC_TOP 0x20000000
8.18 @@ -320,7 +321,7 @@
8.19
8.20 void mem_copy_to_sh4( uint32_t destaddr, char *src, size_t count ) {
8.21 if( destaddr >= 0x10000000 && destaddr < 0x20000000 ) {
8.22 - pvr2ta_write( src, count );
8.23 + pvr2_ta_write( src, count );
8.24 } else if( destaddr >= 04000000 && destaddr < 0x5000000 ) {
8.25 /* 64-bit video write. Oh. Yuck */
8.26 uint32_t *dest32[2];
.