From 47ef4962ec99b946ba349198fed51e1b3573f333 Mon Sep 17 00:00:00 2001 From: Seunghun Date: Thu, 11 Apr 2019 18:35:12 +0900 Subject: [PATCH] video: Remove duplicated codes. Added following codes instead of removed one. e_video_hwc_vbuf_find() e_video_hwc_vbuf_find_with_comp_buffer() Change-Id: I16d540f78c3078bace41063234127c0b21d1d228 --- src/bin/video/iface/e_video_hwc.c | 30 +++++++++++++++++++ src/bin/video/iface/e_video_hwc.h | 2 ++ src/bin/video/iface/e_video_hwc_planes.c | 36 ++--------------------- src/bin/video/iface/e_video_hwc_windows.c | 36 ++--------------------- 4 files changed, 38 insertions(+), 66 deletions(-) diff --git a/src/bin/video/iface/e_video_hwc.c b/src/bin/video/iface/e_video_hwc.c index c6eebe1120..86973e42c1 100644 --- a/src/bin/video/iface/e_video_hwc.c +++ b/src/bin/video/iface/e_video_hwc.c @@ -19,6 +19,36 @@ struct _E_Video_Hwc E_Video_Comp_Iface *backend; }; +EINTERN E_Comp_Wl_Video_Buf * +e_video_hwc_vbuf_find(Eina_List *list, tbm_surface_h buffer) +{ + E_Comp_Wl_Video_Buf *vbuf; + Eina_List *l = NULL; + + EINA_LIST_FOREACH(list, l, vbuf) + { + if (vbuf->tbm_surface == buffer) + return vbuf; + } + + return NULL; +} + +EINTERN E_Comp_Wl_Video_Buf * +e_video_hwc_vbuf_find_with_comp_buffer(Eina_List *list, E_Comp_Wl_Buffer *comp_buffer) +{ + E_Comp_Wl_Video_Buf *vbuf; + Eina_List *l = NULL; + + EINA_LIST_FOREACH(list, l, vbuf) + { + if (vbuf->comp_buffer == comp_buffer) + return vbuf; + } + + return NULL; +} + EINTERN E_Client * e_video_hwc_client_offscreen_parent_get(E_Client *ec) { diff --git a/src/bin/video/iface/e_video_hwc.h b/src/bin/video/iface/e_video_hwc.h index 0e93ce08a6..366f0b061c 100644 --- a/src/bin/video/iface/e_video_hwc.h +++ b/src/bin/video/iface/e_video_hwc.h @@ -36,4 +36,6 @@ EINTERN Eina_Bool e_video_hwc_client_visible_get(E_Client *ec); EINTERN Eina_Bool e_video_hwc_geometry_get(E_Client *ec, E_Video_Hwc_Geometry *out); EINTERN Eina_Bool e_video_hwc_geometry_map_apply(E_Client *ec, E_Video_Hwc_Geometry *out); +EINTERN E_Comp_Wl_Video_Buf *e_video_hwc_vbuf_find(Eina_List *list, tbm_surface_h buffer); +EINTERN E_Comp_Wl_Video_Buf *e_video_hwc_vbuf_find_with_comp_buffer(Eina_List *list, E_Comp_Wl_Buffer *comp_buffer); #endif diff --git a/src/bin/video/iface/e_video_hwc_planes.c b/src/bin/video/iface/e_video_hwc_planes.c index 87d2b23a49..6a43425fb9 100644 --- a/src/bin/video/iface/e_video_hwc_planes.c +++ b/src/bin/video/iface/e_video_hwc_planes.c @@ -103,36 +103,6 @@ static Eina_Bool _e_video_tdm_get_layer_usable(tdm_layer *layer); static void _e_video_vblank_handler(tdm_output *output, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data); -static E_Comp_Wl_Video_Buf * -_e_video_vbuf_find(Eina_List *list, tbm_surface_h buffer) -{ - E_Comp_Wl_Video_Buf *vbuf; - Eina_List *l = NULL; - - EINA_LIST_FOREACH(list, l, vbuf) - { - if (vbuf->tbm_surface == buffer) - return vbuf; - } - - return NULL; -} - -static E_Comp_Wl_Video_Buf * -_e_video_vbuf_find_with_comp_buffer(Eina_List *list, E_Comp_Wl_Buffer *comp_buffer) -{ - E_Comp_Wl_Video_Buf *vbuf; - Eina_List *l = NULL; - - EINA_LIST_FOREACH(list, l, vbuf) - { - if (vbuf->comp_buffer == comp_buffer) - return vbuf; - } - - return NULL; -} - static E_Output * _get_e_output(tdm_output *output) { @@ -519,7 +489,7 @@ _e_video_input_buffer_get(E_Video_Hwc_Planes *evhp, E_Comp_Wl_Buffer *comp_buffe E_Comp_Wl_Video_Buf *vbuf; Eina_Bool need_pp_scanout = EINA_FALSE; - vbuf = _e_video_vbuf_find_with_comp_buffer(evhp->input_buffer_list, comp_buffer); + vbuf = e_video_hwc_vbuf_find_with_comp_buffer(evhp->input_buffer_list, comp_buffer); if (vbuf) { vbuf->content_r = evhp->geo.input_r; @@ -1332,11 +1302,11 @@ _e_video_pp_cb_done(tdm_pp *pp, tbm_surface_h sb, tbm_surface_h db, void *user_d E_Video_Hwc_Planes *evhp = (E_Video_Hwc_Planes*)user_data; E_Comp_Wl_Video_Buf *input_buffer, *pp_buffer; - input_buffer = _e_video_vbuf_find(evhp->input_buffer_list, sb); + input_buffer = e_video_hwc_vbuf_find(evhp->input_buffer_list, sb); if (input_buffer) e_comp_wl_video_buffer_unref(input_buffer); - pp_buffer = _e_video_vbuf_find(evhp->pp_buffer_list, db); + pp_buffer = e_video_hwc_vbuf_find(evhp->pp_buffer_list, db); if (pp_buffer) { e_comp_wl_video_buffer_set_use(pp_buffer, EINA_FALSE); diff --git a/src/bin/video/iface/e_video_hwc_windows.c b/src/bin/video/iface/e_video_hwc_windows.c index 9796bfe20a..5a1eab353c 100644 --- a/src/bin/video/iface/e_video_hwc_windows.c +++ b/src/bin/video/iface/e_video_hwc_windows.c @@ -74,36 +74,6 @@ static void _e_video_render(E_Video_Hwc_Windows *evhw, const char *func); static Eina_Bool _e_video_frame_buffer_show(E_Video_Hwc_Windows *evhw, E_Comp_Wl_Video_Buf *vbuf); static void _e_video_vblank_handler(tdm_output *output, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data); -static E_Comp_Wl_Video_Buf * -_e_video_vbuf_find(Eina_List *list, tbm_surface_h buffer) -{ - E_Comp_Wl_Video_Buf *vbuf; - Eina_List *l = NULL; - - EINA_LIST_FOREACH(list, l, vbuf) - { - if (vbuf->tbm_surface == buffer) - return vbuf; - } - - return NULL; -} - -static E_Comp_Wl_Video_Buf * -_e_video_vbuf_find_with_comp_buffer(Eina_List *list, E_Comp_Wl_Buffer *comp_buffer) -{ - E_Comp_Wl_Video_Buf *vbuf; - Eina_List *l = NULL; - - EINA_LIST_FOREACH(list, l, vbuf) - { - if (vbuf->comp_buffer == comp_buffer) - return vbuf; - } - - return NULL; -} - static Eina_Bool _e_video_parent_is_viewable(E_Video_Hwc_Windows *evhw) { @@ -233,7 +203,7 @@ _e_video_input_buffer_get(E_Video_Hwc_Windows *evhw, E_Comp_Wl_Buffer *comp_buff E_Comp_Wl_Video_Buf *vbuf; Eina_Bool need_pp_scanout = EINA_FALSE; - vbuf = _e_video_vbuf_find_with_comp_buffer(evhw->input_buffer_list, comp_buffer); + vbuf = e_video_hwc_vbuf_find_with_comp_buffer(evhw->input_buffer_list, comp_buffer); if (vbuf) { vbuf->content_r = evhw->geo.input_r; @@ -853,11 +823,11 @@ _e_video_pp_cb_done(tdm_pp *pp, tbm_surface_h sb, tbm_surface_h db, void *user_d E_Video_Hwc_Windows *evhw = (E_Video_Hwc_Windows*)user_data; E_Comp_Wl_Video_Buf *input_buffer, *pp_buffer; - input_buffer = _e_video_vbuf_find(evhw->input_buffer_list, sb); + input_buffer = e_video_hwc_vbuf_find(evhw->input_buffer_list, sb); if (input_buffer) e_comp_wl_video_buffer_unref(input_buffer); - pp_buffer = _e_video_vbuf_find(evhw->pp_buffer_list, db); + pp_buffer = e_video_hwc_vbuf_find(evhw->pp_buffer_list, db); if (pp_buffer) { e_comp_wl_video_buffer_set_use(pp_buffer, EINA_FALSE); -- 2.34.1