2 * Copyright (C) 2013 Samsung Electronics Co.Ltd
4 * Inki Dae <inki.dae@samsung.com>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
23 #include <linux/stddef.h>
27 #include "libdrm_macros.h"
28 #include "exynos_drm.h"
29 #include "fimg2d_reg.h"
30 #include "exynos_fimg2d.h"
32 #define SET_BF(val, sc, si, scsa, scda, dc, di, dcsa, dcda) \
33 val.data.src_coeff = sc; \
34 val.data.inv_src_color_coeff = si; \
35 val.data.src_coeff_src_a = scsa; \
36 val.data.src_coeff_dst_a = scda; \
37 val.data.dst_coeff = dc; \
38 val.data.inv_dst_color_coeff = di; \
39 val.data.dst_coeff_src_a = dcsa; \
40 val.data.dst_coeff_dst_a = dcda;
42 #define MIN(a, b) ((a) < (b) ? (a) : (b))
44 enum g2d_base_addr_reg {
49 static unsigned int g2d_get_scaling(unsigned int src, unsigned int dst)
52 * The G2D hw scaling factor is a normalized inverse of the scaling factor.
53 * For example: When source width is 100 and destination width is 200
54 * (scaling of 2x), then the hw factor is NC * 100 / 200.
55 * The normalization factor (NC) is 2^16 = 0x10000.
58 return ((src << 16) / dst);
61 static unsigned int g2d_get_blend_op(enum e_g2d_op op)
63 union g2d_blend_func_val val;
69 case G2D_OP_DISJOINT_CLEAR:
70 case G2D_OP_CONJOINT_CLEAR:
71 SET_BF(val, G2D_COEFF_MODE_ZERO, 0, 0, 0, G2D_COEFF_MODE_ZERO,
75 case G2D_OP_DISJOINT_SRC:
76 case G2D_OP_CONJOINT_SRC:
77 SET_BF(val, G2D_COEFF_MODE_ONE, 0, 0, 0, G2D_COEFF_MODE_ZERO,
81 case G2D_OP_DISJOINT_DST:
82 case G2D_OP_CONJOINT_DST:
83 SET_BF(val, G2D_COEFF_MODE_ZERO, 0, 0, 0, G2D_COEFF_MODE_ONE,
87 SET_BF(val, G2D_COEFF_MODE_ONE, 0, 0, 0,
88 G2D_COEFF_MODE_SRC_ALPHA, 1, 0, 0);
90 case G2D_OP_INTERPOLATE:
91 SET_BF(val, G2D_COEFF_MODE_SRC_ALPHA, 0, 0, 0,
92 G2D_COEFF_MODE_SRC_ALPHA, 1, 0, 0);
95 fprintf(stderr, "Not support operation(%d).\n", op);
96 SET_BF(val, G2D_COEFF_MODE_ONE, 0, 0, 0, G2D_COEFF_MODE_ZERO,
105 * g2d_check_space - check if command buffers have enough space left.
107 * @ctx: a pointer to g2d_context structure.
108 * @num_cmds: number of (regular) commands.
109 * @num_gem_cmds: number of GEM commands.
111 static unsigned int g2d_check_space(const struct g2d_context *ctx,
112 unsigned int num_cmds, unsigned int num_gem_cmds)
114 if (ctx->cmd_nr + num_cmds >= G2D_MAX_CMD_NR ||
115 ctx->cmd_buf_nr + num_gem_cmds >= G2D_MAX_GEM_CMD_NR)
122 * g2d_add_cmd - set given command and value to user side command buffer.
124 * @ctx: a pointer to g2d_context structure.
125 * @cmd: command data.
126 * @value: value data.
128 static int g2d_add_cmd(struct g2d_context *ctx, unsigned long cmd,
131 switch (cmd & ~(G2D_BUF_USERPTR)) {
132 case SRC_BASE_ADDR_REG:
133 case SRC_PLANE2_BASE_ADDR_REG:
134 case DST_BASE_ADDR_REG:
135 case DST_PLANE2_BASE_ADDR_REG:
136 case PAT_BASE_ADDR_REG:
137 case MASK_BASE_ADDR_REG:
138 if (ctx->cmd_buf_nr >= G2D_MAX_GEM_CMD_NR) {
139 fprintf(stderr, "Overflow cmd_gem size.\n");
143 ctx->cmd_buf[ctx->cmd_buf_nr].offset = cmd;
144 ctx->cmd_buf[ctx->cmd_buf_nr].data = value;
148 if (ctx->cmd_nr >= G2D_MAX_CMD_NR) {
149 fprintf(stderr, "Overflow cmd size.\n");
153 ctx->cmd[ctx->cmd_nr].offset = cmd;
154 ctx->cmd[ctx->cmd_nr].data = value;
163 * g2d_add_base_addr - helper function to set dst/src base address register.
165 * @ctx: a pointer to g2d_context structure.
166 * @img: a pointer to the dst/src g2d_image structure.
167 * @reg: the register that should be set.
169 static void g2d_add_base_addr(struct g2d_context *ctx, struct g2d_image *img,
170 enum g2d_base_addr_reg reg)
172 const unsigned long cmd = (reg == g2d_dst) ?
173 DST_BASE_ADDR_REG : SRC_BASE_ADDR_REG;
175 if (img->buf_type == G2D_IMGBUF_USERPTR)
176 g2d_add_cmd(ctx, cmd | G2D_BUF_USERPTR,
177 (unsigned long)&img->user_ptr[0]);
179 g2d_add_cmd(ctx, cmd, img->bo[0]);
183 * g2d_reset - reset fimg2d hardware.
185 * @ctx: a pointer to g2d_context structure.
188 static void g2d_reset(struct g2d_context *ctx)
193 g2d_add_cmd(ctx, SOFT_RESET_REG, 0x01);
197 * g2d_flush - submit all commands and values in user side command buffer
198 * to command queue aware of fimg2d dma.
200 * @ctx: a pointer to g2d_context structure.
202 * This function should be called after all commands and values to user
203 * side command buffer are set. It submits that buffer to the kernel side driver.
205 static int g2d_flush(struct g2d_context *ctx)
208 struct drm_exynos_g2d_set_cmdlist cmdlist = {0};
210 if (ctx->cmd_nr == 0 && ctx->cmd_buf_nr == 0)
213 if (ctx->cmdlist_nr >= G2D_MAX_CMD_LIST_NR) {
214 fprintf(stderr, "Overflow cmdlist.\n");
218 cmdlist.cmd = (uint64_t)(uintptr_t)&ctx->cmd[0];
219 cmdlist.cmd_buf = (uint64_t)(uintptr_t)&ctx->cmd_buf[0];
220 cmdlist.cmd_nr = ctx->cmd_nr;
221 cmdlist.cmd_buf_nr = ctx->cmd_buf_nr;
222 cmdlist.event_type = G2D_EVENT_NOT;
223 cmdlist.user_data = 0;
228 ret = drmIoctl(ctx->fd, DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST, &cmdlist);
230 fprintf(stderr, "failed to set cmdlist.\n");
240 * g2d_init - create a new g2d context and get hardware version.
242 * fd: a file descriptor to an opened drm device.
244 struct g2d_context *g2d_init(int fd)
246 struct drm_exynos_g2d_get_ver ver;
247 struct g2d_context *ctx;
250 ctx = calloc(1, sizeof(*ctx));
252 fprintf(stderr, "failed to allocate context.\n");
258 ret = drmIoctl(fd, DRM_IOCTL_EXYNOS_G2D_GET_VER, &ver);
260 fprintf(stderr, "failed to get version.\n");
265 ctx->major = ver.major;
266 ctx->minor = ver.minor;
268 printf("g2d version(%d.%d).\n", ctx->major, ctx->minor);
272 void g2d_fini(struct g2d_context *ctx)
278 * g2d_exec - start the dma to process all commands summited by g2d_flush().
280 * @ctx: a pointer to g2d_context structure.
282 int g2d_exec(struct g2d_context *ctx)
284 struct drm_exynos_g2d_exec exec;
287 if (ctx->cmdlist_nr == 0)
292 ret = drmIoctl(ctx->fd, DRM_IOCTL_EXYNOS_G2D_EXEC, &exec);
294 fprintf(stderr, "failed to execute.\n");
304 * g2d_solid_fill - fill given buffer with given color data.
306 * @ctx: a pointer to g2d_context structure.
307 * @img: a pointer to g2d_image structure including image and buffer
309 * @x: x start position to buffer filled with given color data.
310 * @y: y start position to buffer filled with given color data.
311 * @w: width value to buffer filled with given color data.
312 * @h: height value to buffer filled with given color data.
315 g2d_solid_fill(struct g2d_context *ctx, struct g2d_image *img,
316 unsigned int x, unsigned int y, unsigned int w,
319 union g2d_bitblt_cmd_val bitblt;
320 union g2d_point_val pt;
322 if (g2d_check_space(ctx, 7, 1))
325 g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_NORMAL);
326 g2d_add_cmd(ctx, DST_COLOR_MODE_REG, img->color_mode);
327 g2d_add_base_addr(ctx, img, g2d_dst);
328 g2d_add_cmd(ctx, DST_STRIDE_REG, img->stride);
330 if (x + w > img->width)
332 if (y + h > img->height)
338 g2d_add_cmd(ctx, DST_LEFT_TOP_REG, pt.val);
344 g2d_add_cmd(ctx, DST_RIGHT_BOTTOM_REG, pt.val);
346 g2d_add_cmd(ctx, SF_COLOR_REG, img->color);
349 bitblt.data.fast_solid_color_fill_en = 1;
350 g2d_add_cmd(ctx, BITBLT_COMMAND_REG, bitblt.val);
352 return g2d_flush(ctx);
356 * g2d_copy - copy contents in source buffer to destination buffer.
358 * @ctx: a pointer to g2d_context structure.
359 * @src: a pointer to g2d_image structure including image and buffer
360 * information to source.
361 * @dst: a pointer to g2d_image structure including image and buffer
362 * information to destination.
363 * @src_x: x start position to source buffer.
364 * @src_y: y start position to source buffer.
365 * @dst_x: x start position to destination buffer.
366 * @dst_y: y start position to destination buffer.
367 * @w: width value to source and destination buffers.
368 * @h: height value to source and destination buffers.
371 g2d_copy(struct g2d_context *ctx, struct g2d_image *src,
372 struct g2d_image *dst, unsigned int src_x, unsigned int src_y,
373 unsigned int dst_x, unsigned dst_y, unsigned int w,
376 union g2d_rop4_val rop4;
377 union g2d_point_val pt;
378 unsigned int src_w, src_h, dst_w, dst_h;
382 if (src_x + src->width > w)
383 src_w = src->width - src_x;
384 if (src_y + src->height > h)
385 src_h = src->height - src_y;
389 if (dst_x + dst->width > w)
390 dst_w = dst->width - dst_x;
391 if (dst_y + dst->height > h)
392 dst_h = dst->height - dst_y;
394 w = MIN(src_w, dst_w);
395 h = MIN(src_h, dst_h);
397 if (w <= 0 || h <= 0) {
398 fprintf(stderr, "invalid width or height.\n");
402 if (g2d_check_space(ctx, 11, 2))
405 g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR);
406 g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
407 g2d_add_base_addr(ctx, dst, g2d_dst);
408 g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride);
410 g2d_add_cmd(ctx, SRC_SELECT_REG, G2D_SELECT_MODE_NORMAL);
411 g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode);
412 g2d_add_base_addr(ctx, src, g2d_src);
413 g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride);
418 g2d_add_cmd(ctx, SRC_LEFT_TOP_REG, pt.val);
420 pt.data.x = src_x + w;
421 pt.data.y = src_y + h;
422 g2d_add_cmd(ctx, SRC_RIGHT_BOTTOM_REG, pt.val);
427 g2d_add_cmd(ctx, DST_LEFT_TOP_REG, pt.val);
429 pt.data.x = dst_x + w;
430 pt.data.y = dst_y + h;
431 g2d_add_cmd(ctx, DST_RIGHT_BOTTOM_REG, pt.val);
434 rop4.data.unmasked_rop3 = G2D_ROP3_SRC;
435 g2d_add_cmd(ctx, ROP4_REG, rop4.val);
437 return g2d_flush(ctx);
441 * g2d_copy_with_scale - copy contents in source buffer to destination buffer
442 * scaling up or down properly.
444 * @ctx: a pointer to g2d_context structure.
445 * @src: a pointer to g2d_image structure including image and buffer
446 * information to source.
447 * @dst: a pointer to g2d_image structure including image and buffer
448 * information to destination.
449 * @src_x: x start position to source buffer.
450 * @src_y: y start position to source buffer.
451 * @src_w: width value to source buffer.
452 * @src_h: height value to source buffer.
453 * @dst_x: x start position to destination buffer.
454 * @dst_y: y start position to destination buffer.
455 * @dst_w: width value to destination buffer.
456 * @dst_h: height value to destination buffer.
457 * @negative: indicate that it uses color negative to source and
458 * destination buffers.
461 g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
462 struct g2d_image *dst, unsigned int src_x,
463 unsigned int src_y, unsigned int src_w,
464 unsigned int src_h, unsigned int dst_x,
465 unsigned int dst_y, unsigned int dst_w,
466 unsigned int dst_h, unsigned int negative)
468 union g2d_rop4_val rop4;
469 union g2d_point_val pt;
470 unsigned int scale, repeat_pad;
471 unsigned int scale_x, scale_y;
473 /* Sanitize this parameter to facilitate space computation below. */
477 if (src_w == dst_w && src_h == dst_h)
481 scale_x = g2d_get_scaling(src_w, dst_w);
482 scale_y = g2d_get_scaling(src_h, dst_h);
485 repeat_pad = src->repeat_mode == G2D_REPEAT_MODE_PAD ? 1 : 0;
487 if (src_x + src_w > src->width)
488 src_w = src->width - src_x;
489 if (src_y + src_h > src->height)
490 src_h = src->height - src_y;
492 if (dst_x + dst_w > dst->width)
493 dst_w = dst->width - dst_x;
494 if (dst_y + dst_h > dst->height)
495 dst_h = dst->height - dst_y;
497 if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0) {
498 fprintf(stderr, "invalid width or height.\n");
502 if (g2d_check_space(ctx, 12 + scale * 3 + negative + repeat_pad, 2))
505 g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR);
506 g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
507 g2d_add_base_addr(ctx, dst, g2d_dst);
508 g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride);
510 g2d_add_cmd(ctx, SRC_SELECT_REG, G2D_SELECT_MODE_NORMAL);
511 g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode);
513 g2d_add_cmd(ctx, SRC_REPEAT_MODE_REG, src->repeat_mode);
515 g2d_add_cmd(ctx, SRC_PAD_VALUE_REG, dst->color);
517 g2d_add_base_addr(ctx, src, g2d_src);
518 g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride);
521 rop4.data.unmasked_rop3 = G2D_ROP3_SRC;
524 g2d_add_cmd(ctx, BG_COLOR_REG, 0x00FFFFFF);
525 rop4.data.unmasked_rop3 ^= G2D_ROP3_DST;
528 g2d_add_cmd(ctx, ROP4_REG, rop4.val);
531 g2d_add_cmd(ctx, SRC_SCALE_CTRL_REG, G2D_SCALE_MODE_BILINEAR);
532 g2d_add_cmd(ctx, SRC_XSCALE_REG, scale_x);
533 g2d_add_cmd(ctx, SRC_YSCALE_REG, scale_y);
539 g2d_add_cmd(ctx, SRC_LEFT_TOP_REG, pt.val);
541 pt.data.x = src_x + src_w;
542 pt.data.y = src_y + src_h;
543 g2d_add_cmd(ctx, SRC_RIGHT_BOTTOM_REG, pt.val);
548 g2d_add_cmd(ctx, DST_LEFT_TOP_REG, pt.val);
550 pt.data.x = dst_x + dst_w;
551 pt.data.y = dst_y + dst_h;
552 g2d_add_cmd(ctx, DST_RIGHT_BOTTOM_REG, pt.val);
554 return g2d_flush(ctx);
558 * g2d_blend - blend image data in source and destination buffers.
560 * @ctx: a pointer to g2d_context structure.
561 * @src: a pointer to g2d_image structure including image and buffer
562 * information to source.
563 * @dst: a pointer to g2d_image structure including image and buffer
564 * information to destination.
565 * @src_x: x start position to source buffer.
566 * @src_y: y start position to source buffer.
567 * @dst_x: x start position to destination buffer.
568 * @dst_y: y start position to destination buffer.
569 * @w: width value to source and destination buffer.
570 * @h: height value to source and destination buffer.
571 * @op: blend operation type.
574 g2d_blend(struct g2d_context *ctx, struct g2d_image *src,
575 struct g2d_image *dst, unsigned int src_x,
576 unsigned int src_y, unsigned int dst_x, unsigned int dst_y,
577 unsigned int w, unsigned int h, enum e_g2d_op op)
579 union g2d_point_val pt;
580 union g2d_bitblt_cmd_val bitblt;
581 union g2d_blend_func_val blend;
582 unsigned int src_w = 0, src_h = 0, dst_w = 0, dst_h = 0;
587 if (op == G2D_OP_SRC || op == G2D_OP_CLEAR)
588 g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR);
590 g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_NORMAL);
592 g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
593 g2d_add_base_addr(ctx, dst, g2d_dst);
594 g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride);
596 g2d_add_cmd(ctx, SRC_SELECT_REG, src->select_mode);
597 g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode);
599 switch (src->select_mode) {
600 case G2D_SELECT_MODE_NORMAL:
601 g2d_add_base_addr(ctx, src, g2d_src);
602 g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride);
604 case G2D_SELECT_MODE_FGCOLOR:
605 g2d_add_cmd(ctx, FG_COLOR_REG, src->color);
607 case G2D_SELECT_MODE_BGCOLOR:
608 g2d_add_cmd(ctx, BG_COLOR_REG, src->color);
611 fprintf(stderr , "failed to set src.\n");
617 if (src_x + w > src->width)
618 src_w = src->width - src_x;
619 if (src_y + h > src->height)
620 src_h = src->height - src_y;
624 if (dst_x + w > dst->width)
625 dst_w = dst->width - dst_x;
626 if (dst_y + h > dst->height)
627 dst_h = dst->height - dst_y;
629 w = MIN(src_w, dst_w);
630 h = MIN(src_h, dst_h);
632 if (w <= 0 || h <= 0) {
633 fprintf(stderr, "invalid width or height.\n");
638 bitblt.data.alpha_blend_mode = G2D_ALPHA_BLEND_MODE_ENABLE;
639 blend.val = g2d_get_blend_op(op);
640 g2d_add_cmd(ctx, BITBLT_COMMAND_REG, bitblt.val);
641 g2d_add_cmd(ctx, BLEND_FUNCTION_REG, blend.val);
646 g2d_add_cmd(ctx, SRC_LEFT_TOP_REG, pt.val);
648 pt.data.x = src_x + w;
649 pt.data.y = src_y + h;
650 g2d_add_cmd(ctx, SRC_RIGHT_BOTTOM_REG, pt.val);
655 g2d_add_cmd(ctx, DST_LEFT_TOP_REG, pt.val);
657 pt.data.x = dst_x + w;
658 pt.data.y = dst_y + h;
659 g2d_add_cmd(ctx, DST_RIGHT_BOTTOM_REG, pt.val);
661 return g2d_flush(ctx);
665 * g2d_scale_and_blend - apply scaling to source buffer and then blend to destination buffer
667 * @ctx: a pointer to g2d_context structure.
668 * @src: a pointer to g2d_image structure including image and buffer
669 * information to source.
670 * @dst: a pointer to g2d_image structure including image and buffer
671 * information to destination.
672 * @src_x: x start position to source buffer.
673 * @src_y: y start position to source buffer.
674 * @src_w: width value to source buffer.
675 * @src_h: height value to source buffer.
676 * @dst_x: x start position to destination buffer.
677 * @dst_y: y start position to destination buffer.
678 * @dst_w: width value to destination buffer.
679 * @dst_h: height value to destination buffer.
680 * @op: blend operation type.
683 g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src,
684 struct g2d_image *dst, unsigned int src_x, unsigned int src_y,
685 unsigned int src_w, unsigned int src_h, unsigned int dst_x,
686 unsigned int dst_y, unsigned int dst_w, unsigned int dst_h,
689 union g2d_point_val pt;
690 union g2d_bitblt_cmd_val bitblt;
691 union g2d_blend_func_val blend;
693 unsigned int scale_x, scale_y;
698 if (op == G2D_OP_SRC || op == G2D_OP_CLEAR)
699 g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR);
701 g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_NORMAL);
703 g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
704 g2d_add_base_addr(ctx, dst, g2d_dst);
705 g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride);
707 g2d_add_cmd(ctx, SRC_SELECT_REG, src->select_mode);
708 g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode);
710 switch (src->select_mode) {
711 case G2D_SELECT_MODE_NORMAL:
712 g2d_add_base_addr(ctx, src, g2d_src);
713 g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride);
715 case G2D_SELECT_MODE_FGCOLOR:
716 g2d_add_cmd(ctx, FG_COLOR_REG, src->color);
718 case G2D_SELECT_MODE_BGCOLOR:
719 g2d_add_cmd(ctx, BG_COLOR_REG, src->color);
722 fprintf(stderr , "failed to set src.\n");
726 if (src_w == dst_w && src_h == dst_h)
730 scale_x = g2d_get_scaling(src_w, dst_w);
731 scale_y = g2d_get_scaling(src_h, dst_h);
734 if (src_x + src_w > src->width)
735 src_w = src->width - src_x;
736 if (src_y + src_h > src->height)
737 src_h = src->height - src_y;
739 if (dst_x + dst_w > dst->width)
740 dst_w = dst->width - dst_x;
741 if (dst_y + dst_h > dst->height)
742 dst_h = dst->height - dst_y;
744 if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0) {
745 fprintf(stderr, "invalid width or height.\n");
751 g2d_add_cmd(ctx, SRC_SCALE_CTRL_REG, G2D_SCALE_MODE_BILINEAR);
752 g2d_add_cmd(ctx, SRC_XSCALE_REG, scale_x);
753 g2d_add_cmd(ctx, SRC_YSCALE_REG, scale_y);
756 bitblt.data.alpha_blend_mode = G2D_ALPHA_BLEND_MODE_ENABLE;
757 blend.val = g2d_get_blend_op(op);
758 g2d_add_cmd(ctx, BITBLT_COMMAND_REG, bitblt.val);
759 g2d_add_cmd(ctx, BLEND_FUNCTION_REG, blend.val);
764 g2d_add_cmd(ctx, SRC_LEFT_TOP_REG, pt.val);
766 pt.data.x = src_x + src_w;
767 pt.data.y = src_y + src_h;
768 g2d_add_cmd(ctx, SRC_RIGHT_BOTTOM_REG, pt.val);
773 g2d_add_cmd(ctx, DST_LEFT_TOP_REG, pt.val);
775 pt.data.x = dst_x + dst_w;
776 pt.data.y = dst_y + dst_h;
777 g2d_add_cmd(ctx, DST_RIGHT_BOTTOM_REG, pt.val);
779 return g2d_flush(ctx);