summaryrefslogtreecommitdiff
path: root/src/g2d/fimg2d.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/g2d/fimg2d.c')
-rw-r--r--src/g2d/fimg2d.c348
1 files changed, 173 insertions, 175 deletions
diff --git a/src/g2d/fimg2d.c b/src/g2d/fimg2d.c
index a68347b..b1e4567 100644
--- a/src/g2d/fimg2d.c
+++ b/src/g2d/fimg2d.c
@@ -1,3 +1,4 @@
+#include <xorg-server.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@@ -5,17 +6,18 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
+#include <xorg-server.h>
#include "xf86drm.h"
#include "xf86drmMode.h"
-#include "exynos_drm.h"
+#include <exynos/exynos_drm.h>
#include "fimg2d.h"
-#include "sec_util.h"
+#include "exynos_util.h"
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
-#define FALSE 1
+#define FALSE 0
#endif
#define G2D_MAX_CMD 64
@@ -34,9 +36,9 @@ typedef struct _G2D_CONTEXT {
unsigned int cmd_gem_nr;
unsigned int cmdlist_nr;
-}G2dContext;
+} G2dContext;
-G2dContext* gCtx=NULL;
+G2dContext *gCtx = NULL;
static void
_g2d_clear(void)
@@ -46,19 +48,21 @@ _g2d_clear(void)
}
int
-g2d_init (int fd)
+g2d_init(int fd)
{
+#ifdef LEGACY_INTERFACE
int ret;
struct drm_exynos_g2d_get_ver ver;
- if(gCtx) return FALSE;
+ if (gCtx)
+ return FALSE;
- gCtx = calloc(1, sizeof(*gCtx));
- gCtx->drm_fd = fd;
+ gCtx = calloc(1, sizeof(*gCtx));
+ gCtx->drm_fd = fd;
ret = ioctl(fd, DRM_IOCTL_EXYNOS_G2D_GET_VER, &ver);
if (ret < 0) {
- XDBG_ERROR (MG2D, "failed to get version: %s\n", strerror(-ret));
+ XDBG_ERROR(MG2D, "failed to get version: %s\n", strerror(-ret));
free(gCtx);
gCtx = NULL;
@@ -68,32 +72,38 @@ g2d_init (int fd)
gCtx->major = ver.major;
gCtx->minor = ver.minor;
- XDBG_INFO (MG2D, "[G2D] version(%d.%d) init....OK\n", gCtx->major, gCtx->minor);
+ XDBG_INFO(MG2D, "[G2D] version(%d.%d) init....OK\n", gCtx->major,
+ gCtx->minor);
return TRUE;
+#else
+ XDBG_ERROR(MG2D, "need to check g2d functionality\n");
+ gCtx = NULL;
+ return FALSE;
+#endif
}
void
-g2d_fini (void)
+g2d_fini(void)
{
+#ifdef LEGACY_INTERFACE
free(gCtx);
gCtx = NULL;
+#endif
}
int
-g2d_add_cmd (unsigned int cmd, unsigned int value)
+g2d_add_cmd(unsigned int cmd, unsigned int value)
{
- switch(cmd) /* Check GEM Command */
- {
+ switch (cmd) { /* Check GEM Command */
case SRC_BASE_ADDR_REG:
case SRC_PLANE2_BASE_ADDR_REG:
case DST_BASE_ADDR_REG:
case DST_PLANE2_BASE_ADDR_REG:
case PAT_BASE_ADDR_REG:
case MASK_BASE_ADDR_REG:
- if(gCtx->cmd_gem_nr >= G2D_MAX_GEM_CMD)
- {
- XDBG_ERROR (MG2D, "Overflow cmd_gem size:%d\n", gCtx->cmd_gem_nr);
+ if (gCtx->cmd_gem_nr >= G2D_MAX_GEM_CMD) {
+ XDBG_ERROR(MG2D, "Overflow cmd_gem size:%d\n", gCtx->cmd_gem_nr);
return FALSE;
}
@@ -102,9 +112,8 @@ g2d_add_cmd (unsigned int cmd, unsigned int value)
gCtx->cmd_gem_nr++;
break;
default:
- if(gCtx->cmd_nr >= G2D_MAX_CMD)
- {
- XDBG_ERROR (MG2D, "Overflow cmd size:%d\n", gCtx->cmd_nr);
+ if (gCtx->cmd_nr >= G2D_MAX_CMD) {
+ XDBG_ERROR(MG2D, "Overflow cmd size:%d\n", gCtx->cmd_nr);
return FALSE;
}
@@ -118,30 +127,29 @@ g2d_add_cmd (unsigned int cmd, unsigned int value)
}
void
-g2d_reset (unsigned int clear_reg)
+g2d_reset(unsigned int clear_reg)
{
gCtx->cmd_nr = 0;
gCtx->cmd_gem_nr = 0;
- if(clear_reg)
- {
+ if (clear_reg) {
g2d_add_cmd(SOFT_RESET_REG, 0x01);
}
}
int
-g2d_exec (void)
+g2d_exec(void)
{
struct drm_exynos_g2d_exec exec;
int ret;
- if(gCtx->cmdlist_nr == 0)
+ if (gCtx->cmdlist_nr == 0)
return TRUE;
exec.async = 0;
ret = ioctl(gCtx->drm_fd, DRM_IOCTL_EXYNOS_G2D_EXEC, &exec);
if (ret < 0) {
- XDBG_ERROR (MG2D, "failed to execute(%d): %s\n", ret, strerror(-ret));
+ XDBG_ERROR(MG2D, "failed to execute(%d): %s\n", ret, strerror(-ret));
return FALSE;
}
@@ -150,24 +158,24 @@ g2d_exec (void)
}
int
-g2d_flush (void)
+g2d_flush(void)
{
+#ifdef LEGACY_INTERFACE
int ret;
struct drm_exynos_g2d_set_cmdlist cmdlist;
if (gCtx->cmd_nr == 0 && gCtx->cmd_gem_nr == 0)
return TRUE;
- if(gCtx->cmdlist_nr >= G2D_MAX_CMD_LIST)
- {
- XDBG_WARNING (MG2D, "Overflow cmdlist:%d\n", gCtx->cmdlist_nr);
+ if (gCtx->cmdlist_nr >= G2D_MAX_CMD_LIST) {
+ XDBG_WARNING(MG2D, "Overflow cmdlist:%d\n", gCtx->cmdlist_nr);
g2d_exec();
}
memset(&cmdlist, 0, sizeof(struct drm_exynos_g2d_set_cmdlist));
- cmdlist.cmd = (unsigned long)&gCtx->cmd[0];
- cmdlist.cmd_gem = (unsigned long)&gCtx->cmd_gem[0];
+ cmdlist.cmd = (unsigned long) &gCtx->cmd[0];
+ cmdlist.cmd_gem = (unsigned long) &gCtx->cmd_gem[0];
cmdlist.cmd_nr = gCtx->cmd_nr;
cmdlist.cmd_gem_nr = gCtx->cmd_gem_nr;
cmdlist.event_type = G2D_EVENT_NOT;
@@ -178,23 +186,26 @@ g2d_flush (void)
ret = ioctl(gCtx->drm_fd, DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST, &cmdlist);
if (ret < 0) {
- XDBG_ERROR (MG2D, "numFlush:%d, failed to set cmdlist(%d): %s\n", gCtx->cmdlist_nr, ret, strerror(-ret));
+ XDBG_ERROR(MG2D, "numFlush:%d, failed to set cmdlist(%d): %s\n",
+ gCtx->cmdlist_nr, ret, strerror(-ret));
return FALSE;
}
gCtx->cmdlist_nr++;
return TRUE;
+#else
+ return FALSE;
+#endif
}
-G2dImage*
+G2dImage *
g2d_image_new(void)
{
- G2dImage* img;
+ G2dImage *img;
img = calloc(1, sizeof(G2dImage));
- if(img == NULL)
- {
- XDBG_ERROR (MG2D, "Cannot create solid image\n");
+ if (img == NULL) {
+ XDBG_ERROR(MG2D, "Cannot create solid image\n");
return NULL;
}
@@ -206,20 +217,19 @@ g2d_image_new(void)
return img;
}
-G2dImage*
-g2d_image_create_solid (unsigned int color)
+G2dImage *
+g2d_image_create_solid(unsigned int color)
{
- G2dImage* img;
+ G2dImage *img;
img = g2d_image_new();
- if(img == NULL)
- {
- XDBG_ERROR (MG2D, "Cannot create solid image\n");
+ if (img == NULL) {
+ XDBG_ERROR(MG2D, "Cannot create solid image\n");
return NULL;
}
img->select_mode = G2D_SELECT_MODE_FGCOLOR;
- img->color_mode = G2D_COLOR_FMT_ARGB8888|G2D_ORDER_AXRGB;
+ img->color_mode = G2D_COLOR_FMT_ARGB8888 | G2D_ORDER_AXRGB;
img->data.color = color;
img->width = -1;
img->height = -1;
@@ -227,16 +237,15 @@ g2d_image_create_solid (unsigned int color)
return img;
}
-G2dImage*
-g2d_image_create_bo (G2dColorMode format, unsigned int width, unsigned int height,
- unsigned int bo, unsigned int stride)
+G2dImage *
+g2d_image_create_bo(G2dColorMode format, unsigned int width,
+ unsigned int height, unsigned int bo, unsigned int stride)
{
- G2dImage* img;
+ G2dImage *img;
img = g2d_image_new();
- if(img == NULL)
- {
- XDBG_ERROR (MG2D, "Cannot alloc bo\n");
+ if (img == NULL) {
+ XDBG_ERROR(MG2D, "Cannot alloc bo\n");
return NULL;
}
@@ -245,44 +254,42 @@ g2d_image_create_bo (G2dColorMode format, unsigned int width, unsigned int heigh
img->width = width;
img->height = height;
- if(bo)
- {
+ if (bo) {
img->data.bo[0] = bo;
img->stride = stride;
}
- else
- {
+ else {
unsigned int stride;
struct drm_exynos_gem_create arg;
- switch(format&G2D_COLOR_FMT_MASK)
- {
+ switch (format & G2D_COLOR_FMT_MASK) {
case G2D_COLOR_FMT_XRGB8888:
case G2D_COLOR_FMT_ARGB8888:
- stride = width*4;
+ stride = width * 4;
break;
case G2D_COLOR_FMT_A1:
- stride = (width+7) / 8;
+ stride = (width + 7) / 8;
break;
case G2D_COLOR_FMT_A4:
- stride = (width*4+7) /8;
+ stride = (width * 4 + 7) / 8;
break;
case G2D_COLOR_FMT_A8:
case G2D_COLOR_FMT_L8:
stride = width;
break;
default:
- XDBG_ERROR (MG2D, "Unsurpported format(%d)\n", format);
+ XDBG_ERROR(MG2D, "Unsurpported format(%d)\n", format);
free(img);
return NULL;
}
/* Allocation gem buffer */
arg.flags = EXYNOS_BO_CACHABLE;
- arg.size = stride*height;
- if(drmCommandWriteRead(gCtx->drm_fd, DRM_EXYNOS_GEM_CREATE, &arg, sizeof(arg)))
- {
- XDBG_ERROR (MG2D, "Cannot create bo image(flag:%x, size:%d)\n", arg.flags, (unsigned int)arg.size);
+ arg.size = stride * height;
+ if (drmCommandWriteRead
+ (gCtx->drm_fd, DRM_EXYNOS_GEM_CREATE, &arg, sizeof(arg))) {
+ XDBG_ERROR(MG2D, "Cannot create bo image(flag:%x, size:%d)\n",
+ arg.flags, (unsigned int) arg.size);
free(img);
return NULL;
}
@@ -294,14 +301,15 @@ g2d_image_create_bo (G2dColorMode format, unsigned int width, unsigned int heigh
memset(&arg_map, 0, sizeof(arg_map));
arg_map.handle = arg.handle;
arg_map.size = arg.size;
- if(drmCommandWriteRead(gCtx->drm_fd, DRM_EXYNOS_GEM_MMAP, &arg_map, sizeof(arg_map)))
- {
- XDBG_ERROR (MG2D, "Cannot map offset bo image\n");
+ if (drmCommandWriteRead
+ (gCtx->drm_fd, DRM_EXYNOS_GEM_MMAP, &arg_map,
+ sizeof(arg_map))) {
+ XDBG_ERROR(MG2D, "Cannot map offset bo image\n");
free(img);
return NULL;
}
- img->mapped_ptr[0] = (void*)(unsigned long)arg_map.mapped;
+ img->mapped_ptr[0] = (void *) (unsigned long) arg_map.mapped;
}
img->stride = stride;
@@ -312,31 +320,28 @@ g2d_image_create_bo (G2dColorMode format, unsigned int width, unsigned int heigh
return img;
}
-G2dImage*
-g2d_image_create_bo2 (G2dColorMode format,
- unsigned int width, unsigned int height,
- unsigned int bo1, unsigned int bo2, unsigned int stride)
+G2dImage *
+g2d_image_create_bo2(G2dColorMode format,
+ unsigned int width, unsigned int height,
+ unsigned int bo1, unsigned int bo2, unsigned int stride)
{
- G2dImage* img;
+ G2dImage *img;
- if (bo1 == 0)
- {
- XDBG_ERROR (MG2D, "[G2D] first bo is NULL. \n");
+ if (bo1 == 0) {
+ XDBG_ERROR(MG2D, "[G2D] first bo is NULL. \n");
return NULL;
}
if (format & G2D_YCbCr_2PLANE)
- if (bo2 == 0)
- {
- XDBG_ERROR (MG2D, "[G2D] second bo is NULL. \n");
+ if (bo2 == 0) {
+ XDBG_ERROR(MG2D, "[G2D] exynosond bo is NULL. \n");
return NULL;
}
img = g2d_image_new();
- if(img == NULL)
- {
- XDBG_ERROR (MG2D, "Cannot alloc bo\n");
+ if (img == NULL) {
+ XDBG_ERROR(MG2D, "Cannot alloc bo\n");
return NULL;
}
@@ -352,16 +357,16 @@ g2d_image_create_bo2 (G2dColorMode format,
return img;
}
-G2dImage*
-g2d_image_create_data (G2dColorMode format, unsigned int width, unsigned int height,
- void* data, unsigned int stride)
+G2dImage *
+g2d_image_create_data(G2dColorMode format, unsigned int width,
+ unsigned int height, void *data, unsigned int stride)
{
- G2dImage* img;
+#ifdef LEGACY_INTERFACE
+ G2dImage *img;
img = g2d_image_new();
- if(img == NULL)
- {
- XDBG_ERROR (MG2D, "Cannot alloc bo\n");
+ if (img == NULL) {
+ XDBG_ERROR(MG2D, "Cannot alloc bo\n");
return NULL;
}
@@ -370,62 +375,59 @@ g2d_image_create_data (G2dColorMode format, unsigned int width, unsigned int hei
img->width = width;
img->height = height;
- if(data)
- {
+ if (data) {
struct drm_exynos_gem_userptr userptr;
memset(&userptr, 0, sizeof(struct drm_exynos_gem_userptr));
- userptr.userptr = (uint64_t)((uint32_t)data);
- userptr.size = stride*height;
+ userptr.userptr = (uint64_t) ((uint32_t) data);
+ userptr.size = stride * height;
img->mapped_ptr[0] = data;
img->stride = stride;
- if(drmCommandWriteRead(gCtx->drm_fd,
- DRM_EXYNOS_GEM_USERPTR,
- &userptr, sizeof(userptr)))
- {
- XDBG_ERROR (MG2D, "Cannot create userptr(ptr:%p, size:%d)\n", (void*)((uint32_t)userptr.userptr), (uint32_t)userptr.size);
+ if (drmCommandWriteRead(gCtx->drm_fd,
+ DRM_EXYNOS_GEM_USERPTR,
+ &userptr, sizeof(userptr))) {
+ XDBG_ERROR(MG2D, "Cannot create userptr(ptr:%p, size:%d)\n",
+ (void *) ((uint32_t) userptr.userptr),
+ (uint32_t) userptr.size);
free(img);
return NULL;
}
img->data.bo[0] = userptr.handle;
img->need_free = 1;
}
- else
- {
+ else {
unsigned int stride;
struct drm_exynos_gem_create arg;
- switch(format&G2D_COLOR_FMT_MASK)
- {
+ switch (format & G2D_COLOR_FMT_MASK) {
case G2D_COLOR_FMT_XRGB8888:
case G2D_COLOR_FMT_ARGB8888:
- stride = width*4;
+ stride = width * 4;
break;
case G2D_COLOR_FMT_A1:
- stride = (width+7) / 8;
+ stride = (width + 7) / 8;
break;
case G2D_COLOR_FMT_A4:
- stride = (width*4+7) /8;
+ stride = (width * 4 + 7) / 8;
break;
case G2D_COLOR_FMT_A8:
case G2D_COLOR_FMT_L8:
stride = width;
break;
default:
- XDBG_ERROR (MG2D, "Unsurpported format(%d)\n", format);
+ XDBG_ERROR(MG2D, "Unsurpported format(%d)\n", format);
free(img);
return NULL;
}
/* Allocation gem buffer */
- arg.flags = EXYNOS_BO_NONCONTIG|EXYNOS_BO_CACHABLE;
- arg.size = stride*height;
- if(drmCommandWriteRead(gCtx->drm_fd,
- DRM_EXYNOS_GEM_CREATE,
- &arg, sizeof(arg)))
- {
- XDBG_ERROR (MG2D, "Cannot create bo image(flag:%x, size:%d)\n", arg.flags, (unsigned int)arg.size);
+ arg.flags = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE;
+ arg.size = stride * height;
+ if (drmCommandWriteRead(gCtx->drm_fd,
+ DRM_EXYNOS_GEM_CREATE, &arg, sizeof(arg))) {
+ XDBG_ERROR(MG2D, "Cannot create bo image(flag:%x, size:%d)\n",
+ arg.flags, (unsigned int) arg.size);
free(img);
return NULL;
}
@@ -437,16 +439,15 @@ g2d_image_create_data (G2dColorMode format, unsigned int width, unsigned int hei
memset(&arg_map, 0, sizeof(arg_map));
arg_map.handle = arg.handle;
arg_map.size = arg.size;
- if(drmCommandWriteRead(gCtx->drm_fd,
- DRM_EXYNOS_GEM_MMAP,
- &arg_map, sizeof(arg_map)))
- {
- XDBG_ERROR (MG2D, "Cannot map offset bo image\n");
+ if (drmCommandWriteRead(gCtx->drm_fd,
+ DRM_EXYNOS_GEM_MMAP,
+ &arg_map, sizeof(arg_map))) {
+ XDBG_ERROR(MG2D, "Cannot map offset bo image\n");
free(img);
return NULL;
}
- img->mapped_ptr[0] = (void*)(unsigned long)arg_map.mapped;
+ img->mapped_ptr[0] = (void *) (unsigned long) arg_map.mapped;
}
img->stride = stride;
@@ -455,21 +456,23 @@ g2d_image_create_data (G2dColorMode format, unsigned int width, unsigned int hei
}
return img;
+#else
+ return NULL;
+#endif
}
void
-g2d_image_free (G2dImage* img)
+g2d_image_free(G2dImage * img)
{
- if(img->need_free)
- {
+ if (img->need_free) {
struct drm_gem_close arg;
/* Free gem buffer */
memset(&arg, 0, sizeof(arg));
arg.handle = img->data.bo[0];
- if(drmIoctl(gCtx->drm_fd, DRM_IOCTL_GEM_CLOSE, &arg))
- {
- XDBG_ERROR (MG2D, "[G2D] %s:%d error: %d\n",__FUNCTION__, __LINE__, errno);
+ if (drmIoctl(gCtx->drm_fd, DRM_IOCTL_GEM_CLOSE, &arg)) {
+ XDBG_ERROR(MG2D, "[G2D] %s:%d error: %d\n", __FUNCTION__, __LINE__,
+ errno);
}
}
@@ -477,23 +480,23 @@ g2d_image_free (G2dImage* img)
}
int
-g2d_set_src(G2dImage* img)
+g2d_set_src(G2dImage * img)
{
- if(img == NULL) return FALSE;
+ if (img == NULL)
+ return FALSE;
g2d_add_cmd(SRC_SELECT_REG, img->select_mode);
g2d_add_cmd(SRC_COLOR_MODE_REG, img->color_mode);
- switch(img->select_mode)
- {
+ switch (img->select_mode) {
case G2D_SELECT_MODE_NORMAL:
g2d_add_cmd(SRC_BASE_ADDR_REG, img->data.bo[0]);
- if (img->color_mode & G2D_YCbCr_2PLANE)
- {
+ if (img->color_mode & G2D_YCbCr_2PLANE) {
if (img->data.bo[1] > 0)
g2d_add_cmd(SRC_PLANE2_BASE_ADDR_REG, img->data.bo[1]);
else
- XDBG_ERROR (MG2D, "[G2D] %s:%d error: second bo is null.\n",__FUNCTION__, __LINE__);
+ XDBG_ERROR(MG2D, "[G2D] %s:%d error: exynosond bo is null.\n",
+ __FUNCTION__, __LINE__);
}
g2d_add_cmd(SRC_STRIDE_REG, img->stride);
break;
@@ -504,7 +507,7 @@ g2d_set_src(G2dImage* img)
g2d_add_cmd(BG_COLOR_REG, img->data.color);
break;
default:
- XDBG_ERROR (MG2D, "Error: set src\n");
+ XDBG_ERROR(MG2D, "Error: set src\n");
_g2d_clear();
return FALSE;
}
@@ -513,19 +516,20 @@ g2d_set_src(G2dImage* img)
}
int
-g2d_set_mask(G2dImage* img)
+g2d_set_mask(G2dImage * img)
{
G2dMaskModeVal mode;
- if(img == NULL) return FALSE;
- if(img->select_mode != G2D_SELECT_MODE_NORMAL) return FALSE;
+ if (img == NULL)
+ return FALSE;
+ if (img->select_mode != G2D_SELECT_MODE_NORMAL)
+ return FALSE;
g2d_add_cmd(MASK_BASE_ADDR_REG, img->data.bo[0]);
g2d_add_cmd(MASK_STRIDE_REG, img->stride);
mode.val = 0;
- switch(img->color_mode & G2D_COLOR_FMT_MASK)
- {
+ switch (img->color_mode & G2D_COLOR_FMT_MASK) {
case G2D_COLOR_FMT_A1:
mode.data.maskMode = G2D_MASK_MODE_1BPP;
break;
@@ -537,19 +541,19 @@ g2d_set_mask(G2dImage* img)
break;
case G2D_COLOR_FMT_ARGB8888:
mode.data.maskMode = G2D_MASK_MODE_32BPP;
- mode.data.maskOrder = (img->color_mode&G2D_ORDER_MASK)>>4;
+ mode.data.maskOrder = (img->color_mode & G2D_ORDER_MASK) >> 4;
break;
case G2D_COLOR_FMT_RGB565:
mode.data.maskMode = G2D_MASK_MODE_16BPP_565;
- mode.data.maskOrder = (img->color_mode&G2D_ORDER_MASK)>>4;
+ mode.data.maskOrder = (img->color_mode & G2D_ORDER_MASK) >> 4;
break;
case G2D_COLOR_FMT_ARGB1555:
mode.data.maskMode = G2D_MASK_MODE_16BPP_1555;
- mode.data.maskOrder = (img->color_mode&G2D_ORDER_MASK)>>4;
+ mode.data.maskOrder = (img->color_mode & G2D_ORDER_MASK) >> 4;
break;
case G2D_COLOR_FMT_ARGB4444:
mode.data.maskMode = G2D_MASK_MODE_16BPP_4444;
- mode.data.maskOrder = (img->color_mode&G2D_ORDER_MASK)>>4;
+ mode.data.maskOrder = (img->color_mode & G2D_ORDER_MASK) >> 4;
break;
default:
break;
@@ -560,15 +564,15 @@ g2d_set_mask(G2dImage* img)
}
int
-g2d_set_dst(G2dImage* img)
+g2d_set_dst(G2dImage * img)
{
- if(img == NULL) return FALSE;
+ if (img == NULL)
+ return FALSE;
g2d_add_cmd(DST_SELECT_REG, G2D_SELECT_MODE_FGCOLOR);
g2d_add_cmd(DST_COLOR_MODE_REG, img->color_mode);
- switch(img->select_mode)
- {
+ switch (img->select_mode) {
case G2D_SELECT_MODE_NORMAL:
g2d_add_cmd(DST_BASE_ADDR_REG, img->data.bo[0]);
g2d_add_cmd(DST_STRIDE_REG, img->stride);
@@ -580,7 +584,7 @@ g2d_set_dst(G2dImage* img)
g2d_add_cmd(BG_COLOR_REG, img->data.color);
break;
default:
- XDBG_ERROR (MG2D, "Error: set src\n");
+ XDBG_ERROR(MG2D, "Error: set src\n");
_g2d_clear();
return FALSE;
}
@@ -592,6 +596,7 @@ unsigned int
g2d_get_blend_op(G2dOp op)
{
G2dBlendFunctionVal val;
+
#define set_bf(sc, si, scsa, scda, dc, di, dcsa, dcda) \
val.data.srcCoeff = sc; \
val.data.invSrcColorCoeff = si; \
@@ -603,29 +608,24 @@ g2d_get_blend_op(G2dOp op)
val.data.dstCoeffDstA = dcda
val.val = 0;
- switch (op)
- {
+ switch (op) {
case G2D_OP_CLEAR:
case G2D_OP_DISJOINT_CLEAR:
case G2D_OP_CONJOINT_CLEAR:
- set_bf (G2D_COEFF_MODE_ZERO, 0,0,0,
- G2D_COEFF_MODE_ZERO, 0,0,0);
+ set_bf(G2D_COEFF_MODE_ZERO, 0, 0, 0, G2D_COEFF_MODE_ZERO, 0, 0, 0);
break;
case G2D_OP_SRC:
case G2D_OP_DISJOINT_SRC:
case G2D_OP_CONJOINT_SRC:
- set_bf (G2D_COEFF_MODE_ONE, 0,0,0,
- G2D_COEFF_MODE_ZERO, 0,0,0);
+ set_bf(G2D_COEFF_MODE_ONE, 0, 0, 0, G2D_COEFF_MODE_ZERO, 0, 0, 0);
break;
case G2D_OP_DST:
case G2D_OP_DISJOINT_DST:
case G2D_OP_CONJOINT_DST:
- set_bf (G2D_COEFF_MODE_ZERO, 0,0,0,
- G2D_COEFF_MODE_ONE, 0,0,0);
+ set_bf(G2D_COEFF_MODE_ZERO, 0, 0, 0, G2D_COEFF_MODE_ONE, 0, 0, 0);
break;
case G2D_OP_OVER:
- set_bf (G2D_COEFF_MODE_ONE, 0,0,0,
- G2D_COEFF_MODE_SRC_ALPHA, 1,0,0);
+ set_bf(G2D_COEFF_MODE_ONE, 0, 0, 0, G2D_COEFF_MODE_SRC_ALPHA, 1, 0, 0);
break;
case G2D_OP_OVER_REVERSE:
case G2D_OP_IN:
@@ -638,9 +638,8 @@ g2d_get_blend_op(G2dOp op)
case G2D_OP_ADD:
case G2D_OP_NONE:
default:
- XDBG_ERROR (MG2D, "[FIMG2D] Not support op:%d\n", op);
- set_bf (G2D_COEFF_MODE_ONE, 0,0,0,
- G2D_COEFF_MODE_ZERO, 0,0,0);
+ XDBG_ERROR(MG2D, "[FIMG2D] Not support op:%d\n", op);
+ set_bf(G2D_COEFF_MODE_ONE, 0, 0, 0, G2D_COEFF_MODE_ZERO, 0, 0, 0);
break;
}
#undef set_bf
@@ -652,19 +651,18 @@ void
g2d_dump(void)
{
int i;
- XDBG_DEBUG (MG2D, "==================\n");
- XDBG_DEBUG (MG2D, " G2D REG DUMP \n");
- XDBG_DEBUG (MG2D, "==================\n");
-
- for(i=0; i<gCtx->cmd_gem_nr; i++)
- {
- XDBG_DEBUG (MG2D, "[GEM] 0x%08x 0x%08x\n",
- gCtx->cmd_gem[i].offset, gCtx->cmd_gem[i].data);
+
+ XDBG_DEBUG(MG2D, "==================\n");
+ XDBG_DEBUG(MG2D, " G2D REG DUMP \n");
+ XDBG_DEBUG(MG2D, "==================\n");
+
+ for (i = 0; i < gCtx->cmd_gem_nr; i++) {
+ XDBG_DEBUG(MG2D, "[GEM] 0x%08x 0x%08x\n",
+ gCtx->cmd_gem[i].offset, gCtx->cmd_gem[i].data);
}
- for(i=0; i<gCtx->cmd_nr; i++)
- {
- XDBG_DEBUG (MG2D, "[CMD] 0x%08x 0x%08x\n",
- gCtx->cmd[i].offset, gCtx->cmd[i].data);
+ for (i = 0; i < gCtx->cmd_nr; i++) {
+ XDBG_DEBUG(MG2D, "[CMD] 0x%08x 0x%08x\n",
+ gCtx->cmd[i].offset, gCtx->cmd[i].data);
}
}