File npv/video/local/code.frag.c changed (mode: 100644) (index 71655cc..7bc1a4c) |
... |
... |
STATIC void init_once_local(void) |
74 |
74 |
++i; |
++i; |
75 |
75 |
} |
} |
76 |
76 |
receive_fr_l = avutil_video_fr_ref_alloc(); |
receive_fr_l = avutil_video_fr_ref_alloc(); |
|
77 |
|
is_swpchn_sem_fence_submitted_l = false; |
77 |
78 |
} |
} |
78 |
79 |
STATIC void scaler_img_create(avutil_video_fr_ref_t *fr) |
STATIC void scaler_img_create(avutil_video_fr_ref_t *fr) |
79 |
80 |
{ |
{ |
|
... |
... |
STATIC void blits_request_update(void) |
543 |
544 |
++i; |
++i; |
544 |
545 |
} |
} |
545 |
546 |
} |
} |
546 |
|
STATIC bool are_sems_available(void) |
|
|
547 |
|
STATIC bool is_swpchn_sem_consistent(void) |
547 |
548 |
{ |
{ |
548 |
549 |
s32 r; |
s32 r; |
|
550 |
|
|
|
551 |
|
/* nothing submitted then nothing to check */ |
|
552 |
|
if (!is_swpchn_sem_fence_submitted_l) |
|
553 |
|
return true; |
549 |
554 |
/* coarse synchronization (we could use a pool of semaphores/fences) */ |
/* coarse synchronization (we could use a pool of semaphores/fences) */ |
550 |
555 |
vk_get_fence_status(); |
vk_get_fence_status(); |
551 |
556 |
if (r == vk_not_ready) |
if (r == vk_not_ready) |
|
... |
... |
STATIC bool are_sems_available(void) |
555 |
560 |
/* vk_success */ |
/* vk_success */ |
556 |
561 |
vk_reset_fences(); |
vk_reset_fences(); |
557 |
562 |
IF_FATALVVK("%d:device:%p:unable to reset the fence\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence); |
IF_FATALVVK("%d:device:%p:unable to reset the fence\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence); |
|
563 |
|
is_swpchn_sem_fence_submitted_l = false; |
558 |
564 |
return true; |
return true; |
559 |
565 |
} |
} |
560 |
566 |
#define READY 0 |
#define READY 0 |
|
... |
... |
STATIC u8 swpchn_next_img(u32 *swpchn_img) { loop |
576 |
582 |
* of a fence. |
* of a fence. |
577 |
583 |
*/ |
*/ |
578 |
584 |
vk_acquire_next_img(&info, swpchn_img); |
vk_acquire_next_img(&info, swpchn_img); |
579 |
|
if (r == vk_not_ready) |
|
|
585 |
|
/* |
|
586 |
|
* XXX: MESA BUG: |
|
587 |
|
* should _NOT_ return vk_timeout for timeout == 0 |
|
588 |
|
* |
|
589 |
|
* src/vulkan/wsi/wsi_common_x11.c:x11_acquire_next_image_from_queue |
|
590 |
|
* this func does not return vk_not_ready on timeout == 0 |
|
591 |
|
*/ |
|
592 |
|
if (r == vk_not_ready || r == vk_timeout) |
580 |
593 |
return NOT_READY; |
return NOT_READY; |
581 |
594 |
else if (r == vk_out_of_date || r == vk_suboptimal) { |
else if (r == vk_out_of_date || r == vk_suboptimal) { |
|
595 |
|
vk_q_wait_idle(); /* very violent, hopefully not too long */ |
|
596 |
|
IF_FATALVVK("%d:queue:%p:unable to wait for idle or completion to prepare for a swpchn update\n", r, npv_vk_surf_p.dev.q); |
582 |
597 |
npv_vk_swpchn_update(); |
npv_vk_swpchn_update(); |
583 |
598 |
blits_request_update(); |
blits_request_update(); |
584 |
599 |
continue; |
continue; |
|
... |
... |
STATIC u8 send_to_pe(u32 swpchn_img) |
617 |
632 |
/* XXX: coarse synchronization happens here */ |
/* XXX: coarse synchronization happens here */ |
618 |
633 |
vk_q_submit(&submit_info, npv_vk_surf_p.dev.fence); |
vk_q_submit(&submit_info, npv_vk_surf_p.dev.fence); |
619 |
634 |
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); |
|
635 |
|
is_swpchn_sem_fence_submitted_l = true; |
620 |
636 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
621 |
637 |
idxs[0] = swpchn_img; |
idxs[0] = swpchn_img; |
622 |
638 |
memset(&present_info, 0, sizeof(present_info)); |
memset(&present_info, 0, sizeof(present_info)); |
|
... |
... |
STATIC u8 send_to_pe(u32 swpchn_img) |
633 |
649 |
present_info.results = 0; |
present_info.results = 0; |
634 |
650 |
vk_q_present(&present_info); |
vk_q_present(&present_info); |
635 |
651 |
if (r == vk_out_of_date || r == vk_suboptimal) { |
if (r == vk_out_of_date || r == vk_suboptimal) { |
|
652 |
|
vk_q_wait_idle(); /* very violent, hopefully not too long */ |
|
653 |
|
IF_FATALVVK("%d:queue:%p:unable to wait for idle or completion to prepare for a swpchn update\n", r, npv_vk_surf_p.dev.q); |
636 |
654 |
npv_vk_swpchn_update(); |
npv_vk_swpchn_update(); |
637 |
655 |
blits_request_update(); |
blits_request_update(); |
638 |
656 |
return SWPCHN_UPDATED; |
return SWPCHN_UPDATED; |
File npv/video/namespace/main.c changed (mode: 100644) (index 2780159..bf28b16) |
23 |
23 |
#define img_mem_barrier_run_once npv_video_img_mem_barrier_run_once |
#define img_mem_barrier_run_once npv_video_img_mem_barrier_run_once |
24 |
24 |
#define init_once_local npv_video_init_once_local |
#define init_once_local npv_video_init_once_local |
25 |
25 |
#define init_once_public npv_video_init_once_public |
#define init_once_public npv_video_init_once_public |
|
26 |
|
#define is_swpchn_sem_consistent npv_video_is_swpchn_sem_consistent |
|
27 |
|
#define is_swpchn_sem_fence_submitted_l npv_video_is_swpchn_sem_fence_submitted_l |
26 |
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 |
27 |
29 |
#define match_mem_type npv_video_match_mem_type |
#define match_mem_type npv_video_match_mem_type |
28 |
30 |
#define poutff npv_video_poutff |
#define poutff npv_video_poutff |
|
70 |
72 |
#undef img_mem_barrier_run_once |
#undef img_mem_barrier_run_once |
71 |
73 |
#undef init_once_local |
#undef init_once_local |
72 |
74 |
#undef init_once_public |
#undef init_once_public |
|
75 |
|
#undef is_swpchn_sem_consistent |
|
76 |
|
#undef is_swpchn_sem_fence_submitted_l |
73 |
77 |
#undef last_fr_sent_to_pe_l |
#undef last_fr_sent_to_pe_l |
74 |
78 |
#undef match_mem_type |
#undef match_mem_type |
75 |
79 |
#undef poutff |
#undef poutff |
File npv/video/public/code.frag.c changed (mode: 100644) (index c8b403b..abde336) |
... |
... |
STATIC void timer_evt(void) |
225 |
225 |
/* in pause, we "redraw" the same img all the time */ |
/* in pause, we "redraw" the same img all the time */ |
226 |
226 |
if (!npv_paused_p && fr == last_fr_sent_to_pe_l) |
if (!npv_paused_p && fr == last_fr_sent_to_pe_l) |
227 |
227 |
return; |
return; |
228 |
|
if (npv_thdsws_is_busy(scaler_p.ctx)) |
|
|
228 |
|
if (npv_thdsws_is_busy(scaler_p.ctx)) { |
229 |
229 |
return; |
return; |
|
230 |
|
} |
230 |
231 |
if (scaler_p.img.fr != fr) { |
if (scaler_p.img.fr != fr) { |
231 |
232 |
start_scaling(fr, fr_priv); |
start_scaling(fr, fr_priv); |
232 |
233 |
return; |
return; |
|
... |
... |
STATIC void timer_evt(void) |
234 |
235 |
if (npv_paused_p) |
if (npv_paused_p) |
235 |
236 |
npv_video_osd_rop_restore(); |
npv_video_osd_rop_restore(); |
236 |
237 |
npv_video_osd_rop_blend(now); |
npv_video_osd_rop_blend(now); |
237 |
|
if (!are_sems_available()) |
|
|
238 |
|
if (!is_swpchn_sem_consistent()) |
238 |
239 |
return; |
return; |
239 |
240 |
loop { /* because the swpchn can change for many reasons */ |
loop { /* because the swpchn can change for many reasons */ |
240 |
241 |
r = swpchn_next_img(&swpchn_img); |
r = swpchn_next_img(&swpchn_img); |