Search
lxdream.org :: lxdream/src/pvr2/pvr2.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/pvr2.c
changeset 282:01e53698ff38
prev274:4e8f1e988d80
next284:808617ee7135
author nkeynes
date Sun Jan 14 11:43:00 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change First cut of YUV converter
file annotate diff log raw
1.1 --- a/src/pvr2/pvr2.c Thu Jan 11 12:14:57 2007 +0000
1.2 +++ b/src/pvr2/pvr2.c Sun Jan 14 11:43:00 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: pvr2.c,v 1.37 2007-01-11 12:14:57 nkeynes Exp $
1.6 + * $Id: pvr2.c,v 1.38 2007-01-14 11:43:00 nkeynes Exp $
1.7 *
1.8 * PVR2 (Video) Core module implementation and MMIO registers.
1.9 *
1.10 @@ -474,7 +474,6 @@
1.11 MMIO_WRITE( PVR2, reg, val&0x00FFFFF8 );
1.12 break;
1.13 case YUV_CFG:
1.14 - DEBUG( "YUV config set to %08X", val );
1.15 MMIO_WRITE( PVR2, reg, val&0x01013F3F );
1.16 break;
1.17
1.18 @@ -683,6 +682,51 @@
1.19 }
1.20 }
1.21
1.22 +/**
1.23 + * Write an image to 64-bit vram, with a line-stride different from the line-size.
1.24 + * The destaddr must be 32-bit aligned, and both line_bytes and line_stride_bytes
1.25 + * must be multiples of 4.
1.26 + */
1.27 +void pvr2_vram64_write_stride( sh4addr_t destaddr, char *src, uint32_t line_bytes,
1.28 + uint32_t line_stride_bytes, uint32_t line_count )
1.29 +{
1.30 + int bank_flag = (destaddr & 0x04) >> 2;
1.31 + uint32_t *banks[2];
1.32 + uint32_t *dwsrc;
1.33 + uint32_t line_gap;
1.34 + int line_gap_flag;
1.35 + int i,j;
1.36 +
1.37 + destaddr = destaddr & 0x7FFFF8;
1.38 + i = line_stride_bytes - line_bytes;
1.39 + line_gap_flag = i & 0x04;
1.40 + line_gap = i >> 3;
1.41 +
1.42 +
1.43 + for( i=destaddr & 0xFFFFF000; i < destaddr + line_stride_bytes*line_count; i+= PAGE_SIZE ) {
1.44 + texcache_invalidate_page( i );
1.45 + }
1.46 +
1.47 + banks[0] = (uint32_t *)(video_base + (destaddr >>1));
1.48 + banks[1] = banks[0] + 0x100000;
1.49 + if( bank_flag )
1.50 + banks[0]++;
1.51 +
1.52 + dwsrc = (uint32_t *)src;
1.53 + for( i=0; i<line_count; i++ ) {
1.54 + for( j=0; j<line_bytes; j++ ) {
1.55 + *banks[bank_flag]++ = *dwsrc++;
1.56 + bank_flag = !bank_flag;
1.57 + }
1.58 + *banks[0] += line_gap;
1.59 + *banks[1] += line_gap;
1.60 + if( line_gap_flag ) {
1.61 + *banks[bank_flag]++;
1.62 + bank_flag = !bank_flag;
1.63 + }
1.64 + }
1.65 +}
1.66 +
1.67 void pvr2_vram_write_invert( sh4addr_t destaddr, char *src, uint32_t length, uint32_t line_length )
1.68 {
1.69 char *dest = video_base + (destaddr & 0x007FFFFF);
.