|
@@ -5,6 +5,9 @@
|
|
|
|
|
|
#include "msm_vidc_fence.h"
|
|
#include "msm_vidc_fence.h"
|
|
#include "msm_vidc_debug.h"
|
|
#include "msm_vidc_debug.h"
|
|
|
|
+#include "msm_vidc_driver.h"
|
|
|
|
+
|
|
|
|
+extern struct msm_vidc_core *g_core;
|
|
|
|
|
|
static const char *msm_vidc_dma_fence_get_driver_name(struct dma_fence *df)
|
|
static const char *msm_vidc_dma_fence_get_driver_name(struct dma_fence *df)
|
|
{
|
|
{
|
|
@@ -92,6 +95,18 @@ int msm_vidc_create_fence_fd(struct msm_vidc_inst *inst,
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Acquire inst->lock for fence fd creation
|
|
|
|
+ * to avoid sync_file_create() and sync_file_poll()
|
|
|
|
+ * race conditions in e2e playback usecase.
|
|
|
|
+ */
|
|
|
|
+ inst = get_inst_ref(g_core, inst);
|
|
|
|
+ if (!inst) {
|
|
|
|
+ d_vpr_e("%s: invalid params\n", __func__);
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+ inst_lock(inst, __func__);
|
|
|
|
+
|
|
fence->fd = get_unused_fd_flags(0);
|
|
fence->fd = get_unused_fd_flags(0);
|
|
if (fence->fd < 0) {
|
|
if (fence->fd < 0) {
|
|
i_vpr_e(inst, "%s: getting fd (%d) failed\n", __func__,
|
|
i_vpr_e(inst, "%s: getting fd (%d) failed\n", __func__,
|
|
@@ -109,11 +124,16 @@ int msm_vidc_create_fence_fd(struct msm_vidc_inst *inst,
|
|
|
|
|
|
i_vpr_l(inst, "%s: created fd %d for fence %s\n", __func__,
|
|
i_vpr_l(inst, "%s: created fd %d for fence %s\n", __func__,
|
|
fence->fd, fence->name);
|
|
fence->fd, fence->name);
|
|
- return rc;
|
|
|
|
|
|
+
|
|
|
|
+ inst_unlock(inst, __func__);
|
|
|
|
+ put_inst(inst);
|
|
|
|
+ return 0;
|
|
|
|
|
|
err_sync_file:
|
|
err_sync_file:
|
|
put_unused_fd(fence->fd);
|
|
put_unused_fd(fence->fd);
|
|
err_fd:
|
|
err_fd:
|
|
|
|
+ inst_unlock(inst, __func__);
|
|
|
|
+ put_inst(inst);
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|