History

hwcontext_vulkan: add PREP_MODE_GENERAL for non-transfer_dst images

Vulkan filters don't need images which can be transferred into.

Lynne committed 2 years ago

Commit c41ef7f1 parent 66e950f1 file · +8 −1Browse files

Unified · Split

libavutil/hwcontext_vulkan.c+8−1
@@ -2187,6 +2187,7 @@ static int alloc_bind_mem(AVHWFramesContext *hwfc, AVVkFrame *f, · 2186 unmodified lines
21872187 }
21882188
21892189 enum PrepMode {
2190+ PREP_MODE_GENERAL,
21902191 PREP_MODE_WRITE,
21912192 PREP_MODE_EXTERNAL_EXPORT,
21922193 PREP_MODE_EXTERNAL_IMPORT,
@@ -2232,6 +2233,10 @@ static int prepare_frame(AVHWFramesContext *hwfc, FFVkExecPool *ectx, · 39 unmodified lines
22322233 return err;
22332234
22342235 switch (pmode) {
2236+ case PREP_MODE_GENERAL:
2237+ new_layout = VK_IMAGE_LAYOUT_GENERAL;
2238+ new_access = VK_ACCESS_TRANSFER_WRITE_BIT;
2239+ break;
22352240 case PREP_MODE_WRITE:
22362241 new_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
22372242 new_access = VK_ACCESS_TRANSFER_WRITE_BIT;
@@ -2520,8 +2525,10 @@ static AVBufferRef *vulkan_pool_alloc(void *opaque, size_t size) · 282 unmodified lines
25202525 err = prepare_frame(hwfc, &fp->compute_exec, f, PREP_MODE_DECODING_DST);
25212526 else if (hwctx->usage & VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR)
25222527 err = prepare_frame(hwfc, &fp->compute_exec, f, PREP_MODE_ENCODING_DPB);
2523− else
2528+ else if (hwctx->usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT)
25242529 err = prepare_frame(hwfc, &fp->compute_exec, f, PREP_MODE_WRITE);
2530+ else
2531+ err = prepare_frame(hwfc, &fp->compute_exec, f, PREP_MODE_GENERAL);
25252532 if (err)
25262533 goto fail;
25272534

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t