From 5ae1396df688ff3d3bfe6a70bf601d327d99716b Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 24 Nov 2016 15:22:32 +0900 Subject: [PATCH 01/16] Revert "Revert "refactor the sprd log"" This reverts commit c05a617dc5d39c556a8995289202d7f2c9630198. Change-Id: Ib4cb9b5b0449d465a42e75424a72c46af156e122 --- src/tbm_bufmgr_sprd.c | 352 +++++++++++++++++++------------------------------- 1 file changed, 132 insertions(+), 220 deletions(-) diff --git a/src/tbm_bufmgr_sprd.c b/src/tbm_bufmgr_sprd.c index 1db8ac5..6866db9 100644 --- a/src/tbm_bufmgr_sprd.c +++ b/src/tbm_bufmgr_sprd.c @@ -102,11 +102,12 @@ _target_name(void) return app_name; } -#define TBM_SPRD_LOG(fmt, args...) LOGE("\033[31m" "[%s]" fmt "\033[0m", _target_name(), ##args) -#define DBG(fmt, args...) if (bDebug&01) LOGE("[%s]" fmt, _target_name(), ##args) + +#define TBM_SPRD_ERROR(fmt, args...) LOGE("\033[31m" "[%s] " fmt "\033[0m", _target_name(), ##args) +#define TBM_SPRD_DEBUG(fmt, args...) if (bDebug&01) LOGD("[%s] " fmt, _target_name(), ##args) #else -#define TBM_SPRD_LOG(...) -#define DBG(...) +#define TBM_SPRD_ERROR(...) +#define TBM_SPRD_DEBUG(...) #endif #define SIZE_ALIGN(value, base) (((value) + ((base) - 1)) & ~((base) - 1)) @@ -119,13 +120,13 @@ _target_name(void) /* check condition */ #define SPRD_RETURN_IF_FAIL(cond) {\ if (!(cond)) {\ - TBM_SPRD_LOG("[%s] : '%s' failed.\n", __FUNCTION__, #cond);\ + TBM_SPRD_ERROR("[%s] : '%s' failed.\n", __FUNCTION__, #cond);\ return;\ } \ } #define SPRD_RETURN_VAL_IF_FAIL(cond, val) {\ if (!(cond)) {\ - TBM_SPRD_LOG("[%s] : '%s' failed.\n", __FUNCTION__, #cond);\ + TBM_SPRD_ERROR("[%s] : '%s' failed.\n", __FUNCTION__, #cond);\ return val;\ } \ } @@ -261,13 +262,11 @@ _tgl_get_version(int fd) err = ioctl(fd, TGL_IOCTL_GET_VERSION, &data); if (err) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error(%s) %s:%d\n", - getpid(), strerror(errno), __func__, __LINE__); + TBM_SPRD_ERROR("error(%s) %s:%d\n", strerror(errno)); return 0; } - TBM_SPRD_LOG("[libtbm-sprd:%d] %s:%d tgl version is (%u, %u).\n", - getpid(), __func__, __LINE__, data.major, data.minor); + TBM_SPRD_DEBUG("tgl version is (%u, %u).\n", data.major, data.minor); return 1; } @@ -284,8 +283,7 @@ _tgl_init(int fd, unsigned int key) err = ioctl(fd, TGL_IOCTL_REGISTER, &data); if (err) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error(%s) %s:%d key:%d\n", - getpid(), strerror(errno), __func__, __LINE__, key); + TBM_SPRD_ERROR("error(%s) key:%d\n", strerror(errno), key); return 0; } @@ -301,8 +299,7 @@ _tgl_destroy(int fd, unsigned int key) data.key = key; err = ioctl(fd, TGL_IOCTL_UNREGISTER, &data); if (err) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error(%s) %s:%d key:%d\n", - getpid(), strerror(errno), __func__, __LINE__, key); + TBM_SPRD_ERROR("error(%s) key:%d\n", strerror(errno), key); return 0; } @@ -333,8 +330,8 @@ _tgl_lock(int fd, unsigned int key, int opt) err = ioctl(fd, TGL_IOCTL_LOCK, data); if (err) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error(%s) %s:%d key:%d opt:%d\n", - getpid(), strerror(errno), __func__, __LINE__, key, opt); + TBM_SPRD_ERROR("error(%s) key:%d opt:%d\n", + strerror(errno), key, opt); return 0; } @@ -352,8 +349,8 @@ _tgl_unlock(int fd, unsigned int key) err = ioctl(fd, TGL_IOCTL_UNLOCK, data); if (err) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error(%s) %s:%d key:%d\n", - getpid(), strerror(errno), __func__, __LINE__, key); + TBM_SPRD_ERROR("error(%s) key:%d\n", + strerror(errno), key); return 0; } @@ -372,8 +369,8 @@ _tgl_set_data(int fd, unsigned int key, unsigned int val) err = ioctl(fd, TGL_IOCTL_SET_DATA, &data); if (err) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error(%s) %s:%d key:%d\n", - getpid(), strerror(errno), __func__, __LINE__, key); + TBM_SPRD_ERROR("error(%s) key:%d\n", + strerror(errno), key); return 0; } @@ -390,8 +387,8 @@ _tgl_get_data(int fd, unsigned int key, unsigned int *locked) err = ioctl(fd, TGL_IOCTL_GET_DATA, &data); if (err) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error(%s) %s:%d key:%d\n", - getpid(), strerror(errno), __func__, __LINE__, key); + TBM_SPRD_ERROR("error(%s) key:%d\n", + strerror(errno), key); return 0; } @@ -420,13 +417,11 @@ _tbm_sprd_open_drm(void) return fd; #ifdef HAVE_UDEV - TBM_SPRD_LOG("[libtbm-sprd:%d] warning %s:%d fail to open drm, " - "so search drm-device by udev\n", - getpid(), __FUNCTION__, __LINE__); + TBM_SPRD_DEBUG("warning fail to open drm. search drm-device by udev\n"); udev = udev_new(); if (!udev) { - TBM_SPRD_LOG("udev_new() failed.\n"); + TBM_SPRD_ERROR("udev_new() failed.\n"); return -1; } @@ -445,8 +440,7 @@ _tbm_sprd_open_drm(void) if (device_parent) { if (strcmp(udev_device_get_sysname(device_parent), "sprd-drm") == 0) { drm_device = device; - DBG("[%s] Found render device: '%s' (%s)\n", - _target_name(), + TBM_SPRD_DEBUG("Found render device: '%s' (%s)\n", udev_device_get_syspath(drm_device), udev_device_get_sysname(device_parent)); break; @@ -460,7 +454,7 @@ _tbm_sprd_open_drm(void) /* Get device file path. */ filepath = udev_device_get_devnode(drm_device); if (!filepath) { - TBM_SPRD_LOG("udev_device_get_devnode() failed.\n"); + TBM_SPRD_ERROR("udev_device_get_devnode() failed.\n"); udev_device_unref(drm_device); udev_unref(udev); return -1; @@ -472,18 +466,18 @@ _tbm_sprd_open_drm(void) /* Open DRM device file and check validity. */ fd = open(filepath, O_RDWR | O_CLOEXEC); if (fd < 0) { - TBM_SPRD_LOG("open(%s, O_RDWR | O_CLOEXEC) failed.\n"); + TBM_SPRD_ERROR("open(%s, O_RDWR | O_CLOEXEC) failed.\n"); return -1; } if (fstat(fd, &s)) { - TBM_SPRD_LOG("fstat() failed %s.\n"); + TBM_SPRD_ERROR("fstat() failed %s.\n"); close(fd); return -1; } #else - TBM_SPRD_LOG("[libtbm-sprd:%d] warning %s:%d fail to open drm\n", - getpid(), __FUNCTION__, __LINE__); + TBM_SPRD_ERROR("warning fail to open drm\n", + ); #endif return fd; @@ -534,11 +528,9 @@ _sprd_bo_cache_flush(tbm_bufmgr_sprd bufmgr_sprd, tbm_bo_sprd bo_sprd, int flags cache_op.flags |= SPRD_DRM_ALL_CACHES_CORES; ret = drmCommandWriteRead(bufmgr_sprd->fd, DRM_SPRD_GEM_CACHE_OP, &cache_op, - sizeof(cache_op)); + sizeof(cache_op)); if (ret) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d fail to flush the cache.\n", - getpid(), __FUNCTION__, __LINE__); + TBM_SPRD_ERROR("error fail to flush the cache.\n"); return 0; } #endif @@ -627,8 +619,7 @@ _bo_set_cache_state(tbm_bufmgr_sprd bufmgr_sprd, tbm_bo_sprd bo_sprd, int device /* call cache flush */ _sprd_bo_cache_flush(bufmgr_sprd, bo_sprd, need_flush); - DBG("[libtbm:%d] \tcache(%d,%d)....flush:0x%x, cntFlush(%d)\n", - getpid(), + TBM_SPRD_DEBUG("\tcache(%d,%d)....flush:0x%x, cntFlush(%d)\n", bo_sprd->cache_state.data.isCached, bo_sprd->cache_state.data.isDirtied, need_flush, @@ -685,26 +676,19 @@ _bufmgr_init_cache_state(tbm_bufmgr_sprd bufmgr_sprd) /* open tgl fd for saving cache flush data */ bufmgr_sprd->tgl_fd = open(tgl_devfile, O_RDWR); if (bufmgr_sprd->tgl_fd < 0) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error: Fail to open global_lock:%s\n", - getpid(), tgl_devfile); + TBM_SPRD_ERROR("fail to open global_lock:%s\n", tgl_devfile); return 0; } if (!_tgl_get_version(bufmgr_sprd->tgl_fd)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error: fail to get tgl_version. tgl init failed.\n", - getpid()); - + TBM_SPRD_ERROR("fail to get tgl_version. tgl init failed.\n"); close(bufmgr_sprd->tgl_fd); return 0; } #ifdef USE_CACHE if (!_tgl_init(bufmgr_sprd->tgl_fd, GLOBAL_KEY)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error: Fail to initialize the tgl\n", - getpid()); - + TBM_SPRD_ERROR("fail to initialize the tgl\n"); close(bufmgr_sprd->tgl_fd); return 0; } @@ -779,9 +763,7 @@ _get_name(int fd, unsigned int gem) arg.handle = gem; if (drmIoctl(fd, DRM_IOCTL_GEM_FLINK, &arg)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d fail to get flink gem=%d\n", - getpid(), __FUNCTION__, __LINE__, gem); + TBM_SPRD_ERROR("error fail to get flink gem=%d\n", gem); return 0; } @@ -806,9 +788,7 @@ _sprd_bo_handle(tbm_bo_sprd bo_sprd, int device) arg.handle = bo_sprd->gem; arg.size = bo_sprd->size; if (drmCommandWriteRead(bo_sprd->fd, DRM_SPRD_GEM_MMAP, &arg, sizeof(arg))) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot usrptr gem=%d\n", - getpid(), __FUNCTION__, __LINE__, bo_sprd->gem); + TBM_SPRD_ERROR("error Cannot usrptr gem=%d\n", bo_sprd->gem); return (tbm_bo_handle) NULL; } bo_sprd->pBase = (void *)((uint32_t)arg.mapped); @@ -822,9 +802,7 @@ _sprd_bo_handle(tbm_bo_sprd bo_sprd, int device) struct drm_prime_handle arg = {0, }; arg.handle = bo_sprd->gem; if (drmIoctl(bo_sprd->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot dmabuf=%d\n", - getpid(), __FUNCTION__, __LINE__, bo_sprd->gem); + TBM_SPRD_ERROR("error Cannot dmabuf=%d\n", bo_sprd->gem); return (tbm_bo_handle) NULL; } bo_sprd->dmabuf = arg.fd; @@ -838,19 +816,14 @@ _sprd_bo_handle(tbm_bo_sprd bo_sprd, int device) case TBM_DEVICE_MM: #ifdef USE_HEAP_ID //TODO : Add ioctl for GSP MAP once available. - DBG("[libtbm-sprd:%d] %s In case TBM_DEVICE_MM: \n", getpid(), - __FUNCTION_); - _ - + TBM_SPRD_DEBUG("%s In case TBM_DEVICE_MM: \n", __FUNCTION_); #else if (!bo_sprd->dmabuf) { struct drm_prime_handle arg = {0, }; arg.handle = bo_sprd->gem; if (drmIoctl(bo_sprd->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot dmabuf=%d\n", - getpid(), __FUNCTION__, __LINE__, bo_sprd->gem); + TBM_SPRD_ERROR("error Cannot dmabuf=%d\n", bo_sprd->gem); return (tbm_bo_handle) NULL; } bo_sprd->dmabuf = arg.fd; @@ -894,9 +867,7 @@ tbm_sprd_bo_alloc(tbm_bo bo, int size, int flags) bo_sprd = calloc(1, sizeof(struct _tbm_bo_sprd)); if (!bo_sprd) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d fail to allocate the bo private\n", - getpid(), __FUNCTION__, __LINE__); + TBM_SPRD_ERROR("error fail to allocate the bo private\n"); return 0; } @@ -914,9 +885,8 @@ tbm_sprd_bo_alloc(tbm_bo bo, int size, int flags) arg.flags = sprd_flags; if (drmCommandWriteRead(bufmgr_sprd->fd, DRM_SPRD_GEM_CREATE, &arg, sizeof(arg))) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot create bo(flag:%x, size:%d)\n", - getpid(), __FUNCTION__, __LINE__, arg.flags, (unsigned int)arg.size); + TBM_SPRD_ERROR("error Cannot create bo(flag:%x, size:%d)\n", + arg.flags, (unsigned int)arg.size); free(bo_sprd); return 0; } @@ -929,7 +899,7 @@ tbm_sprd_bo_alloc(tbm_bo bo, int size, int flags) bo_sprd->name = _get_name(bo_sprd->fd, bo_sprd->gem); if (!_bo_init_cache_state(bufmgr_sprd, bo_sprd, 0)) { - TBM_SPRD_LOG("error fail init cache state(%d)\n", bo_sprd->name); + TBM_SPRD_ERROR("error fail init cache state(%d)\n", bo_sprd->name); free(bo_sprd); return 0; } @@ -942,9 +912,7 @@ tbm_sprd_bo_alloc(tbm_bo bo, int size, int flags) arg.handle = bo_sprd->gem; if (drmIoctl(bo_sprd->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot dmabuf=%d\n", - getpid(), __FUNCTION__, __LINE__, bo_sprd->gem); + TBM_SPRD_ERROR("error Cannot dmabuf=%d\n", bo_sprd->gem); free(bo_sprd); return 0; } @@ -954,25 +922,20 @@ tbm_sprd_bo_alloc(tbm_bo bo, int size, int flags) /* add bo to hash */ PrivGem *privGem = calloc(1, sizeof(PrivGem)); if (!privGem) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Fail to calloc PrivGem\n", - getpid(), __FUNCTION__, __LINE__); + TBM_SPRD_ERROR("error Fail to calloc PrivGem\n"); free(bo_sprd); return 0; } privGem->ref_count = 1; privGem->bo_priv = bo_sprd; - if (drmHashInsert(bufmgr_sprd->hashBos, bo_sprd->name, (void *)privGem) < 0) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot insert bo to Hash(%d)\n", - getpid(), __FUNCTION__, __LINE__, bo_sprd->name); - } + if (drmHashInsert(bufmgr_sprd->hashBos, bo_sprd->name, (void *)privGem) < 0) + TBM_SPRD_ERROR("error Cannot insert bo to Hash(%d)\n", bo_sprd->name); - DBG("[libtbm-sprd:%d] %s size:%d, gem:%d(%d), flags:%d(%d)\n", getpid(), - __FUNCTION__, bo_sprd->size, - bo_sprd->gem, bo_sprd->name, - flags, sprd_flags); + TBM_SPRD_DEBUG("%s size:%d, gem:%d(%d), flags:%d(%d)\n", + __FUNCTION__, bo_sprd->size, + bo_sprd->gem, bo_sprd->name, + flags, sprd_flags); return (void *)bo_sprd; } @@ -992,15 +955,12 @@ tbm_sprd_bo_free(tbm_bo bo) bo_sprd = (tbm_bo_sprd)tbm_backend_get_bo_priv(bo); SPRD_RETURN_IF_FAIL(bo_sprd != NULL); - DBG("[libtbm-sprd:%d] %s size:%d, gem:%d(%d)\n", - getpid(), __FUNCTION__, bo_sprd->size, bo_sprd->gem, bo_sprd->name); + TBM_SPRD_DEBUG("size:%d, gem:%d(%d)\n", + bo_sprd->size, bo_sprd->gem, bo_sprd->name); if (bo_sprd->pBase) { - if (munmap(bo_sprd->pBase, bo_sprd->size) == -1) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d\n", - getpid(), __FUNCTION__, __LINE__); - } + if (munmap(bo_sprd->pBase, bo_sprd->size) == -1) + TBM_SPRD_ERROR("error fail to munmap.\n"); } /* closedmabuf */ @@ -1022,9 +982,7 @@ tbm_sprd_bo_free(tbm_bo bo) privGem = NULL; } } else { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "warning %s:%d Cannot find bo to Hash(%d), ret=%d\n", - getpid(), __FUNCTION__, __LINE__, bo_sprd->name, ret); + TBM_SPRD_DEBUG("warning Cannot find bo to Hash(%d), ret=%d\n", bo_sprd->name, ret); } _bo_destroy_cache_state(bufmgr_sprd, bo_sprd); @@ -1033,11 +991,8 @@ tbm_sprd_bo_free(tbm_bo bo) struct drm_gem_close arg = {0, }; memset(&arg, 0, sizeof(arg)); arg.handle = bo_sprd->gem; - if (drmIoctl(bo_sprd->fd, DRM_IOCTL_GEM_CLOSE, &arg)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d\n", - getpid(), __FUNCTION__, __LINE__); - } + if (drmIoctl(bo_sprd->fd, DRM_IOCTL_GEM_CLOSE, &arg)) + TBM_SPRD_ERROR("error fail to DRM_IOCTL_GEM_CLOSE\n"); free(bo_sprd); } @@ -1065,9 +1020,7 @@ tbm_sprd_bo_import(tbm_bo bo, unsigned int key) arg.name = key; if (drmIoctl(bufmgr_sprd->fd, DRM_IOCTL_GEM_OPEN, &arg)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot open gem name=%d\n", - getpid(), __FUNCTION__, __LINE__, key); + TBM_SPRD_ERROR("error Cannot open gem name=%d\n", key); return NULL; } @@ -1076,17 +1029,13 @@ tbm_sprd_bo_import(tbm_bo bo, unsigned int key) DRM_SPRD_GEM_GET, &info, sizeof(struct drm_sprd_gem_info))) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot get gem info=%d\n", - getpid(), __FUNCTION__, __LINE__, key); + TBM_SPRD_ERROR("error Cannot get gem info=%d\n", key); goto fail_get_gem; } bo_sprd = calloc(1, sizeof(struct _tbm_bo_sprd)); if (!bo_sprd) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d fail to allocate the bo private\n", - getpid(), __FUNCTION__, __LINE__); + TBM_SPRD_ERROR("error fail to allocate the bo private\n"); goto fail_alloc_bo; } @@ -1103,7 +1052,7 @@ tbm_sprd_bo_import(tbm_bo bo, unsigned int key) #endif if (!_bo_init_cache_state(bufmgr_sprd, bo_sprd, 1)) { - TBM_SPRD_LOG("error fail init cache state(%d)\n", bo_sprd->name); + TBM_SPRD_ERROR("error fail init cache state(%d)\n", bo_sprd->name); goto fail_init_cache; } @@ -1112,9 +1061,7 @@ tbm_sprd_bo_import(tbm_bo bo, unsigned int key) arg.handle = bo_sprd->gem; if (drmIoctl(bo_sprd->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot dmabuf=%d\n", - getpid(), __FUNCTION__, __LINE__, bo_sprd->gem); + TBM_SPRD_ERROR("error Cannot dmabuf=%d\n", bo_sprd->gem); goto fail_prime_handle_to_fd; } bo_sprd->dmabuf = arg.fd; @@ -1123,23 +1070,18 @@ tbm_sprd_bo_import(tbm_bo bo, unsigned int key) /* add bo to hash */ privGem = calloc(1, sizeof(PrivGem)); if (!privGem) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error %s:%d Fail to alloc\n", - getpid(), __FUNCTION__, __LINE__); + TBM_SPRD_ERROR("error Fail to alloc\n"); goto fail_alloc_gem_priv; } privGem->ref_count = 1; privGem->bo_priv = bo_sprd; - if (drmHashInsert(bufmgr_sprd->hashBos, bo_sprd->name, (void *)privGem) < 0) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot insert bo to Hash(%d)\n", - getpid(), __FUNCTION__, __LINE__, bo_sprd->name); - } + if (drmHashInsert(bufmgr_sprd->hashBos, bo_sprd->name, (void *)privGem) < 0) + TBM_SPRD_ERROR("error Cannot insert bo to Hash(%d)\n", bo_sprd->name); - DBG("[libtbm-sprd:%d] %s size:%d, gem:%d(%d), flags:%d(%d)\n", getpid(), - __FUNCTION__, bo_sprd->size, - bo_sprd->gem, bo_sprd->name, - bo_sprd->flags_tbm, bo_sprd->flags_sprd); + TBM_SPRD_DEBUG("size:%d, gem:%d(%d), flags:%d(%d)\n", + bo_sprd->size, bo_sprd->gem, bo_sprd->name, + bo_sprd->flags_tbm, bo_sprd->flags_sprd); return (void *)bo_sprd; @@ -1178,16 +1120,16 @@ tbm_sprd_bo_import_fd(tbm_bo bo, tbm_fd key) arg.fd = key; if (drmIoctl(bufmgr_sprd->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &arg)) { - TBM_SPRD_LOG("error bo:%p Cannot get gem handle from fd:%d (%s)\n", - bo, arg.fd, strerror(errno)); + TBM_SPRD_ERROR("error bo:%p Cannot get gem handle from fd:%d (%s)\n", + bo, arg.fd, strerror(errno)); return NULL; } gem = arg.handle; name = _get_name(bufmgr_sprd->fd, gem); if (!name) { - TBM_SPRD_LOG("error bo:%p Cannot get name from gem:%d, fd:%d (%s)\n", - bo, gem, key, strerror(errno)); + TBM_SPRD_ERROR("error bo:%p Cannot get name from gem:%d, fd:%d (%s)\n", + bo, gem, key, strerror(errno)); return NULL; } @@ -1211,8 +1153,8 @@ tbm_sprd_bo_import_fd(tbm_bo bo, tbm_fd key) DRM_SPRD_GEM_GET, &info, sizeof(struct drm_sprd_gem_info))) { - TBM_SPRD_LOG("error bo:%p Cannot get gem info from gem:%d, fd:%d (%s)\n", - bo, gem, key, strerror(errno)); + TBM_SPRD_ERROR("error bo:%p Cannot get gem info from gem:%d, fd:%d (%s)\n", + bo, gem, key, strerror(errno)); return NULL; } @@ -1221,7 +1163,7 @@ tbm_sprd_bo_import_fd(tbm_bo bo, tbm_fd key) bo_sprd = calloc(1, sizeof(struct _tbm_bo_sprd)); if (!bo_sprd) { - TBM_SPRD_LOG("error bo:%p fail to allocate the bo private\n", bo); + TBM_SPRD_ERROR("error bo:%p fail to allocate the bo private\n", bo); return NULL; } @@ -1233,34 +1175,31 @@ tbm_sprd_bo_import_fd(tbm_bo bo, tbm_fd key) bo_sprd->name = name; if (!bo_sprd->name) { - TBM_SPRD_LOG("error bo:%p Cannot get name from gem:%d, fd:%d (%s)\n", - bo, gem, key, strerror(errno)); + TBM_SPRD_ERROR("error bo:%p Cannot get name from gem:%d, fd:%d (%s)\n", + bo, gem, key, strerror(errno)); goto fail_check_name; } if (!_bo_init_cache_state(bufmgr_sprd, bo_sprd, 1)) { - TBM_SPRD_LOG("error fail init cache state(%d)\n", bo_sprd->name); + TBM_SPRD_ERROR("error fail init cache state(%d)\n", bo_sprd->name); goto fail_init_cache; } /* add bo to hash */ privGem = calloc(1, sizeof(PrivGem)); if (!privGem) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Fail to callocprivGem\n", - getpid(), __FUNCTION__, __LINE__); + TBM_SPRD_ERROR("error Fail to callocprivGem\n"); goto fail_alloc_gem_priv; } privGem->ref_count = 1; privGem->bo_priv = bo_sprd; if (drmHashInsert(bufmgr_sprd->hashBos, bo_sprd->name, (void *)privGem) < 0) { - TBM_SPRD_LOG("error bo:%p Cannot insert bo to Hash(%d) from gem:%d, fd:%d\n", - bo, bo_sprd->name, gem, key); + TBM_SPRD_ERROR("error bo:%p Cannot insert bo to Hash(%d) from gem:%d, fd:%d\n", + bo, bo_sprd->name, gem, key); } - DBG(" [%s] bo:%p, gem:%d(%d), fd:%d, key_fd:%d, flags:%d(%d), size:%d\n", - _target_name(), + TBM_SPRD_DEBUG("bo:%p, gem:%d(%d), fd:%d, key_fd:%d, flags:%d(%d), size:%d\n", bo, bo_sprd->gem, bo_sprd->name, bo_sprd->dmabuf, @@ -1291,17 +1230,14 @@ tbm_sprd_bo_export(tbm_bo bo) if (!bo_sprd->name) { bo_sprd->name = _get_name(bo_sprd->fd, bo_sprd->gem); if (!bo_sprd->name) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot get name\n", - getpid(), __FUNCTION__, __LINE__); + TBM_SPRD_ERROR("error Cannot get name\n"); return 0; } } - DBG("[libtbm-sprd:%d] %s size:%d, gem:%d(%d), flags:%d(%d)\n", getpid(), - __FUNCTION__, bo_sprd->size, - bo_sprd->gem, bo_sprd->name, - bo_sprd->flags_tbm, bo_sprd->flags_sprd); + TBM_SPRD_DEBUG("size:%d, gem:%d(%d), flags:%d(%d)\n", + bo_sprd->size, bo_sprd->gem, bo_sprd->name, + bo_sprd->flags_tbm, bo_sprd->flags_sprd); return (unsigned int)bo_sprd->name; } @@ -1322,19 +1258,18 @@ tbm_sprd_bo_export_fd(tbm_bo bo) arg.handle = bo_sprd->gem; ret = drmIoctl(bo_sprd->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg); if (ret) { - TBM_SPRD_LOG("error bo:%p Cannot dmabuf=%d (%s)\n", - bo, bo_sprd->gem, strerror(errno)); + TBM_SPRD_ERROR("error bo:%p Cannot dmabuf=%d (%s)\n", + bo, bo_sprd->gem, strerror(errno)); return (tbm_fd) ret; } - DBG(" [%s] bo:%p, gem:%d(%d), fd:%d, key_fd:%d, flags:%d(%d), size:%d\n", - _target_name(), - bo, - bo_sprd->gem, bo_sprd->name, - bo_sprd->dmabuf, - arg.fd, - bo_sprd->flags_tbm, bo_sprd->flags_sprd, - bo_sprd->size); + TBM_SPRD_DEBUG("bo:%p, gem:%d(%d), fd:%d, key_fd:%d, flags:%d(%d), size:%d\n", + bo, + bo_sprd->gem, bo_sprd->name, + bo_sprd->dmabuf, + arg.fd, + bo_sprd->flags_tbm, bo_sprd->flags_sprd, + bo_sprd->size); return (tbm_fd)arg.fd; } @@ -1352,21 +1287,18 @@ tbm_sprd_bo_get_handle(tbm_bo bo, int device) SPRD_RETURN_VAL_IF_FAIL(bo_sprd != NULL, (tbm_bo_handle) NULL); if (!bo_sprd->gem) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot map gem=%d\n", - getpid(), __FUNCTION__, __LINE__, bo_sprd->gem); + TBM_SPRD_ERROR("error Cannot map gem=%d\n", bo_sprd->gem); return (tbm_bo_handle) NULL; } - DBG("[libtbm-sprd:%d] %s gem:%d(%d), %s\n", getpid(), - __FUNCTION__, bo_sprd->gem, bo_sprd->name, STR_DEVICE[device]); + TBM_SPRD_DEBUG("gem:%d(%d), %s\n", + bo_sprd->gem, bo_sprd->name, STR_DEVICE[device]); /*Get mapped bo_handle*/ bo_handle = _sprd_bo_handle(bo_sprd, device); if (bo_handle.ptr == NULL) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot get handle: gem:%d, device:%d\n", - getpid(), __FUNCTION__, __LINE__, bo_sprd->gem, device); + TBM_SPRD_ERROR("error Cannot get handle: gem:%d, device:%d\n", + bo_sprd->gem, device); return (tbm_bo_handle) NULL; } @@ -1389,21 +1321,18 @@ tbm_sprd_bo_map(tbm_bo bo, int device, int opt) SPRD_RETURN_VAL_IF_FAIL(bo_sprd != NULL, (tbm_bo_handle) NULL); if (!bo_sprd->gem) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot map gem=%d\n", - getpid(), __FUNCTION__, __LINE__, bo_sprd->gem); + TBM_SPRD_ERROR("error Cannot map gem=%d\n", bo_sprd->gem); return (tbm_bo_handle) NULL; } - DBG("[libtbm-sprd:%d] %s gem:%d(%d), %s, %s\n", getpid(), - __FUNCTION__, bo_sprd->gem, bo_sprd->name, STR_DEVICE[device], STR_OPT[opt]); + TBM_SPRD_DEBUG("%s gem:%d(%d), %s, %s\n", + __FUNCTION__, bo_sprd->gem, bo_sprd->name, STR_DEVICE[device], STR_OPT[opt]); /*Get mapped bo_handle*/ bo_handle = _sprd_bo_handle(bo_sprd, device); if (bo_handle.ptr == NULL) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Cannot get handle: gem:%d, device:%d, opt:%d\n", - getpid(), __FUNCTION__, __LINE__, bo_sprd->gem, device, opt); + TBM_SPRD_ERROR("error Cannot get handle: gem:%d, device:%d, opt:%d\n", + bo_sprd->gem, device, opt); return (tbm_bo_handle) NULL; } @@ -1437,8 +1366,7 @@ tbm_sprd_bo_unmap(tbm_bo bo) if (bo_sprd->map_cnt == 0) _bo_save_cache_state(bufmgr_sprd, bo_sprd); - DBG("[libtbm-sprd:%d] %s gem:%d(%d) \n", getpid(), - __FUNCTION__, bo_sprd->gem, bo_sprd->name); + TBM_SPRD_DEBUG("gem:%d(%d) \n", bo_sprd->gem, bo_sprd->name); return 1; } @@ -1472,8 +1400,7 @@ tbm_sprd_bo_lock(tbm_bo bo, int device, int opt) else if (device == TBM_DEVICE_3D) fence.type = DMA_BUF_ACCESS_WRITE | DMA_BUF_ACCESS_DMA; else { - DBG("[libtbm-sprd:%d] %s GET_FENCE is ignored(device type is not 3D/CPU),\n", - getpid(), __FUNCTION__); + TBM_SPRD_DEBUG("GET_FENCE is ignored(device type is not 3D/CPU),\n"); return 0; } } else if (opt & TBM_OPTION_READ) { @@ -1482,21 +1409,17 @@ tbm_sprd_bo_lock(tbm_bo bo, int device, int opt) else if (device == TBM_DEVICE_3D) fence.type = DMA_BUF_ACCESS_READ | DMA_BUF_ACCESS_DMA; else { - DBG("[libtbm-sprd:%d] %s GET_FENCE is ignored(device type is not 3D/CPU),\n", - getpid(), __FUNCTION__); + TBM_SPRD_DEBUG("GET_FENCE is ignored(device type is not 3D/CPU),\n"); return 0; } } else { - TBM_SPRD_LOG("[libtbm-sprd:%d] error %s:%d Invalid argument\n", getpid(), - __FUNCTION__, __LINE__); + TBM_SPRD_ERROR("error Invalid argument\n"); return 0; } ret = ioctl(bo_sprd->dmabuf, DMABUF_IOCTL_GET_FENCE, &fence); if (ret < 0) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Can not set GET FENCE(%s)\n", - getpid(), __FUNCTION__, __LINE__, strerror(errno)); + TBM_SPRD_ERROR("error Can not set GET FENCE(%s)\n", strerror(errno)); return 0; } @@ -1511,20 +1434,16 @@ tbm_sprd_bo_lock(tbm_bo bo, int device, int opt) } if (i == DMA_FENCE_LIST_MAX) { //TODO: if dma_fence list is full, it needs realloc. I will fix this. by minseok3.kim - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d fence list is full\n", - getpid(), __FUNCTION__, __LINE__); + TBM_SPRD_ERROR("error fence list is full\n"); } pthread_mutex_unlock(&bo_sprd->mutex); - DBG("[libtbm-sprd:%d] %s DMABUF_IOCTL_GET_FENCE! flink_id=%d dmabuf=%d\n", - getpid(), - __FUNCTION__, bo_sprd->name, bo_sprd->dmabuf); + TBM_SPRD_DEBUG("DMABUF_IOCTL_GET_FENCE! flink_id=%d dmabuf=%d\n", + bo_sprd->name, bo_sprd->dmabuf); } else { ret = _tgl_lock(bufmgr_sprd->tgl_fd, bo_sprd->name, opt); - DBG("[libtbm-sprd:%d] lock tgl flink_id:%d\n", - getpid(), __FUNCTION__, bo_sprd->name); + TBM_SPRD_DEBUG("lock tgl flink_id:%d\n", bo_sprd->name); return ret; } @@ -1554,14 +1473,12 @@ tbm_sprd_bo_unlock(tbm_bo bo) struct dma_buf_fence fence; if (!bo_sprd->dma_fence[0].ctx) { - DBG("[libtbm-sprd:%d] %s FENCE not support or ignored,\n", getpid(), - __FUNCTION__); + TBM_SPRD_DEBUG("FENCE not support or ignored,\n"; return 0; } if (!bo_sprd->dma_fence[0].type) { - DBG("[libtbm-sprd:%d] %s device type is not 3D/CPU,\n", getpid(), - __FUNCTION__); + TBM_SPRD_DEBUG("device type is not 3D/CPU,\n"); return 0; } @@ -1579,20 +1496,16 @@ tbm_sprd_bo_unlock(tbm_bo bo) ret = ioctl(bo_sprd->dmabuf, DMABUF_IOCTL_PUT_FENCE, &fence); if (ret < 0) { - TBM_SPRD_LOG("[libtbm-sprd:%d] " - "error %s:%d Can not set PUT FENCE(%s)\n", - getpid(), __FUNCTION__, __LINE__, strerror(errno)); + TBM_SPRD_ERROR("error Can not set PUT FENCE(%s)\n", strerror(errno)); return 0; } - DBG("[libtbm-sprd:%d] %s DMABUF_IOCTL_PUT_FENCE! flink_id=%d dmabuf=%d\n", - getpid(), - __FUNCTION__, bo_sprd->name, bo_sprd->dmabuf); + TBM_SPRD_DEBUG("DMABUF_IOCTL_PUT_FENCE! flink_id=%d dmabuf=%d\n", + bo_sprd->name, bo_sprd->dmabuf); } else { ret = _tgl_unlock(bufmgr_sprd->tgl_fd, bo_sprd->name); - DBG("[libtbm-sprd:%d] unlock tgl flink_id:%d\n", - getpid(), __FUNCTION__, bo_sprd->name); + TBM_SPRD_DEBUG("unlock tgl flink_id:%d\n", bo_sprd->name); return ret; } @@ -1935,7 +1848,7 @@ tbm_sprd_bufmgr_bind_native_display(tbm_bufmgr bufmgr, void *NativeDisplay) if (!tbm_drm_helper_wl_auth_server_init(NativeDisplay, bufmgr_sprd->fd, bufmgr_sprd->device_name, 0)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error:Fail to tbm_drm_helper_wl_server_init\n"); + TBM_SPRD_ERROR("fail to tbm_drm_helper_wl_server_init\n"); return 0; } @@ -1966,7 +1879,7 @@ init_tbm_bufmgr_priv(tbm_bufmgr bufmgr, int fd) bufmgr_sprd = calloc(1, sizeof(struct _tbm_bufmgr_sprd)); if (!bufmgr_sprd) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error: Fail to alloc bufmgr_sprd!\n", getpid()); + TBM_SPRD_ERROR("fail to alloc bufmgr_sprd!\n"); return 0; } @@ -1975,7 +1888,7 @@ init_tbm_bufmgr_priv(tbm_bufmgr bufmgr, int fd) if (bufmgr_sprd->fd < 0) { bufmgr_sprd->fd = _tbm_sprd_open_drm(); if (bufmgr_sprd->fd < 0) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error: Fail to open drm!\n", getpid()); + TBM_SPRD_ERROR("fail to open drm!\n"); goto fail_open_drm; } } @@ -1984,13 +1897,13 @@ init_tbm_bufmgr_priv(tbm_bufmgr bufmgr, int fd) bufmgr_sprd->device_name = drmGetDeviceNameFromFd(bufmgr_sprd->fd); if (!bufmgr_sprd->device_name) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error: Fail to get device name!\n", getpid()); + TBM_SPRD_ERROR("fail to get device name!\n"); tbm_drm_helper_unset_tbm_master_fd(); goto fail_get_device_name; } } else { if (!tbm_drm_helper_get_auth_info(&(bufmgr_sprd->fd), &(bufmgr_sprd->device_name), NULL)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error: Fail to get auth drm info!\n", getpid()); + TBM_SPRD_ERROR("fail to get auth drm info!\n"); goto fail_get_auth_info; } } @@ -2011,13 +1924,13 @@ init_tbm_bufmgr_priv(tbm_bufmgr bufmgr, int fd) } if (!_bufmgr_init_cache_state(bufmgr_sprd)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error: Fail to init bufmgr cache state\n", getpid()); + TBM_SPRD_ERROR("fail to init bufmgr cache state\n"); goto fail_init_cache_state; } bufmgr_backend = tbm_backend_alloc(); if (!bufmgr_backend) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error: Fail to alloc backend!\n", getpid()); + TBM_SPRD_ERROR("fail to alloc backend!\n"); goto fail_alloc_backend; } @@ -2041,7 +1954,7 @@ init_tbm_bufmgr_priv(tbm_bufmgr bufmgr, int fd) bufmgr_backend->bufmgr_bind_native_display = tbm_sprd_bufmgr_bind_native_display; if (!tbm_backend_init(bufmgr, bufmgr_backend)) { - TBM_SPRD_LOG("[libtbm-sprd:%d] error: Fail to init backend!\n", getpid()); + TBM_SPRD_ERROR("fail to init backend!\n"); goto fail_init_backend; } @@ -2052,16 +1965,15 @@ init_tbm_bufmgr_priv(tbm_bufmgr bufmgr, int fd) env = getenv("TBM_SPRD_DEBUG"); if (env) { bDebug = atoi(env); - TBM_SPRD_LOG("TBM_SPRD_DEBUG=%s\n", env); + TBM_SPRD_ERROR("TBM_SPRD_DEBUG=%s\n", env); } else bDebug = 0; } #endif - DBG("[libtbm-sprd:%d] %s DMABUF FENCE is %s\n", getpid(), - __FUNCTION__, bufmgr_sprd->use_dma_fence ? "supported!" : "NOT supported!"); - DBG("[libtbm-sprd:%d] %s fd:%d\n", getpid(), - __FUNCTION__, bufmgr_sprd->fd); + TBM_SPRD_DEBUG("DMABUF FENCE is %s\n", + bufmgr_sprd->use_dma_fence ? "supported!" : "NOT supported!"); + TBM_SPRD_DEBUG("fd:%d\n", bufmgr_sprd->fd); return 1; -- 2.7.4 From 80bc4f5b0a66a532e58f4240379d97f4efb64948 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 24 Nov 2016 15:07:13 +0900 Subject: [PATCH 02/16] use slp_global_lock temporarily we remove slp_global_lock after kernel enables tgl Change-Id: I356c344863a7d700929cb53151db7c6fda1b75cc --- rules/99-libtbm_sprd.rules | 1 + src/tbm_bufmgr_sprd.c | 9 +++++++-- src/tbm_bufmgr_tgl.h | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/rules/99-libtbm_sprd.rules b/rules/99-libtbm_sprd.rules index 13cef12..a826c4c 100644 --- a/rules/99-libtbm_sprd.rules +++ b/rules/99-libtbm_sprd.rules @@ -1 +1,2 @@ KERNEL=="tgl", MODE="0666", GROUP="display", SECLABEL{smack}="*" +KERNEL=="slp_global_lock*", MODE="0666", GROUP="display", SECLABEL{smack}="*" diff --git a/src/tbm_bufmgr_sprd.c b/src/tbm_bufmgr_sprd.c index 6866db9..2ac2b4a 100644 --- a/src/tbm_bufmgr_sprd.c +++ b/src/tbm_bufmgr_sprd.c @@ -675,9 +675,14 @@ _bufmgr_init_cache_state(tbm_bufmgr_sprd bufmgr_sprd) /* open tgl fd for saving cache flush data */ bufmgr_sprd->tgl_fd = open(tgl_devfile, O_RDWR); + if (bufmgr_sprd->tgl_fd < 0) { - TBM_SPRD_ERROR("fail to open global_lock:%s\n", tgl_devfile); - return 0; + bufmgr_sprd->tgl_fd = open(tgl_devfile1, O_RDWR); + if (bufmgr_sprd->tgl_fd < 0) { + TBM_SPRD_ERROR("fail to open global_lock:%s\n", + tgl_devfile1); + return 0; + } } if (!_tgl_get_version(bufmgr_sprd->tgl_fd)) { diff --git a/src/tbm_bufmgr_tgl.h b/src/tbm_bufmgr_tgl.h index 1790885..cae2c04 100644 --- a/src/tbm_bufmgr_tgl.h +++ b/src/tbm_bufmgr_tgl.h @@ -34,7 +34,8 @@ #include -static char tgl_devfile[] = "/dev/tgl"; +static char tgl_devfile[] = "/dev/slp_global_lock"; +static char tgl_devfile1[] = "/dev/tgl"; #define TGL_IOCTL_BASE 0x32 #define TGL_IO(nr) _IO(TGL_IOCTL_BASE, nr) -- 2.7.4 From 2c7cc5dd1ca03c6d8c454d22dbe40951edfd02d3 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 24 Nov 2016 15:19:54 +0900 Subject: [PATCH 03/16] package version up to 1.0.5 Change-Id: Iad2dec014becabfddb4363cae70f97ad25a12cdc --- packaging/libtbm-sprd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtbm-sprd.spec b/packaging/libtbm-sprd.spec index 48a43b8..4ec247e 100644 --- a/packaging/libtbm-sprd.spec +++ b/packaging/libtbm-sprd.spec @@ -1,5 +1,5 @@ Name: libtbm-sprd -Version: 1.0.4 +Version: 1.0.5 Release: 0 License: MIT Summary: Tizen Buffer Manager - sprd backend -- 2.7.4 From b45034e7df37724bf0f6cc8417cf42593dca8fe1 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 25 Nov 2016 12:46:50 +0900 Subject: [PATCH 04/16] remove the unused code We do not use tgl and do not use the user lock of the dmafence at tm1 - remove lock/unlock - block the tgl codes Change-Id: If71fd61f4def380959079e8feb8f3aa163ed99ee --- src/tbm_bufmgr_sprd.c | 168 +++++--------------------------------------------- 1 file changed, 15 insertions(+), 153 deletions(-) diff --git a/src/tbm_bufmgr_sprd.c b/src/tbm_bufmgr_sprd.c index 2ac2b4a..9d1f486 100644 --- a/src/tbm_bufmgr_sprd.c +++ b/src/tbm_bufmgr_sprd.c @@ -56,12 +56,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #define DEBUG -#include "tbm_bufmgr_tgl.h" - //#define USE_CONTIG_ONLY //#define USE_CACHE #define USE_DMAIMPORT +#ifdef USE_CACHE +#include "tbm_bufmgr_tgl.h" +#endif + #define TBM_COLOR_FORMAT_COUNT 4 #ifdef DEBUG @@ -254,6 +256,7 @@ uint32_t tbm_sprd_color_format_list[TBM_COLOR_FORMAT_COUNT] = { TBM_FORMAT_YUV420 }; +#ifdef USE_CACHE static inline int _tgl_get_version(int fd) { @@ -271,7 +274,6 @@ _tgl_get_version(int fd) return 1; } - static inline int _tgl_init(int fd, unsigned int key) { @@ -357,7 +359,6 @@ _tgl_unlock(int fd, unsigned int key) return 1; } -#ifdef USE_CACHE static inline int _tgl_set_data(int fd, unsigned int key, unsigned int val) { @@ -476,8 +477,7 @@ _tbm_sprd_open_drm(void) return -1; } #else - TBM_SPRD_ERROR("warning fail to open drm\n", - ); + TBM_SPRD_ERROR("warning fail to open drm\n"); #endif return fd; @@ -534,6 +534,7 @@ _sprd_bo_cache_flush(tbm_bufmgr_sprd bufmgr_sprd, tbm_bo_sprd bo_sprd, int flags return 0; } #endif + return 1; } #endif @@ -541,6 +542,7 @@ _sprd_bo_cache_flush(tbm_bufmgr_sprd bufmgr_sprd, tbm_bo_sprd bo_sprd, int flags static int _bo_init_cache_state(tbm_bufmgr_sprd bufmgr_sprd, tbm_bo_sprd bo_sprd, int import) { +#ifdef USE_CACHE SPRD_RETURN_VAL_IF_FAIL(bo_sprd != NULL, 0); SPRD_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0); @@ -549,7 +551,6 @@ _bo_init_cache_state(tbm_bufmgr_sprd bufmgr_sprd, tbm_bo_sprd bo_sprd, int impor _tgl_init(bufmgr_sprd->tgl_fd, bo_sprd->name); -#ifdef USE_CACHE tbm_bo_cache_state cache_state; if (import == 0) { @@ -656,6 +657,7 @@ _bo_save_cache_state(tbm_bufmgr_sprd bufmgr_sprd, tbm_bo_sprd bo_sprd) static void _bo_destroy_cache_state(tbm_bufmgr_sprd bufmgr_sprd, tbm_bo_sprd bo_sprd) { +#ifdef USE_CACHE SPRD_RETURN_IF_FAIL(bo_sprd != NULL); SPRD_RETURN_IF_FAIL(bufmgr_sprd != NULL); @@ -663,11 +665,13 @@ _bo_destroy_cache_state(tbm_bufmgr_sprd bufmgr_sprd, tbm_bo_sprd bo_sprd) return; _tgl_destroy(bufmgr_sprd->tgl_fd, bo_sprd->name); +#endif } static int _bufmgr_init_cache_state(tbm_bufmgr_sprd bufmgr_sprd) { +#ifdef USE_CACHE SPRD_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0); if (bufmgr_sprd->use_dma_fence) @@ -691,7 +695,6 @@ _bufmgr_init_cache_state(tbm_bufmgr_sprd bufmgr_sprd) return 0; } -#ifdef USE_CACHE if (!_tgl_init(bufmgr_sprd->tgl_fd, GLOBAL_KEY)) { TBM_SPRD_ERROR("fail to initialize the tgl\n"); close(bufmgr_sprd->tgl_fd); @@ -705,6 +708,7 @@ _bufmgr_init_cache_state(tbm_bufmgr_sprd bufmgr_sprd) static void _bufmgr_deinit_cache_state(tbm_bufmgr_sprd bufmgr_sprd) { +#ifdef USE_CACHE SPRD_RETURN_IF_FAIL(bufmgr_sprd != NULL); if (bufmgr_sprd->use_dma_fence) @@ -712,6 +716,7 @@ _bufmgr_deinit_cache_state(tbm_bufmgr_sprd bufmgr_sprd) if (bufmgr_sprd->tgl_fd >= 0) close(bufmgr_sprd->tgl_fd); +#endif } #ifndef USE_CONTIG_ONLY @@ -1376,149 +1381,6 @@ tbm_sprd_bo_unmap(tbm_bo bo) return 1; } -static int -tbm_sprd_bo_lock(tbm_bo bo, int device, int opt) -{ - SPRD_RETURN_VAL_IF_FAIL(bo != NULL, 0); - - tbm_bufmgr_sprd bufmgr_sprd; - tbm_bo_sprd bo_sprd; - - bo_sprd = (tbm_bo_sprd)tbm_backend_get_bo_priv(bo); - SPRD_RETURN_VAL_IF_FAIL(bo_sprd != NULL, 0); - - bufmgr_sprd = (tbm_bufmgr_sprd)tbm_backend_get_bufmgr_priv(bo); - SPRD_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0); - -#if USE_BACKEND_LOCK - int ret = 0; - - if (bufmgr_sprd->use_dma_fence) { - struct dma_buf_fence fence; - - memset(&fence, 0, sizeof(struct dma_buf_fence)); - - /* Check if the given type is valid or not. */ - if (opt & TBM_OPTION_WRITE) { - if (device == TBM_DEVICE_CPU) - fence.type = DMA_BUF_ACCESS_WRITE; - else if (device == TBM_DEVICE_3D) - fence.type = DMA_BUF_ACCESS_WRITE | DMA_BUF_ACCESS_DMA; - else { - TBM_SPRD_DEBUG("GET_FENCE is ignored(device type is not 3D/CPU),\n"); - return 0; - } - } else if (opt & TBM_OPTION_READ) { - if (device == TBM_DEVICE_CPU) - fence.type = DMA_BUF_ACCESS_READ; - else if (device == TBM_DEVICE_3D) - fence.type = DMA_BUF_ACCESS_READ | DMA_BUF_ACCESS_DMA; - else { - TBM_SPRD_DEBUG("GET_FENCE is ignored(device type is not 3D/CPU),\n"); - return 0; - } - } else { - TBM_SPRD_ERROR("error Invalid argument\n"); - return 0; - } - - ret = ioctl(bo_sprd->dmabuf, DMABUF_IOCTL_GET_FENCE, &fence); - if (ret < 0) { - TBM_SPRD_ERROR("error Can not set GET FENCE(%s)\n", strerror(errno)); - return 0; - } - - pthread_mutex_lock(&bo_sprd->mutex); - int i; - for (i = 0; i < DMA_FENCE_LIST_MAX; i++) { - if (bo_sprd->dma_fence[i].ctx == 0) { - bo_sprd->dma_fence[i].type = fence.type; - bo_sprd->dma_fence[i].ctx = fence.ctx; - break; - } - } - if (i == DMA_FENCE_LIST_MAX) { - //TODO: if dma_fence list is full, it needs realloc. I will fix this. by minseok3.kim - TBM_SPRD_ERROR("error fence list is full\n"); - } - pthread_mutex_unlock(&bo_sprd->mutex); - - TBM_SPRD_DEBUG("DMABUF_IOCTL_GET_FENCE! flink_id=%d dmabuf=%d\n", - bo_sprd->name, bo_sprd->dmabuf); - } else { - ret = _tgl_lock(bufmgr_sprd->tgl_fd, bo_sprd->name, opt); - - TBM_SPRD_DEBUG("lock tgl flink_id:%d\n", bo_sprd->name); - - return ret; - } -#endif - - return 1; -} - -static int -tbm_sprd_bo_unlock(tbm_bo bo) -{ - SPRD_RETURN_VAL_IF_FAIL(bo != NULL, 0); - - tbm_bufmgr_sprd bufmgr_sprd; - tbm_bo_sprd bo_sprd; - - bo_sprd = (tbm_bo_sprd)tbm_backend_get_bo_priv(bo); - SPRD_RETURN_VAL_IF_FAIL(bo_sprd != NULL, 0); - - bufmgr_sprd = (tbm_bufmgr_sprd)tbm_backend_get_bufmgr_priv(bo); - SPRD_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0); - -#if USE_BACKEND_LOCK - int ret = 0; - - if (bufmgr_sprd->use_dma_fence) { - struct dma_buf_fence fence; - - if (!bo_sprd->dma_fence[0].ctx) { - TBM_SPRD_DEBUG("FENCE not support or ignored,\n"; - return 0; - } - - if (!bo_sprd->dma_fence[0].type) { - TBM_SPRD_DEBUG("device type is not 3D/CPU,\n"); - return 0; - } - - pthread_mutex_lock(&bo_sprd->mutex); - fence.type = bo_sprd->dma_fence[0].type; - fence.ctx = bo_sprd->dma_fence[0].ctx; - int i; - for (i = 1; i < DMA_FENCE_LIST_MAX; i++) { - bo_sprd->dma_fence[i - 1].type = bo_sprd->dma_fence[i].type; - bo_sprd->dma_fence[i - 1].ctx = bo_sprd->dma_fence[i].ctx; - } - bo_sprd->dma_fence[DMA_FENCE_LIST_MAX - 1].type = 0; - bo_sprd->dma_fence[DMA_FENCE_LIST_MAX - 1].ctx = 0; - pthread_mutex_unlock(&bo_sprd->mutex); - - ret = ioctl(bo_sprd->dmabuf, DMABUF_IOCTL_PUT_FENCE, &fence); - if (ret < 0) { - TBM_SPRD_ERROR("error Can not set PUT FENCE(%s)\n", strerror(errno)); - return 0; - } - - TBM_SPRD_DEBUG("DMABUF_IOCTL_PUT_FENCE! flink_id=%d dmabuf=%d\n", - bo_sprd->name, bo_sprd->dmabuf); - } else { - ret = _tgl_unlock(bufmgr_sprd->tgl_fd, bo_sprd->name); - - TBM_SPRD_DEBUG("unlock tgl flink_id:%d\n", bo_sprd->name); - - return ret; - } -#endif - - return 1; -} - static void tbm_sprd_bufmgr_deinit(void *priv) { @@ -1954,8 +1816,8 @@ init_tbm_bufmgr_priv(tbm_bufmgr bufmgr, int fd) bufmgr_backend->surface_get_plane_data = tbm_sprd_surface_get_plane_data; bufmgr_backend->surface_supported_format = tbm_sprd_surface_supported_format; bufmgr_backend->bo_get_flags = tbm_sprd_bo_get_flags; - bufmgr_backend->bo_lock = tbm_sprd_bo_lock; - bufmgr_backend->bo_unlock = tbm_sprd_bo_unlock; + bufmgr_backend->bo_lock = NULL; + bufmgr_backend->bo_unlock = NULL; bufmgr_backend->bufmgr_bind_native_display = tbm_sprd_bufmgr_bind_native_display; if (!tbm_backend_init(bufmgr, bufmgr_backend)) { -- 2.7.4 From bf1db2eb2a7cf48fbb9bbfd4fe98792ae857ffe7 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 25 Nov 2016 14:23:05 +0900 Subject: [PATCH 05/16] package version up to 1.0.6 Change-Id: I0e1d973401b7b861a08209b6ee5c2abdba1e520b --- packaging/libtbm-sprd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtbm-sprd.spec b/packaging/libtbm-sprd.spec index 4ec247e..ec91902 100644 --- a/packaging/libtbm-sprd.spec +++ b/packaging/libtbm-sprd.spec @@ -1,5 +1,5 @@ Name: libtbm-sprd -Version: 1.0.5 +Version: 1.0.6 Release: 0 License: MIT Summary: Tizen Buffer Manager - sprd backend -- 2.7.4 From 232d3a6e1ceab142f41e422f74cab4804ca381a1 Mon Sep 17 00:00:00 2001 From: YoungJun Cho Date: Thu, 1 Dec 2016 11:55:13 +0900 Subject: [PATCH 06/16] tbm_bufmgr_sprd: fix wrong ioctl() parameter This patch fixes wrong ioctl() parameter. Change-Id: Ic8cea15bd8c2a16b6aadbc362a6cd185f5bad83f Signed-off-by: YoungJun Cho --- src/tbm_bufmgr_sprd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tbm_bufmgr_sprd.c b/src/tbm_bufmgr_sprd.c index 9d1f486..5e12c8f 100644 --- a/src/tbm_bufmgr_sprd.c +++ b/src/tbm_bufmgr_sprd.c @@ -330,7 +330,7 @@ _tgl_lock(int fd, unsigned int key, int opt) data.key = key; data.type = tgl_type; - err = ioctl(fd, TGL_IOCTL_LOCK, data); + err = ioctl(fd, TGL_IOCTL_LOCK, &data); if (err) { TBM_SPRD_ERROR("error(%s) key:%d opt:%d\n", strerror(errno), key, opt); @@ -349,7 +349,7 @@ _tgl_unlock(int fd, unsigned int key) data.key = key; data.type = TGL_TYPE_NONE; - err = ioctl(fd, TGL_IOCTL_UNLOCK, data); + err = ioctl(fd, TGL_IOCTL_UNLOCK, &data); if (err) { TBM_SPRD_ERROR("error(%s) key:%d\n", strerror(errno), key); -- 2.7.4 From 6f47a08953c3eb4a01fbb5c6a5c796d552bb9842 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 5 Dec 2016 16:22:12 +0900 Subject: [PATCH 07/16] package version up to 1.0.7 Change-Id: Ieb539c12177937b64283fca567bcbc36b58d0a01 --- packaging/libtbm-sprd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtbm-sprd.spec b/packaging/libtbm-sprd.spec index ec91902..b1d189d 100644 --- a/packaging/libtbm-sprd.spec +++ b/packaging/libtbm-sprd.spec @@ -1,5 +1,5 @@ Name: libtbm-sprd -Version: 1.0.6 +Version: 1.0.7 Release: 0 License: MIT Summary: Tizen Buffer Manager - sprd backend -- 2.7.4 From ebb5989fb6251ecc8043e0438034d87b414761ff Mon Sep 17 00:00:00 2001 From: Roman Marchenko Date: Wed, 28 Dec 2016 11:11:49 +0200 Subject: [PATCH 08/16] fix memory leak in init_tbm_bufmgr_priv() - bufmgr_sprd->device_name is come from strdup(). so it should be free if init failed. Change-Id: I862d057ce6bd503685a6ff1576baa1e9423ca7d3 Signed-off-by: Roman Marchenko --- src/tbm_bufmgr_sprd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tbm_bufmgr_sprd.c b/src/tbm_bufmgr_sprd.c index 5e12c8f..558aaf7 100644 --- a/src/tbm_bufmgr_sprd.c +++ b/src/tbm_bufmgr_sprd.c @@ -1853,6 +1853,8 @@ fail_init_cache_state: drmHashDestroy(bufmgr_sprd->hashBos); if (tbm_backend_is_display_server()) tbm_drm_helper_unset_tbm_master_fd(); + if (bufmgr_sprd->device_name) + free(bufmgr_sprd->device_name); fail_get_device_name: close(bufmgr_sprd->fd); fail_get_auth_info: -- 2.7.4 From 675109d2e310053e8cdb4cedf50e7e955d5d0a74 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Thu, 5 Jan 2017 12:55:46 +0900 Subject: [PATCH 09/16] package version up to 1.0.8 Change-Id: I36f7f3d3d3296cb126ed14f3fb6fc5fdde6198e7 --- packaging/libtbm-sprd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtbm-sprd.spec b/packaging/libtbm-sprd.spec index b1d189d..b87ccec 100644 --- a/packaging/libtbm-sprd.spec +++ b/packaging/libtbm-sprd.spec @@ -1,5 +1,5 @@ Name: libtbm-sprd -Version: 1.0.7 +Version: 1.0.8 Release: 0 License: MIT Summary: Tizen Buffer Manager - sprd backend -- 2.7.4 From 9890f2b47ec063a144fa91025ed7e70fdd9886db Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Thu, 12 Jan 2017 19:19:19 +0900 Subject: [PATCH 10/16] added tbm_drm_helper_set/unset_fd Change-Id: Ic09676af10fb55dc6a615fa357fe158e3a3bb4fc --- src/tbm_bufmgr_sprd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tbm_bufmgr_sprd.c b/src/tbm_bufmgr_sprd.c index 558aaf7..35535e3 100644 --- a/src/tbm_bufmgr_sprd.c +++ b/src/tbm_bufmgr_sprd.c @@ -1408,6 +1408,8 @@ tbm_sprd_bufmgr_deinit(void *priv) if (tbm_backend_is_display_server()) tbm_drm_helper_unset_tbm_master_fd(); + else + tbm_drm_helper_unset_fd(); if (bufmgr_sprd->device_name) free(bufmgr_sprd->device_name); @@ -1773,6 +1775,8 @@ init_tbm_bufmgr_priv(tbm_bufmgr bufmgr, int fd) TBM_SPRD_ERROR("fail to get auth drm info!\n"); goto fail_get_auth_info; } + + tbm_drm_helper_set_fd(bufmgr_sprd->fd); } //Create Hash Table @@ -1853,6 +1857,8 @@ fail_init_cache_state: drmHashDestroy(bufmgr_sprd->hashBos); if (tbm_backend_is_display_server()) tbm_drm_helper_unset_tbm_master_fd(); + else + tbm_drm_helper_unset_fd(); if (bufmgr_sprd->device_name) free(bufmgr_sprd->device_name); fail_get_device_name: -- 2.7.4 From 47b7175b6d7bab7aefaceda5c6e0f7ebbaeaf0f2 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 21 Feb 2017 17:28:34 +0900 Subject: [PATCH 11/16] Do not use tizen-target-name In unified build environment (Tizen:Unified), you should not use any macro that depends on repository/profile. Without this commit, this package won't be able to be built in Tizen:Unified. Change-Id: I71bbd0a83abab6cd38be582febe711a624dd2c98 --- packaging/libtbm-sprd.spec | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packaging/libtbm-sprd.spec b/packaging/libtbm-sprd.spec index b87ccec..9edd165 100644 --- a/packaging/libtbm-sprd.spec +++ b/packaging/libtbm-sprd.spec @@ -4,17 +4,14 @@ Release: 0 License: MIT Summary: Tizen Buffer Manager - sprd backend Group: System/Libraries -ExcludeArch: i586 x86_64 -%if ("%{?tizen_target_name}" != "TM1") -ExclusiveArch: -%endif +ExcludeArch: i586 x86_64 aarch64 Source0: %{name}-%{version}.tar.gz BuildRequires: pkgconfig(libdrm) BuildRequires: pkgconfig(libtbm) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(libudev) -BuildRequires: kernel-headers-tizen-dev +BuildRequires: kernel-headers-3.10-sc7730 BuildConflicts: linux-glibc-devel %description -- 2.7.4 From 60d0228a98d1929dd9454269ca4228b508363429 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 21 Feb 2017 19:04:20 +0900 Subject: [PATCH 12/16] Revert "Do not use tizen-target-name" This reverts commit 47b7175b6d7bab7aefaceda5c6e0f7ebbaeaf0f2. Change-Id: Ib517bc120f54d94df322aeff238ab6333cd9daee --- packaging/libtbm-sprd.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packaging/libtbm-sprd.spec b/packaging/libtbm-sprd.spec index 9edd165..b87ccec 100644 --- a/packaging/libtbm-sprd.spec +++ b/packaging/libtbm-sprd.spec @@ -4,14 +4,17 @@ Release: 0 License: MIT Summary: Tizen Buffer Manager - sprd backend Group: System/Libraries -ExcludeArch: i586 x86_64 aarch64 +ExcludeArch: i586 x86_64 +%if ("%{?tizen_target_name}" != "TM1") +ExclusiveArch: +%endif Source0: %{name}-%{version}.tar.gz BuildRequires: pkgconfig(libdrm) BuildRequires: pkgconfig(libtbm) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(libudev) -BuildRequires: kernel-headers-3.10-sc7730 +BuildRequires: kernel-headers-tizen-dev BuildConflicts: linux-glibc-devel %description -- 2.7.4 From 01366058d1741b08b406767615d596f98be75b81 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 22 Feb 2017 11:06:54 +0900 Subject: [PATCH 13/16] Revert "Revert "Do not use tizen-target-name"" This reverts commit 60d0228a98d1929dd9454269ca4228b508363429. --- packaging/libtbm-sprd.spec | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packaging/libtbm-sprd.spec b/packaging/libtbm-sprd.spec index b87ccec..9edd165 100644 --- a/packaging/libtbm-sprd.spec +++ b/packaging/libtbm-sprd.spec @@ -4,17 +4,14 @@ Release: 0 License: MIT Summary: Tizen Buffer Manager - sprd backend Group: System/Libraries -ExcludeArch: i586 x86_64 -%if ("%{?tizen_target_name}" != "TM1") -ExclusiveArch: -%endif +ExcludeArch: i586 x86_64 aarch64 Source0: %{name}-%{version}.tar.gz BuildRequires: pkgconfig(libdrm) BuildRequires: pkgconfig(libtbm) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(libudev) -BuildRequires: kernel-headers-tizen-dev +BuildRequires: kernel-headers-3.10-sc7730 BuildConflicts: linux-glibc-devel %description -- 2.7.4 From 2d2c75ee21871a53cd29585d79a9f0a6b260af43 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 22 Feb 2017 14:38:33 +0900 Subject: [PATCH 14/16] fix the excludeArch for i586 Change-Id: I500538bfef920d9a07eb4f6ee820b11fb2801ed8 --- packaging/libtbm-sprd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtbm-sprd.spec b/packaging/libtbm-sprd.spec index 9edd165..4f7260d 100644 --- a/packaging/libtbm-sprd.spec +++ b/packaging/libtbm-sprd.spec @@ -4,7 +4,7 @@ Release: 0 License: MIT Summary: Tizen Buffer Manager - sprd backend Group: System/Libraries -ExcludeArch: i586 x86_64 aarch64 +ExcludeArch: %{ix86} x86_64 aarch64 Source0: %{name}-%{version}.tar.gz BuildRequires: pkgconfig(libdrm) -- 2.7.4 From 7998c518fa348b8888c7166654407bca28da09f9 Mon Sep 17 00:00:00 2001 From: "Mun, Gwan-gyeong" Date: Tue, 21 Mar 2017 11:33:04 +0900 Subject: [PATCH 15/16] Apply tbm_drm_helper_set / unset_fd both of server(master) and client. Some GLES/EGL Driver ,like as MESA, can call tbm_drm_helper_get_fd() both of server(master) and client. so, tbm backend should call tbm_drm_helper_set / unset over both of server(master) and client case. Change-Id: I4597f904bec3d4e6e20868a6ebf402d808ab7a9a Signed-off-by: Mun, Gwan-gyeong --- src/tbm_bufmgr_sprd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/tbm_bufmgr_sprd.c b/src/tbm_bufmgr_sprd.c index 35535e3..ab15e62 100644 --- a/src/tbm_bufmgr_sprd.c +++ b/src/tbm_bufmgr_sprd.c @@ -1408,8 +1408,8 @@ tbm_sprd_bufmgr_deinit(void *priv) if (tbm_backend_is_display_server()) tbm_drm_helper_unset_tbm_master_fd(); - else - tbm_drm_helper_unset_fd(); + + tbm_drm_helper_unset_fd(); if (bufmgr_sprd->device_name) free(bufmgr_sprd->device_name); @@ -1776,8 +1776,8 @@ init_tbm_bufmgr_priv(tbm_bufmgr bufmgr, int fd) goto fail_get_auth_info; } - tbm_drm_helper_set_fd(bufmgr_sprd->fd); } + tbm_drm_helper_set_fd(bufmgr_sprd->fd); //Create Hash Table bufmgr_sprd->hashBos = drmHashCreate(); @@ -1857,8 +1857,7 @@ fail_init_cache_state: drmHashDestroy(bufmgr_sprd->hashBos); if (tbm_backend_is_display_server()) tbm_drm_helper_unset_tbm_master_fd(); - else - tbm_drm_helper_unset_fd(); + tbm_drm_helper_unset_fd(); if (bufmgr_sprd->device_name) free(bufmgr_sprd->device_name); fail_get_device_name: -- 2.7.4 From 84e44f68c20dc0a4c7608ebab4c2975bb56d10e1 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 22 Mar 2017 15:44:20 +0900 Subject: [PATCH 16/16] use %license macro to copy the COPYING file. Change-Id: I498e72741500017ae68382b931ca6a7397683311 --- packaging/libtbm-sprd.spec | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packaging/libtbm-sprd.spec b/packaging/libtbm-sprd.spec index 4f7260d..49b5d45 100644 --- a/packaging/libtbm-sprd.spec +++ b/packaging/libtbm-sprd.spec @@ -31,8 +31,6 @@ make %{?_smp_mflags} %install rm -rf %{buildroot} -mkdir -p %{buildroot}/%{TZ_SYS_RO_SHARE}/license -cp -af COPYING %{buildroot}/%{TZ_SYS_RO_SHARE}/license/%{name} mkdir -p %{buildroot}%{_libdir}/udev/rules.d/ cp -af rules/99-libtbm_sprd.rules %{buildroot}%{_libdir}/udev/rules.d/ %make_install @@ -48,7 +46,7 @@ ln -s libtbm_sprd.so %{_libdir}/bufmgr/libtbm_default.so %files %defattr(-,root,root,-) -%{TZ_SYS_RO_SHARE}/license/%{name} +%license COPYING %{_libdir}/bufmgr/libtbm_*.so* %{_libdir}/udev/rules.d/99-libtbm_sprd.rules -- 2.7.4