From 5279a9ec05fb661f20959a02199712c60fb46bfa Mon Sep 17 00:00:00 2001 From: Boram Park Date: Wed, 11 May 2016 08:41:28 +0900 Subject: [PATCH] add max_attach_count variable Change-Id: Ib5f6801a489232a1ed45c83809fefa527a601a51 --- include/tdm_backend.h | 10 ++++++++++ src/tdm_pp.c | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/tdm_backend.h b/include/tdm_backend.h index e114d3c..596ca78 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -156,6 +156,11 @@ typedef struct _tdm_caps_pp { int max_w; /**< The maximum width. -1 means "not defined" */ int max_h; /**< The maximum height. -1 means "not defined" */ int preferred_align; /**< The prefered align. -1 means "not defined" */ + + int max_attach_count; /**< The attach count which a PP object can handle. + * -1 means "not defined". + * @since 1.2.0 + */ } tdm_caps_pp; /** @@ -174,6 +179,11 @@ typedef struct _tdm_caps_capture { int max_w; /**< The maximum width. -1 means "not defined" */ int max_h; /**< The maximum height. -1 means "not defined" */ int preferred_align; /**< The prefered align. -1 means "not defined" */ + + int max_attach_count; /**< The attach count which a capture object can handle. + * -1 means "not defined". + * @since 1.2.0 + */ } tdm_caps_capture; /** diff --git a/src/tdm_pp.c b/src/tdm_pp.c index 0b56073..c574d8a 100644 --- a/src/tdm_pp.c +++ b/src/tdm_pp.c @@ -360,6 +360,18 @@ tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst) return TDM_ERROR_NOT_IMPLEMENTED; } + if (tdm_display_check_module_abi(private_display, 1, 2) && + private_display->caps_pp.max_attach_count > 0) { + int length = LIST_LENGTH(&private_pp->src_pending_buffer_list) + + LIST_LENGTH(&private_pp->src_buffer_list); + if (length >= private_display->caps_pp.max_attach_count) { + _pthread_mutex_unlock(&private_display->lock); + TDM_DBG("failed: too many attached!! max_attach_count(%d)", + private_display->caps_pp.max_attach_count); + return TDM_ERROR_BAD_REQUEST; + } + } + ret = _tdm_pp_check_if_exist(private_pp, src, dst); if (ret != TDM_ERROR_NONE) { _pthread_mutex_unlock(&private_display->lock); -- 2.7.4