sylware / nyanmp (public) (License: AGPLv3) (since 2020-02-12) (hash sha1)
intended to become a collection of media players for gnu/linux based on ffmpeg, alsa, vulkan, x11, wayland, etc.
List of commits:
Subject Hash Author Date (UTC)
npv: fixes, sync cleanup 2e8935339971f099e42cab9f4142bf040d09b109 Sylvain BERTRAND 2024-09-30 13:56:03
npv:osd:smooth timer glyph rendering d6bed048741df610b9a4c5efb9c527bd792a6a2c Sylvain BERTRAND 2024-05-05 14:05:50
npv:osd:timer glyph size change 38787582262a2c4cd08d29384f928c3d86e500eb Sylvain BERTRAND 2024-05-04 22:43:43
epoll cfg done at the wrong time c275849395c9c772d293c0e02216ff3f94bd1899 Sylvain BERTRAND 2023-08-13 20:50:55
npv: my iap trash peering with twitch.tv wants more workaround ccdcd2048de11de3f78c8a6011824b2abdace92d Sylvain BERTRAND 2022-09-04 02:53:07
npv: move to a shared video/audio limit 53d5990ce4a87715a106095dde83e6658c3c1642 Sylvain BERTRAND 2022-08-30 17:58:39
npv: my iap hls peering with twitch.tv is accute trash 4ab8caadb41ac42482f8c7a43725054067674fe3 Sylvain BERTRAND 2022-08-30 17:17:21
npv: alsa, POLLERR is XRUN 73c89d6529123fca081c4f55d1a57eab4ede7b90 Sylvain BERTRAND 2022-06-30 15:43:27
npv: may help IAPs with bad peerings 7ec70f67d779a478f065f0e92259e52f8315d113 Sylvain BERTRAND 2022-06-30 15:42:47
move to new ffmpeg channel layout handling 938790d0c657278f405c4f57987d2274c5ada9b7 Sylvain BERTRAND 2022-03-20 22:18:01
npa: fine grained volume control 89279ea0c7dcaf7a718c9a57ecb6b08a0ccfbcb9 Sylvain BERTRAND 2022-02-15 23:24:36
npv: add fine grained volume control 06bc3b77b065f35f294659db520f66e7e8094c8c Sylvain BERTRAND 2022-02-15 18:47:34
npv: move to freetype SDF rendering 972a3027fec3b69a1e10405cc0da35b5194b6f46 Sylvain BERTRAND 2021-12-27 20:54:53
npv:osd:ascii only mode for the timer 3de3158fc3300f8a9c6f75fcca76b512331b8c2f Sylvain BERTRAND 2021-10-30 19:18:38
npv: default to dejavu instead of noto 708f3166a09fd7ba815ec47907cabfb1af4d26c5 Sylvain BERTRAND 2021-10-10 17:05:17
npv: live mode and ready the code for indicators.. if ever... 2d6ddb83edd6f08e99fbe01dc60a354b5e5a2afe Sylvain BERTRAND 2021-07-23 13:17:47
npv: don't block the muted state 0c29e9329ec5db6bed191b2b4caffff8166bd11f Sylvain BERTRAND 2021-07-21 21:34:37
npv: now we have enough perspective, make states internal 62f6b1bf62fc083762f036ddde1f29dd23baf814 Sylvain BERTRAND 2021-07-21 20:12:36
npv/npa: add gcc4 atomic support d9676b20984dcbfd8df4afbf85178c8ff4295e4f Sylvain BERTRAND 2021-06-18 15:04:01
npv: better reuse of ffmpeg references, stats 4bb1b9ab45609f8e5113cc7613ebc1d09499561b Sylvain BERTRAND 2021-05-20 18:24:32
Commit 2e8935339971f099e42cab9f4142bf040d09b109 - npv: fixes, sync cleanup
Author: Sylvain BERTRAND
Author date (UTC): 2024-09-30 13:56
Committer name: Sylvain BERTRAND
Committer date (UTC): 2024-09-30 13:56
Parent(s): d6bed048741df610b9a4c5efb9c527bd792a6a2c
Signer:
Signing key:
Signing status: N
Tree: 3c7c74fdf5901f9202922639c1a126b4f3eb719e
File Lines added Lines deleted
npv/local/code.frag.c 1 0
npv/nyanvk/syms_dev.h 17 11
npv/video/local/code.frag.c 36 41
npv/video/local/state.frag.c 0 1
npv/video/namespace/main.c 2 6
npv/video/public/code.frag.c 13 3
npv/vk/api_usage.h 14 9
npv/vk/local/code.frag.c 24 3
npv/vk/namespace/main.c 4 2
npv/vk/namespace/public.h 18 16
npv/vk/public/code.frag.c 2 1
npv/vk/public/state.frag.h 5 2
File npv/local/code.frag.c changed (mode: 100644) (index 2d98097..2220fc3)
... ... STATIC void evt_accumulate(struct epoll_event *evt, bool *have_evt_sigs,
158 158 if (evt->data.fd == sig_fd_l) { if (evt->data.fd == sig_fd_l) {
159 159 if ((evt->events & EPOLLIN) != 0) { if ((evt->events & EPOLLIN) != 0) {
160 160 *have_evt_sigs = true; *have_evt_sigs = true;
161 return;
161 162 } }
162 163 fatal("event loop wait:signal:unexpected event\n"); fatal("event loop wait:signal:unexpected event\n");
163 164 } }
File npv/nyanvk/syms_dev.h changed (mode: 100644) (index 8a8874f..41b3d3c)
175 175 u32 img_layout,\ u32 img_layout,\
176 176 union vk_clr_color_val_t *color,\ union vk_clr_color_val_t *color,\
177 177 u32 ranges_n,\ u32 ranges_n,\
178 struct vk_img_subrsrc_range_t *ranges); \
178 struct vk_img_subrsrc_range_t *ranges);\
179 179 s32 (*dl_vk_create_fence)(\ s32 (*dl_vk_create_fence)(\
180 struct vk_dev_t *dev, \
181 struct vk_fence_create_info_t *info, \
182 void * allocator, \
183 struct vk_fence_t **fence); \
180 struct vk_dev_t *dev,\
181 struct vk_fence_create_info_t *info,\
182 void * allocator,\
183 struct vk_fence_t **fence);\
184 184 s32 (*dl_vk_get_fence_status)(\ s32 (*dl_vk_get_fence_status)(\
185 struct vk_dev_t *dev, \
186 struct vk_fence_t *fence); \
187 s32 (*dl_vk_reset_fences)( \
188 struct vk_dev_t *dev, \
189 u32 fences_n, \
190 struct vk_fence_t **fences);
185 struct vk_dev_t *dev,\
186 struct vk_fence_t *fence);\
187 s32 (*dl_vk_reset_fences)(\
188 struct vk_dev_t *dev,\
189 u32 fences_n,\
190 struct vk_fence_t **fences);\
191 s32 (*dl_vk_wait_for_fences)(\
192 struct vk_dev_t *dev,\
193 u32 fences_n,\
194 struct vk_fence_t **fences,\
195 u32 wait_all,\
196 u64 timeout);
191 197 #endif #endif
File npv/video/local/code.frag.c changed (mode: 100644) (index f4b9a9f..03818ed)
... ... STATIC void init_once_local(void)
75 75 ++i; ++i;
76 76 } }
77 77 receive_fr_l = avutil_video_fr_ref_alloc(); receive_fr_l = avutil_video_fr_ref_alloc();
78 is_swpchn_sem_fence_submitted_l = false;
79 78 } }
80 79 #undef NONE #undef NONE
81 80 STATIC void scaler_img_create(avutil_video_fr_ref_t *fr) STATIC void scaler_img_create(avutil_video_fr_ref_t *fr)
 
