pipe_mutex_lock(dev->mutex);
- vl_compositor_init_state(&vmixer->cstate, dev->context);
+ if (!vl_compositor_init_state(&vmixer->cstate, dev->context)) {
+ ret = VDP_STATUS_ERROR;
+ goto no_compositor_state;
+ }
vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_BT_601, NULL, true, &vmixer->csc);
- if (!debug_get_bool_option("G3DVL_NO_CSC", FALSE))
- vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc, 1.0f, 0.0f);
+ if (!debug_get_bool_option("G3DVL_NO_CSC", FALSE)) {
+ if (!vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc, 1.0f, 0.0f)) {
+ ret = VDP_STATUS_ERROR;
+ goto err_csc_matrix;
+ }
+ }
*mixer = vlAddDataHTAB(vmixer);
if (*mixer == 0) {
vlRemoveDataHTAB(*mixer);
no_handle:
+err_csc_matrix:
vl_compositor_cleanup_state(&vmixer->cstate);
+no_compositor_state:
pipe_mutex_unlock(dev->mutex);
DeviceReference(&vmixer->device, NULL);
FREE(vmixer);
case VDP_VIDEO_MIXER_FEATURE_LUMA_KEY:
vmixer->luma_key.enabled = feature_enables[i];
if (!debug_get_bool_option("G3DVL_NO_CSC", FALSE))
- vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc,
- vmixer->luma_key.luma_min, vmixer->luma_key.luma_max);
+ if (!vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc,
+ vmixer->luma_key.luma_min, vmixer->luma_key.luma_max)) {
+ pipe_mutex_unlock(vmixer->device->mutex);
+ return VDP_STATUS_ERROR;
+ }
break;
case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1:
else
memcpy(vmixer->csc, vdp_csc, sizeof(vl_csc_matrix));
if (!debug_get_bool_option("G3DVL_NO_CSC", FALSE))
- vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc,
- vmixer->luma_key.luma_min, vmixer->luma_key.luma_max);
+ if (!vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc,
+ vmixer->luma_key.luma_min, vmixer->luma_key.luma_max)) {
+ ret = VDP_STATUS_ERROR;
+ goto fail;
+ }
break;
case VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL:
}
vmixer->luma_key.luma_min = val;
if (!debug_get_bool_option("G3DVL_NO_CSC", FALSE))
- vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc,
- vmixer->luma_key.luma_min, vmixer->luma_key.luma_max);
+ if (!vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc,
+ vmixer->luma_key.luma_min, vmixer->luma_key.luma_max)) {
+ ret = VDP_STATUS_ERROR;
+ goto fail;
+ }
break;
case VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MAX_LUMA:
}
vmixer->luma_key.luma_max = val;
if (!debug_get_bool_option("G3DVL_NO_CSC", FALSE))
- vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc,
- vmixer->luma_key.luma_min, vmixer->luma_key.luma_max);
+ if (!vl_compositor_set_csc_matrix(&vmixer->cstate, (const vl_csc_matrix *)&vmixer->csc,
+ vmixer->luma_key.luma_min, vmixer->luma_key.luma_max)) {
+ ret = VDP_STATUS_ERROR;
+ goto fail;
+ }
break;
case VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL:
pipe_resource_reference(&res, NULL);
- vl_compositor_init_state(&vlsurface->cstate, pipe);
+ if (!vl_compositor_init_state(&vlsurface->cstate, pipe))
+ goto err_resource;
+
vl_compositor_reset_dirty_area(&vlsurface->dirty_area);
pipe_mutex_unlock(dev->mutex);
if (!csc_matrix) {
vl_csc_matrix csc;
vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_BT_601, NULL, 1, &csc);
- vl_compositor_set_csc_matrix(cstate, (const vl_csc_matrix*)&csc, 1.0f, 0.0f);
+ if (!vl_compositor_set_csc_matrix(cstate, (const vl_csc_matrix*)&csc, 1.0f, 0.0f))
+ goto err_csc_matrix;
} else {
- vl_compositor_set_csc_matrix(cstate, csc_matrix, 1.0f, 0.0f);
+ if (!vl_compositor_set_csc_matrix(cstate, csc_matrix, 1.0f, 0.0f))
+ goto err_csc_matrix;
}
vl_compositor_clear_layers(cstate);
pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_OK;
+err_csc_matrix:
+ vbuffer->destroy(vbuffer);
+ pipe_mutex_unlock(vlsurface->device->mutex);
+ return VDP_STATUS_ERROR;
}
static unsigned