Commit 97b526c1 authored by Lynne's avatar Lynne

hwcontext_vulkan: only use one semaphore per image

The idea was to allow separate planes to be filtered independently, however,
in hindsight, literaly nothing uses separate per-plane semaphores and it
would only work when each plane is backed by separate device memory.
parent 3f9fd9dc
......@@ -390,32 +390,28 @@ int ff_vk_add_exec_dep(AVFilterContext *avctx, FFVkExecContext *e,
AVFrame *frame, VkPipelineStageFlagBits in_wait_dst_flag)
{
AVVkFrame *f = (AVVkFrame *)frame->data[0];
AVHWFramesContext *fc = (AVHWFramesContext *)frame->hw_frames_ctx->data;
int planes = av_pix_fmt_count_planes(fc->sw_format);
for (int i = 0; i < planes; i++) {
e->sem_wait = av_fast_realloc(e->sem_wait, &e->sem_wait_alloc,
(e->sem_wait_cnt + 1)*sizeof(*e->sem_wait));
if (!e->sem_wait)
return AVERROR(ENOMEM);
e->sem_wait = av_fast_realloc(e->sem_wait, &e->sem_wait_alloc,
(e->sem_wait_cnt + 1)*sizeof(*e->sem_wait));
if (!e->sem_wait)
return AVERROR(ENOMEM);
e->sem_wait_dst = av_fast_realloc(e->sem_wait_dst, &e->sem_wait_dst_alloc,
(e->sem_wait_cnt + 1)*sizeof(*e->sem_wait_dst));
if (!e->sem_wait_dst)
return AVERROR(ENOMEM);
e->sem_wait_dst = av_fast_realloc(e->sem_wait_dst, &e->sem_wait_dst_alloc,
(e->sem_wait_cnt + 1)*sizeof(*e->sem_wait_dst));
if (!e->sem_wait_dst)
return AVERROR(ENOMEM);
e->sem_sig = av_fast_realloc(e->sem_sig, &e->sem_sig_alloc,
(e->sem_sig_cnt + 1)*sizeof(*e->sem_sig));
if (!e->sem_sig)
return AVERROR(ENOMEM);
e->sem_sig = av_fast_realloc(e->sem_sig, &e->sem_sig_alloc,
(e->sem_sig_cnt + 1)*sizeof(*e->sem_sig));
if (!e->sem_sig)
return AVERROR(ENOMEM);
e->sem_wait[e->sem_wait_cnt] = f->sem[i];
e->sem_wait_dst[e->sem_wait_cnt] = in_wait_dst_flag;
e->sem_wait_cnt++;
e->sem_wait[e->sem_wait_cnt] = f->sem;
e->sem_wait_dst[e->sem_wait_cnt] = in_wait_dst_flag;
e->sem_wait_cnt++;
e->sem_sig[e->sem_sig_cnt] = f->sem[i];
e->sem_sig_cnt++;
}
e->sem_sig[e->sem_sig_cnt] = f->sem;
e->sem_sig_cnt++;
return 0;
}
......
This diff is collapsed.
......@@ -133,10 +133,10 @@ typedef struct AVVkFrame {
VkImageLayout layout[AV_NUM_DATA_POINTERS];
/**
* Per-image semaphores. Must not be freed manually. Must be waited on
* Per-frame semaphore. Must not be freed manually. Must be waited on
* and signalled at every queue submission.
*/
VkSemaphore sem[AV_NUM_DATA_POINTERS];
VkSemaphore sem;
/**
* Internal data.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment