From: Boram Park Date: Wed, 23 Nov 2016 06:56:00 +0000 (+0900) Subject: remove unused helper function X-Git-Tag: submit/tizen/20161128.110729~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ca1c88f3d4353a73f54b560cc4a7015ddcb1be4;p=platform%2Fcore%2Fuifw%2Flibtdm.git remove unused helper function Change-Id: I4e996c26aaab61adb0ae10969b39c8871f28296c --- diff --git a/include/tdm_helper.h b/include/tdm_helper.h index 459b1b1f..3e4459ca 100644 --- a/include/tdm_helper.h +++ b/include/tdm_helper.h @@ -119,56 +119,6 @@ int tdm_helper_get_fd(const char *env); */ void tdm_helper_set_fd(const char *env, int fd); -/** - * @brief Start the dump debugging. - * @details - * Start tdm dump. - * Make dump file when tdm_layer_set_buffer() function is called. - * Set the dump count to 1. - * @param[in] dumppath The given dump path - * @param[in] count The dump count number - * @see #tdm_helper_dump_stop() - */ -void -tdm_helper_dump_start(char *dumppath, int *count); - -/** - * @brief Stop the dump debugging. - * @details - * Stop tdm dump. - * Set the dump count to 0. - * @see #tdm_helper_dump_start() - */ -void -tdm_helper_dump_stop(void); - -/** - * @brief The tdm helper capture handler - * @details - * This handler will be called when composit image produced. - * @see #tdm_helper_capture_output() function - */ -typedef void (*tdm_helper_capture_handler)(tbm_surface_h buffer, void *user_data); - -/** - * @brief Make an output's image surface. - * @details Composit specific output's all layer's buffer to dst_buffer surface. - * After composing, tdm_helper_capture_handler func will be called. - * @param[in] output A output object - * @param[in] dst_buffer A surface composite image saved - * @param[in] x A horizontal position of composite image on dst_buffer - * @param[in] y A vertical position of composite image on dst_buffer - * @param[in] w A composite image width - * @param[in] h A composite image height - * @param[in] func A composing done handler - * @param[in] user_data The user data - * @return #TDM_ERROR_NONE if success. Otherwise, error value. - */ -tdm_error -tdm_helper_capture_output(tdm_output *output, tbm_surface_h dst_buffer, - int x, int y, int w, int h, - tdm_helper_capture_handler func, void *data); - /** * @brief Fill the display information to the reply buffer as string. * @param[in] dpy A display object diff --git a/src/tdm_display.c b/src/tdm_display.c index a34daabe..8d0cdd22 100644 --- a/src/tdm_display.c +++ b/src/tdm_display.c @@ -40,7 +40,6 @@ #include "tdm.h" #include "tdm_backend.h" #include "tdm_private.h" -#include "tdm_helper.h" #define COUNT_MAX 10 @@ -1597,26 +1596,6 @@ tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info) return ret; } -static void -_tdm_layer_dump_buffer(tdm_layer *layer, tbm_surface_h buffer) -{ - tdm_private_layer *private_layer = (tdm_private_layer*)layer; - tdm_private_output *private_output = private_layer->private_output; - unsigned int pipe; - int zpos; - char fname[PATH_MAX]; - - pipe = private_output->pipe; - zpos = private_layer->caps.zpos; - - snprintf(fname, sizeof(fname), "tdm_%d_lyr_%d", pipe, zpos); - - tbm_surface_internal_dump_buffer(buffer, fname); - TDM_DBG("%s dump excute", fname); - - return; -} - EXTERN tdm_error tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer) { @@ -1653,10 +1632,6 @@ tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer) ret = func_layer->layer_set_buffer(private_layer->layer_backend, buffer); TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE); - /* dump buffer */ - if (tdm_dump_enable && !(private_layer->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO)) - _tdm_layer_dump_buffer(layer, buffer); - if (ret == TDM_ERROR_NONE) { /* FIXME: should save to pending_buffer first. And after committing * successfully, need to move to waiting_buffer. diff --git a/src/tdm_helper.c b/src/tdm_helper.c index f5e39b31..f2fce589 100644 --- a/src/tdm_helper.c +++ b/src/tdm_helper.c @@ -397,179 +397,6 @@ tdm_helper_set_fd(const char *env, int fd) TDM_INFO("%s: fd(%d)", env, fd); } -EXTERN void -tdm_helper_dump_start(char *dumppath, int *count) -{ - if (dumppath == NULL || count == NULL) { - TDM_DBG("tdm_helper_dump dumppath or count is null."); - return; - } - - tdm_dump_enable = 1; - - TDM_DBG("tdm_helper_dump start.(path : %s)", dumppath); -} - -EXTERN void -tdm_helper_dump_stop(void) -{ - tdm_dump_enable = 0; - - TDM_DBG("tdm_helper_dump stop."); -} - -static pixman_format_code_t -_tdm_helper_pixman_format_get(tbm_format format) -{ - switch (format) { - case TBM_FORMAT_ARGB8888: - return PIXMAN_a8r8g8b8; - case TBM_FORMAT_XRGB8888: - return PIXMAN_x8r8g8b8; - default: - return 0; - } - - return 0; -} - -static tdm_error -_tdm_helper_buffer_convert(tbm_surface_h srcbuf, tbm_surface_h dstbuf, - int dx, int dy, int dw, int dh, int count) -{ - pixman_image_t *src_img = NULL, *dst_img = NULL; - pixman_format_code_t src_format, dst_format; - pixman_transform_t t; - struct pixman_f_transform ft; - pixman_op_t op; - tbm_surface_info_s src_info = {0, }; - tbm_surface_info_s dst_info = {0, }; - int stride, width; - double scale_x, scale_y; - - TDM_RETURN_VAL_IF_FAIL(srcbuf != NULL, TDM_ERROR_INVALID_PARAMETER); - TDM_RETURN_VAL_IF_FAIL(dstbuf != NULL, TDM_ERROR_INVALID_PARAMETER); - - if (tbm_surface_map(srcbuf, TBM_SURF_OPTION_READ, &src_info) - != TBM_SURFACE_ERROR_NONE) { - TDM_ERR("cannot mmap srcbuf\n"); - return TDM_ERROR_OPERATION_FAILED; - } - - if (tbm_surface_map(dstbuf, TBM_SURF_OPTION_WRITE, &dst_info) - != TBM_SURFACE_ERROR_NONE) { - TDM_ERR("cannot mmap dstbuf\n"); - tbm_surface_unmap(srcbuf); - return TDM_ERROR_OPERATION_FAILED; - } - TDM_GOTO_IF_FAIL(src_info.num_planes == 1, cant_convert); - TDM_GOTO_IF_FAIL(dst_info.num_planes == 1, cant_convert); - - /* src */ - src_format = _tdm_helper_pixman_format_get(src_info.format); - TDM_GOTO_IF_FAIL(src_format > 0, cant_convert); - - width = src_info.planes[0].stride / 4; - stride = src_info.planes[0].stride; - src_img = pixman_image_create_bits(src_format, width, src_info.height, - (uint32_t*)src_info.planes[0].ptr, stride); - TDM_GOTO_IF_FAIL(src_img != NULL, cant_convert); - - /* dst */ - dst_format = _tdm_helper_pixman_format_get(dst_info.format); - TDM_GOTO_IF_FAIL(dst_format > 0, cant_convert); - - width = dst_info.planes[0].stride / 4; - stride = dst_info.planes[0].stride; - dst_img = pixman_image_create_bits(dst_format, width, dst_info.height, - (uint32_t*)dst_info.planes[0].ptr, stride); - TDM_GOTO_IF_FAIL(dst_img != NULL, cant_convert); - - pixman_f_transform_init_identity(&ft); - - scale_x = (double)src_info.width / dw; - scale_y = (double)src_info.height / dh; - - pixman_f_transform_scale(&ft, NULL, scale_x, scale_y); - pixman_f_transform_translate(&ft, NULL, 0, 0); - pixman_transform_from_pixman_f_transform(&t, &ft); - pixman_image_set_transform(src_img, &t); - - if (count == 0) - op = PIXMAN_OP_SRC; - else - op = PIXMAN_OP_OVER; - - pixman_image_composite(op, src_img, NULL, dst_img, - 0, 0, 0, 0, dx, dy, dw, dh); - - if (src_img) - pixman_image_unref(src_img); - if (dst_img) - pixman_image_unref(dst_img); - - tbm_surface_unmap(srcbuf); - tbm_surface_unmap(dstbuf); - - return TDM_ERROR_NONE; - -cant_convert: - if (src_img) - pixman_image_unref(src_img); - - tbm_surface_unmap(srcbuf); - tbm_surface_unmap(dstbuf); - - return TDM_ERROR_OPERATION_FAILED; -} - -EXTERN tdm_error -tdm_helper_capture_output(tdm_output *output, tbm_surface_h dst_buffer, - int x, int y, int w, int h, - tdm_helper_capture_handler func, void *data) -{ - tbm_surface_h surface; - tdm_error err; - int i, count, first = 0; - - TDM_RETURN_VAL_IF_FAIL(output != NULL, TDM_ERROR_INVALID_PARAMETER); - TDM_RETURN_VAL_IF_FAIL(dst_buffer != NULL, TDM_ERROR_INVALID_PARAMETER); - TDM_RETURN_VAL_IF_FAIL(x >= 0, TDM_ERROR_INVALID_PARAMETER); - TDM_RETURN_VAL_IF_FAIL(y >= 0, TDM_ERROR_INVALID_PARAMETER); - TDM_RETURN_VAL_IF_FAIL(w >= 0, TDM_ERROR_INVALID_PARAMETER); - TDM_RETURN_VAL_IF_FAIL(h >= 0, TDM_ERROR_INVALID_PARAMETER); - TDM_RETURN_VAL_IF_FAIL(func != NULL, TDM_ERROR_INVALID_PARAMETER); - TDM_RETURN_VAL_IF_FAIL(data != NULL, TDM_ERROR_INVALID_PARAMETER); - - err = tdm_output_get_layer_count(output, &count); - if (err != TDM_ERROR_NONE) { - TDM_ERR("tdm_output_get_layer_count fail(%d)\n", err); - return TDM_ERROR_OPERATION_FAILED; - } - if (count <= 0) { - TDM_ERR("tdm_output_get_layer_count err(%d, %d)\n", err, count); - return TDM_ERROR_BAD_MODULE; - } - - for (i = count - 1; i >= 0; i--) { - tdm_layer *layer = tdm_output_get_layer(output, i, NULL); - - surface = tdm_layer_get_displaying_buffer(layer, &err); - if (err != TDM_ERROR_NONE) - continue; - - err = _tdm_helper_buffer_convert(surface, dst_buffer, x, y, w, h, first++); - if (err != TDM_ERROR_NONE) - TDM_DBG("convert fail %d-layer buffer\n", i); - else - TDM_DBG("convert success %d-layer buffer\n", i); - } - - func(dst_buffer, data); - - return TDM_ERROR_NONE; -} - EXTERN void tdm_helper_get_display_information(tdm_display *dpy, char *reply, int *len) {