Skip to content

Commit

Permalink
Merge pull request #208 from thesword53/fix-getimage
Browse files Browse the repository at this point in the history
Fix CUDA_ERROR_INVALID_CONTEXT from cuMemcpy2D
  • Loading branch information
elFarto authored May 19, 2023
2 parents 4726a8a + 053eb8a commit 5ad7fae
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vabackend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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;
}
Expand Down

0 comments on commit 5ad7fae

Please sign in to comment.