-SUBDIRS =
-
-if HOST_CPU_X86_64
-SUBDIRS += src
-else
-SUBDIRS += src drm_slp
-endif
+SUBDIRS = src
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libtbm.pc
AC_OUTPUT([
src/Makefile
src/wayland-drm/Makefile
- drm_slp/Makefile
Makefile
libtbm.pc])
+++ /dev/null
-SUBDIRS = .
-
-AM_CFLAGS = \
- $(WARN_CFLAGS) \
- -I$(top_srcdir) \
- -I$(top_srcdir)/src \
- -I$(top_srcdir)/drm_slp \
- $(PTHREADSTUBS_CFLAGS) \
- -I$(top_srcdir)/include/drm
-
-libdrm_slp_la_LTLIBRARIES = libdrm_slp.la
-libdrm_slp_ladir = $(libdir)
-libdrm_slp_la_LDFLAGS = -version-number 1:0:0 -no-undefined
-libdrm_slp_la_LIBADD = ../src/libtbm.la @PTHREADSTUBS_LIBS@ @CLOCK_LIB@ -ldl
-
-libdrm_slp_la_SOURCES = \
- drm_slp_bufmgr.c \
- drm_slp_bufmgr.h
-
+++ /dev/null
-/**************************************************************************
-
-xserver-xorg-video-sec
-
-Copyright 2011 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-
-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 "config.h"
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "drm_slp_bufmgr.h"
-#include "tbm_bufmgr.h"
-#include "tbm_bufmgr_int.h"
-
-drm_slp_bufmgr
-drm_slp_bufmgr_init(int fd, void *arg)
-{
- tbm_bufmgr bufmgr = NULL;
-
- bufmgr = tbm_bufmgr_init (fd);
- if (!bufmgr)
- {
- TBM_LOG ("[libdrm_slp:%d]: error bufmgr is null\n", getpid());
- return NULL;
- }
-
- return (drm_slp_bufmgr)bufmgr;
-}
-
-void
-drm_slp_bufmgr_destroy(drm_slp_bufmgr bufmgr)
-{
- tbm_bufmgr_deinit ((tbm_bufmgr)bufmgr);
-}
-
-void
-drm_slp_bo_unref(drm_slp_bo bo)
-{
- tbm_bo_unref ((tbm_bo)bo);
-}
-
-drm_slp_bo
-drm_slp_bo_import(drm_slp_bufmgr bufmgr, unsigned int key)
-{
- tbm_bo bo = NULL;
-
- bo = tbm_bo_import ((tbm_bufmgr)bufmgr, key);
- if (!bo)
- {
- TBM_LOG ("[libdrm_slp:%d]: error bo is null\n", getpid());
- return NULL;
- }
-
- return (drm_slp_bo)bo;
-}
-
-void *
-drm_slp_bo_map(drm_slp_bo bo, int device, int opt)
-{
- tbm_bo_handle bo_handle;
- void *ret = NULL;
-
- bo_handle = tbm_bo_map ((tbm_bo)bo, device, opt);
- if (bo_handle.ptr == NULL)
- {
- TBM_LOG ("[libdrm_slp:%d]: error bo_handle is null\n", getpid());
- return NULL;
- }
-
- switch (device)
- {
- case TBM_DEVICE_DEFAULT:
- case TBM_DEVICE_2D:
- case TBM_DEVICE_3D:
- case TBM_DEVICE_MM:
- ret = (void *)((uintptr_t)bo_handle.u32);
- break;
- case TBM_DEVICE_CPU:
- ret = bo_handle.ptr;
- break;
- default:
- TBM_LOG ("[libdrm_slp:%d]: error wrong device type\n", getpid());
- return NULL;
- }
-
- return ret;
-}
-
-int
-drm_slp_bo_unmap(drm_slp_bo bo, int device)
-{
- tbm_bo_unmap ((tbm_bo)bo);
-
- return 1;
-}
-
+++ /dev/null
-/**************************************************************************
-
-xserver-xorg-video-sec
-
-Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-
-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 _DRM_SLP_BUFMGR_H_
-#define _DRM_SLP_BUFMGR_H_
-
-#include "tbm_bufmgr.h"
-
-typedef struct _drm_slp_bo * drm_slp_bo;
-typedef struct _drm_slp_bufmgr * drm_slp_bufmgr;
-
-/* Functions for buffer mnager */
-drm_slp_bufmgr drm_slp_bufmgr_init(int fd, void * arg);
-void drm_slp_bufmgr_destroy(drm_slp_bufmgr bufmgr);
-
-/*Functions for bo*/
-void drm_slp_bo_unref(drm_slp_bo bo);
-drm_slp_bo drm_slp_bo_import(drm_slp_bufmgr bufmgr, unsigned int key);
-void *drm_slp_bo_map(drm_slp_bo bo, int device, int opt);
-int drm_slp_bo_unmap(drm_slp_bo bo, int device);
-
-#endif /* _DRM_SLP_BUFMGR_H_ */
%bcond_with wayland
Name: libtbm
-Version: 1.1.1
+Version: 1.1.4
Release: 1
License: MIT
Summary: The library for Tizen Buffer Manager
%defattr(-,root,root,-)
/usr/share/license/%{name}
%{_libdir}/libtbm.so.*
-%ifarch x86_64
-%else
-%{_libdir}/libdrm_slp.so.*
-%endif
%files devel
%defattr(-,root,root,-)
%{_includedir}/tbm_bufmgr_backend.h
%{_includedir}/tbm_type.h
%{_libdir}/libtbm.so
-%ifarch x86_64
-%else
-%{_libdir}/libdrm_slp.so
-%endif
%{_libdir}/pkgconfig/libtbm.pc
pthread_mutex_t gLock = PTHREAD_MUTEX_INITIALIZER;
tbm_bufmgr gBufMgr = NULL;
+static __thread tbm_error_e tbm_last_error = TBM_ERROR_NONE;
+
+static void
+_tbm_set_last_result(tbm_error_e err)
+{
+ tbm_last_error = err;
+}
+
static inline int
_tgl_init (int fd, unsigned int key)
{
tbm_bufmgr bufmgr = bo->bufmgr;
tbm_bo_cache_state cache_state;
+ if (bo->tgl_key == INITIAL_KEY)
+ bo->tgl_key = bufmgr->backend->bo_get_global_key (bo);
+
+ if (!bo->default_handle.u32)
+ bo->default_handle = bufmgr->backend->bo_get_handle (bo, TBM_DEVICE_DEFAULT);
+
RETURN_VAL_CHECK_FLAG (TBM_ALL_CTRL_BACKEND_VALID(bufmgr->backend->flags), 1);
cache_state.val = 0;
switch (opt)
{
case CACHE_OP_CREATE: /*Create*/
- if (bo->tgl_key == INITIAL_KEY)
- bo->tgl_key = bufmgr->backend->bo_get_global_key (bo);
_tgl_init (bufmgr->lock_fd, bo->tgl_key);
_tgl_set_data (bufmgr->lock_fd, bo->tgl_key, cache_state.val);
break;
case CACHE_OP_IMPORT: /*Import*/
- if (bo->tgl_key == INITIAL_KEY)
- bo->tgl_key = bufmgr->backend->bo_get_global_key (bo);
_tgl_init (bufmgr->lock_fd, bo->tgl_key);
break;
if (ret)
bo->lock_cnt++;
}
+ else
+ ret = 1;
}
else if (bufmgr->lock_type == LOCK_TRY_ALWAYS)
{
abimaj = GET_ABI_MAJOR (data->abiversion);
abimin = GET_ABI_MINOR (data->abiversion);
- TBM_LOG ("[libtbm:%d] "
+ DBG ("[libtbm:%d] "
"TBM module %s: vendor=\"%s\" ABI=%d,%d\n",
getpid(), data->modname ? data->modname : "UNKNOWN!",
data->vendor ? data->vendor : "UNKNOWN!", abimaj, abimin);
bufmgr->module_data = module_data;
- TBM_LOG ("[libtbm:%d] "
+ DBG ("[libtbm:%d] "
"Success to load module(%s)\n", getpid(), file);
return 1;
{
char *env;
int fd_flag = 0;
+ int backend_flag = 0;
pthread_mutex_lock (&gLock);
/* initialize buffer manager */
if (gBufMgr)
{
- TBM_LOG ("[libtbm:%d] use previous gBufMgr\n", getpid());
+ DBG ("[libtbm:%d] use previous gBufMgr\n", getpid());
gBufMgr->ref_count++;
- TBM_LOG ("[libtbm:%d] bufmgr ref: fd=%d, ref_count:%d\n",
+
+ if (fd >= 0)
+ {
+ if (dup2(gBufMgr->fd, fd) < 0) {
+ _tbm_set_last_result (TBM_BO_ERROR_DUP_FD_FAILED);
+ DBG ("[libtbm:%d] Fail to duplicate(dup2) the drm fd\n", getpid());
+ pthread_mutex_unlock (&gLock);
+ return NULL;
+ }
+ DBG ("[libtbm:%d] duplicate the drm_fd(%d), new drm_fd(%d).\n",
+ getpid(), gBufMgr->fd, fd);
+ }
+
+ DBG ("[libtbm:%d] bufmgr ref: fd=%d, ref_count:%d\n",
getpid(), gBufMgr->fd, gBufMgr->ref_count);
pthread_mutex_unlock (&gLock);
return gBufMgr;
#endif
if (fd < 0)
{
+ _tbm_set_last_result (TBM_BO_ERROR_GET_FD_FAILED);
TBM_LOG ("[libtbm:%d] Fail get drm fd\n", getpid());
pthread_mutex_unlock (&gLock);
return NULL;
fd_flag = 1;
}
- TBM_LOG ("[libtbm:%d] bufmgr init: fd=%d\n", getpid(), fd);
+ DBG ("[libtbm:%d] bufmgr init: fd=%d\n", getpid(), fd);
/* allocate bufmgr */
gBufMgr = calloc (1, sizeof(struct _tbm_bufmgr));
if (!gBufMgr)
{
+ _tbm_set_last_result (TBM_BO_ERROR_HEAP_ALLOC_FAILED);
pthread_mutex_unlock (&gLock);
return NULL;
}
+ gBufMgr->fd_flag = fd_flag;
+
+ if (fd_flag)
+ {
+ gBufMgr->fd = fd;
+ }
+ else
+ {
+ gBufMgr->fd = dup(fd);
+ if (gBufMgr->fd < 0)
+ {
+ _tbm_set_last_result (TBM_BO_ERROR_DUP_FD_FAILED);
+ TBM_LOG ("[libtbm:%d] Fail to duplicate(dup) the drm fd\n", getpid());
+ free (gBufMgr);
+ gBufMgr = NULL;
+ pthread_mutex_unlock (&gLock);
+ return NULL;
+ }
+ DBG ("[libtbm:%d] duplicate the drm_fd(%d), bufmgr use fd(%d).\n",
+ getpid(), fd, gBufMgr->fd);
+ }
+
/* load bufmgr priv from env */
- if (!_tbm_load_module(gBufMgr, fd))
+ if (!_tbm_load_module(gBufMgr, gBufMgr->fd))
{
+ _tbm_set_last_result (TBM_BO_ERROR_LOAD_MODULE_FAILED);
TBM_LOG ("[libtbm:%d] "
"error : Fail to load bufmgr backend\n",
getpid());
pthread_mutex_unlock (&gLock);
return NULL;
}
+ else
+ {
+ backend_flag = gBufMgr->backend->flags;
+ /* log for tbm backend_flag */
+ DBG ("[libtbm:%d] ", getpid());
+ DBG ("cache_crtl:");
+ if (backend_flag&TBM_CACHE_CTRL_BACKEND) {
+ DBG ("BACKEND ");
+ } else {
+ DBG ("TBM ");
+ }
+ DBG ("lock_crtl:");
+ if (backend_flag&TBM_LOCK_CTRL_BACKEND) {
+ DBG ("BACKEND ");
+ } else {
+ DBG ("TBM ");
+ }
+ DBG ("\n");
+ }
- gBufMgr->fd_flag = fd_flag;
- gBufMgr->fd = fd;
gBufMgr->ref_count = 1;
- TBM_LOG ("[libtbm:%d] create tizen bufmgr: ref_count:%d\n", getpid(), gBufMgr->ref_count);
+ DBG ("[libtbm:%d] create tizen bufmgr: ref_count:%d\n", getpid(), gBufMgr->ref_count);
if (pthread_mutex_init (&gBufMgr->lock, NULL) != 0)
{
+ _tbm_set_last_result (TBM_BO_ERROR_THREAD_INIT_FAILED);
gBufMgr->backend->bufmgr_deinit (gBufMgr->backend->priv);
tbm_backend_free (gBufMgr->backend);
dlclose (gBufMgr->module_data);
/* intialize the tizen global status */
if (!_tbm_bufmgr_init_state (gBufMgr))
{
+ _tbm_set_last_result (TBM_BO_ERROR_INIT_STATE_FAILED);
TBM_LOG ("[libtbm:%d] "
"error: Fail to init state\n",
getpid());
pthread_mutex_destroy (&bufmgr->lock);
- TBM_LOG ("[libtbm:%d] "
+ DBG ("[libtbm:%d] "
"tizen bufmgr destroy: bufmgr:%p\n",
getpid(), bufmgr);
dlclose (bufmgr->module_data);
- if(bufmgr->fd_flag)
- close(bufmgr->fd);
+ close(bufmgr->fd);
free (bufmgr);
bufmgr = NULL;
bo = calloc (1, sizeof(struct _tbm_bo));
if(!bo)
+ {
+ _tbm_set_last_result (TBM_BO_ERROR_HEAP_ALLOC_FAILED);
return NULL;
+ }
bo->bufmgr = bufmgr;
bo_priv = bufmgr->backend->bo_alloc (bo, size, flags);
if (!bo_priv)
{
+ _tbm_set_last_result (TBM_BO_ERROR_BO_ALLOC_FAILED);
free (bo);
pthread_mutex_unlock (&bufmgr->lock);
return NULL;
/* init bo state */
if (!_tbm_bo_init_state (bo, CACHE_OP_CREATE))
{
+ _tbm_set_last_result (TBM_BO_ERROR_INIT_STATE_FAILED);
_tbm_bo_unref (bo);
pthread_mutex_unlock (&bufmgr->lock);
return NULL;
TBM_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), NULL);
tbm_bo bo = NULL;
+ tbm_bo bo2 = NULL;
+ tbm_bo tmp = NULL;
void * bo_priv = NULL;
+ pthread_mutex_lock (&bufmgr->lock);
+
+ /* find bo in list */
+ if(!LIST_IS_EMPTY (&bufmgr->bo_list))
+ {
+ LIST_FOR_EACH_ENTRY_SAFE (bo2, tmp, &bufmgr->bo_list, item_link)
+ {
+ if (bo2->tgl_key == key)
+ {
+ DBG ("[libtbm:%d] "
+ "find bo(%p, ref:%d key:%d) in list \n",
+ getpid(), bo2, bo2->ref_cnt, bo2->tgl_key);
+
+ bo2->ref_cnt++;
+ pthread_mutex_unlock (&bufmgr->lock);
+ return bo2;
+ }
+ }
+ }
+
bo = calloc (1, sizeof(struct _tbm_bo));
if(!bo)
return NULL;
bo->bufmgr = bufmgr;
- pthread_mutex_lock (&bufmgr->lock);
-
bo_priv = bufmgr->backend->bo_import (bo, key);
if (!bo_priv)
{
+ _tbm_set_last_result (TBM_BO_ERROR_IMPORT_FAILED);
free (bo);
pthread_mutex_unlock (&bufmgr->lock);
return NULL;
/* init bo state */
if (!_tbm_bo_init_state (bo, CACHE_OP_IMPORT))
{
+ _tbm_set_last_result (TBM_BO_ERROR_INIT_STATE_FAILED);
_tbm_bo_unref (bo);
pthread_mutex_unlock (&bufmgr->lock);
return NULL;
TBM_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), NULL);
tbm_bo bo = NULL;
+ tbm_bo bo2 = NULL;
+ tbm_bo tmp = NULL;
void * bo_priv = NULL;
+ tbm_bo_handle default_handle;
+
+ pthread_mutex_lock (&bufmgr->lock);
+
+ default_handle = bufmgr->backend->fd_to_handle (bufmgr, fd, TBM_DEVICE_DEFAULT);
+
+ /* find bo in list */
+ if(!LIST_IS_EMPTY (&bufmgr->bo_list))
+ {
+ LIST_FOR_EACH_ENTRY_SAFE (bo2, tmp, &bufmgr->bo_list, item_link)
+ {
+ if (bo2->default_handle.u32 == default_handle.u32)
+ {
+ DBG ("[libtbm:%d] "
+ "find bo(%p, ref:%d handle:%d) in list \n",
+ getpid(), bo2, bo2->ref_cnt, bo2->default_handle.u32);
+
+ bo2->ref_cnt++;
+ pthread_mutex_unlock (&bufmgr->lock);
+ return bo2;
+ }
+ }
+ }
bo = calloc (1, sizeof(struct _tbm_bo));
if(!bo)
bo->bufmgr = bufmgr;
- pthread_mutex_lock (&bufmgr->lock);
-
bo_priv = bufmgr->backend->bo_import_fd(bo, fd);
if (!bo_priv)
{
+ _tbm_set_last_result (TBM_BO_ERROR_IMPORT_FD_FAILED);
free (bo);
pthread_mutex_unlock (&bufmgr->lock);
return NULL;
/* init bo state */
if (!_tbm_bo_init_state (bo, CACHE_OP_IMPORT))
{
+ _tbm_set_last_result (TBM_BO_ERROR_INIT_STATE_FAILED);
_tbm_bo_unref (bo);
pthread_mutex_unlock (&bufmgr->lock);
return NULL;
pthread_mutex_lock (&bufmgr->lock);
ret = bufmgr->backend->bo_export (bo);
+ if (!ret)
+ {
+ _tbm_set_last_result (TBM_BO_ERROR_EXPORT_FAILED);
+ pthread_mutex_unlock (&bufmgr->lock);
+ return ret;
+ }
pthread_mutex_unlock (&bufmgr->lock);
return ret;
pthread_mutex_lock (&bufmgr->lock);
ret = bufmgr->backend->bo_export_fd (bo);
+ if (!ret)
+ {
+ _tbm_set_last_result (TBM_BO_ERROR_EXPORT_FD_FAILED);
+ pthread_mutex_unlock (&bufmgr->lock);
+ return ret;
+ }
pthread_mutex_unlock (&bufmgr->lock);
return ret;
pthread_mutex_lock (&bufmgr->lock);
bo_handle = bufmgr->backend->bo_get_handle (bo, device);
+ if (bo_handle.ptr == NULL)
+ {
+ _tbm_set_last_result (TBM_BO_ERROR_GET_HANDLE_FAILED);
+ pthread_mutex_unlock (&bufmgr->lock);
+ return (tbm_bo_handle)NULL;
+ }
pthread_mutex_unlock (&bufmgr->lock);
return bo_handle;
if (!_tbm_bo_lock (bo, device, opt))
{
+ _tbm_set_last_result (TBM_BO_ERROR_LOCK_FAILED);
TBM_LOG ("[libtbm:%d] "
"error %s:%d fail to lock bo:%p)\n",
getpid(), __FUNCTION__, __LINE__, bo);
-#ifdef HAVE_CAPI_0_1_1
- set_last_result (TBM_ERROR_BO_LOCK_FAILED);
-#endif
pthread_mutex_unlock (&bufmgr->lock);
return (tbm_bo_handle)NULL;
}
bo_handle = bufmgr->backend->bo_map (bo, device, opt);
if (bo_handle.ptr == NULL)
{
+ _tbm_set_last_result (TBM_BO_ERROR_MAP_FAILED);
TBM_LOG ("[libtbm:%d] "
"error %s:%d fail to map bo:%p\n",
getpid(), __FUNCTION__, __LINE__, bo);
_tbm_bo_unlock(bo);
-#ifdef HAVE_CAPI_0_1_1
- set_last_result (TBM_ERROR_BO_MAP_FAILED);
-#endif
pthread_mutex_unlock (&bufmgr->lock);
return (tbm_bo_handle)NULL;
}
ret = bufmgr->backend->bo_unmap (bo);
if (!ret)
{
+
+ _tbm_set_last_result (TBM_BO_ERROR_UNMAP_FAILED);
pthread_mutex_unlock (&bufmgr->lock);
return ret;
}
void* temp;
unsigned int tmp_key;
+ pthread_mutex_lock (&bo1->bufmgr->lock);
+
if (bo1->bufmgr->backend->bo_size (bo1) != bo2->bufmgr->backend->bo_size (bo2))
+ {
+ _tbm_set_last_result (TBM_BO_ERROR_SWAP_FAILED);
+ pthread_mutex_unlock (&bo1->bufmgr->lock);
return 0;
+ }
- pthread_mutex_lock (&bo1->bufmgr->lock);
tmp_key = bo1->tgl_key;
bo1->tgl_key = bo2->tgl_key;
return 1;
}
+tbm_error_e
+tbm_get_last_error (void)
+{
+ return tbm_last_error;
+}
+
#include <tbm_type.h>
#include <stdint.h>
-#include <tizen_error.h>
-
-/* this define will be removed when the capi-common is the version 0.1.1 */
-#ifndef TIZEN_ERROR_TBM
-#define TIZEN_ERROR_TBM -0x02830000
+/* tbm error base : this error base is same as TIZEN_ERROR_TBM in tizen_error.h */
+#ifndef TBM_ERROR_BASE
+#define TBM_ERROR_BASE -0x02830000
#endif
/**
/**
* @brief Definition for the tizen buffer manager
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef struct _tbm_bufmgr * tbm_bufmgr;
/**
* @brief Definition for the tizen buffer object
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef struct _tbm_bo *tbm_bo;
/**
* @brief Definition for the key associated with the buffer object
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef uint32_t tbm_key;
/**
* @brief Definition for the file descripter of the system buffer manager
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef int32_t tbm_fd;
/**
* @brief Definition for the device type to get the default handle
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_DEVICE_DEFAULT 0
/**
* @brief Definition for the device type to get the virtual memory
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_DEVICE_CPU 1
/**
* @brief Definition for the device type to get the 2D memory handle
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_DEVICE_2D 2
/**
* @brief Definition for the device type to get the 3D memory handle
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_DEVICE_3D 3
/**
* @brief Definition for the device type to get the multimedia handle
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_DEVICE_MM 4
/**
* @brief Definition for the cache invalidate
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_CACHE_INV 0x01
/**
* @brief Definition for the cache clean
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_CACHE_CLN 0x02
/**
* @brief Definition for the access option to read
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_OPTION_READ (1 << 0)
/**
* @brief Definition for the access option to write
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_OPTION_WRITE (1 << 1)
/**
* @brief Definition for the vendor specific option that depends on the backend
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_OPTION_VENDOR (0xffff0000)
/**
* @brief tbm_bo_handle abstraction of the memory handle by TBM_DEVICE_TYPE
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef union _tbm_bo_handle
{
/**
* @brief Enumeration of bo memory type
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
enum TBM_BO_FLAGS
{
*/
typedef enum
{
- TBM_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- TBM_ERROR_BO_LOCK_FAILED = TIZEN_ERROR_TBM|0x0101, /**< tbm_bo lock failed */
- TBM_ERROR_BO_MAP_FAILED = TIZEN_ERROR_TBM|0x0102, /**< tbm_bo map failed */
+ TBM_ERROR_NONE = 0, /**< Successful */
+ TBM_BO_ERROR_GET_FD_FAILED = TBM_ERROR_BASE|0x0101, /**< failed to get fd failed */
+ TBM_BO_ERROR_HEAP_ALLOC_FAILED = TBM_ERROR_BASE|0x0102, /**< failed to allocate the heap memory */
+ TBM_BO_ERROR_LOAD_MODULE_FAILED = TBM_ERROR_BASE|0x0103, /**< failed to load module*/
+ TBM_BO_ERROR_THREAD_INIT_FAILED = TBM_ERROR_BASE|0x0104, /**< failed to initialize the pthread */
+ TBM_BO_ERROR_BO_ALLOC_FAILED = TBM_ERROR_BASE|0x0105, /**< failed to allocate tbm_bo */
+ TBM_BO_ERROR_INIT_STATE_FAILED = TBM_ERROR_BASE|0x0106, /**< failed to initialize the state of tbm_bo */
+ TBM_BO_ERROR_IMPORT_FAILED = TBM_ERROR_BASE|0x0107, /**< failed to import the handle of tbm_bo */
+ TBM_BO_ERROR_IMPORT_FD_FAILED = TBM_ERROR_BASE|0x0108, /**< failed to import fd of tbm_bo */
+ TBM_BO_ERROR_EXPORT_FAILED = TBM_ERROR_BASE|0x0109, /**< failed to export the handle of the tbm_bo */
+ TBM_BO_ERROR_EXPORT_FD_FAILED = TBM_ERROR_BASE|0x01010, /**< failed to export fd of tbm_bo */
+ TBM_BO_ERROR_GET_HANDLE_FAILED = TBM_ERROR_BASE|0x0111, /**< failed to get the tbm_bo_handle */
+ TBM_BO_ERROR_LOCK_FAILED = TBM_ERROR_BASE|0x0112, /**< failed to lock the tbm_bo */
+ TBM_BO_ERROR_MAP_FAILED = TBM_ERROR_BASE|0x0113, /**< failed to map the tbm_bo to get the tbm_bo_handle */
+ TBM_BO_ERROR_UNMAP_FAILED = TBM_ERROR_BASE|0x0114, /**< failed to unmap the tbm_bo */
+ TBM_BO_ERROR_SWAP_FAILED = TBM_ERROR_BASE|0x0115, /**< failed to swap the tbm_bos */
+ TBM_BO_ERROR_DUP_FD_FAILED = TBM_ERROR_BASE|0x0116, /**< failed to duplicate fd */
} tbm_error_e;
* BUFMGR_MAP_CACHE default is true\n
* true : use map cache flushing\n
* false : to use map cache flushing
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] fd : file descripter of the system buffer manager
* @return a buffer manager
* @retval #tbm_bufmgr
/**
* @brief Deinitializes the buffer manager.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bufmgr : the buffer manager
* @see tbm_bufmgr_init()
* @par Example
int bufmgr_fd;
tbm_bufmgr bufmgr;
+ tbm_error_e error;
bufmgr = tbm_bufmgr_init (bufmgr_fd);
+ if (!bufmgr)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
....
* #TBM_BO_NONCACHABLE indecates non-cachable memory\n
* #TBM_BO_WC indecates write-combine memory\n
* #TBM_BO_VENDOR indecates vendor specific memory: it depends on the tbm backend
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bufmgr : the buffer manager
* @param[in] size : the size of buffer object
* @param[in] flags : the flags of memory type
int bufmgr_fd;
tbm_bufmgr bufmgr;
tbm_bo;
+ tbm_error_e error;
bufmgr = tbm_bufmgr_init (bufmgr_fd);
bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
+ if (!bo)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
....
/**
* @brief Increases the reference count of bo.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @return a buffer object
* @retval #tbm_bo
/**
* @brief Decreases the reference count of bo
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @see tbm_bo_ref()
* @see tbm_bo_alloc()
* #TBM_OPTION_READ indecates the accss option to read.\n
* #TBM_OPTION_WRITE indecates the access option to write.\n
* #TBM_OPTION_VENDOR indecates the vendor specific option that depends on the backend.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @param[in] device : the device type to get a handle
* @param[in] opt : the option to access the buffer object
handle = tbm_bo_map (bo, TBM_DEVICE_2D, TBM_OPTION_READ|TBM_OPTION_WRITE);
if (handle.ptr == NULL)
{
- error = get_last_result ();
+ error = tbm_get_last_error ();
...
}
/**
* @brief Unmaps the buffer object.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @return 1 if this function succeeds, otherwise 0.
* @see tbm_bo_map()
* #TBM_DEVICE_3D indecates the 3D memory handle.\n
* #TBM_DEVICE_CPU indecates the virtual memory handle.\n
* #TBM_DEVICE_MM indecates the multimedia handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @param[in] device : the device type to get a handle
* @return the handle of the buffer object
tbm_bufmgr bufmgr;
tbm_bo bo;
tbm_bo_handle handle;
+ tbm_error_e error;
bufmgr = tbm_bufmgr_init (bufmgr_fd);
bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
...
handle = tbm_bo_get_handle (bo, TBM_DEVICE_2D);
+ if (handle.ptr == NULL)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
...
/**
* @brief Exports the buffer object by key.
* @details The tbm_bo can be exported to the anther process with the unique key associated with the the tbm_bo.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @return key associated with the buffer object
* @retval #tbm_key
tbm_bufmgr bufmgr;
tbm_bo;
tbm_key key;
+ tbm_error_e error;
bufmgr = tbm_bufmgr_init (bufmgr_fd);
bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
key = tbm_bo_export (bo);
+ if (key == 0)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
...
/**
* @brief Exports the buffer object by fd.
* @details The tbm_bo can be exported to the anther process with the unique fd associated with the the tbm_bo.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @return fd associated with the buffer object
* @retval #tbm_fd
tbm_fd bo_fd;
tbm_bufmgr bufmgr;
tbm_bo;
+ tbm_error_e error;
bufmgr = tbm_bufmgr_init (bufmgr_fd);
bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
bo_fd = tbm_bo_export (bo);
+ if (bo_fd == 0)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
...
/**
* @brief Imports the buffer object associated with the key.
* @details The reference count of the tbm_bo is 1.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bufmgr : the buffer manager
* @param[in] key : the key associated with the buffer object
* @return a buffer object
int bo_key;
tbm_bufmgr bufmgr;
tbm_bo;
+ tbm_error_e error;
...
bufmgr = tbm_bufmgr_init (bufmgr_fd);
bo = tbm_bo_import (key);
+ if (bo == NULL)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
...
/**
* @brief Imports the buffer object associated with the fd.
* @details The reference count of the tbm_bo is 1.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bufmgr : the buffer manager
* @param[in] fd : the fd associated with the buffer object
* @return a buffer object
tbm_fd bo_fd;
tbm_bufmgr bufmgr;
tbm_bo bo;
+ tbm_error_e error;
...
bufmgr = tbm_bufmgr_init (bufmgr_fd);
- bo = tbm_bo_import_fd (bo_fd);
+ bo_fd = tbm_bo_import_fd (bo_fd);
+ if (bo_fd == 0)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
...
/**
* @brief Gets the size of a bo.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @return 1 if this function succeeds, otherwise 0.
* @see tbm_bo_alloc()
/**
* @brief Gets the state where the buffer object is locked.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @return 1 if this bo is locked, otherwise 0.
* @see tbm_bo_map()
/**
* @brief Swaps the buffer object.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo1 : the buffer object
* @param[in] bo2 : the buffer object
* @return 1 if this function succeeds, otherwise 0.
tbm_bo bo1;
tbm_bo bo2;
int ret;
+ tbm_error_e error;
bufmgr = tbm_bufmgr_init (bufmgr_fd);
bo1 = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
...
ret = tbm_bo_swap (bo1, bo2);
+ if (ret == 0)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
...
/**
* @brief Called when the user data is deleted in buffer object.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] user_data User_data to be passed to callback function
* @pre The callback must be registered using tbm_bo_add_user_data().\n
* tbm_bo_delete_user_data() must be called to invoke this callback.
/**
* @brief Adds a user_data to the buffer object.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @param[in] key : the key associated with the user_data
* @param[in] data_free_func : the function pointer to free the user_data
/**
* @brief Deletes the user_data in the buffer object.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @param[in] key : the key associated with the user_date
* @return 1 if this function succeeds, otherwise 0.
/**
* @brief Sets a user_date to the buffer object.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @param[in] key : the key associated with the user_date
* @param[in] data : a pointer of the user_data
/**
* @brief Gets a user_data from the buffer object with the key.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bo : the buffer object
* @param[in] key : the key associated with the user_date
* @param[out] data : to get the user data
*/
int tbm_bo_get_user_data (tbm_bo bo, unsigned long key, void** data);
+/**
+ * @brief Gets the latest tbm_error.
+ * @since_tizen 2.4
+ * @return the latest tbm_error
+ * @par Example
+ @code
+ #include <tbm_bufmgr.h>
+
+ int bufmgr_fd;
+ tbm_bufmgr bufmgr;
+ tbm_bo bo;
+ tbm_bo_handle handle;
+ tbm_error_e error;
+
+ bufmgr = tbm_bufmgr_init (bufmgr_fd);
+ bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
+ if (!bo)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
+
+ ...
+
+ handle = tbm_bo_map (bo, TBM_DEVICE_2D, TBM_OPTION_READ|TBM_OPTION_WRITE);
+ if (handle.ptr == NULL)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
+
+ ...
+
+ tbm_bo_unmap (bo);
+ tbm_bo_unref (bo);
+ tbm_bufmgr_deinit (bufmgr);
+ @endcode
+ */
+tbm_error_e tbm_get_last_error (void);
+
#ifdef __cplusplus
}
#endif
}
}
- /* log for tbm flags */
- TBM_LOG ("[libtbm:%d] ", getpid());
- TBM_LOG ("cache_crtl:");
- if (flags&TBM_CACHE_CTRL_BACKEND)
- TBM_LOG ("BACKEND ");
- else
- TBM_LOG ("TBM ");
- TBM_LOG ("lock_crtl:");
- if (flags&TBM_LOCK_CTRL_BACKEND)
- TBM_LOG ("BACKEND ");
- else
- TBM_LOG ("TBM ");
- TBM_LOG ("\n");
-
bufmgr->backend = backend;
return 1;
return backend->priv;
}
+void *
+tbm_backend_get_priv_from_bufmgr (tbm_bufmgr bufmgr)
+{
+ tbm_bufmgr_backend backend = bufmgr->backend;
+
+ return backend->priv;
+}
+
void
tbm_backend_set_bo_priv (tbm_bo bo, void *bo_priv)
{
*/
tbm_fd (*bo_export_fd) (tbm_bo bo);
+ /**
+ * @brief get the tbm_bo_handle according to the device type and the prime fd.
+ * @param[in] bufmgr : the tizen buffer manager
+ * @param[in] fd : the prime fd associated with the buffer object
+ * @param[in] device : the option to access the buffer object
+ * @return the handle of the buffer object
+ */
+ tbm_bo_handle (*fd_to_handle) (tbm_bufmgr bufmgr, tbm_fd fd, int device);
+
/* Padding for future extension */
void (*reserved1) (void);
void (*reserved2) (void);
int tbm_backend_init (tbm_bufmgr bufmgr, tbm_bufmgr_backend backend);
void *tbm_backend_get_bufmgr_priv (tbm_bo bo);
+void *tbm_backend_get_priv_from_bufmgr (tbm_bufmgr bufmgr);
void *tbm_backend_get_bo_priv (tbm_bo bo);
#endif /* _TBM_BUFMGR_BACKEND_H_ */
void *priv; /* bo private */
struct list_head item_link; /* link of bo */
+
+ tbm_bo_handle default_handle; /*default handle */
};
/**
int tbm_bufmgr_get_drm_fd_x11(void);
int tbm_bufmgr_get_drm_fd_wayland(void);
+/* functions for mutex */
+int tbm_surface_internal_get_info (tbm_surface_h surface, int opt, tbm_surface_info_s *info, int map);
+void tbm_surface_internal_unmap (tbm_surface_h surface);
+unsigned int tbm_surface_internal_get_width (tbm_surface_h surface);
+unsigned int tbm_surface_internal_get_height (tbm_surface_h surface);
+tbm_format tbm_surface_internal_get_format (tbm_surface_h surface);
+
#endif /* _TBM_BUFMGR_INT_H_ */
/**************************************************************************
-
-libtbm
-
-Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-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.
-
-**************************************************************************/
-
+ *
+ * libtbm
+ *
+ * Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+ * Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+ *
+ * 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 __TBM_BUFMGR_TGL_H__
#define __TBM_BUFMGR_TGL_H__
#include "tbm_bufmgr_int.h"
#include "tbm_surface_internal.h"
-static int
-_tbm_surface_get_info (struct _tbm_surface *surf, int opt, tbm_surface_info_s *info, int map)
-{
- tbm_bo_handle bo_handles[4];
- int i;
-
- info->width = surf->info.width;
- info->height = surf->info.height;
- info->format = surf->info.format;
- info->bpp = surf->info.bpp;
- info->size = surf->info.size;
- info->num_planes = surf->info.num_planes;
-
- if (surf->num_bos == 1)
- {
- if (map == 1)
- {
- bo_handles[0] = tbm_bo_map (surf->bos[0], TBM_DEVICE_CPU, opt);
- if (bo_handles[0].ptr == NULL)
- return 0;
- }
- else
- {
- bo_handles[0] = tbm_bo_get_handle (surf->bos[0], TBM_DEVICE_CPU);
- if (bo_handles[0].ptr == NULL)
- return 0;
- }
-
- for (i = 0; i < surf->info.num_planes; i++)
- {
- info->planes[i].size = surf->info.planes[i].size;
- info->planes[i].offset = surf->info.planes[i].offset;
- info->planes[i].stride = surf->info.planes[i].stride;
- info->planes[i].ptr = bo_handles[0].ptr + surf->info.planes[i].offset;
- }
- }
- else
- {
- /* TODO: calculate the virtaul address when num_bos is over 1 */
- }
-
- return 1;
-}
-
int
tbm_surface_query_formats (uint32_t **formats, uint32_t *num)
{
TBM_RETURN_VAL_IF_FAIL (surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
TBM_RETURN_VAL_IF_FAIL (info != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
- struct _tbm_surface *surf = (struct _tbm_surface *)surface;
int ret = 0;
- ret = _tbm_surface_get_info (surf, opt, info, 1);
+ ret = tbm_surface_internal_get_info (surface, opt, info, 1);
if (ret == 0)
return TBM_SURFACE_ERROR_INVALID_OPERATION;
{
TBM_RETURN_VAL_IF_FAIL (surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
- struct _tbm_surface *surf = (struct _tbm_surface *)surface;
- int i;
-
- for (i = 0; i < surf->num_bos; i++)
- tbm_bo_unmap (surf->bos[i]);
+ tbm_surface_internal_unmap(surface);
return TBM_SURFACE_ERROR_NONE;
}
TBM_RETURN_VAL_IF_FAIL (surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
TBM_RETURN_VAL_IF_FAIL (info != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
- struct _tbm_surface *surf = (struct _tbm_surface *)surface;
int ret = 0;
- ret = _tbm_surface_get_info (surf, 0, info, 0);
+ ret = tbm_surface_internal_get_info (surface, 0, info, 0);
if (ret == 0)
return TBM_SURFACE_ERROR_INVALID_OPERATION;
{
TBM_RETURN_VAL_IF_FAIL (surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
- struct _tbm_surface *surf = (struct _tbm_surface *)surface;
-
- return surf->info.width;
+ return tbm_surface_internal_get_width(surface);
}
int
{
TBM_RETURN_VAL_IF_FAIL (surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
- struct _tbm_surface *surf = (struct _tbm_surface *)surface;
-
- return surf->info.height;
+ return tbm_surface_internal_get_height(surface);
}
tbm_format
return 0;
}
- struct _tbm_surface *surf = (struct _tbm_surface *)surface;
-
#ifdef HAVE_CAPI_0_1_1
set_last_result (TBM_SURFACE_ERROR_NONE);
#endif
- return surf->info.format;
+ return tbm_surface_internal_get_format(surface);
}
/**
* @brief Enumeration for tbm_surface error type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Definition for the max number of TBM surface plane.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_SURF_PLANE_MAX 4
/* option to map the tbm_surface */
/**
* @brief Definition for the access option to read.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_SURF_OPTION_READ (1 << 0)
/**
* @brief Definition for the access option to write.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_SURF_OPTION_WRITE (1 << 1)
/**
* @brief Definition for the TBM plane struct.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef struct _tbm_surface_plane
{
/**
* @brief Definition for the TBM surface information struct.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef struct _tbm_surface_info
{
/* color index */
/**
* @brief Definition for the TBM surface format C8 ([7:0] C).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_C8 __tbm_fourcc_code('C', '8', ' ', ' ')
/* 8 bpp RGB */
/**
* @brief Definition for the TBM surface format RGB322 ([7:0] R:G:B 3:3:2).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_RGB332 __tbm_fourcc_code('R', 'G', 'B', '8')
/**
* @brief Definition for the TBM surface format RGB233 ([7:0] B:G:R 2:3:3).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_BGR233 __tbm_fourcc_code('B', 'G', 'R', '8')
/* 16 bpp RGB */
/**
* @brief Definition for the TBM surface format XRGB4444 ([15:0] x:R:G:B 4:4:4:4 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_XRGB4444 __tbm_fourcc_code('X', 'R', '1', '2')
/**
* @brief Definition for the TBM surface format XBRG4444 ([15:0] x:B:G:R 4:4:4:4 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_XBGR4444 __tbm_fourcc_code('X', 'B', '1', '2')
/**
* @brief Definition for the TBM surface format RGBX4444 ([15:0] R:G:B:x 4:4:4:4 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_RGBX4444 __tbm_fourcc_code('R', 'X', '1', '2')
/**
* @brief Definition for the TBM surface format BGRX4444 ([15:0] B:G:R:x 4:4:4:4 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_BGRX4444 __tbm_fourcc_code('B', 'X', '1', '2')
/**
* @brief Definition for the TBM surface format ARGB4444 ([15:0] A:R:G:B 4:4:4:4 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_ARGB4444 __tbm_fourcc_code('A', 'R', '1', '2')
/**
* @brief Definition for the TBM surface format ABGR4444 ([15:0] A:B:G:R 4:4:4:4 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_ABGR4444 __tbm_fourcc_code('A', 'B', '1', '2')
/**
* @brief Definition for the TBM surface format RGBA4444 ([15:0] R:G:B:A 4:4:4:4 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_RGBA4444 __tbm_fourcc_code('R', 'A', '1', '2')
/**
* @brief Definition for the TBM surface format BGRA4444 ([15:0] B:G:R:A 4:4:4:4 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_BGRA4444 __tbm_fourcc_code('B', 'A', '1', '2')
/**
* @brief Definition for the TBM surface format XRGB1555 ([15:0] x:R:G:B 1:5:5:5 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_XRGB1555 __tbm_fourcc_code('X', 'R', '1', '5')
/**
* @brief Definition for the TBM surface format XBGR1555 ([15:0] x:B:G:R 1:5:5:5 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_XBGR1555 __tbm_fourcc_code('X', 'B', '1', '5')
/**
* @brief Definition for the TBM surface format RGBX5551 ([15:0] R:G:B:x 5:5:5:1 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_RGBX5551 __tbm_fourcc_code('R', 'X', '1', '5')
/**
* @brief Definition for the TBM surface format BGRX5551 ([15:0] B:G:R:x 5:5:5:1 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_BGRX5551 __tbm_fourcc_code('B', 'X', '1', '5')
/**
* @brief Definition for the TBM surface format ARGB1555 ([15:0] A:R:G:B 1:5:5:5 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_ARGB1555 __tbm_fourcc_code('A', 'R', '1', '5')
/**
* @brief Definition for the TBM surface format ABGR1555 ([15:0] A:B:G:R 1:5:5:5 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_ABGR1555 __tbm_fourcc_code('A', 'B', '1', '5')
/**
* @brief Definition for the TBM surface format RGBA5551 ([15:0] R:G:B:A 5:5:5:1 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_RGBA5551 __tbm_fourcc_code('R', 'A', '1', '5')
/**
* @brief Definition for the TBM surface format BGRA5551 ([15:0] B:G:R:A 5:5:5:1 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_BGRA5551 __tbm_fourcc_code('B', 'A', '1', '5')
/**
* @brief Definition for the TBM surface format RGB565 ([15:0] R:G:B 5:6:5 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_RGB565 __tbm_fourcc_code('R', 'G', '1', '6')
/**
* @brief Definition for the TBM surface format BGR565 ([15:0] B:G:R 5:6:5 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_BGR565 __tbm_fourcc_code('B', 'G', '1', '6')
/* 24 bpp RGB */
/**
* @brief Definition for the TBM surface format RGB888 ([23:0] R:G:B little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_RGB888 __tbm_fourcc_code('R', 'G', '2', '4')
/**
* @brief Definition for the TBM surface format BGR888 ([23:0] B:G:R little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_BGR888 __tbm_fourcc_code('B', 'G', '2', '4')
/* 32 bpp RGB */
/**
* @brief Definition for the TBM surface format XRGB8888 ([31:0] x:R:G:B 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_XRGB8888 __tbm_fourcc_code('X', 'R', '2', '4')
/**
* @brief Definition for the TBM surface format XBGR8888 ([31:0] x:B:G:R 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_XBGR8888 __tbm_fourcc_code('X', 'B', '2', '4')
/**
* @brief Definition for the TBM surface format RGBX8888 ([31:0] R:G:B:x 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_RGBX8888 __tbm_fourcc_code('R', 'X', '2', '4')
/**
* @brief Definition for the TBM surface format BGRX8888 ([31:0] B:G:R:x 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_BGRX8888 __tbm_fourcc_code('B', 'X', '2', '4')
/**
* @brief Definition for the TBM surface format ARGB8888 ([31:0] A:R:G:B 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_ARGB8888 __tbm_fourcc_code('A', 'R', '2', '4')
/**
* @brief Definition for the TBM surface format ABGR8888 ([31:0] [31:0] A:B:G:R 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_ABGR8888 __tbm_fourcc_code('A', 'B', '2', '4')
/**
* @brief Definition for the TBM surface format RGBA8888 ([31:0] R:G:B:A 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_RGBA8888 __tbm_fourcc_code('R', 'A', '2', '4')
/**
* @brief Definition for the TBM surface format BGRA8888 ([31:0] B:G:R:A 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_BGRA8888 __tbm_fourcc_code('B', 'A', '2', '4')
/**
* @brief Definition for the TBM surface format XRGB2101010 ([31:0] x:R:G:B 2:10:10:10 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_XRGB2101010 __tbm_fourcc_code('X', 'R', '3', '0')
/**
* @brief Definition for the TBM surface format XBGR2101010 ([31:0] x:B:G:R 2:10:10:10 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_XBGR2101010 __tbm_fourcc_code('X', 'B', '3', '0')
/**
* @brief Definition for the TBM surface format RGBX1010102 ([31:0] R:G:B:x 10:10:10:2 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_RGBX1010102 __tbm_fourcc_code('R', 'X', '3', '0')
/**
* @brief Definition for the TBM surface format BGRX1010102 ([31:0] B:G:R:x 10:10:10:2 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_BGRX1010102 __tbm_fourcc_code('B', 'X', '3', '0')
/**
* @brief Definition for the TBM surface format ARGB2101010 ([31:0] A:R:G:B 2:10:10:10 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_ARGB2101010 __tbm_fourcc_code('A', 'R', '3', '0')
/**
* @brief Definition for the TBM surface format ABGR2101010 ([31:0] A:B:G:R 2:10:10:10 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_ABGR2101010 __tbm_fourcc_code('A', 'B', '3', '0')
/**
* @brief Definition for the TBM surface format RGBA1010102 ([31:0] R:G:B:A 10:10:10:2 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_RGBA1010102 __tbm_fourcc_code('R', 'A', '3', '0')
/**
* @brief Definition for the TBM surface format BGRA1010102 ([31:0] B:G:R:A 10:10:10:2 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_BGRA1010102 __tbm_fourcc_code('B', 'A', '3', '0') /* */
/* packed YCbCr */
/**
* @brief Definition for the TBM surface format YUYV ([31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_YUYV __tbm_fourcc_code('Y', 'U', 'Y', 'V')
/**
* @brief Definition for the TBM surface format YVYU ([31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_YVYU __tbm_fourcc_code('Y', 'V', 'Y', 'U') /* */
/**
* @brief Definition for the TBM surface format UYVY ([31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_UYVY __tbm_fourcc_code('U', 'Y', 'V', 'Y')
/**
* @brief Definition for the TBM surface format VYUY ([31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_VYUY __tbm_fourcc_code('V', 'Y', 'U', 'Y')
/**
* @brief Definition for the TBM surface format AYUV ([31:0] A:Y:Cb:Cr 8:8:8:8 little endian).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_AYUV __tbm_fourcc_code('A', 'Y', 'U', 'V')
*/
/**
* @brief Definition for the TBM surface format NV12 (2x2 subsampled Cr:Cb plane).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_NV12 __tbm_fourcc_code('N', 'V', '1', '2')
/**
* @brief Definition for the TBM surface format NV21 (2x2 subsampled Cb:Cr plane).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_NV21 __tbm_fourcc_code('N', 'V', '2', '1') /* */
/**
* @brief Definition for the TBM surface format NV16 (2x1 subsampled Cr:Cb plane).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_NV16 __tbm_fourcc_code('N', 'V', '1', '6')
/**
* @brief Definition for the TBM surface format NV61 (2x1 subsampled Cb:Cr plane).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_NV61 __tbm_fourcc_code('N', 'V', '6', '1')
#define TBM_FORMAT_YUV410 __tbm_fourcc_code('Y', 'U', 'V', '9')
/**
* @brief Definition for the TBM surface format YVU410 (4x4 subsampled Cr (1) and Cb (2) planes).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_YVU410 __tbm_fourcc_code('Y', 'V', 'U', '9')
/**
* @brief Definition for the TBM surface format YUV411 (4x1 subsampled Cb (1) and Cr (2) planes).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_YUV411 __tbm_fourcc_code('Y', 'U', '1', '1')
/**
* @brief Definition for the TBM surface format YVU411 (4x1 subsampled Cr (1) and Cb (2) planes).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_YVU411 __tbm_fourcc_code('Y', 'V', '1', '1')
/**
* @brief Definition for the TBM surface format YUV420 (2x2 subsampled Cb (1) and Cr (2) planes).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_YUV420 __tbm_fourcc_code('Y', 'U', '1', '2')
/**
* @brief Definition for the TBM surface format YVU420 (2x2 subsampled Cr (1) and Cb (2) planes).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_YVU420 __tbm_fourcc_code('Y', 'V', '1', '2')
/**
* @brief Definition for the TBM surface format YUV422 (2x1 subsampled Cb (1) and Cr (2) planes).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_YUV422 __tbm_fourcc_code('Y', 'U', '1', '6')
/**
* @brief Definition for the TBM surface format YVU422 (2x1 subsampled Cr (1) and Cb (2) planes).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_YVU422 __tbm_fourcc_code('Y', 'V', '1', '6')
/**
* @brief Definition for the TBM surface format YUV444 (non-subsampled Cb (1) and Cr (2) planes).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_YUV444 __tbm_fourcc_code('Y', 'U', '2', '4')
/**
* @brief Definition for the TBM surface format YVU444 (non-subsampled Cr (1) and Cb (2) planes).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
#define TBM_FORMAT_YVU444 __tbm_fourcc_code('Y', 'V', '2', '4')
/**
* @brief Queries surface format list and number of format supported by the system.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @remarks You must release the formats using free().
*
* @brief Creates the tbm_surface.
* @details This function creates the tbm_surface with the given width, height, and format.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
*
/**
* @brief Destroys the tbm_surface.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] surface The #tbm_surface_h
*
* #TBM_SURF_OPTION_READ indicates access option to read. \n
* #TBM_SURF_OPTION_WRITE indicates access option to write.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] surface The #tbm_surface_h
* @param[in] opt The option to access the tbm_surface
/**
* @brief Unmaps the tbm_surface.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] surface The #tbm_surface_h
*
* The information of tbm_surface has width, height, format, bpp, size, number of planes and information of planes. \n
* The information of planes has stride, offset, size and pointer of plane.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] surface The #tbm_surface_h
* @param[out] info The information of the tbm_surface
/**
* @brief Gets the width of the tbm_surface.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] surface The #tbm_surface_h
*
/**
* @brief Gets the height of the tbm_surface.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] surface The #tbm_surface_h
*
/**
* @brief Gets the format of the tbm_surface.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
*
static tbm_bufmgr g_surface_bufmgr = NULL;
struct list_head g_surface_list; /* list of surfaces belonging to bufmgr */
-static int _tbm_surface_internal_get_num_planes (tbm_format format)
+static pthread_mutex_t tbm_surface_lock;
+
+static bool
+_tbm_surface_mutex_init (void)
+{
+ static bool tbm_surface_mutex_init = false;
+
+ if (tbm_surface_mutex_init)
+ return true;
+
+ if (pthread_mutex_init (&tbm_surface_lock, NULL))
+ {
+ TBM_LOG ("[libtbm] fail: tbm_surface mutex init\n");
+ return false;
+ }
+
+ tbm_surface_mutex_init = true;
+
+ return true;
+}
+
+void
+_tbm_surface_mutex_lock (void)
+{
+ if (!_tbm_surface_mutex_init ())
+ return;
+
+ pthread_mutex_lock (&tbm_surface_lock);
+}
+
+void
+_tbm_surface_mutex_unlock (void)
+{
+ pthread_mutex_unlock (&tbm_surface_lock);
+}
+
+static void
+_init_surface_bufmgr()
+{
+ g_surface_bufmgr = tbm_bufmgr_init (-1);
+}
+
+static void
+_deinit_surface_bufmgr()
+{
+ if (!g_surface_bufmgr)
+ return;
+
+ tbm_bufmgr_deinit (g_surface_bufmgr);
+ g_surface_bufmgr = NULL;
+}
+
+static int
+_tbm_surface_internal_query_size (tbm_surface_h surface)
+{
+ TBM_RETURN_VAL_IF_FAIL (surface, 0);
+
+ struct _tbm_surface *surf = (struct _tbm_surface *) surface;
+ struct _tbm_bufmgr *mgr = surf->bufmgr;
+ int size = 0;
+
+ TBM_RETURN_VAL_IF_FAIL (mgr != NULL, 0);
+ TBM_RETURN_VAL_IF_FAIL (surf->info.width > 0, 0);
+ TBM_RETURN_VAL_IF_FAIL (surf->info.height > 0, 0);
+ TBM_RETURN_VAL_IF_FAIL (surf->info.format > 0, 0);
+
+ size = mgr->backend->surface_get_size (surf, surf->info.width, surf->info.height, surf->info.format);
+
+ return size;
+}
+
+static int
+_tbm_surface_internal_query_plane_data (tbm_surface_h surface, int plane_idx, uint32_t *size, uint32_t *offset, uint32_t *pitch)
+{
+ TBM_RETURN_VAL_IF_FAIL (surface, 0);
+ TBM_RETURN_VAL_IF_FAIL (plane_idx > -1, 0);
+
+ struct _tbm_surface *surf = (struct _tbm_surface *) surface;
+ struct _tbm_bufmgr *mgr = surf->bufmgr;
+ int ret = 0;
+
+ TBM_RETURN_VAL_IF_FAIL (mgr != NULL, 0);
+ TBM_RETURN_VAL_IF_FAIL (surf->info.width > 0, 0);
+ TBM_RETURN_VAL_IF_FAIL (surf->info.height > 0, 0);
+ TBM_RETURN_VAL_IF_FAIL (surf->info.format > 0, 0);
+
+ ret = mgr->backend->surface_get_plane_data (surf, surf->info.width, surf->info.height, surf->info.format, plane_idx, size, offset, pitch);
+ if (!ret)
+ return 0;
+
+ return 1;
+}
+
+int
+tbm_surface_internal_query_supported_formats (uint32_t **formats, uint32_t *num)
+{
+ struct _tbm_bufmgr *mgr;
+ int ret = 0;
+
+ _tbm_surface_mutex_lock();
+
+ if (!g_surface_bufmgr)
+ {
+ _init_surface_bufmgr();
+ LIST_INITHEAD (&g_surface_list);
+ }
+
+ mgr = g_surface_bufmgr;
+ ret = mgr->backend->surface_supported_format (formats, num);
+
+ _tbm_surface_mutex_unlock();
+
+ return ret;
+}
+
+int tbm_surface_internal_get_num_planes (tbm_format format)
{
int num_planes = 0;
return num_planes;
}
-
-static int _tbm_surface_internal_get_bpp (tbm_format format)
+int tbm_surface_internal_get_bpp (tbm_format format)
{
int bpp = 0;
return bpp;
}
-static void
-_init_surface_bufmgr()
-{
- g_surface_bufmgr = tbm_bufmgr_init (-1);
-}
-
-static void
-_deinit_surface_bufmgr()
-{
- if (!g_surface_bufmgr)
- return;
-
- tbm_bufmgr_deinit (g_surface_bufmgr);
- g_surface_bufmgr = NULL;
-}
-
-
-int
-tbm_surface_internal_query_supported_formats (uint32_t **formats, uint32_t *num)
-{
- if (!g_surface_bufmgr)
- {
- _init_surface_bufmgr();
- LIST_INITHEAD (&g_surface_list);
- }
-
- struct _tbm_bufmgr *mgr = g_surface_bufmgr;
- int ret = 0;
-
- pthread_mutex_lock (&mgr->lock);
-
- ret = mgr->backend->surface_supported_format (formats, num);
-
- pthread_mutex_unlock (&mgr->lock);
-
- return ret;
-}
tbm_surface_h
tbm_surface_internal_create_with_flags (int width, int height, int format, int flags)
TBM_RETURN_VAL_IF_FAIL (width > 0, NULL);
TBM_RETURN_VAL_IF_FAIL (height > 0, NULL);
- if (!g_surface_bufmgr)
- {
- _init_surface_bufmgr();
- LIST_INITHEAD (&g_surface_list);
- }
-
- struct _tbm_bufmgr *mgr = g_surface_bufmgr;
-
-
- TBM_RETURN_VAL_IF_FAIL (TBM_BUFMGR_IS_VALID(mgr), NULL);
-
+ struct _tbm_bufmgr *mgr;
struct _tbm_surface *surf = NULL;
uint32_t size = 0;
uint32_t offset = 0;
uint32_t stride = 0;
int i;
+ _tbm_surface_mutex_lock();
+
+ if (!g_surface_bufmgr)
+ {
+ _init_surface_bufmgr();
+ LIST_INITHEAD (&g_surface_list);
+ }
+
+ mgr = g_surface_bufmgr;
+ if (!TBM_BUFMGR_IS_VALID(mgr))
+ {
+ _tbm_surface_mutex_unlock();
+ return NULL;
+ }
surf = calloc (1, sizeof(struct _tbm_surface));
if (!surf)
+ {
+ _tbm_surface_mutex_unlock();
return NULL;
+ }
surf->bufmgr = mgr;
surf->info.width = width;
surf->info.height = height;
surf->info.format = format;
- surf->info.bpp = _tbm_surface_internal_get_bpp (format);
- surf->info.size = tbm_surface_internal_get_size (surf);
- surf->info.num_planes = _tbm_surface_internal_get_num_planes(format);
+ surf->info.bpp = tbm_surface_internal_get_bpp (format);
+ surf->info.size = _tbm_surface_internal_query_size (surf);
+ surf->info.num_planes = tbm_surface_internal_get_num_planes(format);
/* get size, stride and offset */
for (i = 0; i < surf->info.num_planes; i++)
{
- tbm_surface_internal_get_plane_data (surf, i, &size, &offset, &stride);
+ _tbm_surface_internal_query_plane_data (surf, i, &size, &offset, &stride);
surf->info.planes[i].size = size;
surf->info.planes[i].offset = offset;
surf->info.planes[i].stride = stride;
{
_deinit_surface_bufmgr ();
LIST_DELINIT (&g_surface_list);
+ _tbm_surface_mutex_unlock();
return NULL;
}
}
LIST_ADD (&surf->item_link, &g_surface_list);
+ _tbm_surface_mutex_unlock();
+
return surf;
}
tbm_surface_h
-tbm_surface_internal_create_with_bos (int width, int height, int format, tbm_bo *bos, int num)
+tbm_surface_internal_create_with_bos (tbm_surface_info_s *info, tbm_bo *bos, int num)
{
- TBM_RETURN_VAL_IF_FAIL (width > 0, NULL);
- TBM_RETURN_VAL_IF_FAIL (height > 0, NULL);
TBM_RETURN_VAL_IF_FAIL (bos, NULL);
+ TBM_RETURN_VAL_IF_FAIL (info, NULL);
+
+ struct _tbm_bufmgr *mgr;
+ struct _tbm_surface *surf = NULL;
+ int i;
+
+ _tbm_surface_mutex_lock();
if (!g_surface_bufmgr)
{
LIST_INITHEAD (&g_surface_list);
}
-
- struct _tbm_bufmgr *mgr = g_surface_bufmgr;
-
- TBM_RETURN_VAL_IF_FAIL (TBM_BUFMGR_IS_VALID(mgr), NULL);
-
- struct _tbm_surface *surf = NULL;
- uint32_t size = 0;
- uint32_t offset = 0;
- uint32_t stride = 0;
- int i;
-
+ mgr = g_surface_bufmgr;
+ if (!TBM_BUFMGR_IS_VALID(mgr))
+ {
+ _tbm_surface_mutex_unlock();
+ return NULL;
+ }
surf = calloc (1, sizeof(struct _tbm_surface));
if (!surf)
+ {
+ _tbm_surface_mutex_unlock();
return NULL;
+ }
surf->bufmgr = mgr;
- surf->info.width = width;
- surf->info.height = height;
- surf->info.format = format;
- surf->info.bpp = _tbm_surface_internal_get_bpp (format);
- surf->info.size = tbm_surface_internal_get_size (surf);
- surf->info.num_planes = _tbm_surface_internal_get_num_planes(format);
+ surf->info.width = info->width;
+ surf->info.height = info->height;
+ surf->info.format = info->format;
+ surf->info.bpp = info->bpp;
+ surf->info.size = info->size;
+ surf->info.num_planes = info->num_planes;
/* get size, stride and offset */
- for (i = 0; i < surf->info.num_planes; i++)
+ for (i = 0; i < info->num_planes; i++)
{
- tbm_surface_internal_get_plane_data (surf, i, &size, &offset, &stride);
- surf->info.planes[i].size = size;
- surf->info.planes[i].offset = offset;
- surf->info.planes[i].stride = stride;
+ surf->info.planes[i].size = info->planes[i].size;
+ surf->info.planes[i].offset = info->planes[i].offset;
+ surf->info.planes[i].stride = info->planes[i].stride;
}
surf->flags = TBM_BO_DEFAULT;
LIST_ADD (&surf->item_link, &g_surface_list);
+ _tbm_surface_mutex_unlock();
+
return surf;
bail1:
for (i = 0; i < num; i++)
LIST_DELINIT (&g_surface_list);
}
+ _tbm_surface_mutex_unlock();
+
return NULL;
}
if (!surface)
return;
+ _tbm_surface_mutex_lock();
+
surface = (struct _tbm_surface *)surface;
for (i = 0; i < surface->num_bos; i++)
_deinit_surface_bufmgr ();
LIST_DELINIT (&g_surface_list);
}
+
+ _tbm_surface_mutex_unlock();
}
{
TBM_RETURN_VAL_IF_FAIL (surface, 0);
- struct _tbm_surface *surf = (struct _tbm_surface *) surface;
+ struct _tbm_surface *surf;
+ int num;
+
+ _tbm_surface_mutex_lock();
+
+ surf = (struct _tbm_surface *) surface;
+ num = surf->num_bos;
- return surf->num_bos;
+ _tbm_surface_mutex_unlock();
+
+ return num;
}
tbm_bo
TBM_RETURN_VAL_IF_FAIL (surface, NULL);
TBM_RETURN_VAL_IF_FAIL (bo_idx > -1, NULL);
- struct _tbm_surface *surf = (struct _tbm_surface *) surface;
+ struct _tbm_surface *surf;
+ tbm_bo bo;
+
+ _tbm_surface_mutex_lock();
+
+ surf = (struct _tbm_surface *) surface;
+ bo = surf->bos[bo_idx];
- return surf->bos[bo_idx];
+ _tbm_surface_mutex_unlock();
+
+ return bo;
}
int
{
TBM_RETURN_VAL_IF_FAIL (surface, 0);
- struct _tbm_surface *surf = (struct _tbm_surface *) surface;
- struct _tbm_bufmgr *mgr = surf->bufmgr;
- int size = 0;
+ struct _tbm_surface *surf;
+ unsigned int size;
- TBM_RETURN_VAL_IF_FAIL (mgr != NULL, 0);
- TBM_RETURN_VAL_IF_FAIL (surf->info.width > 0, 0);
- TBM_RETURN_VAL_IF_FAIL (surf->info.height > 0, 0);
- TBM_RETURN_VAL_IF_FAIL (surf->info.format > 0, 0);
+ _tbm_surface_mutex_lock();
- pthread_mutex_lock (&mgr->lock);
+ surf = (struct _tbm_surface *) surface;
+ size = surf->info.size;
- size = mgr->backend->surface_get_size (surf, surf->info.width, surf->info.height, surf->info.format);
-
- pthread_mutex_unlock (&mgr->lock);
+ _tbm_surface_mutex_unlock();
return size;
}
TBM_RETURN_VAL_IF_FAIL (surface, 0);
TBM_RETURN_VAL_IF_FAIL (plane_idx > -1, 0);
- struct _tbm_surface *surf = (struct _tbm_surface *) surface;
- struct _tbm_bufmgr *mgr = surf->bufmgr;
- int ret = 0;
+ struct _tbm_surface *surf;
- TBM_RETURN_VAL_IF_FAIL (mgr != NULL, 0);
- TBM_RETURN_VAL_IF_FAIL (surf->info.width > 0, 0);
- TBM_RETURN_VAL_IF_FAIL (surf->info.height > 0, 0);
- TBM_RETURN_VAL_IF_FAIL (surf->info.format > 0, 0);
+ _tbm_surface_mutex_lock();
- pthread_mutex_lock (&mgr->lock);
+ surf = (struct _tbm_surface *) surface;
- ret = mgr->backend->surface_get_plane_data (surf, surf->info.width, surf->info.height, surf->info.format, plane_idx, size, offset, pitch);
- if (!ret)
+ if (plane_idx >= surf->info.num_planes)
{
- pthread_mutex_unlock (&mgr->lock);
+ _tbm_surface_mutex_unlock();
return 0;
}
- pthread_mutex_unlock (&mgr->lock);
+ *size = surf->info.planes[plane_idx].size;
+ *offset = surf->info.planes[plane_idx].offset;
+ *pitch = surf->info.planes[plane_idx].stride;
+
+ _tbm_surface_mutex_unlock();
+
+ return 1;
+}
+
+int
+tbm_surface_internal_get_info (tbm_surface_h surface, int opt, tbm_surface_info_s *info, int map)
+{
+ struct _tbm_surface *surf;
+ tbm_bo_handle bo_handles[4];
+ int i;
+
+ _tbm_surface_mutex_lock();
+
+ surf = (struct _tbm_surface *)surface;
+
+ info->width = surf->info.width;
+ info->height = surf->info.height;
+ info->format = surf->info.format;
+ info->bpp = surf->info.bpp;
+ info->size = surf->info.size;
+ info->num_planes = surf->info.num_planes;
+
+ if (surf->num_bos == 1)
+ {
+ if (map == 1)
+ {
+ bo_handles[0] = tbm_bo_map (surf->bos[0], TBM_DEVICE_CPU, opt);
+ if (bo_handles[0].ptr == NULL)
+ {
+ _tbm_surface_mutex_unlock();
+ return 0;
+ }
+ }
+ else
+ {
+ bo_handles[0] = tbm_bo_get_handle (surf->bos[0], TBM_DEVICE_CPU);
+ if (bo_handles[0].ptr == NULL)
+ {
+ _tbm_surface_mutex_unlock();
+ return 0;
+ }
+ }
+
+ for (i = 0; i < surf->info.num_planes; i++)
+ {
+ info->planes[i].size = surf->info.planes[i].size;
+ info->planes[i].offset = surf->info.planes[i].offset;
+ info->planes[i].stride = surf->info.planes[i].stride;
+ info->planes[i].ptr = bo_handles[0].ptr + surf->info.planes[i].offset;
+ }
+ }
+ else
+ {
+ /* TODO: calculate the virtaul address when num_bos is over 1 */
+ }
+
+ _tbm_surface_mutex_unlock();
return 1;
}
+void
+tbm_surface_internal_unmap (tbm_surface_h surface)
+{
+ struct _tbm_surface *surf;
+ int i;
+
+ _tbm_surface_mutex_lock();
+
+ surf = (struct _tbm_surface *)surface;
+
+ for (i = 0; i < surf->num_bos; i++)
+ tbm_bo_unmap (surf->bos[i]);
+
+ _tbm_surface_mutex_unlock();
+}
+
+unsigned int
+tbm_surface_internal_get_width (tbm_surface_h surface)
+{
+ struct _tbm_surface *surf;
+ unsigned int width;
+
+ _tbm_surface_mutex_lock();
+
+ surf = (struct _tbm_surface *)surface;
+ width = surf->info.width;
+
+ _tbm_surface_mutex_unlock();
+
+ return width;
+}
+
+unsigned int
+tbm_surface_internal_get_height (tbm_surface_h surface)
+{
+ struct _tbm_surface *surf;
+ unsigned int height;
+
+ _tbm_surface_mutex_lock();
+
+ surf = (struct _tbm_surface *)surface;
+ height = surf->info.height;
+
+ _tbm_surface_mutex_unlock();
+
+ return height;
+
+}
+
+tbm_format
+tbm_surface_internal_get_format (tbm_surface_h surface)
+{
+ struct _tbm_surface *surf;
+ tbm_format format;
+
+ _tbm_surface_mutex_lock();
+
+ surf = (struct _tbm_surface *)surface;
+ format = surf->info.format;
+ _tbm_surface_mutex_unlock();
+
+ return format;
+}
/**
* @brief Queries formats which the system can support.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks The formats must be released using free().
* @param[in] bufmgr : the buffer manager
* @param[out] *formats : format array which the system can support. This pointer has to be freed by user.
/**
* @brief Creates the tbm_surface with memory type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @details
* #TBM_BO_DEFAULT is default memory: it depends on the backend\n
* #TBM_BO_SCANOUT is scanout memory\n
uint32_t format_num;
bufmgr = tbm_bufmgr_create (bufmgr_fd);
- surface = tbm_surface_internal_create_with_flags (bufmgr, 128, 128, TBM_FORMAT_YUV420, TBM_BO_DEFAULT);
+ surface = tbm_surface_internal_create_with_flags (128, 128, TBM_FORMAT_YUV420, TBM_BO_DEFAULT);
...
/**
* @brief Creates the tbm_surface with buffer objects.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] bufmgr : the buffer manager
* @param[in] width : the width of surface
* @param[in] height : the height of surface
int bufmgr_fd
tbm_bufmgr bufmgr;
tbm_surface_h surface;
+ tbm_surface_info_s info;
uint32_t *format;
uint32_t format_num;
- tbm_bo bo[2];
+ tbm_bo bo[1];
bufmgr = tbm_bufmgr_init (bufmgr_fd);
- bo[1] = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
- bo[2] = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
- surface = tbm_surface_internal_create_with_bos (bufmgr, 128, 128, TBM_FORMAT_YUV420, TBM_BO_DEFAULT);
+ bo[0] = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
+
+ info.with = 128;
+ info.height = 128;
+ info.format = TBM_FORMAT_ARGB8888;
+ info.bpp = 32;
+ info.size = 65536;
+ info.num_planes = 1;
+ info.planes[0].size = 65536;
+ info.planes[0].offset = 0;
+ info.planes[0].stride = 512;
+
+ surface = tbm_surface_internal_create_with_bos (&info, bo, 1);
...
tbm_surface_bufmgr_deinit (bufmgr);
@endcode
*/
-tbm_surface_h tbm_surface_internal_create_with_bos (int width, int height, int format, tbm_bo *bos, int num);
+tbm_surface_h tbm_surface_internal_create_with_bos (tbm_surface_info_s *info, tbm_bo *bos, int num);
/**
/**
* @brief Gets the number of buffer objects associated with the tbm_surface.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] surface : the tbm_surface_h
* @return the number of buffer objects associated with the tbm_surface_h, otherwise -1.
* @par Example
/**
* @brief Gets the buffor object by the bo_index.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] surface : the tbm_surface_h
* @param[in] bo_idx : the bo index in the the tbm_surface
* @return the buffer object, otherwise NULL.
/**
* @brief Gets the size of the surface.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] surface : the tbm_surface_h
* @return the size of tbm_surface, otherwise -1.
* @par Example
/**
* @brief Gets size, offset and pitch data of plane by the plane_index.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] surface : the tbm_surface_h
* @param[in] plane_idx : the bo index in the the tbm_surface
* @param[out] size : the size of plan in tbm_surface
*/
int tbm_surface_internal_get_plane_data (tbm_surface_h surface, int plane_idx, uint32_t *size, uint32_t *offset, uint32_t *pitch);
+/**
+ * @brief Gets number of planes by the format.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] format : the format of surface
+ * @return number of planes by the format, otherwise 0.
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+ #include <tbm_surface_internal.h>
+
+ int num;
+
+ num = tbm_surface_internal_get_num_planes (TBM_FORMAT_YUV420);
+
+ ...
+
+ @endcode
+ */
+int tbm_surface_internal_get_num_planes (tbm_format format);
+
+/**
+ * @brief Gets bpp by the format.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] format : the format of surface
+ * @return bpp by the format, otherwise 0.
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+ #include <tbm_surface_internal.h>
+
+ int bpp;
+
+ bpp = tbm_surface_internal_get_bpp (TBM_FORMAT_YUV420);
+
+ ...
+
+ @endcode
+ */
+int tbm_surface_internal_get_bpp (tbm_format format);
+
#ifdef __cplusplus
}
#endif
/**
* @brief Definition for the Tizen buffer surface.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef struct _tbm_surface * tbm_surface_h;
/**
* @brief Definition for the Tizen buffer surface format.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef uint32_t tbm_format;