From fc0354984b353a7bc3a504294621be05d6d8522a Mon Sep 17 00:00:00 2001 From: Boram Park Date: Wed, 11 May 2016 11:02:27 +0900 Subject: [PATCH 01/16] version up to 1.2.0 Change-Id: I23b875888896f4b3d197f37a425e50823bc0c4d3 --- configure.ac | 2 +- packaging/libtdm.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 8ead459..4f01243 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.60]) m4_define([tdm_major_version], [1]) -m4_define([tdm_minor_version], [1]) +m4_define([tdm_minor_version], [2]) m4_define([tdm_micro_version], [0]) m4_define([tdm_version], [tdm_major_version.tdm_minor_version.tdm_micro_version]) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 6df4f07..881db02 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -1,5 +1,5 @@ Name: libtdm -Version: 1.1.0 +Version: 1.2.0 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 7449e59bf1928ba857a189e8e70584f9f6fec744 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Wed, 11 May 2016 14:30:11 +0900 Subject: [PATCH 02/16] use the fixed version for doxygen Change-Id: I213ffd20f69bace853074a829536564c3448515e --- configure.ac | 1 - doc/{tdm_doc.h.in => tdm_doc.h} | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) rename doc/{tdm_doc.h.in => tdm_doc.h} (98%) diff --git a/configure.ac b/configure.ac index 4f01243..fa99a81 100644 --- a/configure.ac +++ b/configure.ac @@ -76,7 +76,6 @@ AC_SUBST(WARN_CFLAGS) AC_OUTPUT([ Makefile libtdm.pc - doc/tdm_doc.h include/Makefile protocol/Makefile client/libtdm-client.pc diff --git a/doc/tdm_doc.h.in b/doc/tdm_doc.h similarity index 98% rename from doc/tdm_doc.h.in rename to doc/tdm_doc.h index 3d5b9e6..4d60a64 100644 --- a/doc/tdm_doc.h.in +++ b/doc/tdm_doc.h @@ -39,7 +39,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /** * @mainpage TDM * @author Boram Park, boram1288.park@samsung.com - * @version @TDM_VERSION@ + * @version 1.2.0 * @par Introduction * TDM stands for Tizen Display Manager. It's the display HAL layer for tizen * display server. It offers the frontend APIs(@ref tdm.h) for a frontend user @@ -123,7 +123,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. { "drm", "Samsung", - TDM_BACKEND_ABI_VERSION, + TDM_BACKEND_SET_ABI_VERSION(1,2), tdm_drm_init, tdm_drm_deinit }; -- 2.7.4 From 40ad17404d1c0398a7bebdd039fab420a03c9598 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Wed, 11 May 2016 14:39:19 +0900 Subject: [PATCH 03/16] doxygen update Change-Id: I75908f664daa551d39b5a33d1c938aaefba03a4a --- include/tdm_backend.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 4bde8b0..9a1ea41 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -737,8 +737,8 @@ typedef struct _tdm_func_capture { /** * @brief Attach a TDM buffer to a capture object - * @details When capture_commit() function is called, a backend module dumps - * a output or a layer to a TDM buffer. + * @details When capture_commit() function is called, a backend module starts + * to dump a output or a layer to a TDM buffer. * @param[in] capture A capture object * @param[in] buffer A TDM buffer * @return #TDM_ERROR_NONE if success. Otherwise, error value. @@ -746,7 +746,7 @@ typedef struct _tdm_func_capture { * @see capture_commit() function of #tdm_func_capture * @see capture_set_done_handler, tdm_capture_done_handler * @remark - * A backend module dumps a output or a layer to to a TDM buffer when + * A backend module starts to dump a output or a layer to to a TDM buffer when * committed. The size/crop/transform information is set via #capture_set_info() * of #tdm_func_capture. When done, a backend module @b SHOULD return the TDM * buffer via tdm_capture_done_handler. -- 2.7.4 From 4fe20f14ebf944fd3d633288ac70008468f34400 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 13 May 2016 11:31:32 +0900 Subject: [PATCH 04/16] change dump API from tdm_helper to tbm_surface_internal Change-Id: I860f6addb06a5ce0863dc64ec76473582caad0b3 Signed-off-by: Junkyeong Kim --- src/tdm_display.c | 30 ++++-------------------------- src/tdm_helper.c | 16 ---------------- src/tdm_private.h | 5 ----- 3 files changed, 4 insertions(+), 47 deletions(-) diff --git a/src/tdm_display.c b/src/tdm_display.c index e8c6f60..1b95bec 100644 --- a/src/tdm_display.c +++ b/src/tdm_display.c @@ -1431,39 +1431,17 @@ _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; - char *path = NULL; - int count; unsigned int pipe; int zpos; - char fullpath[PATH_MAX]; - tbm_surface_info_s info; - tbm_surface_error_e err; - - path = tdm_helper_get_dump_path(); - if (!path) - return; - - count = tdm_helper_get_dump_count(); - if (count <= 0) - return; - - err = tbm_surface_map(buffer, TBM_SURF_OPTION_READ, &info); - TDM_RETURN_IF_FAIL(err == TBM_SURFACE_ERROR_NONE); + char fname[PATH_MAX]; pipe = private_output->pipe; zpos = private_layer->caps.zpos; - if (info.format == TBM_FORMAT_ARGB8888 || info.format == TBM_FORMAT_XRGB8888) - snprintf(fullpath, sizeof(fullpath), "%s/%03d_out_%d_lyr_%d.png", - path, count, pipe, zpos); - else - snprintf(fullpath, sizeof(fullpath), "%s/%03d_out_%d_lyr_%d_%dx%d_%c%c%c%c.yuv", - path, count, pipe, zpos, info.planes[0].stride, info.height, FOURCC_STR(info.format)); - - tbm_surface_unmap(buffer); + snprintf(fname, sizeof(fname), "tdm_%d_lyr_%d", pipe, zpos); - tdm_helper_dump_buffer(buffer, fullpath); - TDM_DBG("%d, %s dump excute", count, fullpath); + tbm_surface_internal_dump_buffer(buffer, fname); + TDM_DBG("%s dump excute", fname); return; } diff --git a/src/tdm_helper.c b/src/tdm_helper.c index 18b6a48..d85d412 100644 --- a/src/tdm_helper.c +++ b/src/tdm_helper.c @@ -286,19 +286,3 @@ tdm_helper_dump_stop(void) TDM_DBG("tdm_helper_dump stop."); } -INTERN int -tdm_helper_get_dump_count(void) -{ - if ((tdm_helper_dump_count != NULL) && (tdm_helper_dump_path != NULL)) { - if (*tdm_helper_dump_count == 1000) - *tdm_helper_dump_count = 1; - return (*tdm_helper_dump_count)++; - } else - return 0; -} - -INTERN char * -tdm_helper_get_dump_path(void) -{ - return tdm_helper_dump_path; -} diff --git a/src/tdm_private.h b/src/tdm_private.h index 134ce51..65ce287 100644 --- a/src/tdm_private.h +++ b/src/tdm_private.h @@ -456,11 +456,6 @@ extern pthread_mutex_t tdm_mutex_check_lock; extern int tdm_mutex_locked; extern int tdm_dump_enable; -int -tdm_helper_get_dump_count(void); -char * -tdm_helper_get_dump_path(void); - #define _pthread_mutex_unlock(l) \ do { \ if (tdm_debug_mutex) \ -- 2.7.4 From 934915afafa9e65bb51740509047b6b45e799810 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 17 May 2016 14:26:57 +0900 Subject: [PATCH 05/16] Add tdm_layer_get_displaying_buffer function Change-Id: Icf5337ce6ead12ae534506a4d150039568e59a73 --- include/tdm.h | 10 ++++++++++ src/tdm_display.c | 25 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index 1c38b52..229de00 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -582,6 +582,16 @@ tdm_error tdm_layer_unset_buffer(tdm_layer *layer); /** + * @brief Get a displaying TDM buffer from a layer object + * @details A displaying TDM buffer is a current showing buffer on screen + * that is set to layer object and applied output object of a layer object. + * @param[in] layer A layer object + * @return A TDM buffer if success. Otherwise, NULL. + */ +tbm_surface_h +tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error); + +/** * @brief Set a TBM surface_queue to a layer object * @details A TBM surface_queue will be applied when the output object * of a layer object is committed. and TDM layer will be automatically updated diff --git a/src/tdm_display.c b/src/tdm_display.c index 1b95bec..c44130b 100644 --- a/src/tdm_display.c +++ b/src/tdm_display.c @@ -1543,6 +1543,31 @@ tdm_layer_unset_buffer(tdm_layer *layer) return ret; } +EXTERN tbm_surface_h +tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error) +{ + tbm_surface_h buffer; + LAYER_FUNC_ENTRY_ERROR(); + + _pthread_mutex_lock(&private_display->lock); + + if (error) + *error = TDM_ERROR_NONE; + + if (private_layer->showing_buffer) { + buffer = private_layer->showing_buffer; + } else { + *error = TDM_ERROR_OPERATION_FAILED; + _pthread_mutex_unlock(&private_display->lock); + TDM_ERR("layer(%p) showing_buffer is null", + private_layer); + return NULL; + } + _pthread_mutex_unlock(&private_display->lock); + + return buffer; +} + static void _tbm_layer_queue_acquirable_cb(tbm_surface_queue_h surface_queue, void *data) { -- 2.7.4 From 4daf58df84c48637141616910235e372cab278e1 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 17 May 2016 17:32:04 +0900 Subject: [PATCH 06/16] add doxyzen comment for zpos Change-Id: I88c4e90791275236a3169a66a767de5bd837e359 --- include/tdm.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index 229de00..9bea835 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -508,6 +508,12 @@ tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props, * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4). + * -------------------------------- graphic layer 3 <-- top most layer + * -------------------------------- graphic layer 2 + * -------------------------------- graphic layer 1 + * -------------------------------- graphic layer 0 + * -------------------------------- video layer -1 + * -------------------------------- video layer -2 <-- lowest layer * @param[in] layer A layer object * @param[out] zpos The zpos * @return #TDM_ERROR_NONE if success. Otherwise, error value. -- 2.7.4 From ddd92dc65a7fa176404a2a48625fba8920d85e83 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 19 May 2016 17:32:43 +0900 Subject: [PATCH 07/16] add null checking Change-Id: I60beab517611977ca946ee6d469b11be710e32c6 Signed-off-by: Junkyeong Kim --- src/tdm_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tdm_display.c b/src/tdm_display.c index c44130b..b61bed5 100644 --- a/src/tdm_display.c +++ b/src/tdm_display.c @@ -1557,7 +1557,8 @@ tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error) if (private_layer->showing_buffer) { buffer = private_layer->showing_buffer; } else { - *error = TDM_ERROR_OPERATION_FAILED; + if (error) + *error = TDM_ERROR_OPERATION_FAILED; _pthread_mutex_unlock(&private_display->lock); TDM_ERR("layer(%p) showing_buffer is null", private_layer); -- 2.7.4 From b372f55a6f7216909a694914f43c28632afaf733 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 20 May 2016 17:43:25 +0900 Subject: [PATCH 08/16] update output when udev event occured Change-Id: I7a85d3d9ad52f9914d68a66cf4b5537b349db7dc Signed-off-by: Junkyeong Kim --- src/tdm.c | 10 ++++++---- src/tdm_display.c | 20 ++++++++++++++++++++ src/tdm_private.h | 4 ++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/tdm.c b/src/tdm.c index f073d21..a3d0137 100644 --- a/src/tdm.c +++ b/src/tdm.c @@ -402,8 +402,8 @@ failed_update: return ret; } -static tdm_error -_tdm_display_update_output(tdm_private_display *private_display, +INTERN tdm_error +tdm_display_update_output(tdm_private_display *private_display, tdm_output *output_backend, int pipe) { tdm_func_output *func_output = &private_display->func_output; @@ -436,10 +436,12 @@ _tdm_display_update_output(tdm_private_display *private_display, LIST_INITHEAD(&private_output->change_handler_list_main); LIST_INITHEAD(&private_output->change_handler_list_sub); - if (func_output->output_set_status_handler) + if (func_output->output_set_status_handler) { func_output->output_set_status_handler(private_output->output_backend, tdm_output_cb_status, private_output); + private_output->regist_change_cb = 1; + } } else _tdm_display_destroy_caps_output(&private_output->caps); @@ -625,7 +627,7 @@ _tdm_display_update_internal(tdm_private_display *private_display, goto failed_update; for (i = 0; i < output_count; i++) { - ret = _tdm_display_update_output(private_display, outputs[i], i); + ret = tdm_display_update_output(private_display, outputs[i], i); if (ret != TDM_ERROR_NONE) goto failed_update; } diff --git a/src/tdm_display.c b/src/tdm_display.c index b61bed5..0148871 100644 --- a/src/tdm_display.c +++ b/src/tdm_display.c @@ -488,6 +488,21 @@ tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status) return ret; } +static void +_tdm_output_update(tdm_output *output_backend, void *user_data) +{ + tdm_private_display *private_display; + tdm_private_output *private_output = user_data; + tdm_error ret; + + TDM_RETURN_IF_FAIL(private_output); + + private_display = private_output->private_display; + + ret = tdm_display_update_output(private_display, output_backend, private_output->pipe); + TDM_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); +} + INTERN void tdm_output_cb_status(tdm_output *output_backend, tdm_output_conn_status status, void *user_data) @@ -505,6 +520,8 @@ tdm_output_cb_status(tdm_output *output_backend, tdm_output_conn_status status, tdm_thread_cb_output_status output_status; tdm_error ret; + _tdm_output_update(output_backend, user_data); + output_status.base.type = TDM_THREAD_CB_OUTPUT_STATUS; output_status.base.length = sizeof output_status; output_status.output_stamp = private_output->stamp; @@ -523,6 +540,9 @@ tdm_output_cb_status(tdm_output *output_backend, tdm_output_conn_status status, return; } + if (!tdm_thread_is_running()) + _tdm_output_update(output_backend, user_data); + value.u32 = status; tdm_output_call_change_handler_internal(private_output, &private_output->change_handler_list_main, diff --git a/src/tdm_private.h b/src/tdm_private.h index 65ce287..a4a88f5 100644 --- a/src/tdm_private.h +++ b/src/tdm_private.h @@ -513,6 +513,10 @@ _tdm_display_unlock(tdm_display *dpy, const char *func); #define tdm_display_lock(dpy) _tdm_display_lock(dpy, __FUNCTION__) #define tdm_display_unlock(dpy) _tdm_display_unlock(dpy, __FUNCTION__) +tdm_error +tdm_display_update_output(tdm_private_display *private_display, + tdm_output *output_backend, int pipe); + #ifdef __cplusplus } #endif -- 2.7.4 From 5ca033e110b436529bf77469bab4b2156ea6d36f Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 26 May 2016 17:45:07 +0900 Subject: [PATCH 09/16] erase unused variable Change-Id: I03dee48c79d49b07478dfa0501427a97e1df9360 Signed-off-by: Junkyeong Kim --- src/tdm_helper.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/tdm_helper.c b/src/tdm_helper.c index d85d412..2a77cea 100644 --- a/src/tdm_helper.c +++ b/src/tdm_helper.c @@ -17,8 +17,6 @@ static const char *dump_prefix[2] = {"png", "yuv"}; int tdm_dump_enable; -static int *tdm_helper_dump_count; -static char *tdm_helper_dump_path; INTERN unsigned long tdm_helper_get_time_in_millis(void) @@ -257,30 +255,19 @@ tdm_helper_set_fd(const char *env, int fd) EXTERN void tdm_helper_dump_start(char *dumppath, int *count) { - if (tdm_helper_dump_count != NULL) { - TDM_DBG("tdm_helper_dump is already started."); - return; - } - if (dumppath == NULL || count == NULL) { TDM_DBG("tdm_helper_dump dumppath or count is null."); return; } - tdm_helper_dump_count = count; - tdm_helper_dump_path = dumppath; - tdm_dump_enable = 1; - TDM_DBG("tdm_helper_dump start.(path : %s)", tdm_helper_dump_path); + TDM_DBG("tdm_helper_dump start.(path : %s)", dumppath); } EXTERN void tdm_helper_dump_stop(void) { - tdm_helper_dump_path = NULL; - tdm_helper_dump_count = NULL; - tdm_dump_enable = 0; TDM_DBG("tdm_helper_dump stop."); -- 2.7.4 From 93b3b2b29d84ca9f05347a4ded714759908d6f4b Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 26 May 2016 16:21:02 +0900 Subject: [PATCH 10/16] reuse ordered output Change-Id: I5bba0bf6768192a5554c642309ff3b79f77707b5 Signed-off-by: Junkyeong Kim --- src/tdm.c | 31 ++++++++++++++++++------------- src/tdm_private.h | 3 +++ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/tdm.c b/src/tdm.c index a3d0137..24f3e52 100644 --- a/src/tdm.c +++ b/src/tdm.c @@ -196,6 +196,10 @@ _tdm_display_destroy_private_display(tdm_private_display *private_display) tdm_private_pp *p = NULL, *pp = NULL; free(private_display->outputs_ptr); + if (private_display->outputs) { + free(private_display->outputs); + private_display->outputs = NULL; + } LIST_FOR_EACH_ENTRY_SAFE(p, pp, &private_display->pp_list, link) tdm_pp_destroy_internal(p); @@ -486,8 +490,7 @@ _tdm_display_set_main_first(tdm_output **outputs, int index) } static tdm_output ** -_tdm_display_get_ordered_outputs(tdm_private_display *private_display, - int *count, int init) +_tdm_display_get_ordered_outputs(tdm_private_display *private_display, int *count) { tdm_func_display *func_display = &private_display->func_display; tdm_output **outputs = NULL; @@ -500,6 +503,10 @@ _tdm_display_get_ordered_outputs(tdm_private_display *private_display, int index_dsi = 0, index_lvds = 0, index_hdmia = 0, index_hdmib = 0; tdm_error ret; + /* don't change list order if not init time */ + if (private_display->outputs) + return private_display->outputs; + outputs = func_display->display_get_outputs(private_display->bdata, &output_count, &ret); if (ret != TDM_ERROR_NONE) @@ -509,12 +516,10 @@ _tdm_display_get_ordered_outputs(tdm_private_display *private_display, if (output_count == 0) goto failed_get_outputs; - else if (output_count == 1) - return outputs; - - /* don't change list order if not init time */ - if (init != 0) + else if (output_count == 1) { + private_display->outputs = outputs; return outputs; + } /* count connected outputs */ for (i = 0; i < output_count; i++) { @@ -524,13 +529,13 @@ _tdm_display_get_ordered_outputs(tdm_private_display *private_display, if (!func_output->output_get_capability) { TDM_ERR("no output_get_capability()"); - return outputs; + goto failed_get_outputs; } ret = func_output->output_get_capability(outputs[i], &caps); if (ret != TDM_ERROR_NONE) { TDM_ERR("output_get_capability() failed"); - return outputs; + goto failed_get_outputs; } if (caps.status == TDM_OUTPUT_CONN_STATUS_CONNECTED) { @@ -592,9 +597,12 @@ _tdm_display_get_ordered_outputs(tdm_private_display *private_display, new_outputs = outputs; } + private_display->outputs = new_outputs; + return new_outputs; failed_get_outputs: + free(outputs); *count = 0; return NULL; } @@ -622,7 +630,7 @@ _tdm_display_update_internal(tdm_private_display *private_display, goto failed_update; } - outputs = _tdm_display_get_ordered_outputs(private_display, &output_count, only_display); + outputs = _tdm_display_get_ordered_outputs(private_display, &output_count); if (!outputs) goto failed_update; @@ -632,13 +640,10 @@ _tdm_display_update_internal(tdm_private_display *private_display, goto failed_update; } - free(outputs); - return TDM_ERROR_NONE; failed_update: _tdm_display_destroy_private_display(private_display); - free(outputs); return ret; } diff --git a/src/tdm_private.h b/src/tdm_private.h index a4a88f5..d751a81 100644 --- a/src/tdm_private.h +++ b/src/tdm_private.h @@ -141,6 +141,9 @@ struct _tdm_private_display { /* for event handling */ tdm_private_loop *private_loop; + + /* output order */ + tdm_output **outputs; }; struct _tdm_private_output { -- 2.7.4 From a96653d12ad8b320812307b3d1d6cb8b35fe9e78 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 30 May 2016 11:04:45 +0900 Subject: [PATCH 11/16] apply tizen coding rule Change-Id: I4557e1e0aa1a8d1ed026444f0caf480a66bb9c28 --- client/tdm_client.c | 106 ++++++++-------- client/tdm_client.h | 127 ++++++++++--------- doc/tdm_doc.h | 172 +++++++++++++------------- include/tdm.h | 125 ++++++++++--------- include/tdm_backend.h | 255 +++++++++++++++++++------------------- include/tdm_helper.h | 64 +++++----- include/tdm_list.h | 16 +-- include/tdm_log.h | 70 +++++------ include/tdm_types.h | 94 +++++++------- src/tdm.c | 151 +++++++++++------------ src/tdm_backend.c | 78 ++++++------ src/tdm_buffer.c | 79 ++++++------ src/tdm_capture.c | 96 +++++++-------- src/tdm_display.c | 321 ++++++++++++++++++++++++------------------------ src/tdm_event_loop.c | 103 ++++++++-------- src/tdm_helper.c | 91 +++++++++----- src/tdm_macro.h | 141 +++++++++++---------- src/tdm_pp.c | 106 ++++++++-------- src/tdm_private.h | 92 +++++++------- src/tdm_server.c | 134 ++++++++++---------- src/tdm_thread.c | 103 ++++++++-------- tools/tdm_test_client.c | 66 +++++----- 22 files changed, 1299 insertions(+), 1291 deletions(-) diff --git a/client/tdm_client.c b/client/tdm_client.c index 5797af8..2560a87 100644 --- a/client/tdm_client.c +++ b/client/tdm_client.c @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifdef HAVE_CONFIG_H @@ -70,8 +70,8 @@ typedef struct _tdm_client_vblank_info { static void _tdm_client_cb_global(void *data, struct wl_registry *registry, - uint32_t name, const char *interface, - uint32_t version) + uint32_t name, const char *interface, + uint32_t version) { tdm_private_client *private_client = data; @@ -89,10 +89,9 @@ _tdm_client_cb_global_remove(void *data, struct wl_registry *registry, uint32_t { } -static const struct wl_registry_listener tdm_client_registry_listener = -{ - _tdm_client_cb_global, - _tdm_client_cb_global_remove +static const struct wl_registry_listener tdm_client_registry_listener = { + _tdm_client_cb_global, + _tdm_client_cb_global_remove }; tdm_client* @@ -105,7 +104,7 @@ tdm_client_create(tdm_client_error *error) if (debug && (strstr(debug, "1"))) tdm_debug = 1; - private_client = calloc(1, sizeof *private_client); + private_client = calloc(1, sizeof * private_client); if (!private_client) { TDM_ERR("alloc failed"); if (error) @@ -120,7 +119,7 @@ tdm_client_create(tdm_client_error *error) TDM_GOTO_IF_FAIL(private_client->registry != NULL, create_failed); wl_registry_add_listener(private_client->registry, - &tdm_client_registry_listener, private_client); + &tdm_client_registry_listener, private_client); wl_display_roundtrip(private_client->display); /* check global objects */ @@ -202,7 +201,7 @@ tdm_client_handle_events(tdm_client *client) static void _tdm_client_cb_vblank_done(void *data, struct wl_tdm_vblank *vblank, - uint32_t sequence, uint32_t tv_sec, uint32_t tv_usec) + uint32_t sequence, uint32_t tv_sec, uint32_t tv_usec) { tdm_client_vblank_info *vblank_info = (tdm_client_vblank_info*)data; @@ -212,11 +211,10 @@ _tdm_client_cb_vblank_done(void *data, struct wl_tdm_vblank *vblank, TDM_NEVER_GET_HERE(); TDM_DBG("vblank_info(%p) wl_tbm_vblank@%d", vblank_info, - wl_proxy_get_id((struct wl_proxy *)vblank)); + wl_proxy_get_id((struct wl_proxy *)vblank)); - if (vblank_info->func) { + if (vblank_info->func) vblank_info->func(sequence, tv_sec, tv_usec, vblank_info->user_data); - } if (vblank_info->need_free) { LIST_DEL(&vblank_info->link); @@ -232,8 +230,8 @@ static const struct wl_tdm_vblank_listener tdm_client_vblank_listener = { tdm_client_error tdm_client_wait_vblank(tdm_client *client, char *name, - int sw_timer, int interval, int sync, - tdm_client_vblank_handler func, void *user_data) + int sw_timer, int interval, int sync, + tdm_client_vblank_handler func, void *user_data) { tdm_private_client *private_client = (tdm_private_client*)client; tdm_client_vblank_info *vblank_info; @@ -246,7 +244,7 @@ tdm_client_wait_vblank(tdm_client *client, char *name, TDM_RETURN_VAL_IF_FAIL(private_client != NULL, TDM_CLIENT_ERROR_INVALID_PARAMETER); TDM_RETURN_VAL_IF_FAIL(private_client->tdm_client != NULL, TDM_CLIENT_ERROR_INVALID_PARAMETER); - vblank_info = calloc(1, sizeof *vblank_info); + vblank_info = calloc(1, sizeof * vblank_info); if (!vblank_info) { TDM_ERR("alloc failed"); return TDM_CLIENT_ERROR_OUT_OF_MEMORY; @@ -255,13 +253,13 @@ tdm_client_wait_vblank(tdm_client *client, char *name, clock_gettime(CLOCK_MONOTONIC, &tp); vblank_info->req_sec = (unsigned int)tp.tv_sec; - vblank_info->req_usec = (unsigned int)(tp.tv_nsec/1000); + vblank_info->req_usec = (unsigned int)(tp.tv_nsec / 1000); vblank_info->need_free = (sync) ? 0 : 1; vblank_info->vblank = wl_tdm_client_wait_vblank(private_client->tdm_client, - name, sw_timer, interval, - vblank_info->req_sec, vblank_info->req_usec); + name, sw_timer, interval, + vblank_info->req_sec, vblank_info->req_usec); if (!vblank_info->vblank) { TDM_ERR("couldn't create vblank resource"); free(vblank_info); @@ -269,10 +267,10 @@ tdm_client_wait_vblank(tdm_client *client, char *name, } TDM_DBG("vblank_info(%p) wl_tbm_vblank@%d", vblank_info, - wl_proxy_get_id((struct wl_proxy *)vblank_info->vblank)); + wl_proxy_get_id((struct wl_proxy *)vblank_info->vblank)); wl_tdm_vblank_add_listener(vblank_info->vblank, - &tdm_client_vblank_listener, vblank_info); + &tdm_client_vblank_listener, vblank_info); vblank_info->func = func; vblank_info->user_data = user_data; @@ -288,8 +286,8 @@ tdm_client_wait_vblank(tdm_client *client, char *name, clock_gettime(CLOCK_MONOTONIC, &tp); TDM_DBG("block during %d us", - ((unsigned int)(tp.tv_sec * 1000000) + (unsigned int)(tp.tv_nsec/1000)) - - (vblank_info->req_sec * 1000000 + vblank_info->req_usec)); + ((unsigned int)(tp.tv_sec * 1000000) + (unsigned int)(tp.tv_nsec / 1000)) + - (vblank_info->req_sec * 1000000 + vblank_info->req_usec)); LIST_DEL(&vblank_info->link); free(vblank_info); diff --git a/client/tdm_client.h b/client/tdm_client.h index 06e2c9b..a6a7a09 100644 --- a/client/tdm_client.h +++ b/client/tdm_client.h @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifndef _TDM_CLIENT_H_ @@ -45,15 +45,14 @@ extern "C" { * @brief The header file for a client of TDM. * @par Example * @code - #include //for a client of TDM + * #include //for a client of TDM * @endcode */ /** * @brief The client error enumeration */ -typedef enum -{ +typedef enum { TDM_CLIENT_ERROR_NONE = 0, /**< none */ TDM_CLIENT_ERROR_OPERATION_FAILED = -1, /**< operaion failed */ TDM_CLIENT_ERROR_INVALID_PARAMETER = -2, /**< wrong input parameter */ @@ -73,7 +72,7 @@ typedef void *tdm_client; */ typedef void (*tdm_client_vblank_handler)(unsigned int sequence, unsigned int tv_sec, - unsigned int tv_usec, void *user_data); + unsigned int tv_usec, void *user_data); /** * @brief Create a TDM client object. @@ -100,32 +99,32 @@ tdm_client_destroy(tdm_client *client); * @see #tdm_client_handle_events * @par Example * @code - #include //for a client of TDM - - err = tdm_client_get_fd(client, &fd); - if (err != TDM_CLIENT_ERROR_NONE) { - //error handling - } - - fds.events = POLLIN; - fds.fd = fd; - fds.revents = 0; - - while(1) { - ret = poll(&fds, 1, -1); - if (ret < 0) { - if (errno == EBUSY) - continue; - else { - //error handling - } - } - - err = tdm_client_handle_events(client); - if (err != TDM_CLIENT_ERROR_NONE) { - //error handling - } - } + * #include //for a client of TDM + * + * err = tdm_client_get_fd(client, &fd); + * if (err != TDM_CLIENT_ERROR_NONE) { + * //error handling + * } + * + * fds.events = POLLIN; + * fds.fd = fd; + * fds.revents = 0; + * + * while(1) { + * ret = poll(&fds, 1, -1); + * if (ret < 0) { + * if (errno == EBUSY) + * continue; + * else { + * //error handling + * } + * } + * + * err = tdm_client_handle_events(client); + * if (err != TDM_CLIENT_ERROR_NONE) { + * //error handling + * } + * } * @endcode */ tdm_client_error @@ -157,8 +156,8 @@ tdm_client_handle_events(tdm_client *client); */ tdm_client_error tdm_client_wait_vblank(tdm_client *client, char *name, - int sw_timer, int interval, int sync, - tdm_client_vblank_handler func, void *user_data); + int sw_timer, int interval, int sync, + tdm_client_vblank_handler func, void *user_data); #ifdef __cplusplus } diff --git a/doc/tdm_doc.h b/doc/tdm_doc.h index 4d60a64..1abca27 100644 --- a/doc/tdm_doc.h +++ b/doc/tdm_doc.h @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifndef _TDM_DOC_H_ @@ -73,60 +73,60 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * #tdm_backend_register_func_display(), #tdm_backend_register_func_output(), * #tdm_backend_register_func_layer() functions in initial time.\n * @code - #include - - static tdm_drm_data *drm_data; - - tdm_backend_data* - tdm_drm_init(tdm_display *dpy, tdm_error *error) - { - tdm_func_display drm_func_display; - tdm_func_output drm_func_output; - tdm_func_layer drm_func_layer; - - ... - drm_data = calloc(1, sizeof(tdm_drm_data)); - ... - - memset(&drm_func_display, 0, sizeof(drm_func_display)); - drm_func_display.display_get_capabilitiy = drm_display_get_capabilitiy; - ... - ret = tdm_backend_register_func_display(dpy, &drm_func_display); - if (ret != TDM_ERROR_NONE) - goto failed; - - memset(&drm_func_output, 0, sizeof(drm_func_output)); - drm_func_output.output_get_capability = drm_output_get_capability; - ... - ret = tdm_backend_register_func_output(dpy, &drm_func_output); - if (ret != TDM_ERROR_NONE) - goto failed; - - memset(&drm_func_layer, 0, sizeof(drm_func_layer)); - drm_func_layer.layer_get_capability = drm_layer_get_capability; - ... - ret = tdm_backend_register_func_layer(dpy, &drm_func_layer); - if (ret != TDM_ERROR_NONE) - goto failed; - ... - return (tdm_backend_data*)drm_data; - } - - void - tdm_drm_deinit(tdm_backend_data *bdata) - { - ... - free(bdata); - } - - tdm_backend_module tdm_backend_module_data = - { - "drm", - "Samsung", - TDM_BACKEND_SET_ABI_VERSION(1,2), - tdm_drm_init, - tdm_drm_deinit - }; + * #include + * + * static tdm_drm_data *drm_data; + * + * tdm_backend_data* + * tdm_drm_init(tdm_display *dpy, tdm_error *error) + * { + * tdm_func_display drm_func_display; + * tdm_func_output drm_func_output; + * tdm_func_layer drm_func_layer; + * + * ... + * drm_data = calloc(1, sizeof(tdm_drm_data)); + * ... + * + * memset(&drm_func_display, 0, sizeof(drm_func_display)); + * drm_func_display.display_get_capabilitiy = drm_display_get_capabilitiy; + * ... + * ret = tdm_backend_register_func_display(dpy, &drm_func_display); + * if (ret != TDM_ERROR_NONE) + * goto failed; + * + * memset(&drm_func_output, 0, sizeof(drm_func_output)); + * drm_func_output.output_get_capability = drm_output_get_capability; + * ... + * ret = tdm_backend_register_func_output(dpy, &drm_func_output); + * if (ret != TDM_ERROR_NONE) + * goto failed; + * + * memset(&drm_func_layer, 0, sizeof(drm_func_layer)); + * drm_func_layer.layer_get_capability = drm_layer_get_capability; + * ... + * ret = tdm_backend_register_func_layer(dpy, &drm_func_layer); + * if (ret != TDM_ERROR_NONE) + * goto failed; + * ... + * return (tdm_backend_data*)drm_data; + * } + * + * void + * tdm_drm_deinit(tdm_backend_data *bdata) + * { + * ... + * free(bdata); + * } + * + * tdm_backend_module tdm_backend_module_data = + * { + * "drm", + * "Samsung", + * TDM_BACKEND_SET_ABI_VERSION(1,2), + * tdm_drm_init, + * tdm_drm_deinit + * }; * @endcode * \n * A sample backend source code can be downloaded. diff --git a/include/tdm.h b/include/tdm.h index 9bea835..488a549 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifndef _TDM_H_ @@ -52,17 +52,16 @@ extern "C" { * @brief The header file for a frontend user. * @par Example * @code - #include //for a frontend user + * #include //for a frontend user * @endcode */ /** * @brief The display capability enumeration */ -typedef enum -{ - TDM_DISPLAY_CAPABILITY_PP = (1<<0), /**< if hardware supports pp operation */ - TDM_DISPLAY_CAPABILITY_CAPTURE = (1<<1), /**< if hardware supports capture operation */ +typedef enum { + TDM_DISPLAY_CAPABILITY_PP = (1 << 0), /**< if hardware supports pp operation */ + TDM_DISPLAY_CAPABILITY_CAPTURE = (1 << 1), /**< if hardware supports capture operation */ } tdm_display_capability; /** @@ -79,9 +78,9 @@ typedef enum { * changed in runtime. */ typedef void (*tdm_output_change_handler)(tdm_output *output, - tdm_output_change_type type, - tdm_value value, - void *user_data); + tdm_output_change_type type, + tdm_value value, + void *user_data); /** * @brief Initialize a display object @@ -140,7 +139,7 @@ tdm_display_handle_events(tdm_display *dpy); */ tdm_error tdm_display_get_capabilities(tdm_display *dpy, - tdm_display_capability *capabilities); + tdm_display_capability *capabilities); /** * @brief Get the pp capabilities of a display object. @@ -150,7 +149,7 @@ tdm_display_get_capabilities(tdm_display *dpy, */ tdm_error tdm_display_get_pp_capabilities(tdm_display *dpy, - tdm_pp_capability *capabilities); + tdm_pp_capability *capabilities); /** * @brief Get the pp available format array of a display object. @@ -161,7 +160,7 @@ tdm_display_get_pp_capabilities(tdm_display *dpy, */ tdm_error tdm_display_get_pp_available_formats(tdm_display *dpy, - const tbm_format **formats, int *count); + const tbm_format **formats, int *count); /** * @brief Get the pp available size of a display object. @@ -176,7 +175,7 @@ tdm_display_get_pp_available_formats(tdm_display *dpy, */ tdm_error tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h, - int *max_w, int *max_h, int *preferred_align); + int *max_w, int *max_h, int *preferred_align); /** * @brief Get the capture capabilities of a display object. @@ -186,7 +185,7 @@ tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h, */ tdm_error tdm_display_get_capture_capabilities(tdm_display *dpy, - tdm_capture_capability *capabilities); + tdm_capture_capability *capabilities); /** * @brief Get the capture available format array of a display object. @@ -197,7 +196,7 @@ tdm_display_get_capture_capabilities(tdm_display *dpy, */ tdm_error tdm_display_get_catpure_available_formats(tdm_display *dpy, - const tbm_format **formats, int *count); + const tbm_format **formats, int *count); /** * @brief Get the output counts which a display object has. @@ -240,7 +239,7 @@ tdm_display_create_pp(tdm_display *dpy, tdm_error *error); */ tdm_error tdm_output_get_model_info(tdm_output *output, const char **maker, - const char **model, const char **name); + const char **model, const char **name); /** * @brief Get the connection status of a output object. @@ -262,8 +261,8 @@ tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status); */ tdm_error tdm_output_add_change_handler(tdm_output *output, - tdm_output_change_handler func, - void *user_data); + tdm_output_change_handler func, + void *user_data); /** * @brief Remove a output change handler @@ -274,8 +273,8 @@ tdm_output_add_change_handler(tdm_output *output, */ void tdm_output_remove_change_handler(tdm_output *output, - tdm_output_change_handler func, - void *user_data); + tdm_output_change_handler func, + void *user_data); /** * @brief Get the connection type of a output object. @@ -316,7 +315,7 @@ tdm_output_get_layer(tdm_output *output, int index, tdm_error *error); */ tdm_error tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props, - int *count); + int *count); /** * @brief Get the available mode array of a output object. @@ -327,7 +326,7 @@ tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props, */ tdm_error tdm_output_get_available_modes(tdm_output *output, - const tdm_output_mode **modes, int *count); + const tdm_output_mode **modes, int *count); /** * @brief Get the available size of a output object. @@ -342,7 +341,7 @@ tdm_output_get_available_modes(tdm_output *output, */ tdm_error tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h, - int *max_w, int *max_h, int *preferred_align); + int *max_w, int *max_h, int *preferred_align); /** * @brief Get the physical size of a output object. @@ -353,7 +352,7 @@ tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h, */ tdm_error tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth, - unsigned int *mmHeight); + unsigned int *mmHeight); /** * @brief Get the subpixel of a output object. @@ -406,7 +405,7 @@ tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value); */ tdm_error tdm_output_wait_vblank(tdm_output *output, int interval, int sync, - tdm_output_vblank_handler func, void *user_data); + tdm_output_vblank_handler func, void *user_data); /** * @brief Commit changes for a output object @@ -420,7 +419,7 @@ tdm_output_wait_vblank(tdm_output *output, int interval, int sync, */ tdm_error tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, - void *user_data); + void *user_data); /** * @brief Set one of available modes of a output object @@ -476,7 +475,7 @@ tdm_output_create_capture(tdm_output *output, tdm_error *error); */ tdm_error tdm_layer_get_capabilities(tdm_layer *layer, - tdm_layer_capability *capabilities); + tdm_layer_capability *capabilities); /** * @brief Get the available format array of a layer object. @@ -487,7 +486,7 @@ tdm_layer_get_capabilities(tdm_layer *layer, */ tdm_error tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats, - int *count); + int *count); /** * @brief Get the available property array of a layer object. @@ -498,7 +497,7 @@ tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats, */ tdm_error tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props, - int *count); + int *count); /** * @brief Get the zpos of a layer object. @@ -733,7 +732,7 @@ tdm_capture_commit(tdm_capture *capture); * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler */ typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer, - void *user_data); + void *user_data); /** * @brief Add a release handler to a TDM buffer @@ -750,7 +749,7 @@ typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer, */ tdm_error tdm_buffer_add_release_handler(tbm_surface_h buffer, - tdm_buffer_release_handler func, void *user_data); + tdm_buffer_release_handler func, void *user_data); /** * @brief Remove a release handler from a TDM buffer @@ -761,7 +760,7 @@ tdm_buffer_add_release_handler(tbm_surface_h buffer, */ void tdm_buffer_remove_release_handler(tbm_surface_h buffer, - tdm_buffer_release_handler func, void *user_data); + tdm_buffer_release_handler func, void *user_data); #ifdef __cplusplus } diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 9a1ea41..8967b52 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifndef _TDM_BACKEND_H_ @@ -49,7 +49,7 @@ extern "C" { * @brief The backend header file of TDM to implement a TDM backend module. * @par Example * @code - #include + * #include * @endcode */ @@ -68,8 +68,8 @@ typedef void tdm_backend_data; * changed in runtime. */ typedef void (*tdm_output_status_handler)(tdm_output *output, - tdm_output_conn_status status, - void *user_data); + tdm_output_conn_status status, + void *user_data); /** * @brief The display capabilities structure of a backend module @@ -157,10 +157,11 @@ typedef struct _tdm_caps_pp { int max_h; /**< The maximum height. -1 means "not defined" */ int preferred_align; /**< The prefered align. -1 means "not defined" */ - int max_attach_count; /**< The attach count which a PP object can handle. - * -1 means "not defined". - * @since 1.2.0 - */ + /**< The attach count which a PP object can handle. + * -1 means "not defined". + * @since 1.2.0 + */ + int max_attach_count; } tdm_caps_pp; /** @@ -180,10 +181,11 @@ typedef struct _tdm_caps_capture { int max_h; /**< The maximum height. -1 means "not defined" */ int preferred_align; /**< The prefered align. -1 means "not defined" */ - int max_attach_count; /**< The attach count which a capture object can handle. - * -1 means "not defined". - * @since 1.2.0 - */ + /**< The attach count which a capture object can handle. + * -1 means "not defined". + * @since 1.2.0 + */ + int max_attach_count; } tdm_caps_capture; /** @@ -203,8 +205,7 @@ typedef struct _tdm_func_display { * a backend module can set the max count to max_layer_count of #tdm_caps_display * structure. Otherwise, set -1. */ - tdm_error (*display_get_capabilitiy)(tdm_backend_data *bdata, - tdm_caps_display *caps); + tdm_error (*display_get_capabilitiy)(tdm_backend_data *bdata, tdm_caps_display *caps); /** * @brief Get the pp capabilities of a backend module @@ -220,8 +221,7 @@ typedef struct _tdm_func_display { * @b SHOULD fill the #tdm_caps_pp data. #tdm_caps_pp contains the hardware * restriction information which a converting device can handle. ie, format, size, etc. */ - tdm_error (*display_get_pp_capability)(tdm_backend_data *bdata, - tdm_caps_pp *caps); + tdm_error (*display_get_pp_capability)(tdm_backend_data *bdata, tdm_caps_pp *caps); /** * @brief Get the capture capabilities of a backend module @@ -237,8 +237,7 @@ typedef struct _tdm_func_display { * #tdm_caps_capture data. #tdm_caps_capture contains the hardware restriction * information which a capture device can handle. ie, format, size, etc. */ - tdm_error (*display_get_capture_capability)(tdm_backend_data *bdata, - tdm_caps_capture *caps); + tdm_error (*display_get_capture_capability)(tdm_backend_data *bdata, tdm_caps_capture *caps); /** * @brief Get a output array of a backend module @@ -255,45 +254,45 @@ typedef struct _tdm_func_display { * "tdm_output*" data. It will be freed in frontend. * @par Example * @code - tdm_output** - drm_display_get_outputs(tdm_backend_data *bdata, int *count, tdm_error *error) - { - tdm_drm_data *drm_data = bdata; - tdm_drm_output_data *output_data = NULL; - tdm_output **outputs; - int i; - - (*count) = 0; - LIST_FOR_EACH_ENTRY(output_data, &drm_data->output_list, link) - (*count)++; - - if ((*count) == 0) - { - if (error) *error = TDM_ERROR_NONE; - return NULL; - } - - // will be freed in frontend - outputs = calloc(*count, sizeof(tdm_drm_output_data*)); - if (!outputs) - { - (*count) = 0; - if (error) *error = TDM_ERROR_OUT_OF_MEMORY; - return NULL; - } - - i = 0; - LIST_FOR_EACH_ENTRY(output_data, &drm_data->output_list, link) - outputs[i++] = output_data; - - if (error) *error = TDM_ERROR_NONE; - - return outputs; - } + * tdm_output** + * drm_display_get_outputs(tdm_backend_data *bdata, int *count, tdm_error *error) + * { + * tdm_drm_data *drm_data = bdata; + * tdm_drm_output_data *output_data = NULL; + * tdm_output **outputs; + * int i; + * + * (*count) = 0; + * LIST_FOR_EACH_ENTRY(output_data, &drm_data->output_list, link) + * (*count)++; + * + * if ((*count) == 0) + * { + * if (error) *error = TDM_ERROR_NONE; + * return NULL; + * } + * + * // will be freed in frontend + * outputs = calloc(*count, sizeof(tdm_drm_output_data*)); + * if (!outputs) + * { + * (*count) = 0; + * if (error) *error = TDM_ERROR_OUT_OF_MEMORY; + * return NULL; + * } + * + * i = 0; + * LIST_FOR_EACH_ENTRY(output_data, &drm_data->output_list, link) + * outputs[i++] = output_data; + * + * if (error) *error = TDM_ERROR_NONE; + * + * return outputs; + * } * @endcode */ tdm_output **(*display_get_outputs)(tdm_backend_data *bdata, int *count, - tdm_error *error); + tdm_error *error); /** * @brief Get the file descriptor of a backend module @@ -367,7 +366,7 @@ typedef struct _tdm_func_output { * "tdm_layer*" data. It will be freed in frontend. */ tdm_layer **(*output_get_layers)(tdm_output *output, int *count, - tdm_error *error); + tdm_error *error); /** * @brief Set the property which has a given id @@ -377,7 +376,7 @@ typedef struct _tdm_func_output { * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*output_set_property)(tdm_output *output, unsigned int id, - tdm_value value); + tdm_value value); /** * @brief Get the property which has a given id @@ -387,7 +386,7 @@ typedef struct _tdm_func_output { * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*output_get_property)(tdm_output *output, unsigned int id, - tdm_value *value); + tdm_value *value); /** * @brief Wait for VBLANK @@ -403,7 +402,7 @@ typedef struct _tdm_func_output { * vblanks. */ tdm_error (*output_wait_vblank)(tdm_output *output, int interval, int sync, - void *user_data); + void *user_data); /** * @brief Set a user vblank handler @@ -412,7 +411,7 @@ typedef struct _tdm_func_output { * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*output_set_vblank_handler)(tdm_output *output, - tdm_output_vblank_handler func); + tdm_output_vblank_handler func); /** * @brief Commit changes for a output object @@ -438,7 +437,7 @@ typedef struct _tdm_func_output { * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*output_set_commit_handler)(tdm_output *output, - tdm_output_commit_handler func); + tdm_output_commit_handler func); /** * @brief Set DPMS of a output object @@ -496,8 +495,8 @@ typedef struct _tdm_func_output { * @since 1.1.0 */ tdm_error (*output_set_status_handler)(tdm_output *output, - tdm_output_status_handler func, - void *user_data); + tdm_output_status_handler func, + void *user_data); void (*reserved1)(void); void (*reserved2)(void); @@ -534,7 +533,7 @@ typedef struct _tdm_func_layer { * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*layer_set_property)(tdm_layer *layer, unsigned int id, - tdm_value value); + tdm_value value); /** * @brief Get the property which has a given id. @@ -544,7 +543,7 @@ typedef struct _tdm_func_layer { * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*layer_get_property)(tdm_layer *layer, unsigned int id, - tdm_value *value); + tdm_value *value); /** * @brief Set the geometry information to a layer object @@ -636,7 +635,7 @@ typedef struct _tdm_func_layer { * @brief The done handler of a pp object */ typedef void (*tdm_pp_done_handler)(tdm_pp *pp, tbm_surface_h src, - tbm_surface_h dst, void *user_data); + tbm_surface_h dst, void *user_data); /** * @brief The pp functions for a backend module. @@ -647,7 +646,7 @@ typedef struct _tdm_func_pp { * @param[in] pp A pp object * @see display_create_pp() function of #tdm_func_display */ - void (*pp_destroy)(tdm_pp *pp); + void (*pp_destroy)(tdm_pp *pp); /** * @brief Set the geometry information to a pp object @@ -658,7 +657,7 @@ typedef struct _tdm_func_pp { * @remark * A backend module would apply the geometry information when committed. */ - tdm_error (*pp_set_info)(tdm_pp *pp, tdm_info_pp *info); + tdm_error (*pp_set_info)(tdm_pp *pp, tdm_info_pp *info); /** * @brief Attach a source buffer and a destination buffer to a pp object @@ -675,14 +674,14 @@ typedef struct _tdm_func_pp { * #pp_set_info() of #tdm_func_pp. When done, a backend module @b SHOULD * return the source/destination buffer via tdm_pp_done_handler. */ - tdm_error (*pp_attach)(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst); + tdm_error (*pp_attach)(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst); /** * @brief Commit changes for a pp object * @param[in] pp A pp object * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ - tdm_error (*pp_commit)(tdm_pp *pp); + tdm_error (*pp_commit)(tdm_pp *pp); /** * @brief Set a user done handler to a pp object @@ -693,8 +692,8 @@ typedef struct _tdm_func_pp { * @remark * A backend module @b SHOULD call #tdm_pp_done_handler when converintg a image is done. */ - tdm_error (*pp_set_done_handler)(tdm_pp *pp, tdm_pp_done_handler func, - void *user_data); + tdm_error (*pp_set_done_handler)(tdm_pp *pp, tdm_pp_done_handler func, + void *user_data); void (*reserved1)(void); void (*reserved2)(void); @@ -710,7 +709,7 @@ typedef struct _tdm_func_pp { * @brief The done handler of a capture object */ typedef void (*tdm_capture_done_handler)(tdm_capture *capture, - tbm_surface_h buffer, void *user_data); + tbm_surface_h buffer, void *user_data); /** * @brief The capture functions for a backend module. @@ -722,7 +721,7 @@ typedef struct _tdm_func_capture { * @see output_create_capture() function of #tdm_func_output * @see layer_create_capture() function of #tdm_func_layer */ - void (*capture_destroy)(tdm_capture *capture); + void (*capture_destroy)(tdm_capture *capture); /** * @brief Set the geometry information to a capture object @@ -733,7 +732,7 @@ typedef struct _tdm_func_capture { * @remark * A backend module would apply the geometry information when committed. */ - tdm_error (*capture_set_info)(tdm_capture *capture, tdm_info_capture *info); + tdm_error (*capture_set_info)(tdm_capture *capture, tdm_info_capture *info); /** * @brief Attach a TDM buffer to a capture object @@ -751,14 +750,14 @@ typedef struct _tdm_func_capture { * of #tdm_func_capture. When done, a backend module @b SHOULD return the TDM * buffer via tdm_capture_done_handler. */ - tdm_error (*capture_attach)(tdm_capture *capture, tbm_surface_h buffer); + tdm_error (*capture_attach)(tdm_capture *capture, tbm_surface_h buffer); /** * @brief Commit changes for a capture object * @param[in] capture A capture object * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ - tdm_error (*capture_commit)(tdm_capture *capture); + tdm_error (*capture_commit)(tdm_capture *capture); /** * @brief Set a user done handler to a capture object @@ -769,8 +768,8 @@ typedef struct _tdm_func_capture { * @remark * A backend module @b SHOULD call #tdm_capture_done_handler when capture operation is done. */ - tdm_error (*capture_set_done_handler)(tdm_capture *capture, - tdm_capture_done_handler func, void *user_data); + tdm_error (*capture_set_done_handler)(tdm_capture *capture, + tdm_capture_done_handler func, void *user_data); void (*reserved1)(void); void (*reserved2)(void); @@ -788,25 +787,25 @@ typedef struct _tdm_func_capture { #define TDM_BACKEND_GET_ABI_MAJOR(v) (((v) & TDM_BACKEND_MAJOR_VERSION_MASK) >> 16) /** - * @brief + * @brief * The ABI version of TDM backend module. It has a major and minor revision. * Modules using lower minor revisions will work with TDM frontend of a higher * minor revision. There is no compatibility between different major revisions. * The minor revision mask is 0x0000FFFF and the major revision mask is 0xFFFF0000. * @par Example * @code - tdm_backend_module tdm_backend_module_data = { - "drm", - "Samsung", - TDM_BACKEND_SET_ABI_VERSION(1,1), - tdm_drm_init, - tdm_drm_deinit - }; + * tdm_backend_module tdm_backend_module_data = { + * "drm", + * "Samsung", + * TDM_BACKEND_SET_ABI_VERSION(1,1), + * tdm_drm_init, + * tdm_drm_deinit + * }; * @endcode */ #define TDM_BACKEND_SET_ABI_VERSION(major, minor) \ - (((major) << 16) & TDM_BACKEND_MAJOR_VERSION_MASK) | \ - ((major) & TDM_BACKEND_MINOR_VERSION_MASK) + (((major) << 16) & TDM_BACKEND_MAJOR_VERSION_MASK) | \ + ((major) & TDM_BACKEND_MINOR_VERSION_MASK) /** * @brief @@ -856,7 +855,7 @@ typedef struct _tdm_backend_module { */ tdm_error tdm_backend_register_func_display(tdm_display *dpy, - tdm_func_display *func_display); + tdm_func_display *func_display); /** * @brief Register the backend output functions to a display @@ -869,7 +868,7 @@ tdm_backend_register_func_display(tdm_display *dpy, */ tdm_error tdm_backend_register_func_output(tdm_display *dpy, - tdm_func_output *func_output); + tdm_func_output *func_output); /** * @brief Register the backend layer functions to a display @@ -908,7 +907,7 @@ tdm_backend_register_func_pp(tdm_display *dpy, tdm_func_pp *func_pp); */ tdm_error tdm_backend_register_func_capture(tdm_display *dpy, - tdm_func_capture *func_capture); + tdm_func_capture *func_capture); /** * @brief Increase the ref_count of a TDM buffer @@ -943,7 +942,7 @@ tdm_buffer_unref_backend(tbm_surface_h buffer); * @see tdm_buffer_add_destroy_handler, tdm_buffer_remove_destroy_handler */ typedef void (*tdm_buffer_destroy_handler)(tbm_surface_h buffer, - void *user_data); + void *user_data); /** * @brief Add a destroy handler to a TDM buffer @@ -959,7 +958,7 @@ typedef void (*tdm_buffer_destroy_handler)(tbm_surface_h buffer, */ tdm_error tdm_buffer_add_destroy_handler(tbm_surface_h buffer, - tdm_buffer_destroy_handler func, void *user_data); + tdm_buffer_destroy_handler func, void *user_data); /** * @brief Remove a destroy handler from a TDM buffer @@ -970,7 +969,7 @@ tdm_buffer_add_destroy_handler(tbm_surface_h buffer, */ void tdm_buffer_remove_destroy_handler(tbm_surface_h buffer, - tdm_buffer_destroy_handler func, void *user_data); + tdm_buffer_destroy_handler func, void *user_data); /** * @brief Add a FD handler for activity on the given file descriptor @@ -985,8 +984,8 @@ tdm_buffer_remove_destroy_handler(tbm_surface_h buffer, */ tdm_event_loop_source* tdm_event_loop_add_fd_handler(tdm_display *dpy, int fd, tdm_event_loop_mask mask, - tdm_event_loop_fd_handler func, void *user_data, - tdm_error *error); + tdm_event_loop_fd_handler func, void *user_data, + tdm_error *error); /** * @brief Update the mask of the given FD event source @@ -1008,7 +1007,7 @@ tdm_event_loop_source_fd_update(tdm_event_loop_source *source, tdm_event_loop_ma */ tdm_event_loop_source* tdm_event_loop_add_timer_handler(tdm_display *dpy, tdm_event_loop_timer_handler func, - void *user_data, tdm_error *error); + void *user_data, tdm_error *error); /** * @brief Update the millisecond delay time of the given timer event source. diff --git a/include/tdm_helper.h b/include/tdm_helper.h index 254999a..0bde0b9 100644 --- a/include/tdm_helper.h +++ b/include/tdm_helper.h @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifndef _TDM_HELPER_H_ diff --git a/include/tdm_list.h b/include/tdm_list.h index a6d6bbb..6255cd0 100644 --- a/include/tdm_list.h +++ b/include/tdm_list.h @@ -110,41 +110,41 @@ static inline int list_length(struct list_head *item) #define LIST_LENGTH(__item) list_length(__item) #define LIST_ENTRY(__type, __item, __field) \ - ((__type *)(((char *)(__item)) - offsetof(__type, __field))) + ((__type *)(((char *)(__item)) - offsetof(__type, __field))) #define LIST_IS_EMPTY(__list) \ - ((__list)->next == (__list)) + ((__list)->next == (__list)) #ifndef container_of #define container_of(ptr, sample, member) \ - (void *)((char *)(ptr) \ + (void *)((char *)(ptr) \ - ((char *)&(sample)->member - (char *)(sample))) #endif #define LIST_FOR_EACH_ENTRY(pos, head, member) \ - for (pos = container_of((head)->next, pos, member); \ + for (pos = container_of((head)->next, pos, member); \ &pos->member != (head); \ pos = container_of(pos->member.next, pos, member)) #define LIST_FOR_EACH_ENTRY_SAFE(pos, storage, head, member) \ - for (pos = container_of((head)->next, pos, member), \ + for (pos = container_of((head)->next, pos, member), \ storage = container_of(pos->member.next, pos, member); \ &pos->member != (head); \ pos = storage, storage = container_of(storage->member.next, storage, member)) #define LIST_FOR_EACH_ENTRY_SAFE_REV(pos, storage, head, member) \ - for (pos = container_of((head)->prev, pos, member), \ + for (pos = container_of((head)->prev, pos, member), \ storage = container_of(pos->member.prev, pos, member); \ &pos->member != (head); \ pos = storage, storage = container_of(storage->member.prev, storage, member)) #define LIST_FOR_EACH_ENTRY_FROM(pos, start, head, member) \ - for (pos = container_of((start), pos, member); \ + for (pos = container_of((start), pos, member); \ &pos->member != (head); \ pos = container_of(pos->member.next, pos, member)) #define LIST_FOR_EACH_ENTRY_FROM_REV(pos, start, head, member) \ - for (pos = container_of((start), pos, member); \ + for (pos = container_of((start), pos, member); \ &pos->member != (head); \ pos = container_of(pos->member.prev, pos, member)) diff --git a/include/tdm_log.h b/include/tdm_log.h index ebfa1d7..02943c0 100644 --- a/include/tdm_log.h +++ b/include/tdm_log.h @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifndef _TDM_LOG_H_ @@ -54,7 +54,7 @@ extern "C" { * The TDM debug log can be enable by setting "TDM_DEBUG" enviroment * @par Example * @code - $ export TDM_DEBUG=1 + * $ export TDM_DEBUG=1 * @endcode */ extern int tdm_debug; @@ -79,7 +79,7 @@ extern int tdm_debug; #define LOG_TAG "TDM" #define TDM_DBG(fmt, args...) \ - if (tdm_debug) \ + if (tdm_debug) \ do { \ struct timespec ts; \ clock_gettime(CLOCK_MONOTONIC, &ts); \ @@ -125,7 +125,7 @@ extern int tdm_debug; #define COLOR_RESET "\x1b[0m" #define TDM_DBG(fmt, args...) \ - if (tdm_debug) \ + if (tdm_debug) \ do { \ struct timespec ts; \ clock_gettime(CLOCK_MONOTONIC, &ts); \ diff --git a/include/tdm_types.h b/include/tdm_types.h index f6fc5c4..a6b68fa 100755 --- a/include/tdm_types.h +++ b/include/tdm_types.h @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifndef _TDM_TYPES_H_ @@ -52,18 +52,17 @@ extern "C" { * include @ref tdm_types.h * @par Example * @code - #include //for a frontend user + * #include //for a frontend user * @endcode * @code - #include //for a vendor to implement a backend module + * #include //for a vendor to implement a backend module * @endcode */ /** * @brief The error enumeration */ -typedef enum -{ +typedef enum { TDM_ERROR_NONE = 0, /**< none */ TDM_ERROR_BAD_REQUEST = -1, /**< bad request */ TDM_ERROR_OPERATION_FAILED = -2, /**< operaion failed */ @@ -142,12 +141,12 @@ typedef enum { * SCALE and TRANSFORM capability.\n * @par Example * @code - //For example - capabilities = TDM_LAYER_CAPABILITY_PRIMARY | TDM_LAYER_CAPABILITY_GRAPHIC; - capabilities = TDM_LAYER_CAPABILITY_OVERLAY | TDM_LAYER_CAPABILITY_GRAPHIC | TDM_LAYER_CAPABILITY_SCALE; - capabilities = TDM_LAYER_CAPABILITY_OVERLAY | TDM_LAYER_CAPABILITY_GRAPHIC | TDM_LAYER_CAPABILITY_SCALE | TDM_LAYER_CAPABILITY_TRANSFORM; - capabilities = TDM_LAYER_CAPABILITY_CURSOR | TDM_LAYER_CAPABILITY_GRAPHIC; - capabilities = TDM_LAYER_CAPABILITY_OVERLAY | TDM_LAYER_CAPABILITY_VIDEO; + * //For example + * capabilities = TDM_LAYER_CAPABILITY_PRIMARY | TDM_LAYER_CAPABILITY_GRAPHIC; + * capabilities = TDM_LAYER_CAPABILITY_OVERLAY | TDM_LAYER_CAPABILITY_GRAPHIC | TDM_LAYER_CAPABILITY_SCALE; + * capabilities = TDM_LAYER_CAPABILITY_OVERLAY | TDM_LAYER_CAPABILITY_GRAPHIC | TDM_LAYER_CAPABILITY_SCALE | TDM_LAYER_CAPABILITY_TRANSFORM; + * capabilities = TDM_LAYER_CAPABILITY_CURSOR | TDM_LAYER_CAPABILITY_GRAPHIC; + * capabilities = TDM_LAYER_CAPABILITY_OVERLAY | TDM_LAYER_CAPABILITY_VIDEO; * @endcode * @remark * - When a video plays, in most of cases, video buffers will be displayed to @@ -225,8 +224,7 @@ typedef enum { TDM_OUTPUT_MODE_FLAG_CLKDIV2 = (1 << 13), } tdm_output_mode_flag; -typedef enum -{ +typedef enum { TDM_EVENT_LOOP_READABLE = (1 << 0), TDM_EVENT_LOOP_WRITABLE = (1 << 1), TDM_EVENT_LOOP_HANGUP = (1 << 2), @@ -353,16 +351,16 @@ typedef void tdm_pp; * @see output_set_vblank_handler() function of #tdm_func_display */ typedef void (*tdm_output_vblank_handler)(tdm_output *output, unsigned int sequence, - unsigned int tv_sec, unsigned int tv_usec, - void *user_data); + unsigned int tv_sec, unsigned int tv_usec, + void *user_data); /** * @brief The commit handler * @see output_set_commit_handler() function of #tdm_func_display */ typedef void (*tdm_output_commit_handler)(tdm_output *output, unsigned int sequence, - unsigned int tv_sec, unsigned int tv_usec, - void *user_data); + unsigned int tv_sec, unsigned int tv_usec, + void *user_data); /** * @brief The tdm event source diff --git a/src/tdm.c b/src/tdm.c index 24f3e52..996fb9a 100644 --- a/src/tdm.c +++ b/src/tdm.c @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifdef HAVE_CONFIG_H @@ -47,7 +47,7 @@ int tdm_mutex_locked; static tdm_private_layer * _tdm_display_find_private_layer(tdm_private_output *private_output, - tdm_layer *layer_backend) + tdm_layer *layer_backend) { tdm_private_layer *private_layer = NULL; @@ -61,7 +61,7 @@ _tdm_display_find_private_layer(tdm_private_output *private_output, static tdm_private_output * _tdm_display_find_private_output(tdm_private_display *private_display, - tdm_output *output_backend) + tdm_output *output_backend) { tdm_private_output *private_output = NULL; @@ -75,7 +75,7 @@ _tdm_display_find_private_output(tdm_private_display *private_display, INTERN tdm_private_output * tdm_display_find_output_stamp(tdm_private_display *private_display, - unsigned long stamp) + unsigned long stamp) { tdm_private_output *private_output = NULL; @@ -216,7 +216,7 @@ _tdm_display_destroy_private_display(tdm_private_display *private_display) static tdm_error _tdm_display_update_caps_pp(tdm_private_display *private_display, - tdm_caps_pp *caps) + tdm_caps_pp *caps) { tdm_func_display *func_display = &private_display->func_display; char buf[1024]; @@ -254,7 +254,7 @@ _tdm_display_update_caps_pp(tdm_private_display *private_display, static tdm_error _tdm_display_update_caps_capture(tdm_private_display *private_display, - tdm_caps_capture *caps) + tdm_caps_capture *caps) { tdm_func_display *func_display = &private_display->func_display; char buf[1024]; @@ -272,8 +272,7 @@ _tdm_display_update_caps_capture(tdm_private_display *private_display, return TDM_ERROR_BAD_MODULE; } - ret = func_display->display_get_capture_capability(private_display->bdata, - caps); + ret = func_display->display_get_capture_capability(private_display->bdata, caps); if (ret != TDM_ERROR_NONE) { TDM_ERR("display_get_capture_capability() failed"); return TDM_ERROR_BAD_MODULE; @@ -289,7 +288,7 @@ _tdm_display_update_caps_capture(tdm_private_display *private_display, static tdm_error _tdm_display_update_caps_layer(tdm_private_display *private_display, - tdm_layer *layer_backend, tdm_caps_layer *caps) + tdm_layer *layer_backend, tdm_caps_layer *caps) { tdm_func_layer *func_layer = &private_display->func_layer; char buf[1024]; @@ -324,7 +323,7 @@ _tdm_display_update_caps_layer(tdm_private_display *private_display, static tdm_error _tdm_display_update_caps_output(tdm_private_display *private_display, int pipe, - tdm_output *output_backend, tdm_caps_output *caps) + tdm_output *output_backend, tdm_caps_output *caps) { tdm_func_output *func_output = &private_display->func_output; char temp[TDM_NAME_LEN]; @@ -355,14 +354,14 @@ _tdm_display_update_caps_output(tdm_private_display *private_display, int pipe, TDM_DBG("output props: %d, %s", caps->props[i].id, caps->props[i].name); for (i = 0; i < caps->mode_count; i++) { TDM_DBG("output modes: name(%s), clock(%d) vrefresh(%d), flags(%x), type(%d)", - caps->modes[i].name, caps->modes[i].clock, caps->modes[i].vrefresh, - caps->modes[i].flags, caps->modes[i].type); + caps->modes[i].name, caps->modes[i].clock, caps->modes[i].vrefresh, + caps->modes[i].flags, caps->modes[i].type); TDM_DBG("\t\t %d, %d, %d, %d, %d", - caps->modes[i].hdisplay, caps->modes[i].hsync_start, caps->modes[i].hsync_end, - caps->modes[i].htotal, caps->modes[i].hskew); + caps->modes[i].hdisplay, caps->modes[i].hsync_start, caps->modes[i].hsync_end, + caps->modes[i].htotal, caps->modes[i].hskew); TDM_DBG("\t\t %d, %d, %d, %d, %d", - caps->modes[i].vdisplay, caps->modes[i].vsync_start, caps->modes[i].vsync_end, - caps->modes[i].vtotal, caps->modes[i].vscan); + caps->modes[i].vdisplay, caps->modes[i].vsync_start, caps->modes[i].vsync_end, + caps->modes[i].vtotal, caps->modes[i].vscan); } TDM_DBG("output min : %dx%d", caps->min_w, caps->min_h); TDM_DBG("output max : %dx%d", caps->max_w, caps->max_h); @@ -373,8 +372,8 @@ _tdm_display_update_caps_output(tdm_private_display *private_display, int pipe, static tdm_error _tdm_display_update_layer(tdm_private_display *private_display, - tdm_private_output *private_output, - tdm_layer *layer_backend) + tdm_private_output *private_output, + tdm_layer *layer_backend) { tdm_private_layer *private_layer; tdm_error ret; @@ -396,7 +395,7 @@ _tdm_display_update_layer(tdm_private_display *private_display, _tdm_display_destroy_caps_layer(&private_layer->caps); ret = _tdm_display_update_caps_layer(private_display, layer_backend, - &private_layer->caps); + &private_layer->caps); if (ret != TDM_ERROR_NONE) goto failed_update; @@ -408,7 +407,7 @@ failed_update: INTERN tdm_error tdm_display_update_output(tdm_private_display *private_display, - tdm_output *output_backend, int pipe) + tdm_output *output_backend, int pipe) { tdm_func_output *func_output = &private_display->func_output; tdm_private_output *private_output = NULL; @@ -416,8 +415,7 @@ tdm_display_update_output(tdm_private_display *private_display, int layer_count = 0, i; tdm_error ret; - private_output = _tdm_display_find_private_output(private_display, - output_backend); + private_output = _tdm_display_find_private_output(private_display, output_backend); if (!private_output) { private_output = calloc(1, sizeof(tdm_private_output)); TDM_RETURN_VAL_IF_FAIL(private_output != NULL, TDM_ERROR_OUT_OF_MEMORY); @@ -442,8 +440,8 @@ tdm_display_update_output(tdm_private_display *private_display, if (func_output->output_set_status_handler) { func_output->output_set_status_handler(private_output->output_backend, - tdm_output_cb_status, - private_output); + tdm_output_cb_status, + private_output); private_output->regist_change_cb = 1; } @@ -451,7 +449,7 @@ tdm_display_update_output(tdm_private_display *private_display, _tdm_display_destroy_caps_output(&private_output->caps); ret = _tdm_display_update_caps_output(private_display, pipe, output_backend, - &private_output->caps); + &private_output->caps); if (ret != TDM_ERROR_NONE) return ret; @@ -507,8 +505,7 @@ _tdm_display_get_ordered_outputs(tdm_private_display *private_display, int *coun if (private_display->outputs) return private_display->outputs; - outputs = func_display->display_get_outputs(private_display->bdata, - &output_count, &ret); + outputs = func_display->display_get_outputs(private_display->bdata, &output_count, &ret); if (ret != TDM_ERROR_NONE) goto failed_get_outputs; @@ -558,7 +555,7 @@ _tdm_display_get_ordered_outputs(tdm_private_display *private_display, int *coun output_hdmib = outputs[i]; index_hdmib = i; break; - default : + default: break; } } @@ -609,7 +606,7 @@ failed_get_outputs: static tdm_error _tdm_display_update_internal(tdm_private_display *private_display, - int only_display) + int only_display) { tdm_output **outputs = NULL; int output_count = 0, i; @@ -625,7 +622,7 @@ _tdm_display_update_internal(tdm_private_display *private_display, goto failed_update; ret = _tdm_display_update_caps_capture(private_display, - &private_display->caps_capture); + &private_display->caps_capture); if (ret != TDM_ERROR_NONE) goto failed_update; } @@ -684,7 +681,7 @@ _tdm_display_check_module(tdm_backend_module *module) int major, minor; TDM_INFO("TDM ABI version : %d.%d", - TDM_MAJOR_VERSION, TDM_MINOR_VERSION); + TDM_MAJOR_VERSION, TDM_MINOR_VERSION); name = module->name ? module->name : "unknown"; vendor = module->vendor ? module->vendor : "unknown"; @@ -697,13 +694,13 @@ _tdm_display_check_module(tdm_backend_module *module) if (major != TDM_MAJOR_VERSION) { TDM_ERR("'%s' major version mismatch, %d != %d", - name, major, TDM_MAJOR_VERSION); + name, major, TDM_MAJOR_VERSION); return TDM_ERROR_BAD_MODULE; } if (minor > TDM_MINOR_VERSION) { TDM_ERR("'%s' minor version(%d) is newer than %d", - name, minor, TDM_MINOR_VERSION); + name, minor, TDM_MINOR_VERSION); return TDM_ERROR_BAD_MODULE; } @@ -731,16 +728,13 @@ _tdm_display_check_backend_functions(tdm_private_display *private_display) /* below functions should be implemented in backend side */ TDM_RETURN_VAL_IF_FAIL(func_display != NULL, TDM_ERROR_BAD_MODULE); - TDM_RETURN_VAL_IF_FAIL(func_display->display_get_capabilitiy, - TDM_ERROR_BAD_MODULE); + TDM_RETURN_VAL_IF_FAIL(func_display->display_get_capabilitiy, TDM_ERROR_BAD_MODULE); TDM_RETURN_VAL_IF_FAIL(func_display->display_get_outputs, TDM_ERROR_BAD_MODULE); - TDM_RETURN_VAL_IF_FAIL(func_output->output_get_capability, - TDM_ERROR_BAD_MODULE); + TDM_RETURN_VAL_IF_FAIL(func_output->output_get_capability, TDM_ERROR_BAD_MODULE); TDM_RETURN_VAL_IF_FAIL(func_output->output_get_layers, TDM_ERROR_BAD_MODULE); TDM_RETURN_VAL_IF_FAIL(func_layer->layer_get_capability, TDM_ERROR_BAD_MODULE); - ret = func_display->display_get_capabilitiy(private_display->bdata, - &private_display->caps_display); + ret = func_display->display_get_capabilitiy(private_display->bdata, &private_display->caps_display); if (ret != TDM_ERROR_NONE) { TDM_ERR("display_get_capabilitiy() failed"); return TDM_ERROR_BAD_MODULE; @@ -748,8 +742,7 @@ _tdm_display_check_backend_functions(tdm_private_display *private_display) if (private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP) { tdm_func_pp *func_pp = &private_display->func_pp; - TDM_RETURN_VAL_IF_FAIL(func_display->display_get_pp_capability, - TDM_ERROR_BAD_MODULE); + TDM_RETURN_VAL_IF_FAIL(func_display->display_get_pp_capability, TDM_ERROR_BAD_MODULE); TDM_RETURN_VAL_IF_FAIL(func_display->display_create_pp, TDM_ERROR_BAD_MODULE); TDM_RETURN_VAL_IF_FAIL(func_pp->pp_destroy, TDM_ERROR_BAD_MODULE); TDM_RETURN_VAL_IF_FAIL(func_pp->pp_commit, TDM_ERROR_BAD_MODULE); @@ -758,15 +751,12 @@ _tdm_display_check_backend_functions(tdm_private_display *private_display) if (private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE) { tdm_func_capture *func_capture = &private_display->func_capture; - TDM_RETURN_VAL_IF_FAIL(func_display->display_get_capture_capability, - TDM_ERROR_BAD_MODULE); - TDM_RETURN_VAL_IF_FAIL(func_output->output_create_capture, - TDM_ERROR_BAD_MODULE); + TDM_RETURN_VAL_IF_FAIL(func_display->display_get_capture_capability, TDM_ERROR_BAD_MODULE); + TDM_RETURN_VAL_IF_FAIL(func_output->output_create_capture, TDM_ERROR_BAD_MODULE); TDM_RETURN_VAL_IF_FAIL(func_layer->layer_create_capture, TDM_ERROR_BAD_MODULE); TDM_RETURN_VAL_IF_FAIL(func_capture->capture_destroy, TDM_ERROR_BAD_MODULE); TDM_RETURN_VAL_IF_FAIL(func_capture->capture_commit, TDM_ERROR_BAD_MODULE); - TDM_RETURN_VAL_IF_FAIL(func_capture->capture_set_done_handler, - TDM_ERROR_BAD_MODULE); + TDM_RETURN_VAL_IF_FAIL(func_capture->capture_set_done_handler, TDM_ERROR_BAD_MODULE); } return TDM_ERROR_NONE; @@ -774,7 +764,7 @@ _tdm_display_check_backend_functions(tdm_private_display *private_display) static tdm_error _tdm_display_load_module_with_file(tdm_private_display *private_display, - const char *file) + const char *file) { char path[PATH_MAX] = {0,}; tdm_backend_module *module_data; @@ -812,8 +802,7 @@ _tdm_display_load_module_with_file(tdm_private_display *private_display, /* We don't care if backend_data is NULL or not. It's up to backend. */ TDM_TRACE_BEGIN(Init_Backend); - private_display->bdata = module_data->init((tdm_display *)private_display, - &ret); + private_display->bdata = module_data->init((tdm_display *)private_display, &ret); TDM_TRACE_END(); if (ret != TDM_ERROR_NONE) { TDM_ERR("'%s' init failed", file); diff --git a/src/tdm_backend.c b/src/tdm_backend.c index d7cfc8d..c83b3da 100644 --- a/src/tdm_backend.c +++ b/src/tdm_backend.c @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifdef HAVE_CONFIG_H @@ -42,9 +42,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tdm_private.h" #define BACKEND_FUNC_ENTRY() \ - tdm_private_display *private_display; \ - TDM_RETURN_VAL_IF_FAIL(dpy != NULL, TDM_ERROR_INVALID_PARAMETER); \ - private_display = (tdm_private_display*)dpy; + tdm_private_display *private_display; \ + TDM_RETURN_VAL_IF_FAIL(dpy != NULL, TDM_ERROR_INVALID_PARAMETER); \ + private_display = (tdm_private_display*)dpy; static int _check_abi_version(tdm_backend_module *module, int abimaj, int abimin) @@ -58,14 +58,14 @@ _check_abi_version(tdm_backend_module *module, int abimaj, int abimin) return 1; failed: TDM_ERR("The ABI version(%d.%d) of '%s' is less than %d.%d", - major, minor, module->name ? module->name : "unknown", - abimaj, abimin); + major, minor, module->name ? module->name : "unknown", + abimaj, abimin); return 0; } EXTERN tdm_error tdm_backend_register_func_display(tdm_display *dpy, - tdm_func_display *func_display) + tdm_func_display *func_display) { tdm_backend_module *module; @@ -145,7 +145,7 @@ tdm_backend_register_func_pp(tdm_display *dpy, tdm_func_pp *func_pp) EXTERN tdm_error tdm_backend_register_func_capture(tdm_display *dpy, - tdm_func_capture *func_capture) + tdm_func_capture *func_capture) { TDM_RETURN_VAL_IF_FAIL(TDM_MUTEX_IS_LOCKED(), TDM_ERROR_OPERATION_FAILED); diff --git a/src/tdm_buffer.c b/src/tdm_buffer.c index 9f17dd8..3c48e0e 100644 --- a/src/tdm_buffer.c +++ b/src/tdm_buffer.c @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifdef HAVE_CONFIG_H @@ -88,7 +88,7 @@ tdm_buffer_get_info(tbm_surface_h buffer) { tdm_buffer_info *buf_info = NULL; - if (!tbm_surface_internal_get_user_data(buffer, TDM_BUFFER_KEY,(void **)&buf_info)) { + if (!tbm_surface_internal_get_user_data(buffer, TDM_BUFFER_KEY, (void **)&buf_info)) { buf_info = calloc(1, sizeof(tdm_buffer_info)); TDM_RETURN_VAL_IF_FAIL(buf_info != NULL, NULL); @@ -116,7 +116,7 @@ tdm_buffer_get_info(tbm_surface_h buffer) EXTERN tdm_error tdm_buffer_add_release_handler(tbm_surface_h buffer, - tdm_buffer_release_handler func, void *user_data) + tdm_buffer_release_handler func, void *user_data) { tdm_buffer_info *buf_info; tdm_buffer_func_info *func_info; @@ -140,7 +140,7 @@ tdm_buffer_add_release_handler(tbm_surface_h buffer, EXTERN void tdm_buffer_remove_release_handler(tbm_surface_h buffer, - tdm_buffer_release_handler func, void *user_data) + tdm_buffer_release_handler func, void *user_data) { tdm_buffer_info *buf_info; tdm_buffer_func_info *func_info = NULL, *next = NULL; @@ -210,7 +210,7 @@ tdm_buffer_unref_backend(tbm_surface_h buffer) EXTERN tdm_error tdm_buffer_add_destroy_handler(tbm_surface_h buffer, - tdm_buffer_destroy_handler func, void *user_data) + tdm_buffer_destroy_handler func, void *user_data) { tdm_buffer_info *buf_info; tdm_buffer_func_info *func_info; @@ -234,7 +234,7 @@ tdm_buffer_add_destroy_handler(tbm_surface_h buffer, EXTERN void tdm_buffer_remove_destroy_handler(tbm_surface_h buffer, - tdm_buffer_destroy_handler func, void *user_data) + tdm_buffer_destroy_handler func, void *user_data) { tdm_buffer_info *buf_info; tdm_buffer_func_info *func_info = NULL, *next = NULL; @@ -273,7 +273,7 @@ tdm_buffer_list_dump(struct list_head *list) { tdm_buffer_info *buf_info = NULL; char str[256], *p; - int len = sizeof (str); + int len = sizeof(str); TDM_RETURN_IF_FAIL(list != NULL); @@ -283,8 +283,7 @@ tdm_buffer_list_dump(struct list_head *list) int l = snprintf(p, len, " %p", buf_info->buffer); p += l; len -= l; - } - else + } else break; } diff --git a/src/tdm_capture.c b/src/tdm_capture.c index 01f3e8b..ea67044 100644 --- a/src/tdm_capture.c +++ b/src/tdm_capture.c @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifdef HAVE_CONFIG_H @@ -42,18 +42,18 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tdm_private.h" #define CAPTURE_FUNC_ENTRY() \ - tdm_func_capture *func_capture; \ - tdm_private_display *private_display; \ - tdm_private_capture *private_capture; \ - tdm_error ret = TDM_ERROR_NONE; \ - TDM_RETURN_VAL_IF_FAIL(capture != NULL, TDM_ERROR_INVALID_PARAMETER); \ - private_capture = (tdm_private_capture*)capture; \ - private_display = private_capture->private_display; \ - func_capture = &private_display->func_capture + tdm_func_capture *func_capture; \ + tdm_private_display *private_display; \ + tdm_private_capture *private_capture; \ + tdm_error ret = TDM_ERROR_NONE; \ + TDM_RETURN_VAL_IF_FAIL(capture != NULL, TDM_ERROR_INVALID_PARAMETER); \ + private_capture = (tdm_private_capture*)capture; \ + private_display = private_capture->private_display; \ + func_capture = &private_display->func_capture static tdm_error _tdm_capture_check_if_exist(tdm_private_capture *private_capture, - tbm_surface_h buffer) + tbm_surface_h buffer) { tdm_buffer_info *buf_info = NULL; @@ -76,7 +76,7 @@ _tdm_capture_check_if_exist(tdm_private_capture *private_capture, INTERN void tdm_capture_cb_done(tdm_capture *capture_backend, tbm_surface_h buffer, - void *user_data) + void *user_data) { tdm_private_capture *private_capture = user_data; tdm_private_display *private_display = private_capture->private_display; @@ -136,7 +136,7 @@ tdm_capture_find_stamp(tdm_private_display *private_display, unsigned long stamp INTERN tdm_private_capture * tdm_capture_create_output_internal(tdm_private_output *private_output, - tdm_error *error) + tdm_error *error) { tdm_private_display *private_display = private_output->private_display; tdm_func_output *func_output = &private_display->func_output; @@ -155,7 +155,7 @@ tdm_capture_create_output_internal(tdm_private_output *private_output, } capture_backend = func_output->output_create_capture( - private_output->output_backend, &ret); + private_output->output_backend, &ret); if (ret != TDM_ERROR_NONE) { if (error) *error = ret; @@ -172,7 +172,7 @@ tdm_capture_create_output_internal(tdm_private_output *private_output, } ret = func_capture->capture_set_done_handler(capture_backend, - tdm_capture_cb_done, private_capture); + tdm_capture_cb_done, private_capture); if (ret != TDM_ERROR_NONE) { TDM_ERR("capture(%p) set capture_done_handler failed", private_capture); func_capture->capture_destroy(capture_backend); @@ -206,7 +206,7 @@ tdm_capture_create_output_internal(tdm_private_output *private_output, INTERN tdm_private_capture * tdm_capture_create_layer_internal(tdm_private_layer *private_layer, - tdm_error *error) + tdm_error *error) { tdm_private_output *private_output = private_layer->private_output; tdm_private_display *private_display = private_output->private_display; @@ -226,7 +226,7 @@ tdm_capture_create_layer_internal(tdm_private_layer *private_layer, } capture_backend = func_layer->layer_create_capture(private_layer->layer_backend, - &ret); + &ret); if (ret != TDM_ERROR_NONE) return NULL; @@ -403,7 +403,7 @@ tdm_capture_commit(tdm_capture *capture) private_output = private_capture->private_output; if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) { TDM_ERR("output(%d) dpms: %s", private_output->pipe, - dpms_str(private_output->current_dpms_value)); + dpms_str(private_output->current_dpms_value)); _pthread_mutex_unlock(&private_display->lock); return TDM_ERROR_BAD_REQUEST; } diff --git a/src/tdm_display.c b/src/tdm_display.c index 0148871..1790229 100644 --- a/src/tdm_display.c +++ b/src/tdm_display.c @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifdef HAVE_CONFIG_H @@ -45,62 +45,62 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define COUNT_MAX 10 #define DISPLAY_FUNC_ENTRY() \ - tdm_private_display *private_display; \ - tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ - TDM_RETURN_VAL_IF_FAIL(dpy != NULL, TDM_ERROR_INVALID_PARAMETER); \ - private_display = (tdm_private_display*)dpy; + tdm_private_display *private_display; \ + tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ + TDM_RETURN_VAL_IF_FAIL(dpy != NULL, TDM_ERROR_INVALID_PARAMETER); \ + private_display = (tdm_private_display*)dpy; #define DISPLAY_FUNC_ENTRY_ERROR() \ - tdm_private_display *private_display; \ - tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ - TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(dpy != NULL, TDM_ERROR_INVALID_PARAMETER, NULL); \ - private_display = (tdm_private_display*)dpy; + tdm_private_display *private_display; \ + tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ + TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(dpy != NULL, TDM_ERROR_INVALID_PARAMETER, NULL); \ + private_display = (tdm_private_display*)dpy; #define OUTPUT_FUNC_ENTRY() \ - tdm_private_display *private_display; \ - tdm_private_output *private_output; \ - tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ - TDM_RETURN_VAL_IF_FAIL(output != NULL, TDM_ERROR_INVALID_PARAMETER); \ - private_output = (tdm_private_output*)output; \ - private_display = private_output->private_display + tdm_private_display *private_display; \ + tdm_private_output *private_output; \ + tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ + TDM_RETURN_VAL_IF_FAIL(output != NULL, TDM_ERROR_INVALID_PARAMETER); \ + private_output = (tdm_private_output*)output; \ + private_display = private_output->private_display #define OUTPUT_FUNC_ENTRY_ERROR() \ - tdm_private_display *private_display; \ - tdm_private_output *private_output; \ - tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ - TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(output != NULL, TDM_ERROR_INVALID_PARAMETER, NULL); \ - private_output = (tdm_private_output*)output; \ - private_display = private_output->private_display + tdm_private_display *private_display; \ + tdm_private_output *private_output; \ + tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ + TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(output != NULL, TDM_ERROR_INVALID_PARAMETER, NULL); \ + private_output = (tdm_private_output*)output; \ + private_display = private_output->private_display #define LAYER_FUNC_ENTRY() \ - tdm_private_display *private_display; \ - tdm_private_output *private_output; \ - tdm_private_layer *private_layer; \ - tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ - TDM_RETURN_VAL_IF_FAIL(layer != NULL, TDM_ERROR_INVALID_PARAMETER); \ - private_layer = (tdm_private_layer*)layer; \ - private_output = private_layer->private_output; \ - private_display = private_output->private_display + tdm_private_display *private_display; \ + tdm_private_output *private_output; \ + tdm_private_layer *private_layer; \ + tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ + TDM_RETURN_VAL_IF_FAIL(layer != NULL, TDM_ERROR_INVALID_PARAMETER); \ + private_layer = (tdm_private_layer*)layer; \ + private_output = private_layer->private_output; \ + private_display = private_output->private_display #define LAYER_FUNC_ENTRY_ERROR() \ - tdm_private_display *private_display; \ - tdm_private_output *private_output; \ - tdm_private_layer *private_layer; \ - tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ - TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(layer != NULL, TDM_ERROR_INVALID_PARAMETER, NULL); \ - private_layer = (tdm_private_layer*)layer; \ - private_output = private_layer->private_output; \ - private_display = private_output->private_display + tdm_private_display *private_display; \ + tdm_private_output *private_output; \ + tdm_private_layer *private_layer; \ + tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ + TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(layer != NULL, TDM_ERROR_INVALID_PARAMETER, NULL); \ + private_layer = (tdm_private_layer*)layer; \ + private_output = private_layer->private_output; \ + private_display = private_output->private_display #define LAYER_FUNC_ENTRY_VOID_RETURN() \ - tdm_private_display *private_display; \ - tdm_private_output *private_output; \ - tdm_private_layer *private_layer; \ - tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ - TDM_RETURN_IF_FAIL(layer != NULL); \ - private_layer = (tdm_private_layer*)layer; \ - private_output = private_layer->private_output; \ - private_display = private_output->private_display + tdm_private_display *private_display; \ + tdm_private_output *private_output; \ + tdm_private_layer *private_layer; \ + tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\ + TDM_RETURN_IF_FAIL(layer != NULL); \ + private_layer = (tdm_private_layer*)layer; \ + private_output = private_layer->private_output; \ + private_display = private_output->private_display #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) @@ -110,7 +110,8 @@ struct type_name { }; #define type_name_fn(res) \ -const char * res##_str(int type) { \ +const char * res##_str(int type) \ +{ \ unsigned int i; \ for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \ if (res##_names[i].type == type) \ @@ -185,7 +186,7 @@ _tdm_display_unlock(tdm_display *dpy, const char *func) EXTERN tdm_error tdm_display_get_capabilities(tdm_display *dpy, - tdm_display_capability *capabilities) + tdm_display_capability *capabilities) { DISPLAY_FUNC_ENTRY(); @@ -202,7 +203,7 @@ tdm_display_get_capabilities(tdm_display *dpy, EXTERN tdm_error tdm_display_get_pp_capabilities(tdm_display *dpy, - tdm_pp_capability *capabilities) + tdm_pp_capability *capabilities) { DISPLAY_FUNC_ENTRY(); @@ -225,7 +226,7 @@ tdm_display_get_pp_capabilities(tdm_display *dpy, EXTERN tdm_error tdm_display_get_pp_available_formats(tdm_display *dpy, - const tbm_format **formats, int *count) + const tbm_format **formats, int *count) { DISPLAY_FUNC_ENTRY(); @@ -250,7 +251,7 @@ tdm_display_get_pp_available_formats(tdm_display *dpy, EXTERN tdm_error tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h, - int *max_w, int *max_h, int *preferred_align) + int *max_w, int *max_h, int *preferred_align) { DISPLAY_FUNC_ENTRY(); @@ -280,7 +281,7 @@ tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h, EXTERN tdm_error tdm_display_get_capture_capabilities(tdm_display *dpy, - tdm_capture_capability *capabilities) + tdm_capture_capability *capabilities) { DISPLAY_FUNC_ENTRY(); @@ -303,7 +304,7 @@ tdm_display_get_capture_capabilities(tdm_display *dpy, EXTERN tdm_error tdm_display_get_catpure_available_formats(tdm_display *dpy, - const tbm_format **formats, int *count) + const tbm_format **formats, int *count) { DISPLAY_FUNC_ENTRY(); @@ -454,7 +455,7 @@ tdm_display_create_pp(tdm_display *dpy, tdm_error *error) EXTERN tdm_error tdm_output_get_model_info(tdm_output *output, const char **maker, - const char **model, const char **name) + const char **model, const char **name) { OUTPUT_FUNC_ENTRY(); @@ -505,7 +506,7 @@ _tdm_output_update(tdm_output *output_backend, void *user_data) INTERN void tdm_output_cb_status(tdm_output *output_backend, tdm_output_conn_status status, - void *user_data) + void *user_data) { tdm_private_display *private_display; tdm_private_output *private_output = user_data; @@ -530,9 +531,9 @@ tdm_output_cb_status(tdm_output *output_backend, tdm_output_conn_status status, value.u32 = status; tdm_output_call_change_handler_internal(private_output, - &private_output->change_handler_list_sub, - TDM_OUTPUT_CHANGE_CONNECTION, - value); + &private_output->change_handler_list_sub, + TDM_OUTPUT_CHANGE_CONNECTION, + value); ret = tdm_thread_send_cb(private_display->private_loop, &output_status.base); TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE); @@ -545,15 +546,15 @@ tdm_output_cb_status(tdm_output *output_backend, tdm_output_conn_status status, value.u32 = status; tdm_output_call_change_handler_internal(private_output, - &private_output->change_handler_list_main, - TDM_OUTPUT_CHANGE_CONNECTION, - value); + &private_output->change_handler_list_main, + TDM_OUTPUT_CHANGE_CONNECTION, + value); } EXTERN tdm_error tdm_output_add_change_handler(tdm_output *output, - tdm_output_change_handler func, - void *user_data) + tdm_output_change_handler func, + void *user_data) { tdm_private_change_handler *change_handler; OUTPUT_FUNC_ENTRY(); @@ -592,8 +593,8 @@ tdm_output_add_change_handler(tdm_output *output, EXTERN void tdm_output_remove_change_handler(tdm_output *output, - tdm_output_change_handler func, - void *user_data) + tdm_output_change_handler func, + void *user_data) { tdm_private_display *private_display; tdm_private_output *private_output; @@ -703,7 +704,7 @@ tdm_output_get_layer(tdm_output *output, int index, tdm_error *error) EXTERN tdm_error tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props, - int *count) + int *count) { OUTPUT_FUNC_ENTRY(); @@ -722,7 +723,7 @@ tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props, EXTERN tdm_error tdm_output_get_available_modes(tdm_output *output, - const tdm_output_mode **modes, int *count) + const tdm_output_mode **modes, int *count) { OUTPUT_FUNC_ENTRY(); @@ -741,7 +742,7 @@ tdm_output_get_available_modes(tdm_output *output, EXTERN tdm_error tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h, - int *max_w, int *max_h, int *preferred_align) + int *max_w, int *max_h, int *preferred_align) { OUTPUT_FUNC_ENTRY(); @@ -765,7 +766,7 @@ tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h, EXTERN tdm_error tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth, - unsigned int *mmHeight) + unsigned int *mmHeight) { OUTPUT_FUNC_ENTRY(); @@ -829,7 +830,7 @@ tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value) } ret = func_output->output_set_property(private_output->output_backend, id, - value); + value); _pthread_mutex_unlock(&private_display->lock); @@ -855,7 +856,7 @@ tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value) } ret = func_output->output_get_property(private_output->output_backend, id, - value); + value); _pthread_mutex_unlock(&private_display->lock); @@ -864,7 +865,7 @@ tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value) INTERN void tdm_output_cb_vblank(tdm_output *output_backend, unsigned int sequence, - unsigned int tv_sec, unsigned int tv_usec, void *user_data) + unsigned int tv_sec, unsigned int tv_usec, void *user_data) { tdm_private_vblank_handler *vblank_handler = user_data; tdm_private_display *private_display; @@ -898,7 +899,7 @@ tdm_output_cb_vblank(tdm_output *output_backend, unsigned int sequence, if (vblank_handler->func) { _pthread_mutex_unlock(&private_display->lock); vblank_handler->func(vblank_handler->private_output, sequence, - tv_sec, tv_usec, vblank_handler->user_data); + tv_sec, tv_usec, vblank_handler->user_data); _pthread_mutex_lock(&private_display->lock); } @@ -908,7 +909,7 @@ tdm_output_cb_vblank(tdm_output *output_backend, unsigned int sequence, INTERN void tdm_output_cb_commit(tdm_output *output_backend, unsigned int sequence, - unsigned int tv_sec, unsigned int tv_usec, void *user_data) + unsigned int tv_sec, unsigned int tv_usec, void *user_data) { tdm_private_commit_handler *commit_handler = user_data; tdm_private_display *private_display; @@ -950,7 +951,7 @@ tdm_output_cb_commit(tdm_output *output_backend, unsigned int sequence, if (private_layer->buffer_queue) { tbm_surface_queue_release(private_layer->buffer_queue, - private_layer->showing_buffer); + private_layer->showing_buffer); } } @@ -959,14 +960,14 @@ tdm_output_cb_commit(tdm_output *output_backend, unsigned int sequence, if (tdm_debug_buffer) TDM_INFO("layer(%p) waiting_buffer(%p) showing_buffer(%p)", - private_layer, private_layer->waiting_buffer, - private_layer->showing_buffer); + private_layer, private_layer->waiting_buffer, + private_layer->showing_buffer); } if (commit_handler->func) { _pthread_mutex_unlock(&private_display->lock); commit_handler->func(private_output, sequence, - tv_sec, tv_usec, commit_handler->user_data); + tv_sec, tv_usec, commit_handler->user_data); _pthread_mutex_lock(&private_display->lock); } @@ -976,7 +977,7 @@ tdm_output_cb_commit(tdm_output *output_backend, unsigned int sequence, EXTERN tdm_error tdm_output_wait_vblank(tdm_output *output, int interval, int sync, - tdm_output_vblank_handler func, void *user_data) + tdm_output_vblank_handler func, void *user_data) { tdm_func_output *func_output; tdm_private_vblank_handler *vblank_handler; @@ -986,7 +987,7 @@ tdm_output_wait_vblank(tdm_output *output, int interval, int sync, if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) { TDM_ERR("output(%d) dpms: %s", private_output->pipe, - dpms_str(private_output->current_dpms_value)); + dpms_str(private_output->current_dpms_value)); _pthread_mutex_unlock(&private_display->lock); return TDM_ERROR_BAD_REQUEST; } @@ -1013,7 +1014,7 @@ tdm_output_wait_vblank(tdm_output *output, int interval, int sync, vblank_handler->owner_tid = syscall(SYS_gettid); ret = func_output->output_wait_vblank(private_output->output_backend, interval, - sync, vblank_handler); + sync, vblank_handler); if (ret != TDM_ERROR_NONE) { _pthread_mutex_unlock(&private_display->lock); return ret; @@ -1022,7 +1023,7 @@ tdm_output_wait_vblank(tdm_output *output, int interval, int sync, if (!private_output->regist_vblank_cb) { private_output->regist_vblank_cb = 1; ret = func_output->output_set_vblank_handler(private_output->output_backend, - tdm_output_cb_vblank); + tdm_output_cb_vblank); } _pthread_mutex_unlock(&private_display->lock); @@ -1032,7 +1033,7 @@ tdm_output_wait_vblank(tdm_output *output, int interval, int sync, static tdm_error _tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, - void *user_data) + void *user_data) { tdm_func_output *func_output; tdm_private_commit_handler *commit_handler; @@ -1058,13 +1059,13 @@ _tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, commit_handler->owner_tid = syscall(SYS_gettid); ret = func_output->output_commit(private_output->output_backend, sync, - commit_handler); + commit_handler); TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret); if (!private_output->regist_commit_cb) { private_output->regist_commit_cb = 1; ret = func_output->output_set_commit_handler(private_output->output_backend, - tdm_output_cb_commit); + tdm_output_cb_commit); } return ret; @@ -1072,7 +1073,7 @@ _tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, EXTERN tdm_error tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, - void *user_data) + void *user_data) { OUTPUT_FUNC_ENTRY(); @@ -1080,7 +1081,7 @@ tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) { TDM_ERR("output(%d) dpms: %s", private_output->pipe, - dpms_str(private_output->current_dpms_value)); + dpms_str(private_output->current_dpms_value)); _pthread_mutex_unlock(&private_display->lock); return TDM_ERROR_BAD_REQUEST; } @@ -1177,9 +1178,9 @@ tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value) value.u32 = dpms_value; tdm_output_call_change_handler_internal(private_output, - &private_output->change_handler_list_main, - TDM_OUTPUT_CHANGE_DPMS, - value); + &private_output->change_handler_list_main, + TDM_OUTPUT_CHANGE_DPMS, + value); } _pthread_mutex_unlock(&private_display->lock); @@ -1222,8 +1223,7 @@ tdm_output_create_capture(tdm_output *output, tdm_error *error) _pthread_mutex_lock(&private_display->lock); - capture = (tdm_capture *)tdm_capture_create_output_internal(private_output, - error); + capture = (tdm_capture *)tdm_capture_create_output_internal(private_output, error); _pthread_mutex_unlock(&private_display->lock); @@ -1232,9 +1232,9 @@ tdm_output_create_capture(tdm_output *output, tdm_error *error) INTERN void tdm_output_call_change_handler_internal(tdm_private_output *private_output, - struct list_head *change_handler_list, - tdm_output_change_type type, - tdm_value value) + struct list_head *change_handler_list, + tdm_output_change_type type, + tdm_value value) { tdm_private_display *private_display; tdm_private_change_handler *change_handler; @@ -1246,10 +1246,10 @@ tdm_output_call_change_handler_internal(tdm_private_output *private_output, if (!tdm_thread_in_display_thread(syscall(SYS_gettid))) { if (type & TDM_OUTPUT_CHANGE_CONNECTION) TDM_INFO("output(%d) changed: %s (%d)", - private_output->pipe, status_str(value.u32), value.u32); + private_output->pipe, status_str(value.u32), value.u32); if (type & TDM_OUTPUT_CHANGE_DPMS) TDM_INFO("output(%d) changed: dpms %s (%d)", - private_output->pipe, dpms_str(value.u32), value.u32); + private_output->pipe, dpms_str(value.u32), value.u32); } if (LIST_IS_EMPTY(change_handler_list)) @@ -1261,7 +1261,7 @@ tdm_output_call_change_handler_internal(tdm_private_output *private_output, _pthread_mutex_unlock(&private_display->lock); change_handler->func(private_output, type, - value, change_handler->user_data); + value, change_handler->user_data); _pthread_mutex_lock(&private_display->lock); } } @@ -1283,8 +1283,7 @@ tdm_layer_get_capabilities(tdm_layer *layer, tdm_layer_capability *capabilities) } EXTERN tdm_error -tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats, - int *count) +tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats, int *count) { LAYER_FUNC_ENTRY(); @@ -1302,8 +1301,7 @@ tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats, } EXTERN tdm_error -tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props, - int *count) +tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props, int *count) { LAYER_FUNC_ENTRY(); @@ -1405,13 +1403,13 @@ tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info) } TDM_INFO("layer(%p) info: src(%dx%d %d,%d %dx%d %c%c%c%c) dst(%d,%d %dx%d) trans(%d)", - private_layer, info->src_config.size.h, info->src_config.size.v, - info->src_config.pos.x, info->src_config.pos.y, - info->src_config.pos.w, info->src_config.pos.h, - FOURCC_STR(info->src_config.format), - info->dst_pos.x, info->dst_pos.y, - info->dst_pos.w, info->dst_pos.h, - info->transform); + private_layer, info->src_config.size.h, info->src_config.size.v, + info->src_config.pos.x, info->src_config.pos.y, + info->src_config.pos.w, info->src_config.pos.h, + FOURCC_STR(info->src_config.format), + info->dst_pos.x, info->dst_pos.y, + info->dst_pos.w, info->dst_pos.h, + info->transform); ret = func_layer->layer_set_info(private_layer->layer_backend, info); TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE); @@ -1507,7 +1505,7 @@ tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer) private_layer->waiting_buffer = tdm_buffer_ref_backend(buffer); if (tdm_debug_buffer) TDM_INFO("layer(%p) waiting_buffer(%p)", - private_layer, private_layer->waiting_buffer); + private_layer, private_layer->waiting_buffer); } _pthread_mutex_unlock(&private_display->lock); @@ -1533,7 +1531,7 @@ tdm_layer_unset_buffer(tdm_layer *layer) if (tdm_debug_buffer) TDM_INFO("layer(%p) waiting_buffer(%p)", - private_layer, private_layer->waiting_buffer); + private_layer, private_layer->waiting_buffer); } if (private_layer->showing_buffer) { @@ -1544,7 +1542,7 @@ tdm_layer_unset_buffer(tdm_layer *layer) if (tdm_debug_buffer) TDM_INFO("layer(%p) showing_buffer(%p)", - private_layer, private_layer->showing_buffer); + private_layer, private_layer->showing_buffer); } private_layer->usable = 1; @@ -1580,8 +1578,7 @@ tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error) if (error) *error = TDM_ERROR_OPERATION_FAILED; _pthread_mutex_unlock(&private_display->lock); - TDM_ERR("layer(%p) showing_buffer is null", - private_layer); + TDM_ERR("layer(%p) showing_buffer is null", private_layer); return NULL; } _pthread_mutex_unlock(&private_display->lock); @@ -1606,11 +1603,10 @@ _tbm_layer_queue_acquirable_cb(tbm_surface_queue_h surface_queue, void *data) return; } - if (TBM_SURFACE_QUEUE_ERROR_NONE != tbm_surface_queue_acquire( - private_layer->buffer_queue, &surface) || - surface == NULL) { + if (TBM_SURFACE_QUEUE_ERROR_NONE != tbm_surface_queue_acquire(private_layer->buffer_queue, &surface) || + surface == NULL) { TDM_ERR("layer(%p) tbm_surface_queue_acquire() failed surface:%p", - private_layer, surface); + private_layer, surface); _pthread_mutex_unlock(&private_display->lock); return; } @@ -1623,7 +1619,7 @@ _tbm_layer_queue_acquirable_cb(tbm_surface_queue_h surface_queue, void *data) _pthread_mutex_unlock(&private_display->lock); tdm_buffer_unref_backend(private_layer->waiting_buffer); tbm_surface_queue_release(private_layer->buffer_queue, - private_layer->waiting_buffer); + private_layer->waiting_buffer); _pthread_mutex_lock(&private_display->lock); } @@ -1631,7 +1627,7 @@ _tbm_layer_queue_acquirable_cb(tbm_surface_queue_h surface_queue, void *data) if (tdm_debug_buffer) TDM_INFO("layer(%p) waiting_buffer(%p)", - private_layer, private_layer->waiting_buffer); + private_layer, private_layer->waiting_buffer); ret = _tdm_output_commit(private_layer->private_output, 0, NULL, NULL); if (ret != TDM_ERROR_NONE) @@ -1655,7 +1651,7 @@ _tbm_layer_queue_destroy_cb(tbm_surface_queue_h surface_queue, void *data) _pthread_mutex_unlock(&private_display->lock); tdm_buffer_unref_backend(private_layer->waiting_buffer); tbm_surface_queue_release(private_layer->buffer_queue, - private_layer->waiting_buffer); + private_layer->waiting_buffer); _pthread_mutex_lock(&private_display->lock); } @@ -1693,22 +1689,22 @@ tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue) _pthread_mutex_unlock(&private_display->lock); tdm_buffer_unref_backend(private_layer->waiting_buffer); tbm_surface_queue_release(private_layer->buffer_queue, - private_layer->waiting_buffer); + private_layer->waiting_buffer); private_layer->waiting_buffer = NULL; _pthread_mutex_lock(&private_display->lock); if (tdm_debug_buffer) TDM_INFO("layer(%p) waiting_buffer(%p)", - private_layer, private_layer->waiting_buffer); + private_layer, private_layer->waiting_buffer); } private_layer->buffer_queue = buffer_queue; tbm_surface_queue_add_acquirable_cb(private_layer->buffer_queue, - _tbm_layer_queue_acquirable_cb, - layer); + _tbm_layer_queue_acquirable_cb, + layer); tbm_surface_queue_add_destroy_cb(private_layer->buffer_queue, - _tbm_layer_queue_destroy_cb, - layer); + _tbm_layer_queue_destroy_cb, + layer); _pthread_mutex_unlock(&private_display->lock); return ret; @@ -1728,26 +1724,26 @@ tdm_layer_unset_buffer_queue(tdm_layer *layer) _pthread_mutex_unlock(&private_display->lock); tdm_buffer_unref_backend(private_layer->waiting_buffer); tbm_surface_queue_release(private_layer->buffer_queue, - private_layer->waiting_buffer); + private_layer->waiting_buffer); private_layer->waiting_buffer = NULL; _pthread_mutex_lock(&private_display->lock); if (tdm_debug_buffer) TDM_INFO("layer(%p) waiting_buffer(%p)", - private_layer, private_layer->waiting_buffer); + private_layer, private_layer->waiting_buffer); } if (private_layer->showing_buffer) { _pthread_mutex_unlock(&private_display->lock); tdm_buffer_unref_backend(private_layer->showing_buffer); tbm_surface_queue_release(private_layer->buffer_queue, - private_layer->showing_buffer); + private_layer->showing_buffer); _pthread_mutex_lock(&private_display->lock); private_layer->showing_buffer = NULL; if (tdm_debug_buffer) TDM_INFO("layer(%p) showing_buffer(%p)", - private_layer, private_layer->showing_buffer); + private_layer, private_layer->showing_buffer); } tbm_surface_queue_remove_acquirable_cb(private_layer->buffer_queue, _tbm_layer_queue_acquirable_cb, layer); @@ -1822,8 +1818,7 @@ tdm_layer_create_capture(tdm_layer *layer, tdm_error *error) _pthread_mutex_lock(&private_display->lock); - capture = (tdm_capture *)tdm_capture_create_layer_internal(private_layer, - error); + capture = (tdm_capture *)tdm_capture_create_layer_internal(private_layer, error); _pthread_mutex_unlock(&private_display->lock); diff --git a/src/tdm_event_loop.c b/src/tdm_event_loop.c index d1eb6ea..51a8f55 100644 --- a/src/tdm_event_loop.c +++ b/src/tdm_event_loop.c @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifdef HAVE_CONFIG_H @@ -43,21 +43,18 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -typedef struct _tdm_event_loop_source_base -{ +typedef struct _tdm_event_loop_source_base { struct wl_event_source *wl_source; } tdm_event_loop_source_base; -typedef struct _tdm_event_loop_source_fd -{ +typedef struct _tdm_event_loop_source_fd { tdm_event_loop_source_base base; tdm_private_display *private_display; tdm_event_loop_fd_handler func; void *user_data; } tdm_event_loop_source_fd; -typedef struct _tdm_event_loop_source_timer -{ +typedef struct _tdm_event_loop_source_timer { tdm_event_loop_source_base base; tdm_private_display *private_display; tdm_event_loop_timer_handler func; @@ -101,7 +98,7 @@ tdm_event_loop_init(tdm_private_display *private_display) if (private_display->private_loop) return TDM_ERROR_NONE; - private_loop = calloc(1, sizeof *private_loop); + private_loop = calloc(1, sizeof * private_loop); if (!private_loop) { TDM_ERR("alloc failed"); return TDM_ERROR_OUT_OF_MEMORY; @@ -193,9 +190,9 @@ tdm_event_loop_create_backend_source(tdm_private_display *private_display) private_loop->backend_source = tdm_event_loop_add_fd_handler(private_display, fd, - TDM_EVENT_LOOP_READABLE, - _tdm_event_loop_main_fd_handler, - private_display, &ret); + TDM_EVENT_LOOP_READABLE, + _tdm_event_loop_main_fd_handler, + private_display, &ret); if (!private_loop->backend_source) { TDM_ERR("no backend fd(%d) source", fd); return; @@ -231,7 +228,7 @@ tdm_event_loop_dispatch(tdm_private_display *private_display) TDM_INFO("dispatch"); if (tdm_thread_is_running() && - tdm_thread_in_display_thread(syscall(SYS_gettid))) { + tdm_thread_in_display_thread(syscall(SYS_gettid))) { TDM_NEVER_GET_HERE(); return TDM_ERROR_OPERATION_FAILED; } @@ -259,7 +256,7 @@ tdm_event_loop_flush(tdm_private_display *private_display) TDM_RETURN_IF_FAIL(private_loop->wl_display != NULL); if (tdm_thread_is_running() && - tdm_thread_in_display_thread(syscall(SYS_gettid))) { + tdm_thread_in_display_thread(syscall(SYS_gettid))) { TDM_NEVER_GET_HERE(); return; } @@ -297,10 +294,10 @@ _tdm_event_loop_fd_func(int fd, uint32_t wl_mask, void *data) return 1; } -EXTERN tdm_event_loop_source* +EXTERN tdm_event_loop_source * tdm_event_loop_add_fd_handler(tdm_display *dpy, int fd, tdm_event_loop_mask mask, - tdm_event_loop_fd_handler func, void *user_data, - tdm_error *error) + tdm_event_loop_fd_handler func, void *user_data, + tdm_error *error) { tdm_private_display *private_display; tdm_private_loop *private_loop; @@ -328,7 +325,7 @@ tdm_event_loop_add_fd_handler(tdm_display *dpy, int fd, tdm_event_loop_mask mask fd_source->base.wl_source = wl_event_loop_add_fd(private_loop->wl_loop, - fd, wl_mask, _tdm_event_loop_fd_func, fd_source); + fd, wl_mask, _tdm_event_loop_fd_func, fd_source); if (!fd_source->base.wl_source) { if (error) *error = TDM_ERROR_OUT_OF_MEMORY; @@ -343,7 +340,7 @@ tdm_event_loop_add_fd_handler(tdm_display *dpy, int fd, tdm_event_loop_mask mask if (error) *error = TDM_ERROR_NONE; - return (tdm_event_loop_source*)fd_source; + return (tdm_event_loop_source *)fd_source; } EXTERN tdm_error @@ -388,9 +385,9 @@ _tdm_event_loop_timer_func(void *data) return 1; } -EXTERN tdm_event_loop_source* +EXTERN tdm_event_loop_source * tdm_event_loop_add_timer_handler(tdm_display *dpy, tdm_event_loop_timer_handler func, - void *user_data, tdm_error *error) + void *user_data, tdm_error *error) { tdm_private_display *private_display; tdm_private_loop *private_loop; @@ -411,7 +408,7 @@ tdm_event_loop_add_timer_handler(tdm_display *dpy, tdm_event_loop_timer_handler timer_source->base.wl_source = wl_event_loop_add_timer(private_loop->wl_loop, - _tdm_event_loop_timer_func, timer_source); + _tdm_event_loop_timer_func, timer_source); if (!timer_source->base.wl_source) { if (error) *error = TDM_ERROR_OUT_OF_MEMORY; @@ -426,7 +423,7 @@ tdm_event_loop_add_timer_handler(tdm_display *dpy, tdm_event_loop_timer_handler if (error) *error = TDM_ERROR_NONE; - return (tdm_event_loop_source*)timer_source; + return (tdm_event_loop_source *)timer_source; } EXTERN tdm_error diff --git a/src/tdm_helper.c b/src/tdm_helper.c index 2a77cea..a57a732 100644 --- a/src/tdm_helper.c +++ b/src/tdm_helper.c @@ -1,3 +1,38 @@ +/************************************************************************** + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * +**************************************************************************/ + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -42,7 +77,7 @@ tdm_helper_get_time_in_micros(void) static void _tdm_helper_dump_raw(const char *file, void *data1, int size1, void *data2, - int size2, void *data3, int size3) + int size2, void *data3, int size3) { unsigned int *blocks; FILE *fp = fopen(file, "w+"); @@ -66,13 +101,13 @@ _tdm_helper_dump_raw(const char *file, void *data1, int size1, void *data2, static void _tdm_helper_dump_png(const char *file, const void *data, int width, - int height) + int height) { FILE *fp = fopen(file, "wb"); TDM_RETURN_IF_FAIL(fp != NULL); png_structp pPngStruct = - png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!pPngStruct) { fclose(fp); return; @@ -87,20 +122,20 @@ _tdm_helper_dump_png(const char *file, const void *data, int width, png_init_io(pPngStruct, fp); png_set_IHDR(pPngStruct, - pPngInfo, - width, - height, - PNG_DEPTH, - PNG_COLOR_TYPE_RGBA, - PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); + pPngInfo, + width, + height, + PNG_DEPTH, + PNG_COLOR_TYPE_RGBA, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); png_set_bgr(pPngStruct); png_write_info(pPngStruct, pPngInfo); const int pixel_size = 4; // RGBA png_bytep *row_pointers = - png_malloc(pPngStruct, height * sizeof(png_byte *)); + png_malloc(pPngStruct, height * sizeof(png_byte *)); unsigned int *blocks = (unsigned int *)data; int y = 0; @@ -108,7 +143,7 @@ _tdm_helper_dump_png(const char *file, const void *data, int width, for (; y < height; ++y) { png_bytep row = - png_malloc(pPngStruct, sizeof(png_byte) * width * pixel_size); + png_malloc(pPngStruct, sizeof(png_byte) * width * pixel_size); row_pointers[y] = (png_bytep)row; for (x = 0; x < width; ++x) { unsigned int curBlock = blocks[y * width + x]; @@ -160,36 +195,36 @@ tdm_helper_dump_buffer(tbm_surface_h buffer, const char *file) case TBM_FORMAT_ARGB8888: case TBM_FORMAT_XRGB8888: _tdm_helper_dump_png(file, info.planes[0].ptr, - info.planes[0].stride >> 2, info.height); + info.planes[0].stride >> 2, info.height); break; case TBM_FORMAT_YVU420: case TBM_FORMAT_YUV420: _tdm_helper_dump_raw(file, - info.planes[0].ptr, - info.planes[0].stride * info.height, - info.planes[1].ptr, - info.planes[1].stride * (info.height >> 1), - info.planes[2].ptr, - info.planes[2].stride * (info.height >> 1)); + info.planes[0].ptr, + info.planes[0].stride * info.height, + info.planes[1].ptr, + info.planes[1].stride * (info.height >> 1), + info.planes[2].ptr, + info.planes[2].stride * (info.height >> 1)); break; case TBM_FORMAT_NV12: case TBM_FORMAT_NV21: _tdm_helper_dump_raw(file, - info.planes[0].ptr, - info.planes[0].stride * info.height, - info.planes[1].ptr, - info.planes[1].stride * (info.height >> 1), NULL, - 0); + info.planes[0].ptr, + info.planes[0].stride * info.height, + info.planes[1].ptr, + info.planes[1].stride * (info.height >> 1), NULL, + 0); break; case TBM_FORMAT_YUYV: case TBM_FORMAT_UYVY: _tdm_helper_dump_raw(file, - info.planes[0].ptr, - info.planes[0].stride * info.height, NULL, 0, - NULL, 0); + info.planes[0].ptr, + info.planes[0].stride * info.height, NULL, 0, + NULL, 0); break; default: - TDM_ERR("can't dump %c%c%c%c buffer", FOURCC_STR (info.format)); + TDM_ERR("can't dump %c%c%c%c buffer", FOURCC_STR(info.format)); tbm_surface_unmap(buffer); return; } diff --git a/src/tdm_macro.h b/src/tdm_macro.h index a547c0a..b87b4a0 100644 --- a/src/tdm_macro.h +++ b/src/tdm_macro.h @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifndef _TDM_MACRO_H_ @@ -68,55 +68,54 @@ extern "C" { #endif /* check condition */ -#define TDM_RETURN_IF_FAIL(cond) {\ - if (!(cond)) {\ - TDM_ERR ("'%s' failed", #cond);\ - return;\ - }\ +#define TDM_RETURN_IF_FAIL(cond) { \ + if (!(cond)) { \ + TDM_ERR("'%s' failed", #cond); \ + return; \ + } \ } -#define TDM_RETURN_VAL_IF_FAIL(cond, val) {\ - if (!(cond)) {\ - TDM_ERR ("'%s' failed", #cond);\ - return val;\ - }\ +#define TDM_RETURN_VAL_IF_FAIL(cond, val) { \ + if (!(cond)) { \ + TDM_ERR("'%s' failed", #cond); \ + return val; \ + } \ } -#define TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(cond, error_v, val) {\ - if (!(cond)) {\ - TDM_ERR ("'%s' failed", #cond);\ - ret = error_v;\ - if (error) *error = ret;\ - return val;\ - }\ +#define TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(cond, error_v, val) { \ + if (!(cond)) { \ + TDM_ERR("'%s' failed", #cond); \ + ret = error_v; \ + if (error) *error = ret; \ + return val; \ + } \ } -#define TDM_WARNING_IF_FAIL(cond) {\ - if (!(cond))\ - TDM_ERR ("'%s' failed", #cond);\ +#define TDM_WARNING_IF_FAIL(cond) { \ + if (!(cond)) \ + TDM_ERR("'%s' failed", #cond); \ } -#define TDM_GOTO_IF_FAIL(cond, dst) {\ - if (!(cond)) {\ - TDM_ERR ("'%s' failed", #cond);\ - goto dst;\ - }\ +#define TDM_GOTO_IF_FAIL(cond, dst) { \ + if (!(cond)) { \ + TDM_ERR("'%s' failed", #cond); \ + goto dst; \ + } \ } #define TDM_NEVER_GET_HERE() TDM_ERR("** NEVER GET HERE **") #define TDM_SNPRINTF(p, len, fmt, ARG...) \ - do { \ - if (p && len && *len > 0) \ - { \ - int s = snprintf(p, *len, fmt, ##ARG); \ - p += s; \ - *len -= s; \ - } \ - } while (0) - -#define C(b,m) (((b) >> (m)) & 0xFF) -#define B(c,s) ((((unsigned int)(c)) & 0xff) << (s)) -#define FOURCC(a,b,c,d) (B(d,24) | B(c,16) | B(b,8) | B(a,0)) -#define FOURCC_STR(id) C(id,0), C(id,8), C(id,16), C(id,24) -#define FOURCC_ID(str) FOURCC(((char*)str)[0],((char*)str)[1],((char*)str)[2],((char*)str)[3]) + do { \ + if (p && len && *len > 0) { \ + int s = snprintf(p, *len, fmt, ##ARG); \ + p += s; \ + *len -= s; \ + } \ + } while (0) + +#define C(b, m) (((b) >> (m)) & 0xFF) +#define B(c, s) ((((unsigned int)(c)) & 0xff) << (s)) +#define FOURCC(a, b, c, d) (B(d, 24) | B(c, 16) | B(b, 8) | B(a, 0)) +#define FOURCC_STR(id) C(id, 0), C(id, 8), C(id, 16), C(id, 24) +#define FOURCC_ID(str) FOURCC(((char*)str)[0], ((char*)str)[1], ((char*)str)[2], ((char*)str)[3]) #ifdef __cplusplus } diff --git a/src/tdm_pp.c b/src/tdm_pp.c index c574d8a..2db7af4 100644 --- a/src/tdm_pp.c +++ b/src/tdm_pp.c @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifdef HAVE_CONFIG_H @@ -42,18 +42,18 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tdm_private.h" #define PP_FUNC_ENTRY() \ - tdm_func_pp *func_pp; \ - tdm_private_display *private_display; \ - tdm_private_pp *private_pp; \ - tdm_error ret = TDM_ERROR_NONE; \ - TDM_RETURN_VAL_IF_FAIL(pp != NULL, TDM_ERROR_INVALID_PARAMETER); \ - private_pp = (tdm_private_pp*)pp; \ - private_display = private_pp->private_display; \ - func_pp = &private_display->func_pp + tdm_func_pp *func_pp; \ + tdm_private_display *private_display; \ + tdm_private_pp *private_pp; \ + tdm_error ret = TDM_ERROR_NONE; \ + TDM_RETURN_VAL_IF_FAIL(pp != NULL, TDM_ERROR_INVALID_PARAMETER); \ + private_pp = (tdm_private_pp*)pp; \ + private_display = private_pp->private_display; \ + func_pp = &private_display->func_pp static tdm_error _tdm_pp_check_if_exist(tdm_private_pp *private_pp, - tbm_surface_h src, tbm_surface_h dst) + tbm_surface_h src, tbm_surface_h dst) { tdm_buffer_info *buf_info = NULL; @@ -90,7 +90,7 @@ _tdm_pp_check_if_exist(tdm_private_pp *private_pp, INTERN void tdm_pp_cb_done(tdm_pp *pp_backend, tbm_surface_h src, tbm_surface_h dst, - void *user_data) + void *user_data) { tdm_private_pp *private_pp = user_data; tdm_private_display *private_display = private_pp->private_display; @@ -326,15 +326,15 @@ tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info) } TDM_INFO("pp(%p) info: src(%dx%d %d,%d %dx%d %c%c%c%c) dst(%dx%d %d,%d %dx%d %c%c%c%c) trans(%d) sync(%d) flags(%x)", - private_pp, info->src_config.size.h, info->src_config.size.v, - info->src_config.pos.x, info->src_config.pos.y, - info->src_config.pos.w, info->src_config.pos.h, - FOURCC_STR(info->src_config.format), - info->dst_config.size.h, info->dst_config.size.v, - info->dst_config.pos.x, info->dst_config.pos.y, - info->dst_config.pos.w, info->dst_config.pos.h, - FOURCC_STR(info->dst_config.format), - info->transform, info->sync, info->flags); + private_pp, info->src_config.size.h, info->src_config.size.v, + info->src_config.pos.x, info->src_config.pos.y, + info->src_config.pos.w, info->src_config.pos.h, + FOURCC_STR(info->src_config.format), + info->dst_config.size.h, info->dst_config.size.v, + info->dst_config.pos.x, info->dst_config.pos.y, + info->dst_config.pos.w, info->dst_config.pos.h, + FOURCC_STR(info->dst_config.format), + info->transform, info->sync, info->flags); ret = func_pp->pp_set_info(private_pp->pp_backend, info); TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE); @@ -363,11 +363,11 @@ tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst) if (tdm_display_check_module_abi(private_display, 1, 2) && private_display->caps_pp.max_attach_count > 0) { int length = LIST_LENGTH(&private_pp->src_pending_buffer_list) + - LIST_LENGTH(&private_pp->src_buffer_list); + LIST_LENGTH(&private_pp->src_buffer_list); if (length >= private_display->caps_pp.max_attach_count) { _pthread_mutex_unlock(&private_display->lock); TDM_DBG("failed: too many attached!! max_attach_count(%d)", - private_display->caps_pp.max_attach_count); + private_display->caps_pp.max_attach_count); return TDM_ERROR_BAD_REQUEST; } } diff --git a/src/tdm_private.h b/src/tdm_private.h index d751a81..8d07f03 100644 --- a/src/tdm_private.h +++ b/src/tdm_private.h @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifndef _TDM_PRIVATE_H_ @@ -90,8 +90,8 @@ prototype_name_fn(dpms); prototype_name_fn(status); typedef enum { - TDM_CAPTURE_TARGET_OUTPUT, - TDM_CAPTURE_TARGET_LAYER, + TDM_CAPTURE_TARGET_OUTPUT, + TDM_CAPTURE_TARGET_LAYER, } tdm_capture_target; typedef struct _tdm_private_display tdm_private_display; @@ -314,7 +314,7 @@ tdm_display_check_module_abi(tdm_private_display *private_display, int abimaj, i tdm_private_output * tdm_display_find_output_stamp(tdm_private_display *private_display, - unsigned long stamp); + unsigned long stamp); tdm_private_pp * tdm_pp_find_stamp(tdm_private_display *private_display, unsigned long stamp); tdm_private_capture * @@ -322,25 +322,25 @@ tdm_capture_find_stamp(tdm_private_display *private_display, unsigned long stamp void tdm_output_cb_vblank(tdm_output *output_backend, unsigned int sequence, - unsigned int tv_sec, unsigned int tv_usec, void *user_data); + unsigned int tv_sec, unsigned int tv_usec, void *user_data); void tdm_output_cb_commit(tdm_output *output_backend, unsigned int sequence, - unsigned int tv_sec, unsigned int tv_usec, void *user_data); + unsigned int tv_sec, unsigned int tv_usec, void *user_data); void tdm_output_cb_status(tdm_output *output_backend, tdm_output_conn_status status, - void *user_data); + void *user_data); void tdm_pp_cb_done(tdm_pp *pp_backend, tbm_surface_h src, tbm_surface_h dst, - void *user_data); + void *user_data); void tdm_capture_cb_done(tdm_capture *capture_backend, tbm_surface_h buffer, - void *user_data); + void *user_data); void tdm_output_call_change_handler_internal(tdm_private_output *private_output, - struct list_head *change_handler_list, - tdm_output_change_type type, - tdm_value value); + struct list_head *change_handler_list, + tdm_output_change_type type, + tdm_value value); tdm_private_pp * tdm_pp_create_internal(tdm_private_display *private_display, tdm_error *error); @@ -349,10 +349,10 @@ tdm_pp_destroy_internal(tdm_private_pp *private_pp); tdm_private_capture * tdm_capture_create_output_internal(tdm_private_output *private_output, - tdm_error *error); + tdm_error *error); tdm_private_capture * tdm_capture_create_layer_internal(tdm_private_layer *private_layer, - tdm_error *error); + tdm_error *error); void tdm_capture_destroy_internal(tdm_private_capture *private_capture); @@ -518,7 +518,7 @@ _tdm_display_unlock(tdm_display *dpy, const char *func); tdm_error tdm_display_update_output(tdm_private_display *private_display, - tdm_output *output_backend, int pipe); + tdm_output *output_backend, int pipe); #ifdef __cplusplus } diff --git a/src/tdm_server.c b/src/tdm_server.c index b053d47..99ff6d0 100644 --- a/src/tdm_server.c +++ b/src/tdm_server.c @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifdef HAVE_CONFIG_H @@ -85,7 +85,7 @@ static int tdm_debug_server; static void _tdm_server_send_done(tdm_server_vblank_info *vblank_info, unsigned int sequence, - unsigned int tv_sec, unsigned int tv_usec); + unsigned int tv_sec, unsigned int tv_usec); static tdm_error _tdm_server_cb_timer(void *user_data) @@ -93,8 +93,8 @@ _tdm_server_cb_timer(void *user_data) tdm_server_vblank_info *vblank_info = (tdm_server_vblank_info*)user_data; _tdm_server_send_done(vblank_info, 0, - vblank_info->timer_target_sec, - vblank_info->timer_target_usec); + vblank_info->timer_target_sec, + vblank_info->timer_target_usec); return TDM_ERROR_NONE; } @@ -115,9 +115,9 @@ _tdm_server_update_timer(tdm_server_vblank_info *vblank_info, int interval) if (!vblank_info->timer_source) { vblank_info->timer_source = tdm_event_loop_add_timer_handler(private_loop->dpy, - _tdm_server_cb_timer, - vblank_info, - NULL); + _tdm_server_cb_timer, + vblank_info, + NULL); if (!vblank_info->timer_source) { TDM_ERR("couldn't add timer"); tdm_display_unlock(private_loop->dpy); @@ -136,7 +136,7 @@ _tdm_server_update_timer(tdm_server_vblank_info *vblank_info, int interval) next += (unsigned long)client_info->vblank_gap; TDM_DBG("last(%.6lu) req(%.6lu) curr(%.6lu) prev_req(%.6lu) next(%.6lu)", - last, req, curr, prev_req, next); + last, req, curr, prev_req, next); ms_delay = (unsigned int)ceil((double)(next - curr) / 1000); if (ms_delay == 0) @@ -165,7 +165,7 @@ _tdm_server_update_timer(tdm_server_vblank_info *vblank_info, int interval) static void _tdm_server_send_done(tdm_server_vblank_info *vblank_info, unsigned int sequence, - unsigned int tv_sec, unsigned int tv_usec) + unsigned int tv_sec, unsigned int tv_usec) { tdm_server_vblank_info *found; tdm_server_client_info *client_info; @@ -176,7 +176,7 @@ _tdm_server_send_done(tdm_server_vblank_info *vblank_info, unsigned int sequence return; LIST_FIND_ITEM(vblank_info, &keep_private_server->vblank_list, - tdm_server_vblank_info, link, found); + tdm_server_vblank_info, link, found); if (!found) { TDM_DBG("vblank_info(%p) is destroyed", vblank_info); return; @@ -187,7 +187,7 @@ _tdm_server_send_done(tdm_server_vblank_info *vblank_info, unsigned int sequence client_info->last_tv_usec = tv_usec; TDM_DBG("wl_tdm_vblank@%d done. tv(%lu) curr(%lu)", - wl_resource_get_id(vblank_info->resource), vtime, curr); + wl_resource_get_id(vblank_info->resource), vtime, curr); if (tdm_debug_server) { if (curr - vtime > 1000) /* 1ms */ @@ -200,8 +200,8 @@ _tdm_server_send_done(tdm_server_vblank_info *vblank_info, unsigned int sequence static void _tdm_server_cb_output_vblank(tdm_output *output, unsigned int sequence, - unsigned int tv_sec, unsigned int tv_usec, - void *user_data) + unsigned int tv_sec, unsigned int tv_usec, + void *user_data) { tdm_server_vblank_info *vblank_info = (tdm_server_vblank_info*)user_data; @@ -233,10 +233,10 @@ _tdm_server_client_cb_destroy(struct wl_client *client, struct wl_resource *reso static void _tdm_server_client_cb_wait_vblank(struct wl_client *client, - struct wl_resource *resource, - uint32_t id, const char *name, - int32_t sw_timer, int32_t interval, - uint32_t req_sec, uint32_t req_usec) + struct wl_resource *resource, + uint32_t id, const char *name, + int32_t sw_timer, int32_t interval, + uint32_t req_sec, uint32_t req_usec) { tdm_server_client_info *client_info = wl_resource_get_user_data(resource); tdm_private_server *private_server = client_info->private_server; @@ -270,7 +270,7 @@ _tdm_server_client_cb_wait_vblank(struct wl_client *client, tdm_display_get_output_count(private_loop->dpy, &count); for (i = 0; i < count; i++) { - tdm_output *output= tdm_display_get_output(private_loop->dpy, i, NULL); + tdm_output *output = tdm_display_get_output(private_loop->dpy, i, NULL); tdm_output_conn_status status; ret = tdm_output_get_conn_status(output, &status); @@ -292,7 +292,7 @@ _tdm_server_client_cb_wait_vblank(struct wl_client *client, if (!found) { wl_resource_post_error(resource, WL_TDM_CLIENT_ERROR_INVALID_NAME, - "There is no '%s' output", name); + "There is no '%s' output", name); TDM_ERR("There is no '%s' output", name); return; } @@ -305,7 +305,7 @@ _tdm_server_client_cb_wait_vblank(struct wl_client *client, tdm_output_get_mode(client_info->vblank_output, &mode); if (!mode || mode->vrefresh <= 0) { wl_resource_post_error(resource, WL_TDM_CLIENT_ERROR_OPERATION_FAILED, - "couldn't get mode of %s", name); + "couldn't get mode of %s", name); TDM_ERR("couldn't get mode of %s", name); return; } @@ -318,12 +318,12 @@ _tdm_server_client_cb_wait_vblank(struct wl_client *client, if (dpms_value != TDM_OUTPUT_DPMS_ON && !sw_timer) { wl_resource_post_error(resource, WL_TDM_CLIENT_ERROR_DPMS_OFF, - "dpms '%s'", tdm_get_dpms_str(dpms_value)); + "dpms '%s'", tdm_get_dpms_str(dpms_value)); TDM_ERR("dpms '%s'", tdm_get_dpms_str(dpms_value)); return; } - vblank_info = calloc(1, sizeof *vblank_info); + vblank_info = calloc(1, sizeof * vblank_info); if (!vblank_info) { wl_resource_post_no_memory(resource); TDM_ERR("alloc failed"); @@ -334,7 +334,7 @@ _tdm_server_client_cb_wait_vblank(struct wl_client *client, vblank_resource = wl_resource_create(client, &wl_tdm_vblank_interface, - wl_resource_get_version(resource), id); + wl_resource_get_version(resource), id); if (!vblank_resource) { wl_resource_post_no_memory(resource); TDM_ERR("wl_resource_create failed"); @@ -348,10 +348,10 @@ _tdm_server_client_cb_wait_vblank(struct wl_client *client, if (dpms_value == TDM_OUTPUT_DPMS_ON) { ret = tdm_output_wait_vblank(found, interval, 0, - _tdm_server_cb_output_vblank, vblank_info); + _tdm_server_cb_output_vblank, vblank_info); if (ret != TDM_ERROR_NONE) { wl_resource_post_error(resource, WL_TDM_CLIENT_ERROR_OPERATION_FAILED, - "couldn't wait vblank for %s", name); + "couldn't wait vblank for %s", name); TDM_ERR("couldn't wait vblank for %s", name); goto destroy_resource; } @@ -359,19 +359,19 @@ _tdm_server_client_cb_wait_vblank(struct wl_client *client, ret = _tdm_server_update_timer(vblank_info, interval); if (ret != TDM_ERROR_NONE) { wl_resource_post_error(resource, WL_TDM_CLIENT_ERROR_OPERATION_FAILED, - "couldn't update timer for %s", name); + "couldn't update timer for %s", name); TDM_ERR("couldn't update timer for %s", name); goto destroy_resource; } } else { wl_resource_post_error(resource, WL_TDM_CLIENT_ERROR_OPERATION_FAILED, - "bad implementation"); + "bad implementation"); TDM_NEVER_GET_HERE(); goto destroy_resource; } wl_resource_set_implementation(vblank_resource, NULL, vblank_info, - destroy_vblank_callback); + destroy_vblank_callback); LIST_ADDTAIL(&vblank_info->link, &private_server->vblank_list); return; @@ -396,13 +396,13 @@ destroy_client_callback(struct wl_resource *resource) static void _tdm_server_cb_create_client(struct wl_client *client, - struct wl_resource *resource, uint32_t id) + struct wl_resource *resource, uint32_t id) { tdm_private_server *private_server = wl_resource_get_user_data(resource); tdm_server_client_info *client_info; struct wl_resource *client_resource; - client_info = calloc(1, sizeof *client_info); + client_info = calloc(1, sizeof * client_info); if (!client_info) { wl_resource_post_no_memory(resource); TDM_ERR("alloc failed"); @@ -411,7 +411,7 @@ _tdm_server_cb_create_client(struct wl_client *client, client_resource = wl_resource_create(client, &wl_tdm_client_interface, - wl_resource_get_version(resource), id); + wl_resource_get_version(resource), id); if (!client_resource) { wl_resource_post_no_memory(resource); free(client_info); @@ -423,7 +423,7 @@ _tdm_server_cb_create_client(struct wl_client *client, client_info->resource = client_resource; wl_resource_set_implementation(client_resource, &tdm_client_implementation, - client_info, destroy_client_callback); + client_info, destroy_client_callback); LIST_ADDTAIL(&client_info->link, &private_server->client_list); } @@ -434,7 +434,7 @@ static const struct wl_tdm_interface tdm_implementation = { static void _tdm_server_bind(struct wl_client *client, void *data, - uint32_t version, uint32_t id) + uint32_t version, uint32_t id) { struct wl_resource *resource; @@ -465,12 +465,12 @@ tdm_server_init(tdm_private_loop *private_loop) TDM_RETURN_VAL_IF_FAIL(private_loop, TDM_ERROR_OPERATION_FAILED); TDM_RETURN_VAL_IF_FAIL(private_loop->wl_display, TDM_ERROR_OPERATION_FAILED); - if(wl_display_add_socket(private_loop->wl_display, "tdm-socket")) { + if (wl_display_add_socket(private_loop->wl_display, "tdm-socket")) { TDM_ERR("createing a tdm-socket failed"); return TDM_ERROR_OPERATION_FAILED; } - private_server = calloc(1, sizeof *private_server); + private_server = calloc(1, sizeof * private_server); if (!private_server) { TDM_ERR("alloc failed"); return TDM_ERROR_OUT_OF_MEMORY; @@ -480,7 +480,7 @@ tdm_server_init(tdm_private_loop *private_loop) LIST_INITHEAD(&private_server->vblank_list); if (!wl_global_create(private_loop->wl_display, &wl_tdm_interface, 1, - private_server, _tdm_server_bind)) { + private_server, _tdm_server_bind)) { TDM_ERR("creating a global resource failed"); free(private_server); return TDM_ERROR_OUT_OF_MEMORY; diff --git a/src/tdm_thread.c b/src/tdm_thread.c index 4dd33e4..aff3f39 100644 --- a/src/tdm_thread.c +++ b/src/tdm_thread.c @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************/ #ifdef HAVE_CONFIG_H @@ -73,7 +73,7 @@ _tdm_thread_main(void *data) private_thread->thread_tid = syscall(SYS_gettid); TDM_INFO("display_tid:%d, thread_tid: %d", - private_thread->display_tid, private_thread->thread_tid); + private_thread->display_tid, private_thread->thread_tid); fd = tdm_event_loop_get_fd(private_loop->dpy); if (fd < 0) { @@ -138,11 +138,11 @@ tdm_thread_init(tdm_private_loop *private_loop) /* enable as default */ thread = getenv("TDM_THREAD"); if (!thread || strncmp(thread, "1", 1)) { - TDM_INFO("not using a TDM event thread: %s", (thread)?thread:"none"); + TDM_INFO("not using a TDM event thread: %s", (thread) ? thread : "none"); return TDM_ERROR_NONE; } - private_thread = calloc(1, sizeof *private_thread); + private_thread = calloc(1, sizeof * private_thread); if (!private_thread) { TDM_ERR("alloc failed"); return TDM_ERROR_OUT_OF_MEMORY; @@ -160,12 +160,12 @@ tdm_thread_init(tdm_private_loop *private_loop) private_thread->display_tid = syscall(SYS_gettid); pthread_create(&private_thread->event_thread, NULL, _tdm_thread_main, - private_thread); + private_thread); keep_private_thread = private_thread; TDM_INFO("using a TDM event thread. pipe(%d,%d)", - private_thread->pipe[0], private_thread->pipe[1]); + private_thread->pipe[0], private_thread->pipe[1]); return TDM_ERROR_NONE; } @@ -222,7 +222,7 @@ tdm_thread_send_cb(tdm_private_loop *private_loop, tdm_thread_cb_base *base) if (tdm_debug_thread) TDM_INFO("fd(%d) type(%d), length(%d)", - private_thread->pipe[1], base->type, base->length); + private_thread->pipe[1], base->type, base->length); len = write(private_thread->pipe[1], base, base->length); if (len != base->length) { @@ -258,7 +258,7 @@ tdm_thread_handle_cb(tdm_private_loop *private_loop) if (len == 0) return TDM_ERROR_NONE; - if (len < sizeof *base) { + if (len < sizeof * base) { TDM_NEVER_GET_HERE(); return TDM_ERROR_OPERATION_FAILED; } @@ -271,8 +271,7 @@ tdm_thread_handle_cb(tdm_private_loop *private_loop) if (tdm_debug_thread) TDM_INFO("type(%d), length(%d)", base->type, base->length); switch (base->type) { - case TDM_THREAD_CB_OUTPUT_COMMIT: - { + case TDM_THREAD_CB_OUTPUT_COMMIT: { tdm_thread_cb_output_commit *output_commit = (tdm_thread_cb_output_commit*)base; tdm_output *output_backend = tdm_display_find_output_stamp(private_loop->dpy, output_commit->output_stamp); @@ -281,12 +280,11 @@ tdm_thread_handle_cb(tdm_private_loop *private_loop) break; } tdm_output_cb_commit(output_backend, output_commit->sequence, - output_commit->tv_sec, output_commit->tv_usec, - output_commit->user_data); + output_commit->tv_sec, output_commit->tv_usec, + output_commit->user_data); break; } - case TDM_THREAD_CB_OUTPUT_VBLANK: - { + case TDM_THREAD_CB_OUTPUT_VBLANK: { tdm_thread_cb_output_vblank *output_vblank = (tdm_thread_cb_output_vblank*)base; tdm_output *output_backend = tdm_display_find_output_stamp(private_loop->dpy, output_vblank->output_stamp); @@ -295,12 +293,11 @@ tdm_thread_handle_cb(tdm_private_loop *private_loop) break; } tdm_output_cb_vblank(output_backend, output_vblank->sequence, - output_vblank->tv_sec, output_vblank->tv_usec, - output_vblank->user_data); + output_vblank->tv_sec, output_vblank->tv_usec, + output_vblank->user_data); break; } - case TDM_THREAD_CB_OUTPUT_STATUS: - { + case TDM_THREAD_CB_OUTPUT_STATUS: { tdm_thread_cb_output_status *output_status = (tdm_thread_cb_output_status*)base; tdm_output *output_backend = tdm_display_find_output_stamp(private_loop->dpy, output_status->output_stamp); @@ -309,11 +306,10 @@ tdm_thread_handle_cb(tdm_private_loop *private_loop) break; } tdm_output_cb_status(output_backend, output_status->status, - output_status->user_data); + output_status->user_data); break; } - case TDM_THREAD_CB_PP_DONE: - { + case TDM_THREAD_CB_PP_DONE: { tdm_thread_cb_pp_done *pp_done = (tdm_thread_cb_pp_done*)base; tdm_pp *pp_backend = tdm_pp_find_stamp(private_loop->dpy, pp_done->pp_stamp); @@ -324,8 +320,7 @@ tdm_thread_handle_cb(tdm_private_loop *private_loop) tdm_pp_cb_done(pp_backend, pp_done->src, pp_done->dst, pp_done->user_data); break; } - case TDM_THREAD_CB_CAPTURE_DONE: - { + case TDM_THREAD_CB_CAPTURE_DONE: { tdm_thread_cb_capture_done *capture_done = (tdm_thread_cb_capture_done*)base; tdm_capture *capture_backend = tdm_capture_find_stamp(private_loop->dpy, capture_done->capture_stamp); diff --git a/tools/tdm_test_client.c b/tools/tdm_test_client.c index 5e1f1bb..499d1f5 100644 --- a/tools/tdm_test_client.c +++ b/tools/tdm_test_client.c @@ -1,31 +1,37 @@ -/* -Copyright (C) 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: - Changyeon Lee , - JunKyeong Kim , - Boram Park , - SooChan Lim - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. -*/ +/************************************************************************** + * + * libtdm + * + * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Eunchul Kim , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * +**************************************************************************/ #include #include @@ -50,7 +56,7 @@ get_time_in_micros(void) static void _client_vblank_handler(unsigned int sequence, unsigned int tv_sec, - unsigned int tv_usec, void *user_data) + unsigned int tv_usec, void *user_data) { int client, vblank; static int prev = 0; @@ -106,7 +112,7 @@ main(int argc, char *argv[]) int ret; error = tdm_client_wait_vblank(client, "unknown-0", 1, 1, sync, - _client_vblank_handler, NULL); + _client_vblank_handler, NULL); if (error != TDM_CLIENT_ERROR_NONE) { printf("tdm_client_wait_vblank failed\n"); goto done; -- 2.7.4 From 9b901bab29b2fe53d666b5939dafe87e591b939b Mon Sep 17 00:00:00 2001 From: Roman Marchenko Date: Fri, 27 May 2016 16:12:07 +0300 Subject: [PATCH 12/16] move a registration of commit_cb before calling output_commit If TDM backend works without events (for example fbdev backend) then it should be able to call the commit handler function right after doing commit. Change-Id: I981a02bf257fda116861554db47e0bdf822bfa1f Signed-off-by: Roman Marchenko --- src/tdm_display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tdm_display.c b/src/tdm_display.c index 1790229..969b227 100644 --- a/src/tdm_display.c +++ b/src/tdm_display.c @@ -1058,16 +1058,16 @@ _tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, commit_handler->user_data = user_data; commit_handler->owner_tid = syscall(SYS_gettid); - ret = func_output->output_commit(private_output->output_backend, sync, - commit_handler); - TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret); - if (!private_output->regist_commit_cb) { private_output->regist_commit_cb = 1; ret = func_output->output_set_commit_handler(private_output->output_backend, tdm_output_cb_commit); } + ret = func_output->output_commit(private_output->output_backend, sync, + commit_handler); + TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret); + return ret; } -- 2.7.4 From ad3d294b782be0e2b55887399e81084253886bf3 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 1 Jun 2016 16:14:55 +0900 Subject: [PATCH 13/16] erase tdm log macros semicolon Change-Id: Ic012277818e726da3bc9f3e92758e59a038d7c7c Signed-off-by: Junkyeong Kim --- include/tdm_log.h | 40 +++++++++++++++++++++------------------- src/tdm_display.c | 7 +++---- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/include/tdm_log.h b/include/tdm_log.h index 02943c0..c55acf6 100644 --- a/include/tdm_log.h +++ b/include/tdm_log.h @@ -79,14 +79,15 @@ extern int tdm_debug; #define LOG_TAG "TDM" #define TDM_DBG(fmt, args...) \ - if (tdm_debug) \ do { \ - struct timespec ts; \ - clock_gettime(CLOCK_MONOTONIC, &ts); \ - LOGD("[%d.%06d] "fmt"\n", (int)ts.tv_sec, (int)ts.tv_nsec / 1000, ##args); \ - printf("[TDM_DBG][%d.%06d][%d][%s %d] "fmt"\n", (int)ts.tv_sec, \ - (int)ts.tv_nsec / 1000, (int)syscall(SYS_gettid), __func__, __LINE__, ##args); \ - } while (0); + if (tdm_debug) { \ + struct timespec ts; \ + clock_gettime(CLOCK_MONOTONIC, &ts); \ + LOGD("[%d.%06d] "fmt"\n", (int)ts.tv_sec, (int)ts.tv_nsec / 1000, ##args); \ + printf("[TDM_DBG][%d.%06d][%d][%s %d] "fmt"\n", (int)ts.tv_sec, \ + (int)ts.tv_nsec / 1000, (int)syscall(SYS_gettid), __func__, __LINE__, ##args); \ + } \ + } while (0) #define TDM_INFO(fmt, args...) \ do { \ @@ -95,7 +96,7 @@ extern int tdm_debug; LOGI("[%d.%06d] "fmt"\n", (int)ts.tv_sec, (int)ts.tv_nsec / 1000, ##args); \ printf("[TDM_INF][%d.%06d][%d][%s %d] "fmt"\n", (int)ts.tv_sec, \ (int)ts.tv_nsec / 1000, (int)syscall(SYS_gettid), __func__, __LINE__, ##args); \ - } while (0); + } while (0) #define TDM_WRN(fmt, args...) \ do { \ @@ -104,7 +105,7 @@ extern int tdm_debug; LOGI("[%d.%06d] "fmt"\n", (int)ts.tv_sec, (int)ts.tv_nsec / 1000, ##args); \ printf("[TDM_WRN][%d.%06d][%d][%s %d] "fmt"\n", (int)ts.tv_sec, \ (int)ts.tv_nsec / 1000, (int)syscall(SYS_gettid), __func__, __LINE__, ##args); \ - } while (0); + } while (0) #define TDM_ERR(fmt, args...) \ do { \ @@ -113,7 +114,7 @@ extern int tdm_debug; LOGE("[%d.%06d] "fmt"\n", (int)ts.tv_sec, (int)ts.tv_nsec / 1000, ##args); \ printf("[TDM_ERR][%d.%06d][%d][%s %d] "fmt"\n", (int)ts.tv_sec, \ (int)ts.tv_nsec / 1000, (int)syscall(SYS_gettid), __func__, __LINE__, ##args); \ - } while (0); + } while (0) #else /* TDM_CONFIG_DLOG */ @@ -125,13 +126,14 @@ extern int tdm_debug; #define COLOR_RESET "\x1b[0m" #define TDM_DBG(fmt, args...) \ - if (tdm_debug) \ do { \ - struct timespec ts; \ - clock_gettime(CLOCK_MONOTONIC, &ts); \ - printf("[TDM_DBG][%d.%06d][%d][%s %d] "fmt"\n", (int)ts.tv_sec, \ - (int)ts.tv_nsec / 1000, (int)syscall(SYS_gettid), __func__, __LINE__, ##args); \ - } while (0); + if (tdm_debug) { \ + struct timespec ts; \ + clock_gettime(CLOCK_MONOTONIC, &ts); \ + printf("[TDM_DBG][%d.%06d][%d][%s %d] "fmt"\n", (int)ts.tv_sec, \ + (int)ts.tv_nsec / 1000, (int)syscall(SYS_gettid), __func__, __LINE__, ##args); \ + } \ + } while (0) #define TDM_INFO(fmt, args...) \ do { \ @@ -139,7 +141,7 @@ extern int tdm_debug; clock_gettime(CLOCK_MONOTONIC, &ts); \ printf(COLOR_GREEN"[TDM_INF]"COLOR_RESET"[%d.%06d][%d][%s %d] "fmt"\n", (int)ts.tv_sec, \ (int)ts.tv_nsec / 1000, (int)syscall(SYS_gettid), __func__, __LINE__, ##args); \ - } while (0); + } while (0) #define TDM_WRN(fmt, args...) \ do { \ @@ -148,7 +150,7 @@ extern int tdm_debug; printf(COLOR_YELLOW"[TDM_WRN]"COLOR_RESET"[%d.%06d][%d][%s %d] "fmt"\n", (int)ts.tv_sec, \ (int)ts.tv_nsec / 1000, (int)syscall(SYS_gettid), __func__, __LINE__, ##args); \ TDM_ASSERT(0); \ - } while (0); + } while (0) #define TDM_ERR(fmt, args...) \ do { \ @@ -157,7 +159,7 @@ extern int tdm_debug; printf(COLOR_RED"[TDM_ERR]"COLOR_RESET"[%d.%06d][%d][%s %d] "fmt"\n", (int)ts.tv_sec, \ (int)ts.tv_nsec / 1000, (int)syscall(SYS_gettid), __func__, __LINE__, ##args); \ TDM_ASSERT(0); \ - } while (0); + } while (0) #endif /* TDM_CONFIG_DLOG */ diff --git a/src/tdm_display.c b/src/tdm_display.c index 969b227..2fdc486 100644 --- a/src/tdm_display.c +++ b/src/tdm_display.c @@ -154,11 +154,10 @@ _tdm_display_lock(tdm_display *dpy, const char *func) ret = pthread_mutex_trylock(&private_display->lock); if (ret < 0) { - if (ret == EBUSY) { + if (ret == EBUSY) TDM_ERR("mutex lock busy: %s", func); - } else { + else TDM_ERR("mutex lock failed: %s(%m)", func); - } return TDM_ERROR_OPERATION_FAILED; } @@ -1578,7 +1577,7 @@ tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error) if (error) *error = TDM_ERROR_OPERATION_FAILED; _pthread_mutex_unlock(&private_display->lock); - TDM_ERR("layer(%p) showing_buffer is null", private_layer); + TDM_DBG("layer(%p) showing_buffer is null", private_layer); return NULL; } _pthread_mutex_unlock(&private_display->lock); -- 2.7.4 From bed1f05b96cd51546c1f6101832699008b72a2e8 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 7 Jun 2016 22:47:59 +0900 Subject: [PATCH 14/16] enhance log Change-Id: I0a8286733d527ba4c41f9b4301f701041ab751c5 --- src/tdm_display.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/tdm_display.c b/src/tdm_display.c index 2fdc486..17d951e 100644 --- a/src/tdm_display.c +++ b/src/tdm_display.c @@ -1393,6 +1393,9 @@ tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info) func_layer = &private_display->func_layer; + if (private_layer->usable) + TDM_INFO("layer(%p) not usable", private_layer); + private_layer->usable = 0; if (!func_layer->layer_set_info) { @@ -1476,6 +1479,9 @@ tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer) func_layer = &private_display->func_layer; + if (private_layer->usable) + TDM_INFO("layer(%p) not usable", private_layer); + private_layer->usable = 0; if (!func_layer->layer_set_buffer) { @@ -1546,6 +1552,9 @@ tdm_layer_unset_buffer(tdm_layer *layer) private_layer->usable = 1; + if (private_layer->usable) + TDM_INFO("layer(%p) now usable", private_layer); + if (!func_layer->layer_unset_buffer) { _pthread_mutex_unlock(&private_display->lock); TDM_ERR("not implemented!!"); @@ -1671,6 +1680,9 @@ tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue) func_layer = &private_display->func_layer; + if (private_layer->usable) + TDM_INFO("layer(%p) not usable", private_layer); + private_layer->usable = 0; if (!func_layer->layer_set_buffer) { @@ -1750,6 +1762,9 @@ tdm_layer_unset_buffer_queue(tdm_layer *layer) private_layer->buffer_queue = NULL; private_layer->usable = 1; + if (private_layer->usable) + TDM_INFO("layer(%p) now usable", private_layer); + if (!func_layer->layer_unset_buffer) { _pthread_mutex_unlock(&private_display->lock); TDM_ERR("not implemented!!"); -- 2.7.4 From d7b3a6fbc139908131ef977026a45b8a685596df Mon Sep 17 00:00:00 2001 From: Boram Park Date: Wed, 8 Jun 2016 21:20:57 +0900 Subject: [PATCH 15/16] add description for tdm protocol Change-Id: Idbb753a959e4237676806f43a701e4366843fa59 --- protocol/tdm.xml | 54 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/protocol/tdm.xml b/protocol/tdm.xml index 6fa7f3d..7564670 100644 --- a/protocol/tdm.xml +++ b/protocol/tdm.xml @@ -2,41 +2,59 @@ - + - - - - - + + TDM uses the wayland protocol to communicate between tdm client and tdm server. + + + + + + + TDM uses the wayland protocol to communicate between tdm client and tdm server. + + - - - + + + + + + When wl_tdm_client.wait_vblank is called, wl_tdm_vblank resource is created. + And when TDM server gets the HW vblank, TDM server will send the 'done' + event of wl_tdm_vblank interface to let the TDM client get the HW vblank. + If 'sw_timer' param is 1, TDM server will use the SW timer in case of DPMS off. + And TDM server will create the fake vblank event and send it to TDM client. + Otherwise, TDM server will return 'dpms_off' error. + + - - - - - + + + + + - + - - - + + + + + -- 2.7.4 From a3ae245fc52ea4e43684f77981b5cdc730c9e1ed Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 1 Jun 2016 16:20:27 +0900 Subject: [PATCH 16/16] add tdm_helper_capture_output API It makes composite image with output's all layers showing buffer. After composing, call tdm_helper_capture_handler function. Change-Id: I1ea7b939d77aeaf4f6d2c5347a3443ddac2b6d1d Signed-off-by: Junkyeong Kim --- configure.ac | 2 +- include/tdm_helper.h | 26 +++++++++ packaging/libtdm.spec | 1 + src/tdm_helper.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 184 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index fa99a81..ff06dd9 100644 --- a/configure.ac +++ b/configure.ac @@ -37,7 +37,7 @@ fi PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner >= 1.7.0) -PKG_CHECK_MODULES(TDM, dlog libtbm pthread-stubs libpng wayland-server) +PKG_CHECK_MODULES(TDM, dlog libtbm pthread-stubs libpng pixman-1 wayland-server) PKG_CHECK_MODULES(TTRACE, [ttrace], diff --git a/include/tdm_helper.h b/include/tdm_helper.h index 0bde0b9..e98ad9f 100644 --- a/include/tdm_helper.h +++ b/include/tdm_helper.h @@ -118,6 +118,32 @@ tdm_helper_dump_start(char *dumppath, int *count); 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); #ifdef __cplusplus } #endif diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 881db02..077db23 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -11,6 +11,7 @@ BuildRequires: pkgconfig(libtbm) BuildRequires: pkgconfig(libpng) BuildRequires: pkgconfig(ttrace) BuildRequires: pkgconfig(wayland-server) +BuildRequires: pkgconfig(pixman-1) %description Common user library of Tizen Display Manager : libtdm front-end library diff --git a/src/tdm_helper.c b/src/tdm_helper.c index a57a732..354e2e8 100644 --- a/src/tdm_helper.c +++ b/src/tdm_helper.c @@ -43,9 +43,11 @@ #include #include #include +#include #include "tdm.h" #include "tdm_private.h" +#include "tdm_helper.h" #define PNG_DEPTH 8 @@ -308,3 +310,157 @@ tdm_helper_dump_stop(void) 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); + if (dst_img) + pixman_image_unref(dst_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; +} + -- 2.7.4