-
Notifications
You must be signed in to change notification settings - Fork 301
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
Introduce VASurfaceAttribDRMFormatModifiers #505
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,5 +154,22 @@ typedef struct _VADRMPRIMESurfaceDescriptor { | |
} layers[4]; | ||
} VADRMPRIMESurfaceDescriptor; | ||
|
||
/** | ||
* \brief List of DRM format modifiers. | ||
* | ||
* To allocate surfaces with one of the modifiers specified in the array, call | ||
* vaCreateSurfaces() with the VASurfaceAttribDRMFormatModifiers attribute set | ||
* to point to an array of num_surfaces instances of this structure. The driver | ||
* will select the optimal modifier in the list. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the intent of the array of these attributes? (Alternatively: what is the use-case of allocating a set of surfaces with different format modifiers per-surface?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've just matched what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we can get the modifier lists based on the configID, just like the VASurfaceAttribMemoryType? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is not implemented in this pull request. This pull request is just about selecting modifiers when allocating a new surface, for now.
Hmm. How does this work for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So far as I know, the modifier is decisive by the usage of surface. For example, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For AMD hardware, we can. See the original issue: #502. When decoding NV12 buffers, AMD hardware can select between LINEAR and tiled. For some use-cases (rotated direct scanout) tiled buffers are required. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it should be capability report , for example, Intel VDEnc support both tile and linear surface, it could report 2 modifiers for encode config, Decode just support tile surface, it could just report 1 modifiers. |
||
* | ||
* DRM format modifiers are defined in drm_fourcc.h in the Linux kernel. | ||
*/ | ||
typedef struct _VADRMFormatModifierList { | ||
/** Number of modifiers. */ | ||
uint32_t num_modifiers; | ||
/** Array of modifiers. */ | ||
uint64_t *modifiers; | ||
emersion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} VADRMFormatModifierList; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this used for list all supported modifiers of some config? For VPP, we really think the query result There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. No, this is not used to list all supported modifiers of a given config. It's only used with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, I think the ideal usage of this modifier should be:
For VPP, maybe the things are a little complicated, if input and output modifiers are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think the libva client should be responsible for picking the modifier. There may be multiple modifiers suitable for a given usage. For instance, both Y_TILED and X_TILED may be supported by KMS. However the client can't guess what modifier is "the best one". The VA-API driver is a better place to decide which exact modifier to pick. The VA-API driver knows that Y_TILED is better than X_TILED. That's what the GBM API does too: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A real problem we need to face is the GPU memory/surface sharing between modules. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sounds like a good plan to me. However you may notice that the libva query is not strictly necessary. The libva client can just pass the list of modifiers suitable for the usage (e.g. the list of modifiers supported by EGL or KMS). The libva driver can internally intersect the user list with its own list of supported modifiers. That's why I left the query part out. I'm still willing to add a query API nonetheless if you want it, but it's still unclear to me how to address the memory ownership issue. The driver needs to return something more complex than just a single integer to the user. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a gstreamer developer, the query is useful for negotiation. For example, if the About the "memory ownership issue", I am not the VA expert:) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. By "not strictly necessary", I mean that it would be nice to have but would still work without it. You'd just get an error from Thanks for the feedback! |
||
|
||
#endif /* VA_DRM_COMMON_H */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should also be readable, returning the list of supported modifiers to
vaQuerySurfaceAttributes()
?(Unclear how the memory works in that case, maybe it needs to be a pointer to something allocated inside the driver.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the memory ownership issue is the reason why I haven't added this as a readable attrib. Since the supported modifiers depend on the VAConfig, the driver can't have a single global modifier list.
Maybe a better path forward would be to return one attrib per supported modifier, but then we can't re-use the same attrib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it should be readable
it is a list for query , but vaCreateSurfaces call, the list should just has 1 element. you could not create one surface with two+ modifiers.
another one is, we already could use https://github.com/intel/libva/blob/master/va/va_drmcommon.h#L137 for external surface, so need a comment to describe it not used for PRIME2