From: Julien Isorce Date: Thu, 2 May 2019 22:36:04 +0000 (-0700) Subject: st/va: check resource_get_info nullity in vlVaDeriveImage X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8cd71f399e73c5d87e9162cc74da76e317a9f41f;p=mesa.git st/va: check resource_get_info nullity in vlVaDeriveImage This pipe_screen function is not implemented by all backends. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110443 Signed-off-by: Julien Isorce Reviewed-by: Leo Liu --- diff --git a/src/gallium/state_trackers/va/image.c b/src/gallium/state_trackers/va/image.c index 491c2d82858..d4b9ce5596d 100644 --- a/src/gallium/state_trackers/va/image.c +++ b/src/gallium/state_trackers/va/image.c @@ -251,23 +251,26 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image) } mtx_lock(&drv->mutex); - screen->resource_get_info(screen, surfaces[0]->texture, &stride, &offset); - if (!stride) - offset = 0; + if (screen->resource_get_info) { + screen->resource_get_info(screen, surfaces[0]->texture, &stride, + &offset); + if (!stride) + offset = 0; + } switch (img->format.fourcc) { case VA_FOURCC('U','Y','V','Y'): case VA_FOURCC('Y','U','Y','V'): - assert(stride >= (w * 2)); img->pitches[0] = stride > 0 ? stride : w * 2; + assert(img->pitches[0] >= (w * 2)); break; case VA_FOURCC('B','G','R','A'): case VA_FOURCC('R','G','B','A'): case VA_FOURCC('B','G','R','X'): case VA_FOURCC('R','G','B','X'): - assert(stride >= (w * 4)); img->pitches[0] = stride > 0 ? stride : w * 4; + assert(img->pitches[0] >= (w * 4)); break; default: