aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--exynos/exynos_fimg2d.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index fbc77a3d..5873fe79 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -18,6 +18,7 @@
18#include <stdio.h> 18#include <stdio.h>
19#include <string.h> 19#include <string.h>
20#include <errno.h> 20#include <errno.h>
21#include <assert.h>
21 22
22#include <sys/mman.h> 23#include <sys/mman.h>
23#include <linux/stddef.h> 24#include <linux/stddef.h>
@@ -172,8 +173,11 @@ static int g2d_validate_blending_op(
172 * @ctx: a pointer to g2d_context structure. 173 * @ctx: a pointer to g2d_context structure.
173 * @cmd: command data. 174 * @cmd: command data.
174 * @value: value data. 175 * @value: value data.
176 *
177 * The caller has to make sure that the commands buffers have enough space
178 * left to hold the command. Use g2d_check_space() to ensure this.
175 */ 179 */
176static int g2d_add_cmd(struct g2d_context *ctx, unsigned long cmd, 180static void g2d_add_cmd(struct g2d_context *ctx, unsigned long cmd,
177 unsigned long value) 181 unsigned long value)
178{ 182{
179 switch (cmd & ~(G2D_BUF_USERPTR)) { 183 switch (cmd & ~(G2D_BUF_USERPTR)) {
@@ -183,28 +187,20 @@ static int g2d_add_cmd(struct g2d_context *ctx, unsigned long cmd,
183 case DST_PLANE2_BASE_ADDR_REG: 187 case DST_PLANE2_BASE_ADDR_REG:
184 case PAT_BASE_ADDR_REG: 188 case PAT_BASE_ADDR_REG:
185 case MASK_BASE_ADDR_REG: 189 case MASK_BASE_ADDR_REG:
186 if (ctx->cmd_buf_nr >= G2D_MAX_GEM_CMD_NR) { 190 assert(ctx->cmd_buf_nr < G2D_MAX_GEM_CMD_NR);
187 fprintf(stderr, "Overflow cmd_gem size.\n");
188 return -EINVAL;
189 }
190 191
191 ctx->cmd_buf[ctx->cmd_buf_nr].offset = cmd; 192 ctx->cmd_buf[ctx->cmd_buf_nr].offset = cmd;
192 ctx->cmd_buf[ctx->cmd_buf_nr].data = value; 193 ctx->cmd_buf[ctx->cmd_buf_nr].data = value;
193 ctx->cmd_buf_nr++; 194 ctx->cmd_buf_nr++;
194 break; 195 break;
195 default: 196 default:
196 if (ctx->cmd_nr >= G2D_MAX_CMD_NR) { 197 assert(ctx->cmd_nr < G2D_MAX_CMD_NR);
197 fprintf(stderr, "Overflow cmd size.\n");
198 return -EINVAL;
199 }
200 198
201 ctx->cmd[ctx->cmd_nr].offset = cmd; 199 ctx->cmd[ctx->cmd_nr].offset = cmd;
202 ctx->cmd[ctx->cmd_nr].data = value; 200 ctx->cmd[ctx->cmd_nr].data = value;
203 ctx->cmd_nr++; 201 ctx->cmd_nr++;
204 break; 202 break;
205 } 203 }
206
207 return 0;
208} 204}
209 205
210/* 206/*