grdp.s 3.77 KB

/**************************************************************************
 *								          *
 *               Copyright (C) 1994, Silicon Graphics, Inc.       	  *
 *								          *
 *  These coded instructions, statements, and computer programs  contain  *
 *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
 *  are protected by Federal copyright  law.  They  may not be disclosed  *
 *  to  third  parties  or copied or duplicated in any form, in whole or  *
 *  in part, without the prior written consent of Silicon Graphics, Inc.  *
 *								          *
 *************************************************************************/

/*
 * File:		grdp.s
 * Creator:		hsa@sgi.com
 * Create Date:		Fri Jun 24 13:54:26 PDT 1994
 *
 * This file holds the top-level of the RDP command processing, and
 * related routines.
 *
 */


 ############################################################################	
 #
 # The following code processes the RDP type display list commands.
 # Registers on input:	
 #	gfx0	- first word of display list command
 #	gfx1	- second word of display list command
 #
 # RDP command processing is a little different, we only check the
 # command to identify it as having an address to patch up. We don't
 # need a switch table with an entry for each command...
 #

 #
 # NOTE: We need to detect the FULLSYNC (and other sync?) command
 # and then spin until some bit in cp0 (?) tells us the RDP pipeline
 # has drained (about 40 clocks?). Otherwise a race condition is
 # possible when we write the next output...
 #
	
.name mask,	$2
.name addr,	$19
.name	temp,	$8
	
		.ent	doRDP
doRDP:

#ifdef LINE3D	
	# check to see if we have a scissor command

		# shift down the command word
		srl	mask,	gfx0,	24

		# now compare against scissor command
		ori	temp,	zero,	G_SETSCISSOR
		bne	temp,	mask,	notScissor
		
		# we have a scissor command

		#store YH
		andi	temp,	gfx0,	0xfff
		sh	temp,	RSP_STATE_SCISSOR_YH(rsp_state)

		# store XH
		srl	temp,	gfx0,	12
		andi	temp,	temp,	0xfff
		sh	temp,	RSP_STATE_SCISSOR_XH(rsp_state)

		#store YL
		andi	temp,	gfx1,	0xfff
		sh	temp,	RSP_STATE_SCISSOR_YL(rsp_state)

		# store XL
		srl	temp,	gfx1,	12
		andi	temp,	temp,	0xfff
		sh	temp,	RSP_STATE_SCISSOR_XL(rsp_state)

notScissor:			

#endif

		
	# identify RDP command as having an address or not...
		sra	mask, gfx0, 24
		addi	mask, mask, G_RDP_ADDR_FIXUP
		bltz	mask, doRDPSend
		addi	mask, mask, (G_RDP_TEXRECT_CHECK-G_RDP_ADDR_FIXUP)
 ### BRANCH OCCURS to doRDPSend: if no address in command
	#
	# RDP command has an address to patch...
	#
		jal	AddrFixup
		add	addr, gfx1, zero		# delay slot
		add	gfx1, addr, zero
	#
	# if RDP command doesn't have an addr, copy it verbatim.
	#

.name	outsz,	$18	# used in OutputOpen

doRDPSend:
#if !(defined(OUTPUT_DRAM)||defined(OUTPUT_FIFO))
		jal	OutputOpen		#
		addi	outsz, zero, 8
#endif /* !(OUTPUT_DRAM || OUTPUT_FIFO) */
#ifdef	OUTPUT_DUMP
		jal	OutputOpen		#
		addi	outsz, zero, 8-RSP_OUTPUT_END
#endif
#if	(defined(DMA2BUF)||defined(DMANOWAIT))
		jal	DMAwait
		lw	$21, RSP_STATE_FIFO_OUTP(rsp_state)
		mtc0	$21, CMD_END
#endif
						#
		sw	gfx0, 0(outp)		#
		sw	gfx1, 4(outp)		#
#ifdef	OUTPUT_DUMP
		bgtz	mask, GfxDone
		addi	outp, outp, 8
#else
		jal	OutputClose		#
 		addi	outp, outp, 8		# delay slot
#if	(defined(DMA2BUF)||defined(DMANOWAIT))
#ifndef	DMANOWAIT2
		jal	DMAwait
		lw	$21, RSP_STATE_FIFO_OUTP(rsp_state)
		mtc0	$21, CMD_END
#endif
#endif
		bgtz	mask, GfxDone		# most commands return normally
		nop				#
#endif
		j	noYield			# Textured Rectangle commands
						# do not allow a yield to occur
						# before the second half of the
						# command is sent

 #NOTE! delay slot is in gdma.s
	
		.end	doRDP
.unname	outsz
.unname mask
.unname addr
.unname	temp	
		
 #
 #
 #
 ############################################################################