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 796505 - [gstreamer-vaapi][jpegdec] decode image display nothing
[gstreamer-vaapi][jpegdec] decode image display nothing
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer-vaapi
git master
Other Linux
: Normal normal
: 1.15.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-06-06 01:40 UTC by Tianhao
Modified: 2018-06-08 10:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Destory slice buffers after vaEndPicture instead of before vaEndPicture (1.13 KB, patch)
2018-06-06 01:40 UTC, Tianhao
none Details | Review
Fix jpeg decode image display nothing. (1.60 KB, patch)
2018-06-07 01:47 UTC, Tianhao
needs-work Details | Review
Fix jpeg decode image display nothing. (1.13 KB, patch)
2018-06-08 02:50 UTC, Tianhao
needs-work Details | Review
Fix jpeg decode image display nothing. (1.34 KB, patch)
2018-06-08 05:41 UTC, Tianhao
committed Details | Review

Description Tianhao 2018-06-06 01:40:26 UTC
Created attachment 372564 [details] [review]
Destory slice buffers after vaEndPicture instead of before vaEndPicture

System Environment
 =======
 OS Ubuntu 17.04
 Kernel 4.10
 Hardware Skylake Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
 libva tag 2.1.0
 intel-media-driver 48f33e511e08a9335d57aad4c09acbbb4aeb0a7f
 gst-vaapi tag 1.13.90

Reproduce Steps
 ==============
 LIBVA_TRACE=./jpeg gst-launch-1.0 filesrc location=/encoderbitstreams_quality/decodebitstreams//JPEG_RefCompare/capture22.jpg ! jpegparse ! vaapijpegdec ! videoconvert ! video/x-raw,format=I420,width=1024,height=768 ! filesink location=capture22.jpg.I420

Check output I420 file with YUV player, nothing display.
Comment 1 Víctor Manuel Jáquez Leal 2018-06-06 07:29:15 UTC
Hi Tianhao,

Thanks for the patch. Though it is not correctly formatted. Could you please follow the recommendations here https://gstreamer.freedesktop.org/documentation/contribute/index.html#how-to-submit-patches ??

Another recommendation is to use the latest stable branch 1.14
Or, the development branch, master.

Questions:

1\ did you tried with intel-vaapi-driver? 

2\ since this is a patch that affects all the elements, did you test it thoroughly with all the encoders and decoders?
Comment 2 Fei 2018-06-06 08:45:13 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #1)
> Hi Tianhao,
> 
> Thanks for the patch. Though it is not correctly formatted. Could you please
> follow the recommendations here
> https://gstreamer.freedesktop.org/documentation/contribute/index.html#how-to-
> submit-patches ??
> 
> Another recommendation is to use the latest stable branch 1.14
> Or, the development branch, master.
> 
> Questions:
> 
> 1\ did you tried with intel-vaapi-driver? 
> 
> 2\ since this is a patch that affects all the elements, did you test it
> thoroughly with all the encoders and decoders?

@Victor, I picked up 1~2 case for each elements, and it looks good. And the patch also can work with vaapi-driver.
Comment 3 Tianhao 2018-06-07 01:47:36 UTC
Created attachment 372585 [details] [review]
Fix jpeg decode image display nothing.
Comment 4 Tianhao 2018-06-07 03:06:44 UTC
As your recommendation, run this cases on the latest stable branch 1.14 and the development branch, master, the issue still can be reproduced.
The vabuffer of slice data is released before vaEndPicture, driver may or may not store the data to its internal buffer when call vaRenderPicture.If not store the data, how dose driver decode bit stream? Assuming driver will store slice data to its internal buffer seems not be reasonable.
Comment 5 Víctor Manuel Jáquez Leal 2018-06-07 14:40:53 UTC
Review of attachment 372585 [details] [review]:

The commit message is wrong:

the patch is unrelated with vaapijpegdec, but with "libs: decoder: ..."

later, there is not a reason to do this change

does the spec say that?
does it make sense in general? 
is it safer?

::: gst-libs/gst/vaapi/gstvaapidecoder_objects.c
@@ +311,3 @@
+  for (i = 0; i < picture->slices->len; i++) {
+    GstVaapiSlice *const slice = g_ptr_array_index (picture->slices, i);
+    if (slice->param_id != VA_INVALID_ID) {

there  is no need to check if the param_id is not invalid, since vaapi_destroy_buffer() already do it.

@@ +313,3 @@
+    if (slice->param_id != VA_INVALID_ID) {
+      vaapi_destroy_buffer (va_display, &slice->param_id);
+      slice->param_id = VA_INVALID_ID;

there is no need to set param_id to invalid since vaapi_destroy_buffer() do it too

@@ +317,3 @@
+    if (slice->data_id != VA_INVALID_ID) {
+      vaapi_destroy_buffer (va_display, &slice->data_id);
+      slice->data_id = VA_INVALID_ID;

here the same too
Comment 6 Tianhao 2018-06-08 02:50:39 UTC
Created attachment 372598 [details] [review]
Fix jpeg decode image display nothing.

It is safer and more reasonable to release buffer after vaEndPicture instead of before. Because some buffers will be passed into GPU when call vaEndPicture, are not necessary to copy into driver internal buffer.
Comment 7 Víctor Manuel Jáquez Leal 2018-06-08 05:17:30 UTC
Review of attachment 372598 [details] [review]:

::: gst-libs/gst/vaapi/gstvaapidecoder_objects.c
@@ +312,2 @@
   status = vaEndPicture (va_display, va_context);
+

you forgot to add in the patch the removal of the vaapi_destroy_buffer (va_display, ...); in the vaRenderPicture() block
Comment 8 Tianhao 2018-06-08 05:41:09 UTC
Created attachment 372599 [details] [review]
Fix jpeg decode image display nothing.
Comment 9 Víctor Manuel Jáquez Leal 2018-06-08 10:53:21 UTC
I have changed the log message.

Attachment 372599 [details] pushed as bb8894aa - libs: decoder: release VA buffers after vaEndPicture