After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 783599 - plugins: refactor the handling of negotiated caps vs allocation caps
plugins: refactor the handling of negotiated caps vs allocation caps
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer-vaapi
git master
Other Linux
: Normal normal
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 781756 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-06-09 15:09 UTC by Víctor Manuel Jáquez Leal
Modified: 2017-07-10 17:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
vaapivideobufferpool: rename video info structures (4.68 KB, patch)
2017-06-09 15:10 UTC, Víctor Manuel Jáquez Leal
none Details | Review
vaapivideobufferpool: rename local variables (3.82 KB, patch)
2017-06-09 15:10 UTC, Víctor Manuel Jáquez Leal
none Details | Review
vaapivideomemory: rename qdata quarks and ids (4.82 KB, patch)
2017-06-09 15:10 UTC, Víctor Manuel Jáquez Leal
none Details | Review
plugins: distinguish allocation and negotiation caps (9.21 KB, patch)
2017-06-09 15:10 UTC, Víctor Manuel Jáquez Leal
none Details | Review
vaapivideobufferpool: refactor set_config() (6.37 KB, patch)
2017-06-09 15:11 UTC, Víctor Manuel Jáquez Leal
none Details | Review
vaapivideobufferpool: remove allocation_vinfo private attribute (3.22 KB, patch)
2017-06-09 15:11 UTC, Víctor Manuel Jáquez Leal
none Details | Review
vaapivideobufferpool: rename video info structures (4.68 KB, patch)
2017-06-12 17:04 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
vaapivideobufferpool: rename local variables (3.82 KB, patch)
2017-06-12 17:04 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
vaapivideomemory: rename qdata quarks and ids (4.82 KB, patch)
2017-06-12 17:04 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
plugins: distinguish allocation and negotiation caps (9.56 KB, patch)
2017-06-12 17:04 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
vaapivideobufferpool: refactor set_config() (6.37 KB, patch)
2017-06-12 17:04 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
vaapivideobufferpool: remove allocation_vinfo private attribute (3.22 KB, patch)
2017-06-12 17:04 UTC, Víctor Manuel Jáquez Leal
committed Details | Review

Description Víctor Manuel Jáquez Leal 2017-06-09 15:09:40 UTC
Since bug 781577 a regression were introduced: when playing back videos without using vaapipostproc and software based renderers, the frames cannot be mapped because the resolutions doesn't match.

These patches are big refactoring for handling caps when the negotiated and allocation are different.
Comment 1 Víctor Manuel Jáquez Leal 2017-06-09 15:10:39 UTC
Created attachment 353467 [details] [review]
vaapivideobufferpool: rename video info structures

Renamed private GstVideoInfo structure video_info to allocation_vinfo
and alloc_info to negotiated_vinfo.

The purpose of these renaming is to clarify the origin and purpose of
these private variables:

video_info (now allocation_vinfo) comes from the bufferpool
configuration. It describes the physical video resolution to be
allocated by the allocator, which may be different from the
negotiated one.

alloc_info (now vmeta_vinfo) comes from the negotiated caps in
the pipeline. It represents how the frame is going to be mapped
using the video meta.

In Intel's VA-API backend, the allocation_vinfo resolution is
bigger than the negotiated_info.
Comment 2 Víctor Manuel Jáquez Leal 2017-06-09 15:10:44 UTC
Created attachment 353468 [details] [review]
vaapivideobufferpool: rename local variables

Renamed local video info structure names in set_config() vitual
method. The purpose of their renaming is to clarify the origin
of those structures, whether come from passed caps parameter
(new_allocation_vinfo) or from the configured allocator
(allocator_vinfo).
Comment 3 Víctor Manuel Jáquez Leal 2017-06-09 15:10:50 UTC
Created attachment 353469 [details] [review]
vaapivideomemory: rename qdata quarks and ids

Also the parameter names were renamed to reflect their origin
and purpose.
Comment 4 Víctor Manuel Jáquez Leal 2017-06-09 15:10:55 UTC
Created attachment 353470 [details] [review]
plugins: distinguish allocation and negotiation caps

The vaapi video decoders might have different allocation caps from
the negotiation caps, thus the GstVideoMeta shall use the negotiation
caps, not the allocation caps.

This was done before reusing gst_allocator_get_vaapi_video_info(),
storing there the negotiation caps if they differ from the allocation
ones, but this strategy felt short when the allocator had to be reset
in the vaapi buffer pool, since we need both.

This patch adds gst_allocator_set_vaapi_negotiated_video_info() and
gst_allocator_get_vaapi_negotiated_video_info() to store the
negotiated video info in the allocator, and distinguish it from
the allocation video info.
Comment 5 Víctor Manuel Jáquez Leal 2017-06-09 15:11:01 UTC
Created attachment 353471 [details] [review]
vaapivideobufferpool: refactor set_config()

Refactor the set_config() virtual method considering a cleaner
approach to allocator instanciation, if it it not set or if it is
not valid for the pool.
Comment 6 Víctor Manuel Jáquez Leal 2017-06-09 15:11:07 UTC
Created attachment 353472 [details] [review]
vaapivideobufferpool: remove allocation_vinfo private attribute

