summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangyeon Lee <cyeon.lee@samsung.com>2016-04-25 13:15:15 +0900
committerChangyeon Lee <cyeon.lee@samsung.com>2016-04-27 12:59:51 +0900
commit48180c9f6e73f30876971468d344a64d0721a352 (patch)
treeb0043fd62b09f7fcba1c3679a22ca2b081fae249
parentcd7529d4a91040882c96feb9e08a6b6d5c6150bd (diff)
downloadlibtbm-vigs-48180c9f6e73f30876971468d344a64d0721a352.tar.gz
libtbm-vigs-48180c9f6e73f30876971468d344a64d0721a352.tar.bz2
libtbm-vigs-48180c9f6e73f30876971468d344a64d0721a352.zip
Change-Id: Ia9ea3c44f8979470f1e0d95795b5a7aafdf9284c
-rwxr-xr-xsrc/tbm_bufmgr_emulator.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/tbm_bufmgr_emulator.c b/src/tbm_bufmgr_emulator.c
index 956135a..3545016 100755
--- a/src/tbm_bufmgr_emulator.c
+++ b/src/tbm_bufmgr_emulator.c
@@ -458,6 +458,84 @@ tbm_bufmgr_emulator_bind_native_display (tbm_bufmgr bufmgr, void *native_display
return 1;
}
+static void *tbm_bufmgr_emulator_surface_bo_alloc(tbm_bo bo, int width, int height, int format, int flags, int bo_idx)
+{
+ struct vigs_drm_device *drm_dev;
+ struct vigs_drm_surface *sfc;
+ int ret;
+
+ TBM_EMULATOR_LOG_DEBUG("width = %d, height = %d, format = %x, flags = 0x%X bo_idx = %d", width, height, format, flags, bo_idx);
+
+ drm_dev = (struct vigs_drm_device*)tbm_backend_get_bufmgr_priv(bo);
+
+ if (bo_idx != 0) {
+ TBM_EMULATOR_LOG_ERROR ("Not supported bo idx");
+ return NULL;
+ }
+
+ switch(format) {
+ case TBM_FORMAT_RGB888:
+ ret = vigs_drm_surface_create(drm_dev,
+ width, height,
+ width * 3,
+ vigs_drm_surface_bgra8888, 0,
+ &sfc);
+ break;
+
+ case TBM_FORMAT_XRGB8888:
+ ret = vigs_drm_surface_create(drm_dev,
+ width, height,
+ width * 4,
+ vigs_drm_surface_bgra8888, 0,
+ &sfc);
+ break;
+
+ case TBM_FORMAT_ARGB8888:
+ ret = vigs_drm_surface_create(drm_dev,
+ width, height,
+ width * 4,
+ vigs_drm_surface_bgra8888, 0,
+ &sfc);
+ break;
+
+ case TBM_FORMAT_NV21:
+ ret = vigs_drm_surface_create(drm_dev,
+ width, height * 3 >> 1,
+ width,
+ vigs_drm_surface_bgra8888, 0,
+ &sfc);
+ break;
+
+ case TBM_FORMAT_NV61:
+ ret = vigs_drm_surface_create(drm_dev,
+ width, height * 2,
+ width,
+ vigs_drm_surface_bgra8888, 0,
+ &sfc);
+ break;
+
+ case TBM_FORMAT_YUV420:
+ ret = vigs_drm_surface_create(drm_dev,
+ width, height * 3 >> 1,
+ width,
+ vigs_drm_surface_bgra8888, 0,
+ &sfc);
+ break;
+
+ default:
+ TBM_EMULATOR_LOG_ERROR ("Not supported format");
+ return NULL;
+ }
+
+ if (ret != 0) {
+ TBM_EMULATOR_LOG_ERROR("vigs_drm_suface_create failed: %s",
+ strerror(-ret));
+ return NULL;
+ }
+
+ return sfc;
+}
+
MODULEINITPPROTO(tbm_bufmgr_emulator_init);
static TBMModuleVersionInfo EmulatorVersRec =
@@ -534,6 +612,7 @@ int tbm_bufmgr_emulator_init(tbm_bufmgr bufmgr, int fd)
backend->surface_get_plane_data = tbm_bufmgr_emulator_surface_get_plane_data;
backend->surface_supported_format = tbm_bufmgr_emulator_surface_supported_format;
backend->bufmgr_bind_native_display = tbm_bufmgr_emulator_bind_native_display;
+ backend->surface_bo_alloc = tbm_bufmgr_emulator_surface_bo_alloc;
if (!tbm_backend_init(bufmgr, backend)) {
TBM_EMULATOR_LOG_ERROR("tbm_backend_init failed");