... ... STATIC void img_mem_barrier_run_once(struct vk_img_mem_barrier_t *b)
108 107 memset(&begin_info, 0, sizeof(begin_info)); memset(&begin_info, 0, sizeof(begin_info));
109 108 begin_info.type = vk_struct_type_cb_begin_info; begin_info.type = vk_struct_type_cb_begin_info;
110 109 begin_info.flags = vk_cb_usage_one_time_submit_bit; begin_info.flags = vk_cb_usage_one_time_submit_bit;
111 /* we use the first cb which will be used for the swpchn */
112 vk_begin_cb(npv_vk_surf_p.dev.cbs[0], &begin_info);
113 IF_FATALVVK("%d:unable to begin recording the initial layout transition command buffer\n", r, npv_vk_surf_p.dev.cbs[0]);
110 vk_begin_cb(npv_vk_surf_p.dev.misc_cbs[
111 npv_vk_color_space_layout_transition],
112 &begin_info);
113 IF_FATALVVK("%d:unable to begin recording the layout transition command buffer for the vulkan image which will be used by ffmpeg color space converter\n", r, npv_vk_surf_p.dev.misc_cbs[npv_vk_color_space_layout_transition]);
114 114 /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
115 vk_cmd_pl_barrier(npv_vk_surf_p.dev.cbs[0], b);
115 vk_cmd_pl_barrier(npv_vk_surf_p.dev.misc_cbs[
116 npv_vk_color_space_layout_transition], b);
116 117 /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
117 vk_end_cb(npv_vk_surf_p.dev.cbs[0]);
118 IF_FATALVVK("%d:unable to end recording of the initial layout transition command buffer\n", r, npv_vk_surf_p.dev.cbs[0]);
118 vk_end_cb(npv_vk_surf_p.dev.misc_cbs[
119 npv_vk_color_space_layout_transition]);
120 IF_FATALVVK("%d:unable to end recording of the layout transition command buffer for the vulkan image which will be written to by ffmpeg color space converter\n", r, npv_vk_surf_p.dev.misc_cbs[npv_vk_color_space_layout_transition]);
119 121 /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
120 122 memset(&submit_info, 0, sizeof(submit_info)); memset(&submit_info, 0, sizeof(submit_info));
121 123 submit_info.type = vk_struct_type_submit_info; submit_info.type = vk_struct_type_submit_info;
122 124 submit_info.cbs_n = 1; submit_info.cbs_n = 1;
123 submit_info.cbs = &npv_vk_surf_p.dev.cbs[0];
124 vk_q_submit(&submit_info, 0);
125 IF_FATALVVK("%d:queue:%p:unable to submit the initial layout transition command buffer\n", r, npv_vk_surf_p.dev.q);
125 submit_info.cbs = &npv_vk_surf_p.dev.misc_cbs[
126 npv_vk_color_space_layout_transition];
127 vk_q_submit(&submit_info, npv_vk_surf_p.dev.fence_color_space_layout);
128 IF_FATALVVK("%d:queue:%p:unable to submit the layout transition command buffer for the vulkan image which will be written to by ffmpeg color space converter\n", r, npv_vk_surf_p.dev.q);
126 129 /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
127 vk_q_wait_idle();
128 IF_FATALVVK("%d:queue:%p:unable to wait for idle or completion of initial layout transition command buffer\n", r, npv_vk_surf_p.dev.q);
130 /*
131 * we cannot leave without the transition being done since we will
132 * fire up the ffmpeg color space converter right away , then wait for
133 * this fence to signal
134 */
135 vk_wait_for_fences(&npv_vk_surf_p.dev.fence_color_space_layout);
136 if (r == vk_not_ready)
137 npv_vk_fatal("%d:device:%p:wait for fence %p timeout\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence_color_space_layout);
138 else if (r != vk_success)
139 npv_vk_fatal("%d:device:%p:unable to wait for fence %p\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence_color_space_layout);
140 vk_reset_fences(&npv_vk_surf_p.dev.fence_color_space_layout);
141 IF_FATALVVK("%d:device:%p:unable to reset the color space layout fence\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence_color_space_layout);
129 142 /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
130 143 /* /*
131 144 * since it is tagged to run once its state_p is invalid, we need to * since it is tagged to run once its state_p is invalid, we need to
132 145 * reset it to the initial state_p * reset it to the initial state_p
133 146 */ */
134 vk_reset_cb(npv_vk_surf_p.dev.cbs[0]);
135 IF_FATALVVK("%d:command buffer:%p:unable to reset the initial layout transition command buffer\n", r, npv_vk_surf_p.dev.cbs[0]);
147 vk_reset_cb(npv_vk_surf_p.dev.misc_cbs[
148 npv_vk_color_space_layout_transition]);
149 IF_FATALVVK("%d:command buffer:%p:unable to reset the layout transition command buffer for the vulkan image which will be written to by the ffmpeg color space converter\n", r, npv_vk_surf_p.dev.misc_cbs[npv_vk_color_space_layout_transition]);
136 150 } }
137 151 /* once in general layout, the dev sees the img */ /* once in general layout, the dev sees the img */
138 152 STATIC void scaler_img_layout_to_general(void) STATIC void scaler_img_layout_to_general(void)
 
... ... STATIC void blit_setup(u8 swpchn_img)
481 495
482 496 blit_compute_offsets(swpchn_img, current); blit_compute_offsets(swpchn_img, current);
483 497
484 /* sync: may be in pending state? */
498 /* XXX: the fence is synchronizing the usage of this cb */
485 499 vk_reset_cb(npv_vk_surf_p.dev.cbs[swpchn_img]); vk_reset_cb(npv_vk_surf_p.dev.cbs[swpchn_img]);
486 IF_FATALVVK("%d:swapchain img:%u:command buffer:%p:unable reset\n", r, swpchn_img, npv_vk_surf_p.dev.cbs[swpchn_img]);
500 IF_FATALVVK("%d:swapchain img:%u:command buffer:%p:unable to reset\n", r, swpchn_img, npv_vk_surf_p.dev.cbs[swpchn_img]);
487 501 /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
488 502 memset(&begin_info, 0, sizeof(begin_info)); memset(&begin_info, 0, sizeof(begin_info));
489 503 begin_info.type = vk_struct_type_cb_begin_info; begin_info.type = vk_struct_type_cb_begin_info;
 
... ... STATIC void blits_request_update(void)
556 570 ++i; ++i;
557 571 } }
558 572 } }
559 STATIC bool is_swpchn_sem_consistent(void)
560 {
561 s32 r;
562
563 /* nothing submitted then nothing to check */
564 if (!is_swpchn_sem_fence_submitted_l)
565 return true;
566 /* coarse synchronization (we could use a pool of semaphores/fences) */
567 vk_get_fence_status();
568 if (r == vk_not_ready)
569 return false;
570 else if (r != vk_success)
571 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);
572 /* vk_success */
573 vk_reset_fences();
574 IF_FATALVVK("%d:device:%p:unable to reset the fence\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence);
575 is_swpchn_sem_fence_submitted_l = false;
576 return true;
577 }
578 573 #define READY 0 #define READY 0
579 574 #define NOT_READY 1 #define NOT_READY 1
580 STATIC u8 swpchn_next_img(u32 *swpchn_img) { loop
575 STATIC u8 start_swpchn_next_img(u32 *swpchn_img) { loop
581 576 { {
582 577 struct vk_acquire_next_img_info_t info; struct vk_acquire_next_img_info_t info;
583 578 s32 r; s32 r;
 
... ... STATIC u8 swpchn_next_img(u32 *swpchn_img) { loop
610 605 blits_request_update(); blits_request_update();
611 606 continue; continue;
612 607 } else if (r >= 0) } else if (r >= 0)
613 return READY;
608 return READY; /* Careful, the pe may not have finished reading from the acquired image, you need to use the semaphore or the fence to know where the image is actually available. */
614 609 npv_vk_fatal("%d:device:%p:unable to acquire next image from swapchain %p\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.swpchn.vk); npv_vk_fatal("%d:device:%p:unable to acquire next image from swapchain %p\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.swpchn.vk);
615 610 }} }}
616 611 #undef READY #undef READY
 
