diff options
author | Julien Isorce <[email protected]> | 2019-05-02 15:36:04 -0700 |
---|---|---|
committer | Julien Isorce <[email protected]> | 2019-05-03 16:11:55 -0700 |
commit | 8cd71f399e73c5d87e9162cc74da76e317a9f41f (patch) | |
tree | 268a31317c497fc1f10926ac6fce09754c98484d /src/gallium/state_trackers/va/image.c | |
parent | 30fa15e36b031f466106e45d39a6c5295a0530e7 (diff) |
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 <[email protected]>
Reviewed-by: Leo Liu <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/va/image.c')
-rw-r--r-- | src/gallium/state_trackers/va/image.c | 13 |
1 files changed, 8 insertions, 5 deletions
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: |