From: Changyeon Lee Date: Wed, 2 Mar 2016 02:34:06 +0000 (+0900) Subject: Rename protocol tbm-drm to tbm-drm-auth X-Git-Tag: accepted/tizen/common/20160307.153307~2^2^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4b793061c3645b979901eba5a7b31bcd4c1c2c4;p=platform%2Fcore%2Fuifw%2Flibtbm.git Rename protocol tbm-drm to tbm-drm-auth Change-Id: I3f608047366318f6755b42cfebdd1c4a1c6623d8 --- diff --git a/protocol/wayland-tbm-drm.xml b/protocol/wayland-tbm-drm-auth.xml similarity index 95% rename from protocol/wayland-tbm-drm.xml rename to protocol/wayland-tbm-drm-auth.xml index a097a15..f858bd6 100644 --- a/protocol/wayland-tbm-drm.xml +++ b/protocol/wayland-tbm-drm-auth.xml @@ -1,5 +1,5 @@ - + Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. @@ -28,7 +28,7 @@ - + diff --git a/src/Makefile.am b/src/Makefile.am index 16aef4b..a9aa18e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,9 +23,9 @@ libtbm_la_SOURCES = \ tbm_drm_helper_client.c nodist_libtbm_la_SOURCES = \ - wayland-tbm-drm-server-protocol.h \ - wayland-tbm-drm-client-protocol.h \ - wayland-tbm-drm-protocol.c + wayland-tbm-drm-auth-server-protocol.h \ + wayland-tbm-drm-auth-client-protocol.h \ + wayland-tbm-drm-auth-protocol.c %-protocol.c : $(top_srcdir)/protocol/%.xml $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@ diff --git a/src/tbm_drm_helper.h b/src/tbm_drm_helper.h index eebe10f..fdf4f81 100644 --- a/src/tbm_drm_helper.h +++ b/src/tbm_drm_helper.h @@ -32,8 +32,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _TBM_DRM_HELPER_H_ #define _TBM_DRM_HELPER_H_ -int tbm_drm_helper_wl_server_init(void *wl_display, int fd, const char *device_name, uint32_t flags); -void tbm_drm_helper_wl_server_deinit(void); +int tbm_drm_helper_wl_auth_server_init(void *wl_display, int fd, const char *device_name, uint32_t flags); +void tbm_drm_helper_wl_auth_server_deinit(void); int tbm_drm_helper_get_master_fd(void); void tbm_drm_helper_set_master_fd(int fd); diff --git a/src/tbm_drm_helper_client.c b/src/tbm_drm_helper_client.c index d0a3f50..c266e77 100644 --- a/src/tbm_drm_helper_client.c +++ b/src/tbm_drm_helper_client.c @@ -40,20 +40,20 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tbm_bufmgr_int.h" -#include "wayland-tbm-drm-client-protocol.h" +#include "wayland-tbm-drm-auth-client-protocol.h" -struct wayland_tbm_drm_client { +struct wayland_tbm_drm_auth_client { struct wl_display *display; - struct wl_tbm_drm *wl_tbm_drm; + struct wl_tbm_drm_auth *wl_tbm_drm_auth; int auth_fd; char *device; uint32_t capabilities; }; static void -handle_tbm_drm_authentication_info(void *data, struct wl_tbm_drm *wl_tbm_drm, const char *device_name, uint32_t capabilities, int32_t auth_fd) +handle_tbm_drm_authentication_info(void *data, struct wl_tbm_drm_auth *wl_tbm_drm_auth, const char *device_name, uint32_t capabilities, int32_t auth_fd) { - struct wayland_tbm_drm_client *tbm_drm_client = (struct wayland_tbm_drm_client *)data; + struct wayland_tbm_drm_auth_client *tbm_drm_client = (struct wayland_tbm_drm_auth_client *)data; /* client authentication infomation */ tbm_drm_client->auth_fd = auth_fd; @@ -62,25 +62,25 @@ handle_tbm_drm_authentication_info(void *data, struct wl_tbm_drm *wl_tbm_drm, co tbm_drm_client->device = strdup(device_name); } -static const struct wl_tbm_drm_listener wl_tbm_drm_client_listener = { +static const struct wl_tbm_drm_auth_listener wl_tbm_drm_auth_client_listener = { handle_tbm_drm_authentication_info }; static void -_wayland_tbm_drm_client_registry_handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version) +_wayland_tbm_drm_auth_client_registry_handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version) { - struct wayland_tbm_drm_client *tbm_drm_client = (struct wayland_tbm_drm_client *)data; + struct wayland_tbm_drm_auth_client *tbm_drm_client = (struct wayland_tbm_drm_auth_client *)data; - if (!strcmp(interface, "wl_tbm_drm")) { - tbm_drm_client->wl_tbm_drm = wl_registry_bind(registry, name, &wl_tbm_drm_interface, version); - TBM_RETURN_IF_FAIL(tbm_drm_client->wl_tbm_drm != NULL); + if (!strcmp(interface, "wl_tbm_drm_auth")) { + tbm_drm_client->wl_tbm_drm_auth = wl_registry_bind(registry, name, &wl_tbm_drm_auth_interface, version); + TBM_RETURN_IF_FAIL(tbm_drm_client->wl_tbm_drm_auth != NULL); - wl_tbm_drm_add_listener(tbm_drm_client->wl_tbm_drm, &wl_tbm_drm_client_listener, tbm_drm_client); + wl_tbm_drm_auth_add_listener(tbm_drm_client->wl_tbm_drm_auth, &wl_tbm_drm_auth_client_listener, tbm_drm_client); } } static const struct wl_registry_listener registry_listener = { - _wayland_tbm_drm_client_registry_handle_global, + _wayland_tbm_drm_auth_client_registry_handle_global, NULL }; @@ -89,14 +89,14 @@ tbm_drm_helper_get_auth_info(int *auth_fd, char **device, uint32_t *capabilities { struct wl_display *display; struct wl_registry *wl_registry; - struct wayland_tbm_drm_client *tbm_drm_client; + struct wayland_tbm_drm_auth_client *tbm_drm_client; - tbm_drm_client = calloc(1, sizeof(struct wayland_tbm_drm_client)); + tbm_drm_client = calloc(1, sizeof(struct wayland_tbm_drm_auth_client)); TBM_RETURN_VAL_IF_FAIL(tbm_drm_client != NULL, 0); tbm_drm_client->auth_fd = -1; - display = wl_display_connect("tbm-drm"); + display = wl_display_connect("tbm-drm-auth"); if (!display) { TBM_LOG("Failed to connect display\n"); free(tbm_drm_client); @@ -117,11 +117,11 @@ tbm_drm_helper_get_auth_info(int *auth_fd, char **device, uint32_t *capabilities wl_registry_add_listener(wl_registry, ®istry_listener, tbm_drm_client); wl_display_roundtrip(display); //For Gloabl registry - wl_tbm_drm_get_authentication_info(tbm_drm_client->wl_tbm_drm); + wl_tbm_drm_auth_get_authentication_info(tbm_drm_client->wl_tbm_drm_auth); wl_display_roundtrip(display); - if (!tbm_drm_client->wl_tbm_drm) { - TBM_LOG("Failed to get wl_tbm_drm interface\n"); + if (!tbm_drm_client->wl_tbm_drm_auth) { + TBM_LOG("Failed to get wl_tbm_drm_auth interface\n"); wl_registry_destroy(wl_registry); wl_display_disconnect(display); free(tbm_drm_client); @@ -131,8 +131,8 @@ tbm_drm_helper_get_auth_info(int *auth_fd, char **device, uint32_t *capabilities if (tbm_drm_client->auth_fd < 0) { TBM_LOG("Failed to get auth info\n"); - wl_tbm_drm_set_user_data(tbm_drm_client->wl_tbm_drm, NULL); - wl_tbm_drm_destroy(tbm_drm_client->wl_tbm_drm); + wl_tbm_drm_auth_set_user_data(tbm_drm_client->wl_tbm_drm_auth, NULL); + wl_tbm_drm_auth_destroy(tbm_drm_client->wl_tbm_drm_auth); wl_registry_destroy(wl_registry); wl_display_disconnect(display); free(tbm_drm_client); @@ -155,8 +155,8 @@ tbm_drm_helper_get_auth_info(int *auth_fd, char **device, uint32_t *capabilities *device = NULL; } - wl_tbm_drm_set_user_data(tbm_drm_client->wl_tbm_drm, NULL); - wl_tbm_drm_destroy(tbm_drm_client->wl_tbm_drm); + wl_tbm_drm_auth_set_user_data(tbm_drm_client->wl_tbm_drm_auth, NULL); + wl_tbm_drm_auth_destroy(tbm_drm_client->wl_tbm_drm_auth); if (tbm_drm_client->device) free(tbm_drm_client->device); diff --git a/src/tbm_drm_helper_server.c b/src/tbm_drm_helper_server.c index f8dffd2..2a05bf7 100644 --- a/src/tbm_drm_helper_server.c +++ b/src/tbm_drm_helper_server.c @@ -43,11 +43,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tbm_bufmgr_int.h" -#include "wayland-tbm-drm-server-protocol.h" +#include "wayland-tbm-drm-auth-server-protocol.h" -struct wayland_tbm_drm_server { +struct wayland_tbm_drm_auth_server { struct wl_display *display; - struct wl_global *wl_tbm_drm_global; + struct wl_global *wl_tbm_drm_auth_global; char *device_name; uint32_t fd; @@ -56,10 +56,10 @@ struct wayland_tbm_drm_server { #define MIN(x,y) (((x)<(y))?(x):(y)) -struct wayland_tbm_drm_server *tbm_drm_srv; +struct wayland_tbm_drm_auth_server *tbm_drm_auth_srv; static void -_send_server_auth_info(struct wayland_tbm_drm_server *tbm_drm_srv, +_send_server_auth_info(struct wayland_tbm_drm_auth_server *tbm_drm_auth_srv, struct wl_resource *resource) { int fd = -1; @@ -67,17 +67,17 @@ _send_server_auth_info(struct wayland_tbm_drm_server *tbm_drm_srv, char *device_name = NULL; drm_magic_t magic = 0; - fd = open(tbm_drm_srv->device_name, O_RDWR | O_CLOEXEC); + fd = open(tbm_drm_auth_srv->device_name, O_RDWR | O_CLOEXEC); if (fd == -1 && errno == EINVAL) { - fd = open(tbm_drm_srv->device_name, O_RDWR); + fd = open(tbm_drm_auth_srv->device_name, O_RDWR); if (fd != -1) fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); } if (fd < 0) { - TBM_LOG("failed to open drm : device_name, %s\n", tbm_drm_srv->device_name); + TBM_LOG("failed to open drm : device_name, %s\n", tbm_drm_auth_srv->device_name); - wl_resource_post_error(resource, WL_TBM_DRM_ERROR_AUTHENTICATE_FAIL, + wl_resource_post_error(resource, WL_TBM_DRM_AUTH_ERROR_AUTHENTICATE_FAIL, "authenicate failed::open_drm"); goto fini; } @@ -86,114 +86,114 @@ _send_server_auth_info(struct wayland_tbm_drm_server *tbm_drm_srv, if (errno != EACCES) { TBM_LOG("failed to get magic\n"); - wl_resource_post_error(resource, WL_TBM_DRM_ERROR_AUTHENTICATE_FAIL, + wl_resource_post_error(resource, WL_TBM_DRM_AUTH_ERROR_AUTHENTICATE_FAIL, "authenicate failed::get_magic"); goto fini; } } - if (drmAuthMagic(tbm_drm_srv->fd, magic) < 0) { + if (drmAuthMagic(tbm_drm_auth_srv->fd, magic) < 0) { TBM_LOG("failed to authenticate magic\n"); - wl_resource_post_error(resource, WL_TBM_DRM_ERROR_AUTHENTICATE_FAIL, + wl_resource_post_error(resource, WL_TBM_DRM_AUTH_ERROR_AUTHENTICATE_FAIL, "authenicate failed::auth_magic"); goto fini; } - capabilities = tbm_drm_srv->flags; - device_name = tbm_drm_srv->device_name; + capabilities = tbm_drm_auth_srv->flags; + device_name = tbm_drm_auth_srv->device_name; /* send */ - wl_tbm_drm_send_authentication_info(resource, device_name, capabilities, fd); + wl_tbm_drm_auth_send_authentication_info(resource, device_name, capabilities, fd); fini: if (fd >= 0) close(fd); - if (device_name && device_name != tbm_drm_srv->device_name) + if (device_name && device_name != tbm_drm_auth_srv->device_name) free(device_name); } static void -_wayland_tbm_drm_server_impl_get_authentication_info(struct wl_client *client, +_wayland_tbm_drm_auth_server_impl_get_authentication_info(struct wl_client *client, struct wl_resource *resource) { - struct wayland_tbm_drm_server *tbm_drm_srv = wl_resource_get_user_data(resource); + struct wayland_tbm_drm_auth_server *tbm_drm_auth_srv = wl_resource_get_user_data(resource); /* if display server is the client of the host display server, for embedded server */ - _send_server_auth_info(tbm_drm_srv, resource); + _send_server_auth_info(tbm_drm_auth_srv, resource); } -static const struct wl_tbm_drm_interface _wayland_tbm_drm_server_implementation = { - _wayland_tbm_drm_server_impl_get_authentication_info, +static const struct wl_tbm_drm_auth_interface _wayland_tbm_drm_auth_server_implementation = { + _wayland_tbm_drm_auth_server_impl_get_authentication_info, }; static void -_wayland_tbm_drm_server_bind_cb(struct wl_client *client, void *data, +_wayland_tbm_drm_auth_server_bind_cb(struct wl_client *client, void *data, uint32_t version, uint32_t id) { struct wl_resource *resource; - resource = wl_resource_create(client, &wl_tbm_drm_interface, MIN(version, 1), id); + resource = wl_resource_create(client, &wl_tbm_drm_auth_interface, MIN(version, 1), id); if (!resource) { wl_client_post_no_memory(client); return; } wl_resource_set_implementation(resource, - &_wayland_tbm_drm_server_implementation, + &_wayland_tbm_drm_auth_server_implementation, data, NULL); } int -tbm_drm_helper_wl_server_init(void *wl_display, int fd, const char *device_name, uint32_t flags) +tbm_drm_helper_wl_auth_server_init(void *wl_display, int fd, const char *device_name, uint32_t flags) { - if (!tbm_drm_srv) { + if (!tbm_drm_auth_srv) { TBM_RETURN_VAL_IF_FAIL(wl_display != NULL, 0); - tbm_drm_srv = calloc(1, sizeof(struct wayland_tbm_drm_server)); - TBM_RETURN_VAL_IF_FAIL(tbm_drm_srv != NULL, 0); + tbm_drm_auth_srv = calloc(1, sizeof(struct wayland_tbm_drm_auth_server)); + TBM_RETURN_VAL_IF_FAIL(tbm_drm_auth_srv != NULL, 0); - tbm_drm_srv->display = (struct wl_display *)wl_display; - tbm_drm_srv->device_name = strdup(device_name); - tbm_drm_srv->fd = fd; - tbm_drm_srv->flags = flags; + tbm_drm_auth_srv->display = (struct wl_display *)wl_display; + tbm_drm_auth_srv->device_name = strdup(device_name); + tbm_drm_auth_srv->fd = fd; + tbm_drm_auth_srv->flags = flags; - if(wl_display_add_socket(tbm_drm_srv->display, "tbm-drm")) { + if(wl_display_add_socket(tbm_drm_auth_srv->display, "tbm-drm-auth")) { TBM_LOG("[TBM_DRM] fail to add socket\n"); - if (tbm_drm_srv->device_name) - free(tbm_drm_srv->device_name); + if (tbm_drm_auth_srv->device_name) + free(tbm_drm_auth_srv->device_name); - free(tbm_drm_srv); - tbm_drm_srv = NULL; + free(tbm_drm_auth_srv); + tbm_drm_auth_srv = NULL; return 0; } /* init the client resource list */ - tbm_drm_srv->wl_tbm_drm_global = wl_global_create(tbm_drm_srv->display, &wl_tbm_drm_interface, 1, - tbm_drm_srv, _wayland_tbm_drm_server_bind_cb); + tbm_drm_auth_srv->wl_tbm_drm_auth_global = wl_global_create(tbm_drm_auth_srv->display, &wl_tbm_drm_auth_interface, 1, + tbm_drm_auth_srv, _wayland_tbm_drm_auth_server_bind_cb); } return 1; } void -tbm_drm_helper_wl_server_deinit(void) +tbm_drm_helper_wl_auth_server_deinit(void) { - if (tbm_drm_srv) { - wl_global_destroy(tbm_drm_srv->wl_tbm_drm_global); + if (tbm_drm_auth_srv) { + wl_global_destroy(tbm_drm_auth_srv->wl_tbm_drm_auth_global); - if (tbm_drm_srv->device_name) - free(tbm_drm_srv->device_name); + if (tbm_drm_auth_srv->device_name) + free(tbm_drm_auth_srv->device_name); - free(tbm_drm_srv); - tbm_drm_srv = NULL; + free(tbm_drm_auth_srv); + tbm_drm_auth_srv = NULL; } }