diff options
author | Vasiliy Ulyanov <v.ulyanov@samsung.com> | 2015-05-27 15:30:17 +0300 |
---|---|---|
committer | jinhyung.jo <jinhyung.jo@samsung.com> | 2015-08-05 11:44:06 +0900 |
commit | 16598d42852263441d27d86b5cc4fe291e369cb0 (patch) | |
tree | 2c68f81ccca6a589ec84b774afc9f348a94132b1 | |
parent | 4d71bfe0312bdb41ebbe9772eb15d0662a083413 (diff) | |
download | libtbm-vigs-16598d42852263441d27d86b5cc4fe291e369cb0.tar.gz libtbm-vigs-16598d42852263441d27d86b5cc4fe291e369cb0.tar.bz2 libtbm-vigs-16598d42852263441d27d86b5cc4fe291e369cb0.zip |
VIGS: implement bo_import_fd/bo_export_fdtizen_3.0.m2.a1_tv_releasetizen_3.0.m2.a1_mobile_releasetizen_3.0.m1_tv_releasetizen_3.0.m1_mobile_releasesubmit/tizen_wearable/20150810.070944submit/tizen_tv/20150810.070924submit/tizen_mobile/20150810.070932submit/tizen_common/20151026.085049submit/tizen_common/20151023.083358accepted/tizen/wearable/20150810.080810accepted/tizen/tv/20150810.080711accepted/tizen/mobile/20150810.080659tizen_3.0.m1_tvtizen_3.0.m1_mobile
These callbacks are required for DRI3 support
Change-Id: I1be70edf767503bedf4471fce14eb4a81ccbd27d
Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com>
-rwxr-xr-x | src/tbm_bufmgr_emulator.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/tbm_bufmgr_emulator.c b/src/tbm_bufmgr_emulator.c index a9c28c7..c158c2a 100755 --- a/src/tbm_bufmgr_emulator.c +++ b/src/tbm_bufmgr_emulator.c @@ -174,6 +174,31 @@ static void *tbm_bufmgr_emulator_bo_import(tbm_bo bo, unsigned int key) return sfc; } +static void *tbm_bufmgr_emulator_bo_import_fd(tbm_bo bo, tbm_fd key) +{ + struct vigs_drm_device *drm_dev; + struct vigs_drm_surface *sfc; + int ret; + + TBM_EMULATOR_LOG_DEBUG("bo = %p, key = %d", bo, key); + + drm_dev = (struct vigs_drm_device *)tbm_backend_get_bufmgr_priv(bo); + + ret = vigs_drm_prime_import_fd(drm_dev, key, &sfc); + + if (ret != 0) { + TBM_EMULATOR_LOG_ERROR("vigs_drm_prime_import_fd failed for key %d: %s", + key, + strerror(-ret)); + return NULL; + } + + TBM_EMULATOR_LOG_DEBUG("handle = %u", sfc->gem.handle); + + return sfc; +} + + static unsigned int tbm_bufmgr_emulator_bo_export(tbm_bo bo) { struct vigs_drm_surface *sfc; @@ -194,6 +219,28 @@ static unsigned int tbm_bufmgr_emulator_bo_export(tbm_bo bo) return sfc->gem.name; } +tbm_fd tbm_bufmgr_emulator_bo_export_fd(tbm_bo bo) +{ + struct vigs_drm_device *drm_dev; + struct vigs_drm_surface *sfc; + int ret, fd = 0; + + TBM_EMULATOR_LOG_DEBUG("bo = %p", bo); + + drm_dev = (struct vigs_drm_device *)tbm_backend_get_bufmgr_priv(bo); + sfc = (struct vigs_drm_surface *)tbm_backend_get_bo_priv(bo);; + + ret = vigs_drm_prime_export_fd(drm_dev, sfc, &fd); + + if (ret != 0) { + TBM_EMULATOR_LOG_ERROR("vigs_drm_prime_export_fd failed: %s", + strerror(-ret)); + return 0; + } + + return fd; +} + static tbm_bo_handle tbm_bufmgr_emulator_bo_get_handle(tbm_bo bo, int device) { struct vigs_drm_surface *sfc; @@ -466,7 +513,9 @@ int tbm_bufmgr_emulator_init(tbm_bufmgr bufmgr, int fd) backend->bo_alloc = tbm_bufmgr_emulator_bo_alloc; backend->bo_free = tbm_bufmgr_emulator_bo_free; backend->bo_import = tbm_bufmgr_emulator_bo_import; + backend->bo_import_fd = tbm_bufmgr_emulator_bo_import_fd; backend->bo_export = tbm_bufmgr_emulator_bo_export; + backend->bo_export_fd = tbm_bufmgr_emulator_bo_export_fd; backend->bo_get_handle = tbm_bufmgr_emulator_bo_get_handle; backend->bo_map = tbm_bufmgr_emulator_bo_map; backend->bo_unmap = tbm_bufmgr_emulator_bo_unmap; |