There is no need to keep this attribute internally since it is
already managed by the allocator.
Comment 7 Nicolas Dufresne (ndufresne) 2017-06-09 16:13:08 UTC
So if I understand well, in VAAPI we have allocation caps != negotiated caps. So using this method, we are forced to have a buffer pool that is aware of the GstElement in order to receive the negotiated caps, is that right ?

Was there any reason why using only negotiated caps (or croppped caps) combined with gst_buffer_pool_config_set_video_alignment() didn't work ?
Comment 8 Víctor Manuel Jáquez Leal 2017-06-12 16:34:35 UTC
(In reply to Nicolas Dufresne (stormer) from comment #7)
> So if I understand well, in VAAPI we have allocation caps != negotiated
> caps. So using this method, we are forced to have a buffer pool that is
> aware of the GstElement in order to receive the negotiated caps, is that
> right ?
> 
> Was there any reason why using only negotiated caps (or croppped caps)
> combined with gst_buffer_pool_config_set_video_alignment() didn't work ?

Most of this debate was carried on Bug 753914 and it is related with Bug 746087.

But, no, if I understand correctly you question, the pool doesn't have to be aware of the GstElement, just of the configured allocator.
Comment 9 Víctor Manuel Jáquez Leal 2017-06-12 17:04:27 UTC
Created attachment 353611 [details] [review]
vaapivideobufferpool: rename video info structures

Renamed private GstVideoInfo structure video_info to allocation_vinfo
and alloc_info to negotiated_vinfo.

The purpose of these renaming is to clarify the origin and purpose of
these private variables:

video_info (now allocation_vinfo) comes from the bufferpool
configuration. It describes the physical video resolution to be
allocated by the allocator, which may be different from the
negotiated one.

alloc_info (now vmeta_vinfo) comes from the negotiated caps in
the pipeline. It represents how the frame is going to be mapped
using the video meta.

In Intel's VA-API backend, the allocation_vinfo resolution is
bigger than the negotiated_info.
Comment 10 Víctor Manuel Jáquez Leal 2017-06-12 17:04:32 UTC
Created attachment 353612 [details] [review]
vaapivideobufferpool: rename local variables

Renamed local video info structure names in set_config() vitual
method. The purpose of their renaming is to clarify the origin
of those structures, whether come from passed caps parameter
(new_allocation_vinfo) or from the configured allocator
(allocator_vinfo).
Comment 11 Víctor Manuel Jáquez Leal 2017-06-12 17:04:38 UTC
Created attachment 353613 [details] [review]
vaapivideomemory: rename qdata quarks and ids

Also the parameter names were renamed to reflect their origin
and purpose.
Comment 12 Víctor Manuel Jáquez Leal 2017-06-12 17:04:43 UTC
Created attachment 353614 [details] [review]
plugins: distinguish allocation and negotiation caps

The vaapi video decoders might have different allocation caps from
the negotiation caps, thus the GstVideoMeta shall use the negotiation
caps, not the allocation caps.

This was done before reusing gst_allocator_get_vaapi_video_info(),
storing there the negotiation caps if they differ from the allocation
ones, but this strategy felt short when the allocator had to be reset
in the vaapi buffer pool, since we need both.

This patch adds gst_allocator_set_vaapi_negotiated_video_info() and
gst_allocator_get_vaapi_negotiated_video_info() to store the
negotiated video info in the allocator, and distinguish it from
the allocation video info.
Comment 13 Víctor Manuel Jáquez Leal 2017-06-12 17:04:48 UTC
Created attachment 353615 [details] [review]
vaapivideobufferpool: refactor set_config()

Refactor the set_config() virtual method considering a cleaner
approach to allocator instanciation, if it it not set or if it is
not valid for the pool.
Comment 14 Víctor Manuel Jáquez Leal 2017-06-12 17:04:53 UTC
Created attachment 353616 [details] [review]
vaapivideobufferpool: remove allocation_vinfo private attribute

There is no need to keep this attribute internally since it is
already managed by the allocator.
Comment 15 Víctor Manuel Jáquez Leal 2017-06-13 11:35:33 UTC
Attachment 353611 [details] pushed as dce7a6f - vaapivideobufferpool: rename video info structures
Attachment 353612 [details] pushed as 45faeb2 - vaapivideobufferpool: rename local variables
Attachment 353613 [details] pushed as 36cf510 - vaapivideomemory: rename qdata quarks and ids
Attachment 353614 [details] pushed as 7a20692 - plugins: distinguish allocation and negotiation caps
Attachment 353615 [details] pushed as 60158c3 - vaapivideobufferpool: refactor set_config()
Attachment 353616 [details] pushed as bd02092 - vaapivideobufferpool: remove allocation_vinfo private attribute
Comment 16 Víctor Manuel Jáquez Leal 2017-07-10 17:56:44 UTC
*** Bug 781756 has been marked as a duplicate of this bug. ***