... ... STATIC u8 send_to_pe(u32 swpchn_img)
641 636 submit_info.cbs = &npv_vk_surf_p.dev.cbs[swpchn_img]; submit_info.cbs = &npv_vk_surf_p.dev.cbs[swpchn_img];
642 637 submit_info.signal_sems_n = 1; submit_info.signal_sems_n = 1;
643 638 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];
644 /* XXX: coarse synchronization happens here */
639
640 vk_reset_fences(&npv_vk_surf_p.dev.fence);/* XXX: coarse synchronization happens here */
641 IF_FATALVVK("%d:device:%p:unable to reset the fence\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence);
642
645 643 vk_q_submit(&submit_info, npv_vk_surf_p.dev.fence); vk_q_submit(&submit_info, npv_vk_surf_p.dev.fence);
646 644 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);
647 is_swpchn_sem_fence_submitted_l = true;
648 645 /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
649 646 idxs[0] = swpchn_img; idxs[0] = swpchn_img;
650 647 memset(&present_info, 0, sizeof(present_info)); memset(&present_info, 0, sizeof(present_info));
 
... ... STATIC void start_scaling(avutil_video_fr_ref_t *fr,
678 675
679 676 if (scaler_p.ctx->cfg.width != fr->width if (scaler_p.ctx->cfg.width != fr->width
680 677 || scaler_p.ctx->cfg.height != fr->height) { || scaler_p.ctx->cfg.height != fr->height) {
681 u8 i;
682
683 678 if (scaler_p.img.vk != 0) if (scaler_p.img.vk != 0)
684 679 scaler_img_destroy(); scaler_img_destroy();
685 680 scaler_img_create(fr); scaler_img_create(fr);
File npv/video/local/state.frag.c changed (mode: 100644) (index ec8e788..f62d490)
... ... STATIC struct {
16 16 bool update_requested; bool update_requested;
17 17 } blit_l[npv_vk_swpchn_imgs_n_max]; } blit_l[npv_vk_swpchn_imgs_n_max];
18 18 STATIC avutil_video_fr_ref_t *last_fr_sent_to_pe_l; STATIC avutil_video_fr_ref_t *last_fr_sent_to_pe_l;
19 STATIC bool is_swpchn_sem_fence_submitted_l;
File npv/video/namespace/main.c changed (mode: 100644) (index 91c569b..98d4deb)
25 25 #define init_once_local npv_video_init_once_local #define init_once_local npv_video_init_once_local
26 26 #define init_once_public npv_video_init_once_public #define init_once_public npv_video_init_once_public
27 27 #define interrupted_rendering npv_video_iinterrupted_rendering #define interrupted_rendering npv_video_iinterrupted_rendering
28 #define is_swpchn_sem_consistent npv_video_is_swpchn_sem_consistent
29 #define is_swpchn_sem_fence_submitted_l npv_video_is_swpchn_sem_fence_submitted_l
30 28 #define last_fr_sent_to_pe_l npv_video_last_fr_sent_to_pe_l #define last_fr_sent_to_pe_l npv_video_last_fr_sent_to_pe_l
31 29 #define match_mem_type npv_video_match_mem_type #define match_mem_type npv_video_match_mem_type
32 30 #define normal_rendering npv_video_normal_rendering #define normal_rendering npv_video_normal_rendering
 
42 40 #define select_fr npv_video_select_fr #define select_fr npv_video_select_fr
43 41 #define send_to_pe npv_video_send_to_pe #define send_to_pe npv_video_send_to_pe
44 42 #define start_scaling npv_video_start_scaling #define start_scaling npv_video_start_scaling
45 #define swpchn_next_img npv_video_swpchn_next_img
43 #define start_swpchn_next_img npv_video_start_swpchn_next_img
46 44 #define timer_ack npv_video_timer_ack #define timer_ack npv_video_timer_ack
47 45 #define tmp_mem_rqmts_l npv_video_tmp_mem_rqmts_l #define tmp_mem_rqmts_l npv_video_tmp_mem_rqmts_l
48 46 #define tmp_scaler_img_mem_rqmts_get npv_video_tmp_scaler_img_mem_rqmts_get #define tmp_scaler_img_mem_rqmts_get npv_video_tmp_scaler_img_mem_rqmts_get
 
77 75 #undef init_once_local #undef init_once_local
78 76 #undef init_once_public #undef init_once_public
79 77 #undef interrupted_rendering #undef interrupted_rendering
80 #undef is_swpchn_sem_consistent
81 #undef is_swpchn_sem_fence_submitted_l
82 78 #undef last_fr_sent_to_pe_l #undef last_fr_sent_to_pe_l
83 79 #undef match_mem_type #undef match_mem_type
84 80 #undef normal_rendering #undef normal_rendering
 
94 90 #undef select_fr #undef select_fr
95 91 #undef send_to_pe #undef send_to_pe
96 92 #undef start_scaling #undef start_scaling
97 #undef swpchn_next_img
93 #undef start_swpchn_next_img
98 94 #undef timer_ack #undef timer_ack
99 95 #undef tmp_mem_rqmts_l #undef tmp_mem_rqmts_l
100 96 #undef tmp_scaler_img_mem_rqmts_get #undef tmp_scaler_img_mem_rqmts_get
File npv/video/public/code.frag.c changed (mode: 100644) (index b499e34..1187376)
... ... STATIC void normal_rendering(void)
236 236 if (npv_paused_p) if (npv_paused_p)
237 237 npv_video_osd_rop_restore(); /* subtitles will happen here */ npv_video_osd_rop_restore(); /* subtitles will happen here */
238 238 npv_video_osd_rop_blend(now); /* subtitles will happen here */ npv_video_osd_rop_blend(now); /* subtitles will happen here */
239 if (!is_swpchn_sem_consistent())
240 return;
239 /*--------------------------------------------------------------------*/
240 /*
241 * are we still sending to pe ?
242 * (we could go fine-grained, namely per swapchain image)
243 */
244 vk_get_fence_status(npv_vk_surf_p.dev.fence);
245 if (r == vk_not_ready)
246 return; /* nope still sending to pe */
247 else if (r != vk_success)
248 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);
249 /* here, we are finished sending to pe */
241 250 loop { /* because the swpchn can change for many reasons */ loop { /* because the swpchn can change for many reasons */
242 r = swpchn_next_img(&swpchn_img);
251 r = start_swpchn_next_img(&swpchn_img);
243 252 if (r == NOT_READY) if (r == NOT_READY)
244 253 return; return;
254 /* here, we started to acquire the next swapchain image */
245 255 blit_setup(swpchn_img); blit_setup(swpchn_img);
246 256 r = send_to_pe(swpchn_img); r = send_to_pe(swpchn_img);
247 257 if (r == SENT) if (r == SENT)
File npv/vk/api_usage.h changed (mode: 100644) (index f2f1b61..140d558)
... ... r = npv_vk_surf_p.dev.dl_vk_map_mem(npv_vk_surf_p.dev.vk, dev_mem, 0, vk_whole_s
51 51 #define vk_unmap_mem(dev_mem) \ #define vk_unmap_mem(dev_mem) \
52 52 npv_vk_surf_p.dev.dl_vk_unmap_mem(npv_vk_surf_p.dev.vk, dev_mem) npv_vk_surf_p.dev.dl_vk_unmap_mem(npv_vk_surf_p.dev.vk, dev_mem)
53 53
54 #define vk_alloc_cbs(info) \
55 r = npv_vk_surf_p.dev.dl_vk_alloc_cbs(npv_vk_surf_p.dev.vk, info, npv_vk_surf_p.dev.cbs)
54 #define vk_alloc_cbs(info, cbs) \
55 r = npv_vk_surf_p.dev.dl_vk_alloc_cbs(npv_vk_surf_p.dev.vk, info, cbs)
56 56
57 57 #define vk_begin_cb(...) \ #define vk_begin_cb(...) \
58 58 r = npv_vk_surf_p.dev.dl_vk_begin_cb(__VA_ARGS__) r = npv_vk_surf_p.dev.dl_vk_begin_cb(__VA_ARGS__)
 
... ... r = npv_vk_surf_p.dev.dl_vk_begin_cb(__VA_ARGS__)
60 60 #define vk_end_cb(...) \ #define vk_end_cb(...) \
61 61 r = npv_vk_surf_p.dev.dl_vk_end_cb(__VA_ARGS__) r = npv_vk_surf_p.dev.dl_vk_end_cb(__VA_ARGS__)
62 62
63 /* we only use this for image barriers, logical layout transition, then bottom of pipe everywhere */
63 64 #define vk_cmd_pl_barrier(cb, b) \ #define vk_cmd_pl_barrier(cb, b) \
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)
65 npv_vk_surf_p.dev.dl_vk_cmd_pl_barrier(cb, vk_pl_stage_bottom_of_pipe_bit, vk_pl_stage_bottom_of_pipe_bit, 0, 0, 0, 0, 0, 1, b)
65 66
66 67 #define vk_q_submit(info, fence) \ #define vk_q_submit(info, fence) \
67 68 r = npv_vk_surf_p.dev.dl_vk_q_submit(npv_vk_surf_p.dev.q, 1, info, fence) r = npv_vk_surf_p.dev.dl_vk_q_submit(npv_vk_surf_p.dev.q, 1, info, fence)
 
... ... r = npv_vk_surf_p.dev.dl_vk_create_sem(npv_vk_surf_p.dev.vk, info, 0, sem)
89 90
90 91 #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
91 92
92 #define vk_create_fence(info) \
93 r = npv_vk_surf_p.dev.dl_vk_create_fence(npv_vk_surf_p.dev.vk, info, 0, &npv_vk_surf_p.dev.fence)
93 #define vk_create_fence(info,fencep) \
94 r = npv_vk_surf_p.dev.dl_vk_create_fence(npv_vk_surf_p.dev.vk, info, 0, fencep)
94 95
95 #define vk_get_fence_status() \
96 r = npv_vk_surf_p.dev.dl_vk_get_fence_status(npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence)
96 #define vk_get_fence_status(fence) \
97 r = npv_vk_surf_p.dev.dl_vk_get_fence_status(npv_vk_surf_p.dev.vk, fence)
97 98
98 #define vk_reset_fences() \
99 r = npv_vk_surf_p.dev.dl_vk_reset_fences(npv_vk_surf_p.dev.vk, 1, &npv_vk_surf_p.dev.fence)
99 #define vk_reset_fences(fences) \
100 r = npv_vk_surf_p.dev.dl_vk_reset_fences(npv_vk_surf_p.dev.vk, 1, fences)
101
102 /* 100 ms timeout, any fence signaled */
103 #define vk_wait_for_fences(fences) \
104 r = npv_vk_surf_p.dev.dl_vk_wait_for_fences(npv_vk_surf_p.dev.vk, 1, fences, 0, 100000000)
100 105 /******************************************************************************/ /******************************************************************************/
101 106 /* cherry picked and namespaced from nyanvk/syms_global.h */ /* cherry picked and namespaced from nyanvk/syms_global.h */
102 107 #define VK_GLOBAL_SYMS \ #define VK_GLOBAL_SYMS \
File npv/vk/local/code.frag.c changed (mode: 100644) (index ff2810d..e037deb)
... ... STATIC void dev_syms(void)
89 89 DEV_SYM(vkCreateFence, vk_create_fence); DEV_SYM(vkCreateFence, vk_create_fence);
90 90 DEV_SYM(vkGetFenceStatus, vk_get_fence_status); DEV_SYM(vkGetFenceStatus, vk_get_fence_status);
91 91 DEV_SYM(vkResetFences, vk_reset_fences); DEV_SYM(vkResetFences, vk_reset_fences);
92 DEV_SYM(vkWaitForFences, vk_wait_for_fences);
92 93 } }
93 94 #undef DEVICE_SYM #undef DEVICE_SYM
94 95 /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
 
... ... STATIC void sems_create(void)
910 911 ++sem; ++sem;
911 912 } }
912 913 } }
913 STATIC void fence_create(void)
914 STATIC void fences_create(void)
914 915 { {
915 916 s32 r; s32 r;
916 917 struct vk_fence_create_info_t info; struct vk_fence_create_info_t info;
 
... ... STATIC void fence_create(void)
918 919 memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
919 920 info.type = vk_struct_type_fence_create_info; info.type = vk_struct_type_fence_create_info;
920 921 info.flags = vk_fence_create_signaled_bit; info.flags = vk_fence_create_signaled_bit;
921 vk_create_fence(&info);
922 vk_create_fence(&info, &surf_p.dev.fence);
922 923 IF_FATALVK("%d:device:%p:unable to create the synchronization fence\n", r, surf_p.dev.vk); IF_FATALVK("%d:device:%p:unable to create the synchronization fence\n", r, surf_p.dev.vk);
923 924 pout("device:%p:synchronization fence created %p\n", surf_p.dev.vk, surf_p.dev.fence); pout("device:%p:synchronization fence created %p\n", surf_p.dev.vk, surf_p.dev.fence);
925
926 memset(&info, 0, sizeof(info));
927 info.type = vk_struct_type_fence_create_info;
928 vk_create_fence(&info, &surf_p.dev.fence_color_space_layout);
929 IF_FATALVK("%d:device:%p:unable to create the synchronization fence for the color space layout transition\n", r, surf_p.dev.vk);
930 pout("device:%p:color space layout transition synchronization fence created %p\n", surf_p.dev.vk, surf_p.dev.fence_color_space_layout);
931 }
932 STATIC void misc_cbs_init_once(void)
933 {
934 s32 r;
935 struct vk_cb_alloc_info_t alloc_info;
936
937 memset(&alloc_info, 0, sizeof(alloc_info));
938 alloc_info.type = vk_struct_type_cb_alloc_info;
939 alloc_info.cp = surf_p.dev.cp;
940 alloc_info.lvl = vk_cb_lvl_primary;
941 alloc_info.cbs_n = 1;
942 vk_alloc_cbs(&alloc_info,npv_vk_surf_p.dev.misc_cbs);
943 IF_FATALVK("%d:device:%p:unable to allocate a miscellaneous command buffer from %p command pool\n", r, surf_p.dev.vk, surf_p.dev.cp);
944 pout("device:%p:allocated a miscellaneous command buffers for our swapchain images from %p command pool\n", surf_p.dev.vk, surf_p.dev.cp);
924 945 } }
925 946 STATIC void swpchn_imgs_cbs_init_once(void) STATIC void swpchn_imgs_cbs_init_once(void)
926 947 { {
 
... ... STATIC void swpchn_imgs_cbs_init_once(void)
932 953 alloc_info.cp = surf_p.dev.cp; alloc_info.cp = surf_p.dev.cp;
933 954 alloc_info.lvl = vk_cb_lvl_primary; alloc_info.lvl = vk_cb_lvl_primary;
934 955 alloc_info.cbs_n = swpchn_imgs_n_max; alloc_info.cbs_n = swpchn_imgs_n_max;
935 vk_alloc_cbs(&alloc_info);
956 vk_alloc_cbs(&alloc_info,npv_vk_surf_p.dev.cbs);
936 957 IF_FATALVK("%d:device:%p:unable to allocate command buffers for our swapchain images from %p command pool\n", r, surf_p.dev.vk, surf_p.dev.cp); IF_FATALVK("%d:device:%p:unable to allocate command buffers for our swapchain images from %p command pool\n", r, surf_p.dev.vk, surf_p.dev.cp);
937 958 pout("device:%p:allocated %u command buffers for our swapchain images from %p command pool\n", surf_p.dev.vk, surf_p.dev.swpchn.imgs_n, surf_p.dev.cp); pout("device:%p:allocated %u command buffers for our swapchain images from %p command pool\n", surf_p.dev.vk, surf_p.dev.swpchn.imgs_n, surf_p.dev.cp);
938 959 } }
File npv/vk/namespace/main.c changed (mode: 100644) (index a24e51b..49171a2)
5 5 #define dev_init npv_vk_dev_init #define dev_init npv_vk_dev_init
6 6 #define dev_syms npv_vk_devs_syms #define dev_syms npv_vk_devs_syms
7 7 #define dev_type_str npv_vk_dev_type_str #define dev_type_str npv_vk_dev_type_str
8 #define fence_create npv_vk_fence_create
8 #define fences_create npv_vk_fences_create
9 9 #define instance_create npv_vk_instance_create #define instance_create npv_vk_instance_create
10 10 #define instance_exts_dump npv_vk_instance_exts_dump #define instance_exts_dump npv_vk_instance_exts_dump
11 11 #define instance_l npv_vk_instance_l #define instance_l npv_vk_instance_l
 
