From 053eb8a7432f3bc74af86bd1d9e034085c32edbb Mon Sep 17 00:00:00 2001 From: Jean-Christophe WAHL Date: Fri, 19 May 2023 17:03:28 +0200 Subject: [PATCH] Fix CUDA context in nvGetImage --- src/vabackend.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vabackend.c b/src/vabackend.c index f2080ee..86cf801 100644 --- a/src/vabackend.c +++ b/src/vabackend.c @@ -1571,6 +1571,7 @@ static VAStatus nvGetImage( //wait for the surface to be decoded nvSyncSurface(ctx, surface); + CHECK_CUDA_RESULT_RETURN(cu->cuCtxPushCurrent(drv->cudaContext), VA_STATUS_ERROR_OPERATION_FAILED); for (uint32_t i = 0; i < fmtInfo->numPlanes; i++) { const NVFormatPlane *p = &fmtInfo->plane[i]; CUDA_MEMCPY2D memcpy2d = { @@ -1595,6 +1596,7 @@ static VAStatus nvGetImage( } offset += ((width * height) >> (p->ss.x + p->ss.y)) * fmtInfo->bppc * p->channelCount; } + CHECK_CUDA_RESULT_RETURN(cu->cuCtxPopCurrent(NULL), VA_STATUS_ERROR_OPERATION_FAILED); return VA_STATUS_SUCCESS; }