File npv/TODO changed (mode: 100644) (index 8d590d7..57e3367) |
1 |
1 |
not ordered: |
not ordered: |
2 |
2 |
- we were lied to: presentation/decoding timestamps from a demuxer can be |
- we were lied to: presentation/decoding timestamps from a demuxer can be |
3 |
3 |
discontinuous without any warning. |
discontinuous without any warning. |
4 |
|
- "buffering" indicatorr? subtitles? |
|
5 |
4 |
- forced monotonic video frame selection? may be, probably, more robust in |
- forced monotonic video frame selection? may be, probably, more robust in |
6 |
5 |
regard to latency spikes. |
regard to latency spikes. |
|
6 |
|
- "buffering" indicator (no)? subtitles (mmmmh...)? |
7 |
7 |
- use vulkan shaders (no glsl or hlsl), compute or not, in order to perform |
- use vulkan shaders (no glsl or hlsl), compute or not, in order to perform |
8 |
8 |
some yuvX pixel formats to srgb format conversions. do NOT use the vulkan |
some yuvX pixel formats to srgb format conversions. do NOT use the vulkan |
9 |
9 |
yuvX samplers as they are mostly dirty hack tricks built into spirv |
yuvX samplers as they are mostly dirty hack tricks built into spirv |
File npv/nyanvk/consts.h changed (mode: 100644) (index 1094587..522aad5) |
... |
... |
enum { |
43 |
43 |
vk_struct_type_dev_create_info = 3, |
vk_struct_type_dev_create_info = 3, |
44 |
44 |
vk_struct_type_submit_info = 4, |
vk_struct_type_submit_info = 4, |
45 |
45 |
vk_struct_type_mem_alloc_info = 5, |
vk_struct_type_mem_alloc_info = 5, |
|
46 |
|
vk_struct_type_fence_create_info = 8, |
46 |
47 |
vk_struct_type_sem_create_info = 9, |
vk_struct_type_sem_create_info = 9, |
47 |
48 |
vk_struct_type_img_create_info = 14, |
vk_struct_type_img_create_info = 14, |
48 |
49 |
vk_struct_type_imgview_create_info = 15, |
vk_struct_type_imgview_create_info = 15, |
|
... |
... |
enum { |
295 |
296 |
vk_front_face_clockwise = 1, |
vk_front_face_clockwise = 1, |
296 |
297 |
vk_front_face_enum_max = 0x7fffffff |
vk_front_face_enum_max = 0x7fffffff |
297 |
298 |
}; |
}; |
|
299 |
|
enum { |
|
300 |
|
vk_fence_create_signaled_bit = 0x00000001, |
|
301 |
|
vk_fence_create_flag_bits_enum_max = 0x7fffffff |
|
302 |
|
}; |
298 |
303 |
#endif |
#endif |
File npv/video/local/code.frag.c changed (mode: 100644) (index 285cfab..48ef6ab) |
... |
... |
STATIC void img_mem_barrier_run_once(struct vk_img_mem_barrier_t *b) |
119 |
119 |
submit_info.type = vk_struct_type_submit_info; |
submit_info.type = vk_struct_type_submit_info; |
120 |
120 |
submit_info.cbs_n = 1; |
submit_info.cbs_n = 1; |
121 |
121 |
submit_info.cbs = &npv_vk_surf_p.dev.cbs[0]; |
submit_info.cbs = &npv_vk_surf_p.dev.cbs[0]; |
122 |
|
vk_q_submit(&submit_info); |
|
|
122 |
|
vk_q_submit(&submit_info, 0); |
123 |
123 |
IF_FATALVVK("%d:queue:%p:unable to submit the initial layout transition command buffer\n", r, npv_vk_surf_p.dev.q); |
IF_FATALVVK("%d:queue:%p:unable to submit the initial layout transition command buffer\n", r, npv_vk_surf_p.dev.q); |
124 |
124 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
125 |
125 |
vk_q_wait_idle(); |
vk_q_wait_idle(); |
|
... |
... |
STATIC void blit_setup(u8 swpchn_img) |
528 |
528 |
IF_FATALVVK("%d:swapchain img:%u:command buffer:%p:unable to end recording\n", r, swpchn_img, npv_vk_surf_p.dev.cbs[swpchn_img]); |
IF_FATALVVK("%d:swapchain img:%u:command buffer:%p:unable to end recording\n", r, swpchn_img, npv_vk_surf_p.dev.cbs[swpchn_img]); |
529 |
529 |
blit_l[swpchn_img].update_requested = false; |
blit_l[swpchn_img].update_requested = false; |
530 |
530 |
} |
} |
531 |
|
/*NSPC*/ |
|
532 |
531 |
STATIC void blits_request_update(void) |
STATIC void blits_request_update(void) |
533 |
532 |
{ |
{ |
534 |
533 |
u8 i; |
u8 i; |
|
... |
... |
STATIC void blits_request_update(void) |
541 |
540 |
++i; |
++i; |
542 |
541 |
} |
} |
543 |
542 |
} |
} |
|
543 |
|
STATIC bool are_sems_available(void) |
|
544 |
|
{ |
|
545 |
|
s32 r; |
|
546 |
|
/* coarse synchronization (we could use a pool of semaphores/fences) */ |
|
547 |
|
vk_get_fence_status(); |
|
548 |
|
if (r == vk_not_ready) |
|
549 |
|
return false; |
|
550 |
|
else if (r != vk_success) |
|
551 |
|
npv_vk_fatal("%d:device:%p:unable to get fence %p status\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence); |
|
552 |
|
/* vk_success */ |
|
553 |
|
vk_reset_fences(); |
|
554 |
|
IF_FATALVVK("%d:device:%p:unable to reset the fence\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence); |
|
555 |
|
return true; |
|
556 |
|
} |
544 |
557 |
#define READY 0 |
#define READY 0 |
545 |
558 |
#define NOT_READY 1 |
#define NOT_READY 1 |
546 |
559 |
STATIC u8 swpchn_next_img(u32 *swpchn_img) { loop |
STATIC u8 swpchn_next_img(u32 *swpchn_img) { loop |
|
... |
... |
STATIC u8 swpchn_next_img(u32 *swpchn_img) { loop |
554 |
567 |
info.timeout = 0; |
info.timeout = 0; |
555 |
568 |
info.devs = 0x00000001; /* no device group then 1 */ |
info.devs = 0x00000001; /* no device group then 1 */ |
556 |
569 |
info.sem = npv_vk_surf_p.dev.sems[npv_vk_sem_acquire_img_done]; |
info.sem = npv_vk_surf_p.dev.sems[npv_vk_sem_acquire_img_done]; |
|
570 |
|
/* |
|
571 |
|
* XXX: for this vk func, the wait sem _MUST_ be unsignaled _AND_ have |
|
572 |
|
* all its "wait" operations completed. state we secure with our usage |
|
573 |
|
* of a fence. |
|
574 |
|
*/ |
557 |
575 |
vk_acquire_next_img(&info, swpchn_img); |
vk_acquire_next_img(&info, swpchn_img); |
558 |
576 |
if (r == vk_not_ready) |
if (r == vk_not_ready) |
559 |
577 |
return NOT_READY; |
return NOT_READY; |
|
... |
... |
STATIC u8 send_to_pe(u32 swpchn_img) |
581 |
599 |
memset(&submit_info, 0, sizeof(submit_info)); |
memset(&submit_info, 0, sizeof(submit_info)); |
582 |
600 |
submit_info.type = vk_struct_type_submit_info; |
submit_info.type = vk_struct_type_submit_info; |
583 |
601 |
submit_info.wait_sems_n = 1; |
submit_info.wait_sems_n = 1; |
|
602 |
|
/* |
|
603 |
|
* the "semaphore wait operation" will unsignal this semaphore once the |
|
604 |
|
* "wait" is done. |
|
605 |
|
*/ |
584 |
606 |
submit_info.wait_sems = |
submit_info.wait_sems = |
585 |
607 |
&npv_vk_surf_p.dev.sems[npv_vk_sem_acquire_img_done]; |
&npv_vk_surf_p.dev.sems[npv_vk_sem_acquire_img_done]; |
586 |
608 |
wait_dst_stage = vk_pl_stage_bottom_of_pipe_bit; |
wait_dst_stage = vk_pl_stage_bottom_of_pipe_bit; |
|
... |
... |
STATIC u8 send_to_pe(u32 swpchn_img) |
589 |
611 |
submit_info.cbs = &npv_vk_surf_p.dev.cbs[swpchn_img]; |
submit_info.cbs = &npv_vk_surf_p.dev.cbs[swpchn_img]; |
590 |
612 |
submit_info.signal_sems_n = 1; |
submit_info.signal_sems_n = 1; |
591 |
613 |
submit_info.signal_sems = &npv_vk_surf_p.dev.sems[npv_vk_sem_blit_done]; |
submit_info.signal_sems = &npv_vk_surf_p.dev.sems[npv_vk_sem_blit_done]; |
592 |
|
vk_q_submit(&submit_info); |
|
|
614 |
|
/* XXX: coarse synchronization happens here */ |
|
615 |
|
vk_q_submit(&submit_info, npv_vk_surf_p.dev.fence); |
593 |
616 |
IF_FATALVVK("%d:queue:%p:unable to submit the image pre-recorded command buffer\n", r, npv_vk_surf_p.dev.q); |
IF_FATALVVK("%d:queue:%p:unable to submit the image pre-recorded command buffer\n", r, npv_vk_surf_p.dev.q); |
594 |
617 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
595 |
618 |
idxs[0] = swpchn_img; |
idxs[0] = swpchn_img; |
596 |
619 |
memset(&present_info, 0, sizeof(present_info)); |
memset(&present_info, 0, sizeof(present_info)); |
597 |
620 |
present_info.type = vk_struct_type_present_info; |
present_info.type = vk_struct_type_present_info; |
|
621 |
|
/* |
|
622 |
|
* the "semaphore wait operation" will unsignal this semaphore once the |
|
623 |
|
* "wait" is done. |
|
624 |
|
*/ |
598 |
625 |
present_info.wait_sems_n = 1; |
present_info.wait_sems_n = 1; |
599 |
626 |
present_info.wait_sems = &npv_vk_surf_p.dev.sems[npv_vk_sem_blit_done]; |
present_info.wait_sems = &npv_vk_surf_p.dev.sems[npv_vk_sem_blit_done]; |
600 |
627 |
present_info.swpchns_n = 1; |
present_info.swpchns_n = 1; |
File npv/video/namespace/main.c changed (mode: 100644) (index 7844aa7..2780159) |
4 |
4 |
#define avutil_video_fr_ref_alloc av_frame_alloc |
#define avutil_video_fr_ref_alloc av_frame_alloc |
5 |
5 |
#define avutil_video_fr_unref av_frame_unref |
#define avutil_video_fr_unref av_frame_unref |
6 |
6 |
/*----------------------------------------------------------------------------*/ |
/*----------------------------------------------------------------------------*/ |
|
7 |
|
#define are_sems_available npv_video_are_sems_available |
7 |
8 |
#define blit_compute_offsets npv_video_blit_compute_offsets |
#define blit_compute_offsets npv_video_blit_compute_offsets |
8 |
9 |
#define blit_l npv_video_blit_l |
#define blit_l npv_video_blit_l |
9 |
10 |
#define blit_vp_t npv_video_blit_vp_t |
#define blit_vp_t npv_video_blit_vp_t |
10 |
11 |
#define blit_setup npv_video_blit_setup |
#define blit_setup npv_video_blit_setup |
|
12 |
|
#define blit_request npv_video_blits_request |
11 |
13 |
#define dec_a_grow npv_video_dec_a_grow |
#define dec_a_grow npv_video_dec_a_grow |
12 |
14 |
#define dec_ctx_mutex_l npv_video_dec_ctx_mutex_l |
#define dec_ctx_mutex_l npv_video_dec_ctx_mutex_l |
13 |
15 |
#define dec_l npv_video_dec_l |
#define dec_l npv_video_dec_l |
|
49 |
51 |
#undef avutil_video_fr_ref_alloc |
#undef avutil_video_fr_ref_alloc |
50 |
52 |
#undef avutil_video_fr_unref |
#undef avutil_video_fr_unref |
51 |
53 |
/*----------------------------------------------------------------------------*/ |
/*----------------------------------------------------------------------------*/ |
|
54 |
|
#undef are_sems_available |
52 |
55 |
#undef blit_compute_offsets |
#undef blit_compute_offsets |
53 |
56 |
#undef blit_l |
#undef blit_l |
54 |
57 |
#undef blit_vp_t |
#undef blit_vp_t |
55 |
58 |
#undef blit_setup |
#undef blit_setup |
|
59 |
|
#undef blit_request |
56 |
60 |
#undef dec_a_grow |
#undef dec_a_grow |
57 |
61 |
#undef dec_ctx_mutex_l |
#undef dec_ctx_mutex_l |
58 |
62 |
#undef dec_l |
#undef dec_l |
File npv/vk/api_usage.h changed (mode: 100644) (index 8ee52a2..5d59ce4) |
... |
... |
r = npv_vk_surf_p.dev.dl_vk_end_cb(__VA_ARGS__) |
63 |
63 |
#define vk_cmd_pl_barrier(cb, b) \ |
#define vk_cmd_pl_barrier(cb, b) \ |
64 |
64 |
npv_vk_surf_p.dev.dl_vk_cmd_pl_barrier(cb, vk_pl_stage_top_of_pipe_bit, vk_pl_stage_top_of_pipe_bit, 0, 0, 0, 0, 0, 1, b) |
npv_vk_surf_p.dev.dl_vk_cmd_pl_barrier(cb, vk_pl_stage_top_of_pipe_bit, vk_pl_stage_top_of_pipe_bit, 0, 0, 0, 0, 0, 1, b) |
65 |
65 |
|
|
66 |
|
#define vk_q_submit(info) \ |
|
67 |
|
r = npv_vk_surf_p.dev.dl_vk_q_submit(npv_vk_surf_p.dev.q, 1, info, 0) |
|
|
66 |
|
#define vk_q_submit(info, fence) \ |
|
67 |
|
r = npv_vk_surf_p.dev.dl_vk_q_submit(npv_vk_surf_p.dev.q, 1, info, fence) |
68 |
68 |
|
|
69 |
69 |
#define vk_q_wait_idle() \ |
#define vk_q_wait_idle() \ |
70 |
70 |
r = npv_vk_surf_p.dev.dl_vk_q_wait_idle(npv_vk_surf_p.dev.q) |
r = npv_vk_surf_p.dev.dl_vk_q_wait_idle(npv_vk_surf_p.dev.q) |
|
... |
... |
r = npv_vk_surf_p.dev.dl_vk_q_present(npv_vk_surf_p.dev.q, info) |
90 |
90 |
r = npv_vk_surf_p.dev.dl_vk_create_sem(npv_vk_surf_p.dev.vk, info, 0, sem) |
r = npv_vk_surf_p.dev.dl_vk_create_sem(npv_vk_surf_p.dev.vk, info, 0, sem) |
91 |
91 |
|
|
92 |
92 |
#define vk_cmd_clr_color_img npv_vk_surf_p.dev.dl_vk_cmd_clr_color_img |
#define vk_cmd_clr_color_img npv_vk_surf_p.dev.dl_vk_cmd_clr_color_img |
|
93 |
|
|
|
94 |
|
#define vk_create_fence(info) \ |
|
95 |
|
r = npv_vk_surf_p.dev.dl_vk_create_fence(npv_vk_surf_p.dev.vk, info, 0, &npv_vk_surf_p.dev.fence) |
|
96 |
|
|
|
97 |
|
#define vk_get_fence_status() \ |
|
98 |
|
r = npv_vk_surf_p.dev.dl_vk_get_fence_status(npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence) |
|
99 |
|
|
|
100 |
|
#define vk_reset_fences() \ |
|
101 |
|
r = npv_vk_surf_p.dev.dl_vk_reset_fences(npv_vk_surf_p.dev.vk, 1, &npv_vk_surf_p.dev.fence) |
93 |
102 |
/******************************************************************************/ |
/******************************************************************************/ |
94 |
103 |
/* cherry picked from nyanvk/syms_global.h */ |
/* cherry picked from nyanvk/syms_global.h */ |
95 |
104 |
#define VK_GLOBAL_SYMS \ |
#define VK_GLOBAL_SYMS \ |
File npv/vk/local/code.frag.c changed (mode: 100644) (index f996199..19afef6) |
... |
... |
STATIC void dev_syms(void) |
84 |
84 |
DEV_SYM(vkQueuePresentKHR, vk_q_present); |
DEV_SYM(vkQueuePresentKHR, vk_q_present); |
85 |
85 |
DEV_SYM(vkCreateSemaphore, vk_create_sem); |
DEV_SYM(vkCreateSemaphore, vk_create_sem); |
86 |
86 |
DEV_SYM(vkCmdClearColorImage, vk_cmd_clr_color_img); |
DEV_SYM(vkCmdClearColorImage, vk_cmd_clr_color_img); |
|
87 |
|
DEV_SYM(vkCreateFence, vk_create_fence); |
|
88 |
|
DEV_SYM(vkGetFenceStatus, vk_get_fence_status); |
|
89 |
|
DEV_SYM(vkResetFences, vk_reset_fences); |
87 |
90 |
} |
} |
88 |
91 |
#undef DEVICE_SYM |
#undef DEVICE_SYM |
89 |
92 |
/*----------------------------------------------------------------------------*/ |
/*----------------------------------------------------------------------------*/ |
|
... |
... |
STATIC void sems_create(void) |
888 |
891 |
++sem; |
++sem; |
889 |
892 |
} |
} |
890 |
893 |
} |
} |
|
894 |
|
STATIC void fence_create(void) |
|
895 |
|
{ |
|
896 |
|
s32 r; |
|
897 |
|
struct vk_fence_create_info_t info; |
|
898 |
|
|
|
899 |
|
memset(&info, 0, sizeof(info)); |
|
900 |
|
info.type = vk_struct_type_fence_create_info; |
|
901 |
|
info.flags = vk_fence_create_signaled_bit; |
|
902 |
|
vk_create_fence(&info); |
|
903 |
|
IF_FATALVK("%d:device:%p:unable to create the synchronization fence\n", r, surf_p.dev.vk); |
|
904 |
|
pout("device:%p:synchronization fence created %p\n", surf_p.dev.vk, surf_p.dev.fence); |
|
905 |
|
} |
891 |
906 |
STATIC void swpchn_imgs_cbs_init_once(void) |
STATIC void swpchn_imgs_cbs_init_once(void) |
892 |
907 |
{ |
{ |
893 |
908 |
s32 r; |
s32 r; |