libva icon indicating copy to clipboard operation
libva copied to clipboard

va_x11.c::va_DisplayContextGetNumCandidates always returns success

Open dmitry-polunin opened this issue 4 years ago • 1 comments

Problem was detected while investigating the crash when running GStreamer pipeline with vaapisink over SSH with X Forwarding.

VA_API version 1.8.0 LibVA 2.8.0

in va_x11.c

234 static VAStatus va_DisplayContextGetNumCandidates ( 
235     VADisplayContextP pDisplayContext,
236     int *num_candidates
237 )
238 {
239     VAStatus vaStatus;
240 
241     vaStatus = va_DRI2_GetNumCandidates(pDisplayContext, num_candidates);
242 
243     /* A call to va_DisplayContextGetDriverName will fallback to other
244      * methods (i.e. NVCTRL, FGLRX) when DRI2 is unsuccessful.  All of those
245      * fallbacks only have 1 candidate driver.
246      */
247     if (vaStatus != VA_STATUS_SUCCESS)
248       *num_candidates = 1;
249 
250     return VA_STATUS_SUCCESS;
251 }

va_DisplayContextGetNumCandidates always returns SUCCESS status even if the DRI2 is not authed. Seems like return status is not correct for this case.

dmitry-polunin avatar Feb 08 '21 12:02 dmitry-polunin

SSH with X Forwarding is not a local X, but the dri2 protocol only supports local rendering. The problem is, this check always succeeds even dri2 auth fails. The gstreamer as a middle level sw, just go on because no error reported and considers the init succeeds. Later, when it really call dri2's render functions, it will crash there.

HeJunyan avatar Feb 09 '21 08:02 HeJunyan