From: Boram Park Date: Mon, 30 May 2016 02:04:45 +0000 (+0900) Subject: apply tizen coding rule X-Git-Tag: accepted/tizen/common/20160606.141629~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F66%2F71966%2F1;p=platform%2Fcore%2Fuifw%2Flibtdm.git apply tizen coding rule Change-Id: I4557e1e0aa1a8d1ed026444f0caf480a66bb9c28 --- 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;