Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SDI driver related questions



Hello,

I have an SDI card for which I am trying to write the drivers. This SDI card is our own and we are trying to move into Mac OS. SDI drivers on Linux and Windows implement scatter/gather dma. On Mac, we are having difficulties in getting the transmitter to work. Basically, the transmitter should be able to transmit at the rate of 270 Mbits/sec. I see a lot of underruns and the video quality is bad. Video flickers a lot and there are freezes at times when I run the transmitter. We have tried from contiguous allocation to scatter/gather all resulting in bad picture quality. We use IOMultiMemoryDescriptor, IOBufferMemoryDescriptor. I understand the information here isn't sufficient enough to understand the issues that we are having. Here's the buffer allocation method code if somebody is interested in taking a look at it.

IOReturn PLXDMAEngine::new_plxAllocBuffers(plx_dma *dma)
{
	DbgPrint("PLXDMAEngine::new_plxAllocBuffers\n");
	
	const UInt32 total_buffers = dma->pointers_per_buf * dma->buffers;
	
	DbgPrint("Total buffers %d\n", total_buffers);

dma->dma_buffers = reinterpret_cast<IOMultiMemoryDescriptor **>(IOMalloc(sizeof(IOMultiMemoryDescriptor *) * dma->buffers));
//IOFree(dma->dma_buffers, sizeof(IOMultiMemoryDescriptor *) * dma->buffers);
if (!dma->dma_buffers)
{
DbgPrint("Couldn't allocate memory for IOMultiMemoryDescriptor list\n");
return kIOReturnNoMemory;
}

dma->dma_pool = reinterpret_cast<IOBufferMemoryDescriptor **>(IOMalloc(sizeof(IOBufferMemoryDescriptor *) * total_buffers));
memset(dma->dma_pool, 0, sizeof(IOBufferMemoryDescriptor *) * total_buffers);


if (!dma->dma_pool)
{
DbgPrint("Couldn't allocate memory for IOBufferMemoryDescriptor list\n");
IOFree(dma->dma_buffers, sizeof(IOMultiMemoryDescriptor *) * dma->buffers);
}
//IOFree(dma->dma_pool, sizeof(IOBufferMemoryDescriptor *) * total_buffers);

for(UInt32 i = 0; i < total_buffers; i++)
{
dma->dma_pool[i] = IOBufferMemoryDescriptor::withOptions(kIOMemoryPageable, //Options
PAGE_SIZE, //Size
1); //Alignment

if (!dma->dma_pool[i])
{
//TO-DO: Add memory deallocation for 0 - i-1 buffers
DbgPrint("Couldn't allocate buffer, step %d\n", i);
IOFree(dma->dma_pool, sizeof(IOBufferMemoryDescriptor *) * total_buffers);
IOFree(dma->dma_buffers, sizeof(IOMultiMemoryDescriptor *) * dma->buffers);

return kIOReturnNoMemory;
}

memset(dma->dma_pool[i]->getBytesNoCopy(), 0, PAGE_SIZE);
//DbgPrint("%x\n", ((UInt8 *)dma->dma_pool[i]->getBytesNoCopy())[0]);
}

for(UInt32 i = 0; i < dma->buffers; i++)
{
dma->dma_buffers[i] = IOMultiMemoryDescriptor::withDescriptors(reinterpret_cast<IOMemoryDescriptor **>(&dma->dma_pool[i * dma->pointers_per_buf]),
dma->pointers_per_buf,
dma->prepare_type,
false);
if (!dma->dma_buffers[i])
{
DbgPrint("Couldn't allocate IOMultiMemoryDescriptor, step %d\n", i);
//TO-DO: Add memory buffers deallocation
//TO-DO: Add IOMultiMemoryDescriptor deallocation
IOFree(dma->dma_pool, sizeof(IOBufferMemoryDescriptor *) * total_buffers);
IOFree(dma->dma_buffers, sizeof(IOMultiMemoryDescriptor *) * dma->buffers);
return kIOReturnNoMemory;
}
}


	return kIOReturnSuccess;
}

Any input or suggestions are greatly appreciated.

Thanks,

Dinesh

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.