[FFmpeg-devel] [PATCH 6/6] hwcontext_vaapi: Add support for mapping to DRM objects
Mark Thompson
sw at jkqxz.net
Sun Oct 8 19:11:01 EEST 2017
On 08/10/17 17:03, Derek Buitenhuis wrote:
> On 10/8/2017 4:11 PM, Mark Thompson wrote:
>> Uses vaExportSurfaceHandle() from libva2.
>> ---
>> libavutil/hwcontext_vaapi.c | 106 +++++++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 104 insertions(+), 2 deletions(-)
>
> [...]
>
>> + for (i = 0; i < drm_desc->nb_objects; i++)
>> + close(drm_desc->objects[i].fd);
>
> Delightful API...
>
>> + surface_id = (VASurfaceID)(uintptr_t)src->data[3];
>
> Can you elaborate a bit on this part? Casting pointers to uintptr_t and storing
> them is always a red flag to me... C standard issues, etc.
>
>> + dst->data[0] = (uint8_t*)drm_desc;
>
> This is also a bit wtf-looking... is it cast back at some point? That could be
> problematic.
This is just how hardware surfaces are stored in AVFrames - they have their own API-specific handles in the data[] pointers because that's the only place to put them.
See
<http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavutil/pixfmt.h;h=24889c8e5288cd0e6b6dc59bc4455e87747fa7e8;hb=HEAD#l132>
and
<http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavutil/pixfmt.h;h=24889c8e5288cd0e6b6dc59bc4455e87747fa7e8;hb=HEAD#l337>
(and others).
Thanks,
- Mark
More information about the ffmpeg-devel
mailing list