File npv/video/local/code.frag.c changed (mode: 100644) (index 9c78014..285cfab) |
... |
... |
STATIC void init_once_local(void) |
70 |
70 |
blit_l[i].vp.bottom_right.x = -1; |
blit_l[i].vp.bottom_right.x = -1; |
71 |
71 |
blit_l[i].vp.bottom_right.y = -1; |
blit_l[i].vp.bottom_right.y = -1; |
72 |
72 |
blit_l[i].vp.bottom_right.z = -1; |
blit_l[i].vp.bottom_right.z = -1; |
|
73 |
|
blit_l[i].update_requested = true; |
73 |
74 |
++i; |
++i; |
74 |
75 |
} |
} |
75 |
76 |
receive_fr_l = avutil_video_fr_ref_alloc(); |
receive_fr_l = avutil_video_fr_ref_alloc(); |
|
... |
... |
STATIC void blit_compute_offsets(u8 swpchn_img, |
451 |
452 |
vp->width = new_vp->width; |
vp->width = new_vp->width; |
452 |
453 |
vp->height = new_vp->height; |
vp->height = new_vp->height; |
453 |
454 |
} |
} |
454 |
|
STATIC void blit_setup(u8 swpchn_img, bool scaler_dims_changed) |
|
|
455 |
|
STATIC void blit_setup(u8 swpchn_img) |
455 |
456 |
{ |
{ |
456 |
457 |
s32 r; |
s32 r; |
457 |
458 |
struct vk_cb_begin_info_t begin_info; |
struct vk_cb_begin_info_t begin_info; |
|
... |
... |
STATIC void blit_setup(u8 swpchn_img, bool scaler_dims_changed) |
463 |
464 |
|
|
464 |
465 |
current = &npv_vk_surf_p.dev.phydev.surf_caps.core.current_extent; |
current = &npv_vk_surf_p.dev.phydev.surf_caps.core.current_extent; |
465 |
466 |
|
|
466 |
|
if (!scaler_dims_changed && blit_l[swpchn_img].vp.width |
|
467 |
|
== current->width && blit_l[swpchn_img].vp.height |
|
468 |
|
== current->height) |
|
|
467 |
|
if (!blit_l[swpchn_img].update_requested |
|
468 |
|
&& blit_l[swpchn_img].vp.width == current->width |
|
469 |
|
&& blit_l[swpchn_img].vp.height == current->height) |
469 |
470 |
return; |
return; |
470 |
471 |
|
|
471 |
472 |
blit_compute_offsets(swpchn_img, current); |
blit_compute_offsets(swpchn_img, current); |
|
... |
... |
STATIC void blit_setup(u8 swpchn_img, bool scaler_dims_changed) |
525 |
526 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
526 |
527 |
vk_end_cb(npv_vk_surf_p.dev.cbs[swpchn_img]); |
vk_end_cb(npv_vk_surf_p.dev.cbs[swpchn_img]); |
527 |
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 |
|
blit_l[swpchn_img].update_requested = false; |
|
530 |
|
} |
|
531 |
|
/*NSPC*/ |
|
532 |
|
STATIC void blits_request_update(void) |
|
533 |
|
{ |
|
534 |
|
u8 i; |
|
535 |
|
|
|
536 |
|
i = 0; |
|
537 |
|
loop { |
|
538 |
|
if (i == npv_vk_surf_p.dev.swpchn.imgs_n) |
|
539 |
|
break; |
|
540 |
|
blit_l[i].update_requested = true; |
|
541 |
|
++i; |
|
542 |
|
} |
528 |
543 |
} |
} |
529 |
544 |
#define READY 0 |
#define READY 0 |
530 |
545 |
#define NOT_READY 1 |
#define NOT_READY 1 |
|
... |
... |
STATIC u8 swpchn_next_img(u32 *swpchn_img) { loop |
544 |
559 |
return NOT_READY; |
return NOT_READY; |
545 |
560 |
else if (r == vk_out_of_date || r == vk_suboptimal) { |
else if (r == vk_out_of_date || r == vk_suboptimal) { |
546 |
561 |
npv_vk_swpchn_update(); |
npv_vk_swpchn_update(); |
|
562 |
|
blits_request_update(); |
547 |
563 |
continue; |
continue; |
548 |
564 |
} else if (r >= 0) |
} else if (r >= 0) |
549 |
565 |
return READY; |
return READY; |
|
... |
... |
STATIC u8 send_to_pe(u32 swpchn_img) |
588 |
604 |
vk_q_present(&present_info); |
vk_q_present(&present_info); |
589 |
605 |
if (r == vk_out_of_date || r == vk_suboptimal) { |
if (r == vk_out_of_date || r == vk_suboptimal) { |
590 |
606 |
npv_vk_swpchn_update(); |
npv_vk_swpchn_update(); |
|
607 |
|
blits_request_update(); |
591 |
608 |
return SWPCHN_UPDATED; |
return SWPCHN_UPDATED; |
592 |
609 |
} |
} |
593 |
610 |
IF_FATALVVK("%d:queue:%p:unable to submit the image %u to the presentation engine\n", r, npv_vk_surf_p.dev.q, swpchn_img); |
IF_FATALVVK("%d:queue:%p:unable to submit the image %u to the presentation engine\n", r, npv_vk_surf_p.dev.q, swpchn_img); |
|
... |
... |
STATIC u8 send_to_pe(u32 swpchn_img) |
596 |
613 |
#undef SENT |
#undef SENT |
597 |
614 |
#undef SWPCHN_UPDATED |
#undef SWPCHN_UPDATED |
598 |
615 |
STATIC void start_scaling(avutil_video_fr_ref_t *fr, |
STATIC void start_scaling(avutil_video_fr_ref_t *fr, |
599 |
|
struct dec_fr_priv_t *fr_priv, bool *scaler_dims_changed) |
|
|
616 |
|
struct dec_fr_priv_t *fr_priv) |
600 |
617 |
{ |
{ |
|
618 |
|
|
601 |
619 |
if (scaler_p.ctx->cfg.width != fr->width |
if (scaler_p.ctx->cfg.width != fr->width |
602 |
620 |
|| scaler_p.ctx->cfg.height != fr->height) { |
|| scaler_p.ctx->cfg.height != fr->height) { |
|
621 |
|
u8 i; |
|
622 |
|
|
603 |
623 |
if (scaler_p.img.vk != 0) |
if (scaler_p.img.vk != 0) |
604 |
624 |
scaler_img_destroy(); |
scaler_img_destroy(); |
605 |
625 |
scaler_img_create(fr); |
scaler_img_create(fr); |
|
... |
... |
STATIC void start_scaling(avutil_video_fr_ref_t *fr, |
610 |
630 |
scaler_img_dev_mem_bind(); |
scaler_img_dev_mem_bind(); |
611 |
631 |
scaler_img_dev_mem_map(); |
scaler_img_dev_mem_map(); |
612 |
632 |
|
|
613 |
|
*scaler_dims_changed = true; |
|
|
633 |
|
blits_request_update(); |
614 |
634 |
scaler_p.ctx->cfg.width = fr->width; |
scaler_p.ctx->cfg.width = fr->width; |
615 |
635 |
scaler_p.ctx->cfg.height = fr->height; |
scaler_p.ctx->cfg.height = fr->height; |
616 |
636 |
npv_video_osd_update_dimensions(scaler_p.img.data, |
npv_video_osd_update_dimensions(scaler_p.img.data, |
617 |
637 |
(u16)fr->width, (u16)fr->height, |
(u16)fr->width, (u16)fr->height, |
618 |
638 |
(u32)scaler_p.img.layout.row_pitch); |
(u32)scaler_p.img.layout.row_pitch); |
619 |
|
} else |
|
620 |
|
*scaler_dims_changed = false; |
|
|
639 |
|
} |
621 |
640 |
scaler_p.ctx->cfg.src_fmt = fr->fmt; |
scaler_p.ctx->cfg.src_fmt = fr->fmt; |
622 |
641 |
scaler_p.ctx->cfg.dst_fmt = AVUTIL_PIX_FMT_RGB32; |
scaler_p.ctx->cfg.dst_fmt = AVUTIL_PIX_FMT_RGB32; |
623 |
642 |
scaler_p.ctx->cfg.flags = SWS_POINT; /* | SWS_PRINT_INFO */ |
scaler_p.ctx->cfg.flags = SWS_POINT; /* | SWS_PRINT_INFO */ |
File npv/video/public/code.frag.c changed (mode: 100644) (index abea91c..3c2fc4b) |
... |
... |
STATIC void timer_evt(void) |
204 |
204 |
s64 now; |
s64 now; |
205 |
205 |
avutil_video_fr_ref_t *fr; |
avutil_video_fr_ref_t *fr; |
206 |
206 |
struct dec_fr_priv_t *fr_priv; |
struct dec_fr_priv_t *fr_priv; |
207 |
|
bool scaler_dims_changed; |
|
208 |
207 |
u32 swpchn_img; |
u32 swpchn_img; |
209 |
208 |
|
|
210 |
209 |
timer_ack(); |
timer_ack(); |
|
... |
... |
STATIC void timer_evt(void) |
229 |
228 |
if (npv_thdsws_is_busy(scaler_p.ctx)) |
if (npv_thdsws_is_busy(scaler_p.ctx)) |
230 |
229 |
return; |
return; |
231 |
230 |
if (scaler_p.img.fr != fr) { |
if (scaler_p.img.fr != fr) { |
232 |
|
start_scaling(fr, fr_priv, &scaler_dims_changed); |
|
|
231 |
|
start_scaling(fr, fr_priv); |
233 |
232 |
return; |
return; |
234 |
233 |
} |
} |
235 |
234 |
if (npv_paused_p) |
if (npv_paused_p) |
236 |
235 |
npv_video_osd_rop_restore(); |
npv_video_osd_rop_restore(); |
237 |
236 |
npv_video_osd_rop_blend(now); |
npv_video_osd_rop_blend(now); |
238 |
|
loop { /* because the swpchn can change, aka "the win changed" */ |
|
|
237 |
|
loop { /* because the swpchn can change for many reasons */ |
239 |
238 |
r = swpchn_next_img(&swpchn_img); |
r = swpchn_next_img(&swpchn_img); |
240 |
239 |
if (r == NOT_READY) |
if (r == NOT_READY) |
241 |
240 |
return; |
return; |
242 |
|
blit_setup(swpchn_img, scaler_dims_changed); |
|
|
241 |
|
blit_setup(swpchn_img); |
243 |
242 |
r = send_to_pe(swpchn_img); |
r = send_to_pe(swpchn_img); |
244 |
243 |
if (r == SENT) |
if (r == SENT) |
245 |
244 |
break; |
break; |