{
SPRD_RETURN_VAL_IF_FAIL(bo != NULL, 0);
- tbm_bo_sprd bo_sprd;
tbm_bufmgr_sprd bufmgr_sprd;
unsigned int sprd_flags;
+ tbm_bo_sprd bo_sprd;
bufmgr_sprd = (tbm_bufmgr_sprd)tbm_backend_get_bufmgr_priv(bo);
SPRD_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0);
sprd_flags = SPRD_BO_CONTIG;
#else
sprd_flags = _get_sprd_flag_from_tbm(flags);
- if ((flags & TBM_BO_SCANOUT) &&
- size <= 4 * 1024) {
+ if ((flags & TBM_BO_SCANOUT) && (size <= 4 * 1024))
sprd_flags |= SPRD_BO_NONCONTIG;
- }
#endif // USE_CONTIG_ONLY
+
struct drm_sprd_gem_create arg = {0, };
arg.size = (uint64_t)size;
arg.flags = sprd_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__);
+ 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) {