[PATCH 03/14] exynos/fimg2d: add g2d_check_space()

Tobias Jakobi tjakobi at math.uni-bielefeld.de
Mon Aug 24 07:13:58 PDT 2015


This is going to be used to check if the command buffers have
enough space left prior to actual submission of the commands.

Signed-off-by: Tobias Jakobi <tjakobi at math.uni-bielefeld.de>
---
 exynos/exynos_fimg2d.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 85b2317..1ae8adf 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -102,6 +102,23 @@ static unsigned int g2d_get_blend_op(enum e_g2d_op op)
 }
 
 /*
+ * g2d_check_space - check if command buffers have enough space left.
+ *
+ * @ctx: a pointer to g2d_context structure.
+ * @num_cmds: number of (regular) commands.
+ * @num_gem_cmds: number of GEM commands.
+ */
+static unsigned int g2d_check_space(const struct g2d_context *ctx,
+	unsigned int num_cmds, unsigned int num_gem_cmds)
+{
+	if (ctx->cmd_nr + num_cmds >= G2D_MAX_CMD_NR ||
+	    ctx->cmd_buf_nr + num_gem_cmds >= G2D_MAX_GEM_CMD_NR)
+		return 1;
+	else
+		return 0;
+}
+
+/*
  * g2d_add_cmd - set given command and value to user side command buffer.
  *
  * @ctx: a pointer to g2d_context structure.
-- 
2.0.5



More information about the dri-devel mailing list