Hi,
I found a solution, which seems to work fine, I post it here in case anyone runs into the same problem.
The trick I used is as follows:
I allocate two large buffers, each big enough to accomodate half of the number of buffers I wish to use in the ring's bufferlist. I don't need the ring to be very long, in my case about 1000-2000 image buffers is enough.
Then I create a list of pointers, i.e. **bufferlist, and set the pointers to point to address within the two large buffers I've allocated (the first half of the ring points into one buffer, and the second half into the other). As far as the driver is concerned I've just given it a list of pre-allocated image sized buffers.
This kind of allocation scheme allows me then to use a fast multimedia timer in order to monitor the acquisition into the ring. Whenver the timer's callback function detects that half of the ring is acquired, it uses memcpy to copy that entire half of the ring IN ONE memcpy call into another pre allocated buffer. This does the trick. Without the overhead of having to memcpy each buffer the copying takes next to no time in comparison to the time it takes to acquire half of the ring. This, in fact, is nothing but double-buffering on the acuisition ring.
Have fun,
o.
Here is a code snippet of the allocation, and then of the copying-
//allocation:
//Allocate th buffers myself -
//allocate in big chunks
BigChunk1=(unsigned char *)malloc(ShouldBufferSize*NUM_RING_BUFFERS/2);//shouldbuffersize is the size of each image
BigChunk2=(unsigned char *)malloc(ShouldBufferSize*NUM_RING_BUFFERS/2);
//create the logical bufferlist, for passing to the driver
ImaqBuffers = (unsigned char **) malloc(sizeof(*ImaqBuffers) * NUM_RING_BUFFERS);
for(i=0; i<NUM_RING_BUFFERS/2; i++)
ImaqBuffers[i] = &(BigChunk1[i*ShouldBufferSize]);
for(i=NUM_RING_BUFFERS/2; i<NUM_RING_BUFFERS; i++)
ImaqBuffers[i] = &(BigChunk2[(i-NUM_RING_BUFFERS/2)*ShouldBufferSize]);
//double buffering (inside OnTimer callback):
if (currBufNum > NUM_RING_BUFFERS/2 && first)
{//done with the first half, copy it into the pre-allocated ring of big buffers- CopiedBufs
memcpy(CopiedBufs[CopiedIndex],BigChunk1,ShouldBufferSize*NUM_RING_BUFFERS/2);
first=false;
CopiedIndex++;
if (CopiedIndex == NUM_COPIED_BUFS)
CopiedIndex=0;
} else if (currBufNum < NUM_RING_BUFFERS/2 && !first)
{//done with the second half
memcpy(CopiedBufs[CopiedIndex],BigChunk2,ShouldBufferSize*NUM_RING_BUFFERS/2);
first=true;
CopiedIndex++;
if (CopiedIndex == NUM_COPIED_BUFS)
CopiedIndex=0;
}