Hi,
I've done some measuring based on the DMA-copy driver sources you've
provided to us and I saw a strange collapse of the DMA speed at transfer
size = 0x1fff6 bytes. Have you noticed that too, and do you have an
explanation? I don't get it why that happened.
I've attached my test code which replaces the while(!GetQuit())-loop of
function "videoThrFxn" of the DVEVM example called "encodedecode". The
measurement results are written in the comment lines behind its appropriate
#define:
...
while (!getQuit()) {
static int fd;
static int first = 1;
static memio_t arg; // fps MB/s %CPU
#define r1280_1024 (1280*1024) //1310720 = 0x140000, 0-1 1.12 2
#define r1024_768 (1024*768) // 786432 = 0xC0000, 0-1 0.62-1.37 2
#define r720_576 (720*576) // 414720 = 0x65400, 1-2 0.75-1.12 2
#define r600_450 (600*450) // 270000 = 0x41EB0, 3-4 0.87-1.12 2
#define r_0x1fff6 (0x1fff6) // 0x1fff6, 9 1.12 2
#define r_0x1fff4 (0x1fff4) // 0x1fff4, 3110 398 0-20
#define r400_300 (400*300) // 120000 = 0x1D4C0, 3110 365 2-4
#define r200_150 (200*150) // 30000 = 0x7530 , 8350 245 0
const unsigned int r = 0x1fff4;
if (first) {
first = 0;
fd = open("/dev/memio", O_RDWR | O_NONBLOCK);
if (fd == -1) {
ERR("failed to open /dev/memio\n");
}
arg.dst = malloc(r);
arg.addr = malloc(r);
printf("arg.dst=0x%08x\n", arg.dst);
printf("arg.addr=0x%08x\n", arg.addr);
arg.len = r;
}
//printf("1\n");
if (1) {
int i;
int len = arg.len;
memio_t a = arg;
do {
a.len = (len >= 0x10000) ? (0x10000-1) : len;
//printf("a.len=0x%x ", a.len);
//printf("a.dst=0x%08x ", a.dst);
//printf("a.addr=0x%08x\n", a.addr);
ioctl(fd, MEMIO_DMA, &a);
a.dst += a.len;
a.addr += a.len;
len -= a.len;
} while (len);
} else {
ioctl(fd, MEMIO_DMA, &arg);
}
incFrames();
incVideoBytesEncoded(r);
}
...
CU, [EMAIL PROTECTED]
Constantine Shulyupin wrote:
>
> > I already want to do that for a few month but
> > did not had the time yet...
>
> Here you are:
>
> int dmacpy(dma_addr_t dst, dma_addr_t src, size_t n)
> {
> int tcc;
> int dev_id=0;
>
> // initialise DMA
> if (davinci_request_dma(dev_id, "TEST", davinci_edma_cb,
> NULL, &ch, &tcc, EVENTQ_0)) {
> return -1;
> }
> init_completion(&done);
>
> // set DMA parameters
> davinci_set_dma_dest_params(ch, dst, 0, 0);
> davinci_set_dma_src_params(ch, src, 0, 0);
>
> // parameters for transfers size less than 64K
> if (n < 0x10000 ) {
> davinci_set_dma_src_index(ch, 0, 0);
> davinci_set_dma_dest_index(ch, 0, 0);
> davinci_set_dma_transfer_params(ch, n, 1, 1, 0, Async);
>
> }
> // parameters for transfers 64K and more
> if ( n >= 0x10000 ) {
> // tested for up to 64 MB
> // inspired by 3.2 Subframe Extraction Exampl
> int acnt = 0x4000; // could be 0x8000
> int bcnt = n / 0x4000;
> //int bcnt = n / acnt;
> /// Reference:
> /// 2.3.2 EDMA3 Channel Parameter Set Fields
> /// 2.3.2.1 Channel Options Parameter (OPT)
> /// 2.3.2.8 Source B Index (SRCBIDX)
> davinci_set_dma_src_index(ch, acnt, 0); //
> args: srcbidx srccidx
> davinci_set_dma_dest_index(ch, acnt, 0); //
> args: destbidx, destcidx
> davinci_set_dma_transfer_params(ch, acnt, bcnt,
> 1, 0, ABsync);
> // args: acnt, bcnt, ccnt, bcntrld, sync_mode
> }
> // davinci_print_dma_transfer_params(ch);
> // start DMA transfer
> davinci_start_dma(ch);
> // and wait for completion
> wait_for_completion(&done);
> return 0;
> }
>
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source