From: Junkyeong Kim Date: Thu, 20 Feb 2020 09:08:11 +0000 (+0900) Subject: e_video_hwc: enhance pp restriction X-Git-Tag: submit/tizen/20200227.111751~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F02%2F225502%2F2;p=platform%2Fupstream%2Fenlightenment.git e_video_hwc: enhance pp restriction check pp minw, minh values also. check pp preferred vertical align if it is supported.(not supported case this value is -1) Change-Id: If17b0298e7e536dda6105c45dc3b48b91a68995a Signed-off-by: Junkyeong Kim --- diff --git a/src/bin/video/iface/e_video_hwc.c b/src/bin/video/iface/e_video_hwc.c index dbaeacd9ce..a9e8965e2b 100644 --- a/src/bin/video/iface/e_video_hwc.c +++ b/src/bin/video/iface/e_video_hwc.c @@ -282,6 +282,7 @@ _e_video_hwc_pp_create(tdm_display *display, void *user_data) &pp->minw, &pp->minh, &pp->maxw, &pp->maxh, &pp->align); + tdm_display_get_pp_preferred_align_vertical(display, &pp->align_vertical); err = tdm_display_get_pp_capabilities(display, &caps); if (err == TDM_ERROR_NONE) @@ -403,18 +404,79 @@ _e_video_hwc_pp_buffer_cb_free(E_Comp_Wl_Video_Buf *vbuf, void *data) evh->pp_buffer_list = eina_list_remove(evh->pp_buffer_list, vbuf); } +static int +_e_video_hwc_pp_gcd_get(int x, int y) +{ + int temp = 0; + + while (y > 0) + { + temp = y; + y = x % y; + x = temp; + } + + return x; +} + +static void +_e_video_hwc_pp_aligned_value_get(E_Video_Hwc *evh, int *aligned_width, int *aligned_height) +{ + int width_align = 0; + + if (evh->pp->minw != -1) + { + if (evh->pp->minw > *aligned_width) + *aligned_width = evh->pp->minw; + } + + if (evh->pp->minh != -1) + { + if (evh->pp->minh > *aligned_height) + *aligned_height = evh->pp->minh; + } + + if (evh->pp->align > 0) + { + if (evh->output_align != -1) + { + if (evh->output_align >= evh->pp->align) + width_align = _e_video_hwc_pp_gcd_get(evh->output_align, evh->pp->align); + else + width_align = _e_video_hwc_pp_gcd_get(evh->pp->align, evh->output_align); + + width_align = evh->output_align * evh->pp->align / width_align; + } + else + { + width_align = evh->pp->align; + } + } + else + { + if (evh->output_align != -1) + width_align = evh->output_align; + else + width_align = *aligned_width; + } + + *aligned_width = ROUNDUP(*aligned_width, width_align); + + if (evh->pp->align_vertical != -1) + *aligned_height = ROUNDUP(*aligned_height, evh->pp->align_vertical); + +} + static E_Comp_Wl_Video_Buf * _e_video_hwc_pp_buffer_get(E_Video_Hwc *evh, int width, int height) { E_Comp_Wl_Video_Buf *vbuf; Eina_List *l; int i = 0; - int aligned_width; + int aligned_width = width; + int aligned_height = height; - if (evh->output_align != -1) - aligned_width = ROUNDUP(width, evh->output_align); - else - aligned_width = width; + _e_video_hwc_pp_aligned_value_get(evh, &aligned_width, &aligned_height); if (evh->pp_buffer_list) { @@ -422,13 +484,13 @@ _e_video_hwc_pp_buffer_get(E_Video_Hwc *evh, int width, int height) EINA_SAFETY_ON_NULL_RETURN_VAL(vbuf, NULL); /* if we need bigger pp_buffers, destroy all pp_buffers and create */ - if (aligned_width > vbuf->width_from_pitch || height != vbuf->height) + if (aligned_width > vbuf->width_from_pitch || aligned_height != vbuf->height) { Eina_List *ll; VIN("pp buffer changed: %dx%d => %dx%d", evh->ec, vbuf->width_from_pitch, vbuf->height, - aligned_width, height); + aligned_width, aligned_height); EINA_LIST_FOREACH_SAFE(evh->pp_buffer_list, l, ll, vbuf) { @@ -448,7 +510,7 @@ _e_video_hwc_pp_buffer_get(E_Video_Hwc *evh, int width, int height) { for (i = 0; i < BUFFER_MAX_COUNT; i++) { - vbuf = e_comp_wl_video_buffer_alloc(aligned_width, height, evh->pp_tbmfmt, EINA_TRUE); + vbuf = e_comp_wl_video_buffer_alloc(aligned_width, aligned_height, evh->pp_tbmfmt, EINA_TRUE); EINA_SAFETY_ON_NULL_RETURN_VAL(vbuf, NULL); e_comp_wl_video_buffer_free_func_add(vbuf, _e_video_hwc_pp_buffer_cb_free, evh); @@ -457,7 +519,7 @@ _e_video_hwc_pp_buffer_get(E_Video_Hwc *evh, int width, int height) } VIN("pp buffer created: %dx%d, %c%c%c%c", evh->ec, - vbuf->width_from_pitch, height, FOURCC_STR(evh->pp_tbmfmt)); + vbuf->width_from_pitch, aligned_height, FOURCC_STR(evh->pp_tbmfmt)); evh->next_buffer = evh->pp_buffer_list; } diff --git a/src/bin/video/iface/e_video_hwc.h b/src/bin/video/iface/e_video_hwc.h index a04cdc0f46..898400aa65 100644 --- a/src/bin/video/iface/e_video_hwc.h +++ b/src/bin/video/iface/e_video_hwc.h @@ -35,6 +35,7 @@ struct _E_Video_Hwc_PP int minw, minh, maxw, maxh; int align; + int align_vertical; Eina_Bool scanout; };