diff --git a/.pick_status.json b/.pick_status.json index c9d75b93813..fcaca36af54 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2214,7 +2214,7 @@ "description": "frontends/va: Don't allow Render/EndPicture without BeginPicture", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/frontends/va/picture.c b/src/gallium/frontends/va/picture.c index 25d45c59d5a..783d219d331 100644 --- a/src/gallium/frontends/va/picture.c +++ b/src/gallium/frontends/va/picture.c @@ -1005,6 +1005,11 @@ vlVaRenderPicture(VADriverContextP ctx, VAContextID context_id, VABufferID *buff return VA_STATUS_ERROR_INVALID_CONTEXT; } + if (!context->target_id) { + mtx_unlock(&drv->mutex); + return VA_STATUS_ERROR_OPERATION_FAILED; + } + /* Always process VAProtectedSliceDataBufferType first because it changes the state */ for (i = 0; i < num_buffers; ++i) { vlVaBuffer *buf = handle_table_get(drv->htab, buffers[i]); @@ -1155,6 +1160,14 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) return VA_STATUS_ERROR_INVALID_CONTEXT; } + if (!context->target_id) { + mtx_unlock(&drv->mutex); + return VA_STATUS_ERROR_OPERATION_FAILED; + } + + output_id = context->target_id; + context->target_id = 0; + if (!context->decoder) { if (context->templat.profile != PIPE_VIDEO_PROFILE_UNKNOWN) { mtx_unlock(&drv->mutex); @@ -1166,7 +1179,6 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) return VA_STATUS_SUCCESS; } - output_id = context->target_id; out_target = &context->target; apply_av1_fg = vlVaQueryApplyFilmGrainAV1(context, &output_id, &out_target);