[FFmpeg-devel] [RFC] mem: facilitate imports into GPU memory space.

Nicolas George george at nsup.org
Sun Oct 25 14:28:06 CET 2015


Le quartidi 4 brumaire, an CCXXIV, Gwenole Beauchesne a écrit :
> Allow for av_malloc() to allocate memory that could be mapped into
> the GPU address space. This requires allocations on page boundaries.
> On the video memory buffers side, this requires minimal alignment of
> strides to 64 bytes.
> 
> Option 1: use heuristics in av_malloc()
> - break down into mem, frame, and avcodec changes.

Heuristics are fragile, and the result would probably be many false
positive, wasting quite a lot of memory.

> Option 2: use a finer decision model
> - mem: add av_malloc_aligned()
> - buffer: add av_buffer_alloc2() with align and/or flags
> - frame/avcodec: use new APIs

I would go for flags all the way: with an explicit align value, people will
hardcode a random value based on whichever example they looked at, and it
will break when CPUs are upgraded to a larger value.

The API should probably include some kind of "av_foobar_get_align_flags()"
for each foobar domain where alignment can become visible to the
application.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151025/4f65dfbf/attachment.sig>


More information about the ffmpeg-devel mailing list