Skip to content

Introduce VADisplayAttribSurfaceAttribs #519

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

Closed
wants to merge 1 commit into from

Conversation

emersion
Copy link
Contributor

@emersion emersion commented Apr 8, 2021

This allows applications to query the supported surface attributes.

This is useful to allow applications to make sure their attributes
are taken into account, and allow them to have a fallback when a
surface attribute is not supported.

ffmpeg already needs a workaround to figure out whether a driver
supports VASurfaceAttribMemoryType.

The concept of a "HW attribute" is borrowed from #513 and #514.

This allows applications to query the supported surface attributes.

This is useful to allow applications to make sure their attributes
are taken into account, and allow them to have a fallback when a
surface attribute is not supported.

ffmpeg already needs a workaround [1] to figure out whether a driver
supports VASurfaceAttribMemoryType.

[1]: https://github.com/FFmpeg/FFmpeg/blob/d393c45051ddaf6146e7e29ec2ea97035a727529/libavutil/hwcontext_vaapi.h#L53
@XinfengZhang
Copy link
Contributor

not sure whether I understand your purpose, I dont think we need a special attribute to report whether we support another attributes. when a attributes is un-support. it should return with a value VA_ATTRIB_NOT_SUPPORTED, if it is a pointer, it should be set to null. so, why we need to use vaQueryDisplayAttributes to query whether a surface attribute is support or not?

@emersion
Copy link
Contributor Author

emersion commented Apr 8, 2021

when a attributes is un-support. it should return with a value VA_ATTRIB_NOT_SUPPORTED

Ah, I was wondering about this. It doesn't seem like intel media driver is doing it. I've filled a pull request to fix that: intel/media-driver#1176

so, why we need to use vaQueryDisplayAttributes to query whether a surface attribute is support or not?

It's a little tricky for the caller to figure out which attribute caused the failure. If the application provided both VASurfaceAttribUsageHint and VASurfaceAttribMemoryType, which one caused the failure?

If they know in advanced the surface attributes supported by the display, applications can have a fallback. For instance, if VASurfaceAttribUsageHint is not supported, applications can remove it, since it's just a hint.

@XinfengZhang
Copy link
Contributor

the normal call sequence should be:
vaQuerySurfaceAttributes/vaGetSurfaceAttributes then call vaCreateSurfaces

so , before vaCreateSurfaces, it should already know which attribute could be supported.

with your PR, the call sequence seems be changed to
vaQueryDisplayAttributes/vaGetDisplayAttributes ===> vaCreateSurfaces

it looks a little strange.

@emersion
Copy link
Contributor Author

Ah, I guess my question is: how does the application know that the driver supports attributes which aren't readable (only writable)? Examples: VASurfaceAttribExternalBufferDescriptor and VASurfaceAttribDRMFormatModifiers.

Should the driver return the writable attribute without any value in vaQuerySurfaceAttributes?

@XinfengZhang
Copy link
Contributor

XinfengZhang commented Apr 12, 2021

query function support this flag https://github.com/intel/libva/blob/master/va/va.h#L1600 and the value could be
VA_SURFACE_ATTRIB_GETTABLE , VA_SURFACE_ATTRIB_SETTABLE or VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE

* before calling vaPutSurface()
* before calling vaPutSurface().
*
* Display attributes also are used to query/set display adaptor (vaDisplay)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's prioritize #514 - you will need to rebase once that one will be merged.

@emersion
Copy link
Contributor Author

Closing since drivers should return settable attributes in vaQuerySurfaceAttributes. I checked intel-media-driver and Mesa, both already do so for VASurfaceAttribExternalBufferDescriptor.

@emersion emersion closed this Apr 14, 2021
@emersion emersion deleted the supported-surface-attribs branch April 14, 2021 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants