diff --git a/src/surface.c b/src/surface.c index 0b8f802..31cba3c 100644 --- a/src/surface.c +++ b/src/surface.c @@ -118,10 +118,20 @@ VAStatus RequestCreateSurfaces2(VADriverContextP context, unsigned int format, capture_type = v4l2_type_video_capture(video_format->v4l2_mplane); - rc = v4l2_set_format(driver_data->video_fd, capture_type, - video_format->v4l2_format, width, height); - if (rc < 0) - return VA_STATUS_ERROR_OPERATION_FAILED; + /* + * Do not VIDIOC_S_FMT on the CAPTURE queue. The hantro + * stateless decoder derives the CAPTURE format from the + * SPS attached to the OUTPUT request; explicitly setting + * it here can put the driver into an inconsistent state. + * GStreamer's v4l2slh264dec only G_FMTs CAPTURE (see + * gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.c:: + * gst_v4l2_decoder_negotiate_src_format), and that + * variant produces correct decoded NV12 on the same + * hardware where this driver currently emits zeros. + * + * v4l2_get_format() below queries the driver's current + * state and gives us the bytesperline/sizes we need. + */ } else { video_format = driver_data->video_format; capture_type = v4l2_type_video_capture(video_format->v4l2_mplane);