15 15 #define loader_l npv_vk_loader_l #define loader_l npv_vk_loader_l
16 16 #define loader_syms npv_vk_loader_syms #define loader_syms npv_vk_loader_syms
17 17 #define load_vk_loader npv_vk_load_vk_loader #define load_vk_loader npv_vk_load_vk_loader
18 #define misc_cbs_init_once npv_vk_misc_cbs_init_once
18 19 #define phydev_exts_dump npv_vk_phydev_exts_dump #define phydev_exts_dump npv_vk_phydev_exts_dump
19 20 #define phydev_init npv_vk_phydev_init #define phydev_init npv_vk_phydev_init
20 21 #define phydev_mem_type_dump npv_vk_phydev_mem_type_dump #define phydev_mem_type_dump npv_vk_phydev_mem_type_dump
 
68 69 #undef dev_init #undef dev_init
69 70 #undef dev_syms #undef dev_syms
70 71 #undef dev_type_str #undef dev_type_str
71 #undef fence_create
72 #undef fences_create
72 73 #undef instance_create #undef instance_create
73 74 #undef instance_exts_dump #undef instance_exts_dump
74 75 #undef instance_l #undef instance_l
 
78 79 #undef loader_l #undef loader_l
79 80 #undef loader_syms #undef loader_syms
80 81 #undef load_vk_loader #undef load_vk_loader
82 #undef misc_cbs_init_once
81 83 #undef phydev_exts_dump #undef phydev_exts_dump
82 84 #undef phydev_init #undef phydev_init
83 85 #undef phydev_mem_type_dump #undef phydev_mem_type_dump
File npv/vk/namespace/public.h changed (mode: 100644) (index 37b14b6..f79b262)
1 1 #ifndef CLEANUP #ifndef CLEANUP
2 #define dev_t npv_vk_dev_t
3 #define fatal npv_vk_fatal
4 #define init_once npv_vk_init_once
5 #define phydev_t npv_vk_phydev_t
6 #define sem_acquire_img_done npv_vk_sem_acquire_img_done
7 #define sem_blit_done npv_vk_sem_blit_done
8 #define sems_n npv_vk_sems_n
9 #define surf_p npv_vk_surf_p
10 #define surf_init_once npv_vk_surf_init_once
11 #define swpchn_update npv_vk_swpchn_update
12 #define swpchn_imgs_n_max npv_vk_swpchn_imgs_n_max
13 #define swpchn_t npv_vk_swpchn_t
14 #define texel_mem_blk_fmt_t npv_vk_texel_mem_blk_fmt_t
15 #define vfatal npv_vk_vfatal
16 #define vwarning npv_vk_vwarning
17 #define warning npv_vk_warning
2 #define color_space_layout_transition npv_vk_color_space_layout_transition
3 #define dev_t npv_vk_dev_t
4 #define fatal npv_vk_fatal
5 #define init_once npv_vk_init_once
6 #define phydev_t npv_vk_phydev_t
7 #define sem_acquire_img_done npv_vk_sem_acquire_img_done
8 #define sem_blit_done npv_vk_sem_blit_done
9 #define sems_n npv_vk_sems_n
10 #define surf_p npv_vk_surf_p
11 #define surf_init_once npv_vk_surf_init_once
12 #define swpchn_update npv_vk_swpchn_update
13 #define swpchn_imgs_n_max npv_vk_swpchn_imgs_n_max
14 #define swpchn_t npv_vk_swpchn_t
15 #define texel_mem_blk_fmt_t npv_vk_texel_mem_blk_fmt_t
16 #define vfatal npv_vk_vfatal
17 #define vwarning npv_vk_vwarning
18 #define warning npv_vk_warning
18 19 /*============================================================================*/ /*============================================================================*/
19 20 #else #else
21 #undef color_space_layout_transition
20 22 #undef dev_t #undef dev_t
21 23 #undef fatal #undef fatal
22 24 #undef init_once #undef init_once
File npv/vk/public/code.frag.c changed (mode: 100644) (index fa46cab..661f407)
... ... STATIC void surf_init_once(xcb_connection_t *c, u32 win_id)
45 45 surf_create(c, win_id); surf_create(c, win_id);
46 46 dev_init(); dev_init();
47 47 sems_create(); sems_create();
48 fence_create();
48 fences_create();
49 misc_cbs_init_once();
49 50 /*====================================================================*/ /*====================================================================*/
50 51 swpchn_init_once(); swpchn_init_once();
51 52 swpchn_imgs_cbs_init_once(); swpchn_imgs_cbs_init_once();
File npv/vk/public/state.frag.h changed (mode: 100644) (index a67120c..8c4611b)
1 1 constant_u32 { constant_u32 {
2 swpchn_imgs_n_max = 3
2 swpchn_imgs_n_max = 3,
3 3 }; };
4 4 struct swpchn_t { struct swpchn_t {
5 5 struct vk_swpchn_t *vk; struct vk_swpchn_t *vk;
 
... ... struct phydev_t {
23 23 constant_u32 { constant_u32 {
24 24 sem_acquire_img_done = 0, sem_acquire_img_done = 0,
25 25 sem_blit_done = 1, sem_blit_done = 1,
26 sems_n = 2
26 sems_n = 2,
27 color_space_layout_transition = 0
27 28 }; };
28 29 struct dev_t { struct dev_t {
29 30 struct vk_dev_t *vk; struct vk_dev_t *vk;
30 31 struct phydev_t phydev; struct phydev_t phydev;
31 32 struct swpchn_t swpchn; struct swpchn_t swpchn;
32 33 struct vk_fence_t *fence; struct vk_fence_t *fence;
34 struct vk_fence_t *fence_color_space_layout;
33 35 struct vk_q_t *q; struct vk_q_t *q;
34 36 struct vk_cp_t *cp; struct vk_cp_t *cp;
35 37 struct vk_cb_t *cbs[swpchn_imgs_n_max]; struct vk_cb_t *cbs[swpchn_imgs_n_max];
38 struct vk_cb_t *misc_cbs[1]; /* only one for now */
36 39 struct vk_sem_t *sems[sems_n]; struct vk_sem_t *sems[sems_n];
37 40 VK_DEV_SYMS_FULL /* TODO:should cherry pick the syms we use */ VK_DEV_SYMS_FULL /* TODO:should cherry pick the syms we use */
38 41 }; };
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/sylware/nyanmp

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/sylware/nyanmp

Clone this repository using git:
git clone git://git.rocketgit.com/user/sylware/nyanmp

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main