-
Notifications
You must be signed in to change notification settings - Fork 309
Add a more flexible interface for import/export of DRM objects #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@fhvwy @scott-d-phillips has some commits for dma buffer modifier too |
Agree with you that the export functions shouldn't do synchronisation |
AFAIK, Scott did some testing in gstreamer, please refer to https://bugzilla.gnome.org/show_bug.cgi?id=779146 |
|
@scott-d-phillips Some thoughts on that branch:
|
On the other hand, if you want to pass the surface to KMS for display, or to some other process for libva encoding then you do want NV12, P010, etc IIUC. Maybe this preference for the form of multi-planar export can be expressed with the API? Otherwise agree with your points @fhvwy |
|
Can Y-tiled NV12 or P010 be used for scanout on Intel? I didn't think they could. In any case, if you want correct colours (with arbitrary colour spaces and HDR and whatever other features people dream up to mess with output) then you need to do a proper rendering to RGB for display, so I'm not sure how useful it could be (people typically use EGL+OpenGL for this, which is happy to render to KMS buffers). For encoding, there isn't actually any hardware restriction on the plane locations on Intel is there? The current driver does restrict it, but only because it has to be in a single object - the offsets within the object can be arbitrary, I think. So, that should be fixable without too much difficulty. I guess making it configurable would be fine with me, as long as the single-plane formats are accessible for the use-cases I care about. |
Yes, it can. Patches to add that support in the kernel are just now hitting the intel-gfx list.
The hardware requires the address of the UV plane be greater than the address of the Y plane, so not just any two R8 and GR88 planes can be used as NV12. |
da7c3dc to
c73cef6
Compare
ABI was broken in the previous versions, so we will bump the VA API version to 1.0.0 and library version to 2.0.0 for next release. Some data structures will be changed or removed in the next commits Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
… to be consistent with other codecs Currently the data type of slice_data_flag in VASliceParameterBufferHEVC is uint16_t while it is uint32_t for other codecs. It is inconsistent. As the memory is allocated as aligned, it still allocates four bytes for it. So it will be better to use the consistent data type. This fixes https://github.com/01org/libva/issues/58 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
The new header is internal-only and will not be installed. Signed-off-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
This is slightly cleaner, and will be required to set common options on a newly-created display. Signed-off-by: Mark Thompson <sw@jkqxz.net>
Move the logging callbacks into the display context, rather than having them as global state. Add user-context parameter as well so that users can distinguish between callbacks in different instances. The default behaviour does not change, and LIBVA_MESSAGING_LEVEL continues to be respected in that case. Since we're breaking API here, also rename vaMessageCallback to VAMessageCallback to be consistent with all other types. Signed-off-by: Mark Thompson <sw@jkqxz.net>
This will generate a warning on gcc and compatible (clang, icc), and do nothing with other compilers. There is a separate macro for enum variables, because gcc did not support deprecating them until version 6. Signed-off-by: Mark Thompson <sw@jkqxz.net>
This is not now and never will be supported by any hardware, nor is it supported by any current software. Signed-off-by: Mark Thompson <sw@jkqxz.net>
Add "va_" prefix to trace_flag, fool_codec and fool_postp to avoid polluting the global namespace. Signed-off-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
Mainly to fix the warning (glibc marks read(2) with warn_unused_result). The function continues anyway when this happens (matching current behaviour when the file can't be opened at all). Signed-off-by: Mark Thompson <sw@jkqxz.net>
residual_colour_transform_flag and pic_order_present_flag have different names in newer versions of the H.264 standard, so add a comment with the new name to reduce confusion. Signed-off-by: Mark Thompson <sw@jkqxz.net>
license missing on header file. Taken from c file Signed-off-by: Daniel Charles <daniel.charles@intel.com>
The current delat is typo. This fix breaks API, fortunately roi_rc_qp_delat_support isn't used widely This fixes https://github.com/01org/libva/issues/32 Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
The type of bits should be a struct type, otherwise the flags in bits will be impacted each other. In addtion this adds a reserved byte to bits struct in inter_fields, this should fix https://github.com/01org/libva/issues/35 Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
We have defined a codec-independent slice parameter buffer (VASliceParameterBufferBase) for base mode slice decoding for all codecs, so VASliceParameterBufferBaseHEVC is unnecessary. Fortunately VASliceParameterBufferBaseHEVC isn't used publicly, hence we remove VASliceParameterBufferBaseHEVC from VA-API 1.0.0 Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
b_picture_fraction is used as an index in practice, so I updated the comments to reduce the confusion to user Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
The APIs/data structures defined in va_tpi.h and va_egl.h are used to implement buffer sharing between libva and the 3rd party libraries. We have an official buffer sharing machnism in VA core, so libva-tpi and libva-egl are unnecessary any more. However va_egl.h or va_tpi.h is included uselessly in a few places, e.g. https://github.com/01org/libyami/blob/apache/vaapi/vaapidisplay.h#L22 So va_egl.h and va_tpi.h are kept with a deprecation warning message. Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
All applications can use VAEncPackedHeaderRawData to insert a packed header on demand Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
We have already defined VA structures using portable types in some header files. Use portable types in the remaining header files to keep the style consistency, Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
vaGetSurfaceAttributes() was removed years ago, so remove the corresponding comments Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
i965 will return the I420 in vaQuerySurfaceAttributes, but va.h didn't add the pre-define fourcc, and will deprecate IYUV because it same as I420 but most user perfer I420. Signed-off-by: Jun Zhao <jun.zhao@intel.com>
enums marked as deprecated should not be used any more. Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
redefine VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROW to non-zero value all slice structure attributes value can OR'd together. Signed-off-by: xfengcarl <carl.zhang@intel.com>
eea0e4f to
2815347
Compare
|
Ok, here is a new version, now fully working for export. Driver support for Intel: |
|
|
How about to add width and height for the exporting surface in VADRMPRIMESurfaceDescriptor? The 3rd party library might need these metadata. |
|
I was thinking they are already known because they are passed to vaCreateSurfaces() (for export by the creator, and you have to know them directly as an importer). But yeah, that makes sense, I'll add them. |
Initial definition supports exporting as DRM objects only. Fixes intel#10. Signed-off-by: Mark Thompson <sw@jkqxz.net>
|
Could you please change your PR to 'merge 1 commits to 01org:master'? All patches on v2.0-branch have been merged into master. |
|
https://bugzilla.gnome.org/show_bug.cgi?id=779146 is using @scott-d-phillips's definition which is a little different from yours, could you have a look? |
a8f9429 to
ad3ec68
Compare
|
(Moved to #125.) |
This is an attempt to fix #10 and related problems around inability to describe surfaces in a way usable with external APIs. Since it isn't fixable with current interfaces, we need to add something new to be able to do it and libva2 seems like a good opportunity for that. Therefore, this proposes a much more flexible interface for import/export of DRM objects.
This is still looking for general comments, so I haven't actually implemented any of this yet. I would intend to make something in Mesa and mpv to test it on AMD at least.
The descriptor is constructed with the intent that after export one can import directly to EGL using https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import.txt and https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt.
Wrt the complexity of the descriptor, we would like to be able to handle at least these three cases for NV12-like surfaces:
I define new a new pair of Acquire/Release functions to support this - the current VABufferInfo structure is insufficient to support the necessary information, so new functions seemed sensible. They also act directly on surfaces rather than buffers of derived images - I believe this is the only case which anyone would ever use, though please do say if there is some other use-case which I'm not aware of.
Locking is left unclear here. I think it would be cleaner if the export functions did not do any synchronisation, and instead request that the user calls vaSyncSurface() as necessary for their use-case (with behaviour undefined if they act on an object with another API during a render operation). That would support mapping a single time and then synchronising as necessary without the need to keep creating and destroying objects, but there might be some other reason I'm not aware of why this causes problems.
(To compare, other cases of sharing between video and processing APIs tend to have separate mapping and synchronisation - see e.g. https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/cl_khr_dx9_media_sharing.html or https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/cl_khr_d3d11_sharing.html.)
Some other random questions:
All thoughts welcome. I'm not attached to any particular detail here - feel free to suggest changing everything :)