#define TBM_SURFACE_ALIGNMENT_PITCH_RGB (128)
#define TBM_SURFACE_ALIGNMENT_PITCH_YUV (16)
-
-/* check condition */
-#define SPRD_RETURN_IF_FAIL(cond) {\
- if (!(cond)) {\
- TBM_ERR("[%s] : '%s' failed.\n", __FUNCTION__, #cond);\
- return;\
- } \
-}
-#define SPRD_RETURN_VAL_IF_FAIL(cond, val) {\
- if (!(cond)) {\
- TBM_ERR("[%s] : '%s' failed.\n", __FUNCTION__, #cond);\
- return val;\
- } \
-}
-
struct dma_buf_info {
unsigned long size;
unsigned int fence_supported;
static int
_sprd_bo_cache_flush(tbm_bufmgr_sprd bufmgr_sprd, tbm_bo_sprd bo_sprd, int flags)
{
- SPRD_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0);
+ TBM_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0);
/* cache flush is managed by kernel side when using dma-fence. */
if (bufmgr_sprd->use_dma_fence)
_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);
+ TBM_RETURN_VAL_IF_FAIL(bo_sprd != NULL, 0);
+ TBM_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0);
if (bufmgr_sprd->use_dma_fence)
return 1;
_bo_set_cache_state(tbm_bufmgr_sprd bufmgr_sprd, tbm_bo_sprd bo_sprd, int device, int opt)
{
#ifdef USE_CACHE
- SPRD_RETURN_VAL_IF_FAIL(bo_sprd != NULL, 0);
- SPRD_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0);
+ TBM_RETURN_VAL_IF_FAIL(bo_sprd != NULL, 0);
+ TBM_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0);
char need_flush = 0;
unsigned short cntFlush = 0;
_bo_save_cache_state(tbm_bufmgr_sprd bufmgr_sprd, tbm_bo_sprd bo_sprd)
{
#ifdef USE_CACHE
- SPRD_RETURN_VAL_IF_FAIL(bo_sprd != NULL, 0);
- SPRD_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0);
+ TBM_RETURN_VAL_IF_FAIL(bo_sprd != NULL, 0);
+ TBM_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0);
if (bufmgr_sprd->use_dma_fence)
return 1;
_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);
+ TBM_RETURN_IF_FAIL(bo_sprd != NULL);
+ TBM_RETURN_IF_FAIL(bufmgr_sprd != NULL);
if (bufmgr_sprd->use_dma_fence)
return;
_bufmgr_init_cache_state(tbm_bufmgr_sprd bufmgr_sprd)
{
#ifdef USE_CACHE
- SPRD_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0);
+ TBM_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, 0);
if (bufmgr_sprd->use_dma_fence)
return 1;
_bufmgr_deinit_cache_state(tbm_bufmgr_sprd bufmgr_sprd)
{
#ifdef USE_CACHE
- SPRD_RETURN_IF_FAIL(bufmgr_sprd != NULL);
+ TBM_RETURN_IF_FAIL(bufmgr_sprd != NULL);
if (bufmgr_sprd->use_dma_fence)
return;
tbm_sprd_bufmgr_bind_native_display(tbm_backend_bufmgr_data *bufmgr_data, tbm_native_display *native_display)
{
tbm_bufmgr_sprd bufmgr_sprd = (tbm_bufmgr_sprd)bufmgr_data;
- SPRD_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, TBM_ERROR_INVALID_PARAMETER);
+ TBM_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, TBM_ERROR_INVALID_PARAMETER);
if (!tbm_drm_helper_wl_auth_server_init(native_display, bufmgr_sprd->fd,
bufmgr_sprd->device_name, 0)) {
tbm_bufmgr_sprd bufmgr_sprd = (tbm_bufmgr_sprd)bufmgr_data;
uint32_t *color_formats;
- SPRD_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, TBM_ERROR_INVALID_PARAMETER);
+ TBM_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, TBM_ERROR_INVALID_PARAMETER);
color_formats = (uint32_t *)calloc(1, sizeof(uint32_t) * TBM_COLOR_FORMAT_COUNT);
if (color_formats == NULL)
int _bo_idx = 0;
int _align_height = 0;
- SPRD_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, TBM_ERROR_INVALID_PARAMETER);
+ TBM_RETURN_VAL_IF_FAIL(bufmgr_sprd != NULL, TBM_ERROR_INVALID_PARAMETER);
switch (format) {
/* 16 bpp RGB */
unsigned long key;
void *value;
- SPRD_RETURN_IF_FAIL(bufmgr_sprd != NULL);
+ TBM_RETURN_IF_FAIL(bufmgr_sprd != NULL);
bufmgr = bufmgr_sprd->bufmgr;