libdrm: Changes to 'ubuntu'
.gitignore | 4
Makefile.am | 30 ++-
configure.ac | 36 ++-
exynos/Makefile.am | 3
exynos/exynos_drm.c | 19 +
exynos/exynos_drm.h | 40 ----
exynos/exynos_fimg2d.c | 253 +++++++++++++++++++------
exynos/exynos_fimg2d.h | 328 +++++++++++++++++++++++++++++++++
exynos/fimg2d.h | 325 ---------------------------------
exynos/fimg2d_reg.h | 2
freedreno/Android.mk | 3
include/drm/nouveau_drm.h | 1
intel/Android.mk | 2
intel/intel_bufmgr_gem.c | 71 +++----
intel/test_decode.c | 5
libdrm.h | 2
libkms/exynos.c | 7
nouveau/Android.mk | 3
nouveau/abi16.c | 3
nouveau/bufctx.c | 6
nouveau/nouveau.c | 117 +++++------
nouveau/nouveau.h | 1
radeon/Android.mk | 3
tests/Makefile.am | 54 ++---
tests/auth.c | 1
tests/dristat.c | 7
tests/drmstat.c | 2
tests/exynos/Makefile.am | 1
tests/exynos/exynos_fimg2d_test.c | 187 ++++++++++++++++---
tests/gem_basic.c | 102 ----------
tests/gem_flink.c | 137 --------------
tests/gem_mmap.c | 136 -------------
tests/gem_readwrite.c | 139 --------------
tests/getclient.c | 1
tests/getstats.c | 3
tests/kmstest/Makefile.am | 1
tests/kmstest/main.c | 5
tests/lock.c | 1
tests/modeprint/Makefile.am | 1
tests/modeprint/modeprint.c | 18 -
tests/modetest/modetest.c | 2
tests/name_from_fd.c | 4
tests/nouveau/.gitignore | 1
tests/nouveau/Makefile.am | 16 +
tests/nouveau/threaded.c | 156 +++++++++++++++
tests/proptest/Makefile.am | 1
tests/proptest/proptest.c | 4
tests/radeon/Makefile.am | 1
tests/radeon/list.h | 12 -
tests/radeon/radeon_ttm.c | 4
tests/setversion.c | 1
tests/tegra/Makefile.am | 2
tests/updatedraw.c | 3
tests/vbltest/Makefile.am | 2
tests/vbltest/vbltest.c | 5
xf86atomic.h | 19 +
xf86drm.c | 371 ++++++++++++++++++++++++++++++++------
xf86drm.h | 16 +
xf86drmMode.c | 59 +++---
xf86drmRandom.c | 12 -
60 files changed, 1482 insertions(+), 1269 deletions(-)
New commits:
commit f744c07a31010f09b916eefb05d788d51490ccae
Author: Alexandre Courbot <acourbot@nvidia.com>
Date: Fri Dec 5 14:55:35 2014 +0900
Add coherent BO attribute
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h
index b18cad0..87aefc5 100644
--- a/include/drm/nouveau_drm.h
+++ b/include/drm/nouveau_drm.h
@@ -96,6 +96,7 @@ struct drm_nouveau_setparam {
#define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1)
#define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
#define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3)
+#define NOUVEAU_GEM_DOMAIN_COHERENT (1 << 4)
#define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00
#define NOUVEAU_GEM_TILE_16BPP 0x00000001
diff --git a/nouveau/abi16.c b/nouveau/abi16.c
index ae13821..d2d1d0d 100644
--- a/nouveau/abi16.c
+++ b/nouveau/abi16.c
@@ -195,6 +195,9 @@ abi16_bo_init(struct nouveau_bo *bo, uint32_t alignment,
if (bo->flags & NOUVEAU_BO_MAP)
info->domain |= NOUVEAU_GEM_DOMAIN_MAPPABLE;
+ if (bo->flags & NOUVEAU_BO_COHERENT)
+ info->domain |= NOUVEAU_GEM_DOMAIN_COHERENT;
+
if (!(bo->flags & NOUVEAU_BO_CONTIG))
info->tile_flags = NOUVEAU_GEM_TILE_NONCONTIG;
diff --git a/nouveau/nouveau.h b/nouveau/nouveau.h
index a55e2b0..4adda0e 100644
--- a/nouveau/nouveau.h
+++ b/nouveau/nouveau.h
@@ -127,6 +127,7 @@ union nouveau_bo_config {
#define NOUVEAU_BO_MAP 0x80000000
#define NOUVEAU_BO_CONTIG 0x40000000
#define NOUVEAU_BO_NOSNOOP 0x20000000
+#define NOUVEAU_BO_COHERENT 0x10000000
struct nouveau_bo {
struct nouveau_device *device;
commit 858b21f6af03c9658126fd6ec2aa35b4e5151ecb
Author: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Date: Wed Mar 11 20:38:46 2015 +0100
exynos: fimg2d: follow-up fix for G2D_COEFF_MODE_GB_COLOR
Also add the register field formatting info provided by
Inki Dae <inki.dae@samsung.com>.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Suggested-by: Inki Dae <inki.dae@samsung.com>
diff --git a/exynos/exynos_fimg2d.h b/exynos/exynos_fimg2d.h
index f76f2a9..9db0c88 100644
--- a/exynos/exynos_fimg2d.h
+++ b/exynos/exynos_fimg2d.h
@@ -151,6 +151,12 @@ enum e_g2d_op {
G2D_OP_CONJOINT_DST = 0x22,
};
+/*
+ * The G2D_COEFF_MODE_DST_{COLOR,ALPHA} modes both use the ALPHA_REG(0x618)
+ * register. The registers fields are as follows:
+ * bits 31:8 = color value (RGB order)
+ * bits 7:0 = alpha value
+ */
enum e_g2d_coeff_mode {
G2D_COEFF_MODE_ONE,
G2D_COEFF_MODE_ZERO,
@@ -160,7 +166,7 @@ enum e_g2d_coeff_mode {
G2D_COEFF_MODE_DST_COLOR,
/* Global Alpha : Set by ALPHA_REG(0x618) */
G2D_COEFF_MODE_GB_ALPHA,
- /* Global Color : Set by ALPHA_REG(0x618) */
+ /* Global Color and Alpha : Set by ALPHA_REG(0x618) */
G2D_COEFF_MODE_GB_COLOR,
/* (1-SRC alpha)/DST Alpha */
G2D_COEFF_MODE_DISJOINT_S,
commit 3f12191f29c500c4adcffdcca73d74cdd93c1853
Author: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Date: Wed Mar 11 20:38:45 2015 +0100
exynos: add fimg2d header to common includes
The reason for this change is to let userspace use the header.
Currently 'make install' does not install it.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
diff --git a/exynos/Makefile.am b/exynos/Makefile.am
index 1715a85..35bc71f 100644
--- a/exynos/Makefile.am
+++ b/exynos/Makefile.am
@@ -14,11 +14,10 @@ libdrm_exynos_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
libdrm_exynos_la_SOURCES = \
exynos_drm.c \
exynos_fimg2d.c \
- exynos_fimg2d.h \
fimg2d_reg.h
libdrm_exynoscommonincludedir = ${includedir}/exynos
-libdrm_exynoscommoninclude_HEADERS = exynos_drm.h
+libdrm_exynoscommoninclude_HEADERS = exynos_drm.h exynos_fimg2d.h
libdrm_exynosincludedir = ${includedir}/libdrm
libdrm_exynosinclude_HEADERS = exynos_drmif.h
commit 9a0949a8f46b6b844ab4a1ecce79a9e9078151c6
Author: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Date: Wed Mar 11 20:38:44 2015 +0100
exynos: add exynos prefix to fimg2d header
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
diff --git a/exynos/Makefile.am b/exynos/Makefile.am
index 06bee00..1715a85 100644
--- a/exynos/Makefile.am
+++ b/exynos/Makefile.am
@@ -14,7 +14,7 @@ libdrm_exynos_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
libdrm_exynos_la_SOURCES = \
exynos_drm.c \
exynos_fimg2d.c \
- fimg2d.h \
+ exynos_fimg2d.h \
fimg2d_reg.h
libdrm_exynoscommonincludedir = ${includedir}/exynos
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index aecd1c3..fc605ed 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -27,7 +27,7 @@
#include "libdrm.h"
#include "exynos_drm.h"
#include "fimg2d_reg.h"
-#include "fimg2d.h"
+#include "exynos_fimg2d.h"
#define SET_BF(val, sc, si, scsa, scda, dc, di, dcsa, dcda) \
val.data.src_coeff = sc; \
diff --git a/exynos/exynos_fimg2d.h b/exynos/exynos_fimg2d.h
new file mode 100644
index 0000000..f76f2a9
--- /dev/null
+++ b/exynos/exynos_fimg2d.h
@@ -0,0 +1,322 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics Co.Ltd
+ * Authors:
+ * Inki Dae <inki.dae@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef _FIMG2D_H_
+#define _FIMG2D_H_
+
+#define G2D_MAX_CMD_NR 64
+#define G2D_MAX_GEM_CMD_NR 64
+#define G2D_MAX_CMD_LIST_NR 64
+#define G2D_PLANE_MAX_NR 2
+
+enum e_g2d_color_mode {
+ /* COLOR FORMAT */
+ G2D_COLOR_FMT_XRGB8888,
+ G2D_COLOR_FMT_ARGB8888,
+ G2D_COLOR_FMT_RGB565,
+ G2D_COLOR_FMT_XRGB1555,
+ G2D_COLOR_FMT_ARGB1555,
+ G2D_COLOR_FMT_XRGB4444,
+ G2D_COLOR_FMT_ARGB4444,
+ G2D_COLOR_FMT_PRGB888,
+ G2D_COLOR_FMT_YCbCr444,
+ G2D_COLOR_FMT_YCbCr422,
+ G2D_COLOR_FMT_YCbCr420,
+ /* alpha 8bit */
+ G2D_COLOR_FMT_A8,
+ /* Luminance 8bit: gray color */
+ G2D_COLOR_FMT_L8,
+ /* alpha 1bit */
+ G2D_COLOR_FMT_A1,
+ /* alpha 4bit */
+ G2D_COLOR_FMT_A4,
+ G2D_COLOR_FMT_MASK, /* VER4.1 */
+
+ /* COLOR ORDER */
+ G2D_ORDER_AXRGB = (0 << 4), /* VER4.1 */
+ G2D_ORDER_RGBAX = (1 << 4), /* VER4.1 */
+ G2D_ORDER_AXBGR = (2 << 4), /* VER4.1 */
+ G2D_ORDER_BGRAX = (3 << 4), /* VER4.1 */
+ G2D_ORDER_MASK = (3 << 4), /* VER4.1 */
+
+ /* Number of YCbCr plane */
+ G2D_YCbCr_1PLANE = (0 << 8), /* VER4.1 */
+ G2D_YCbCr_2PLANE = (1 << 8), /* VER4.1 */
+ G2D_YCbCr_PLANE_MASK = (3 << 8), /* VER4.1 */
+
+ /* Order in YCbCr */
+ G2D_YCbCr_ORDER_CrY1CbY0 = (0 << 12), /* VER4.1 */
+ G2D_YCbCr_ORDER_CbY1CrY0 = (1 << 12), /* VER4.1 */
+ G2D_YCbCr_ORDER_Y1CrY0Cb = (2 << 12), /* VER4.1 */
+ G2D_YCbCr_ORDER_Y1CbY0Cr = (3 << 12), /* VER4.1 */
+ G2D_YCbCr_ORDER_CrCb = G2D_YCbCr_ORDER_CrY1CbY0, /* VER4.1 */
+ G2D_YCbCr_ORDER_CbCr = G2D_YCbCr_ORDER_CbY1CrY0, /* VER4.1 */
+ G2D_YCbCr_ORDER_MASK = (3 < 12), /* VER4.1 */
+
+ /* CSC */
+ G2D_CSC_601 = (0 << 16), /* VER4.1 */
+ G2D_CSC_709 = (1 << 16), /* VER4.1 */
+ G2D_CSC_MASK = (1 << 16), /* VER4.1 */
+
+ /* Valid value range of YCbCr */
+ G2D_YCbCr_RANGE_NARROW = (0 << 17), /* VER4.1 */
+ G2D_YCbCr_RANGE_WIDE = (1 << 17), /* VER4.1 */
+ G2D_YCbCr_RANGE_MASK = (1 << 17), /* VER4.1 */
+
+ G2D_COLOR_MODE_MASK = 0xFFFFFFFF,
+};
+
+enum e_g2d_select_mode {
+ G2D_SELECT_MODE_NORMAL = (0 << 0),
+ G2D_SELECT_MODE_FGCOLOR = (1 << 0),
+ G2D_SELECT_MODE_BGCOLOR = (2 << 0),
+};
+
+enum e_g2d_repeat_mode {
+ G2D_REPEAT_MODE_REPEAT,
+ G2D_REPEAT_MODE_PAD,
+ G2D_REPEAT_MODE_REFLECT,
+ G2D_REPEAT_MODE_CLAMP,
+ G2D_REPEAT_MODE_NONE,
+};
+
+enum e_g2d_scale_mode {
+ G2D_SCALE_MODE_NONE = 0,
+ G2D_SCALE_MODE_NEAREST,
+ G2D_SCALE_MODE_BILINEAR,
+ G2D_SCALE_MODE_MAX,
+};
+
+enum e_g2d_buf_type {
+ G2D_IMGBUF_COLOR,
+ G2D_IMGBUF_GEM,
+ G2D_IMGBUF_USERPTR,
+};
+
+enum e_g2d_rop3_type {
+ G2D_ROP3_DST = 0xAA,
+ G2D_ROP3_SRC = 0xCC,
+ G2D_ROP3_3RD = 0xF0,
+ G2D_ROP3_MASK = 0xFF,
+};
+
+enum e_g2d_select_alpha_src {
+ G2D_SELECT_SRC_FOR_ALPHA_BLEND, /* VER4.1 */
+ G2D_SELECT_ROP_FOR_ALPHA_BLEND, /* VER4.1 */
+};
+
+enum e_g2d_transparent_mode {
+ G2D_TRANSPARENT_MODE_OPAQUE,
+ G2D_TRANSPARENT_MODE_TRANSPARENT,
+ G2D_TRANSPARENT_MODE_BLUESCREEN,
+ G2D_TRANSPARENT_MODE_MAX,
+};
+
+enum e_g2d_color_key_mode {
+ G2D_COLORKEY_MODE_DISABLE = 0,
+ G2D_COLORKEY_MODE_SRC_RGBA = (1<<0),
+ G2D_COLORKEY_MODE_DST_RGBA = (1<<1),
+ G2D_COLORKEY_MODE_SRC_YCbCr = (1<<2), /* VER4.1 */
+ G2D_COLORKEY_MODE_DST_YCbCr = (1<<3), /* VER4.1 */
+ G2D_COLORKEY_MODE_MASK = 15,
+};
+
+enum e_g2d_alpha_blend_mode {
+ G2D_ALPHA_BLEND_MODE_DISABLE,
+ G2D_ALPHA_BLEND_MODE_ENABLE,
+ G2D_ALPHA_BLEND_MODE_FADING, /* VER3.0 */
+ G2D_ALPHA_BLEND_MODE_MAX,
+};
+
+enum e_g2d_op {
+ G2D_OP_CLEAR = 0x00,
+ G2D_OP_SRC = 0x01,
+ G2D_OP_DST = 0x02,
+ G2D_OP_OVER = 0x03,
+ G2D_OP_INTERPOLATE = 0x04,
+ G2D_OP_DISJOINT_CLEAR = 0x10,
+ G2D_OP_DISJOINT_SRC = 0x11,
+ G2D_OP_DISJOINT_DST = 0x12,
+ G2D_OP_CONJOINT_CLEAR = 0x20,
+ G2D_OP_CONJOINT_SRC = 0x21,
+ G2D_OP_CONJOINT_DST = 0x22,
+};
+
+enum e_g2d_coeff_mode {
+ G2D_COEFF_MODE_ONE,
+ G2D_COEFF_MODE_ZERO,
+ G2D_COEFF_MODE_SRC_ALPHA,
+ G2D_COEFF_MODE_SRC_COLOR,
+ G2D_COEFF_MODE_DST_ALPHA,
+ G2D_COEFF_MODE_DST_COLOR,
+ /* Global Alpha : Set by ALPHA_REG(0x618) */
+ G2D_COEFF_MODE_GB_ALPHA,
+ /* Global Color : Set by ALPHA_REG(0x618) */
+ G2D_COEFF_MODE_GB_COLOR,
+ /* (1-SRC alpha)/DST Alpha */
+ G2D_COEFF_MODE_DISJOINT_S,
+ /* (1-DST alpha)/SRC Alpha */
+ G2D_COEFF_MODE_DISJOINT_D,
+ /* SRC alpha/DST alpha */
+ G2D_COEFF_MODE_CONJOINT_S,
+ /* DST alpha/SRC alpha */
+ G2D_COEFF_MODE_CONJOINT_D,
+ /* DST alpha/SRC alpha */
+ G2D_COEFF_MODE_MASK
+};
+
+enum e_g2d_acoeff_mode {
+ G2D_ACOEFF_MODE_A, /* alpha */
+ G2D_ACOEFF_MODE_APGA, /* alpha + global alpha */
+ G2D_ACOEFF_MODE_AMGA, /* alpha * global alpha */
+ G2D_ACOEFF_MODE_MASK
+};
+
+union g2d_point_val {
+ unsigned int val;
+ struct {
+ /*
+ * Coordinate of Source Image
+ * Range: 0 ~ 8000 (Requirement: SrcLeftX < SrcRightX)
+ * In YCbCr 422 and YCbCr 420 format with even number.
+ */
+ unsigned int x:16;
+ /*
+ * Y Coordinate of Source Image
+ * Range: 0 ~ 8000 (Requirement: SrcTopY < SrcBottomY)
+ * In YCbCr 420 format with even number.
+ */
+ unsigned int y:16;
+ } data;
+};
+
+union g2d_rop4_val {
+ unsigned int val;
+ struct {
+ enum e_g2d_rop3_type unmasked_rop3:8;
+ enum e_g2d_rop3_type masked_rop3:8;
+ unsigned int reserved:16;
+ } data;
+};
+
+union g2d_bitblt_cmd_val {
+ unsigned int val;
+ struct {
+ /* [0:3] */
+ unsigned int mask_rop4_en:1;
+ unsigned int masking_en:1;
+ enum e_g2d_select_alpha_src rop4_alpha_en:1;
+ unsigned int dither_en:1;
+ /* [4:7] */
+ unsigned int resolved1:4;
+ /* [8:11] */
+ unsigned int cw_en:4;
+ /* [12:15] */
+ enum e_g2d_transparent_mode transparent_mode:4;
+ /* [16:19] */
+ enum e_g2d_color_key_mode color_key_mode:4;
+ /* [20:23] */
+ enum e_g2d_alpha_blend_mode alpha_blend_mode:4;
+ /* [24:27] */
+ unsigned int src_pre_multiply:1;
+ unsigned int pat_pre_multiply:1;
+ unsigned int dst_pre_multiply:1;
+ unsigned int dst_depre_multiply:1;
+ /* [28:31] */
+ unsigned int fast_solid_color_fill_en:1;
+ unsigned int reserved:3;
+ } data;
+};
+
+union g2d_blend_func_val {
+ unsigned int val;
+ struct {
+ /* [0:15] */
+ enum e_g2d_coeff_mode src_coeff:4;
+ enum e_g2d_acoeff_mode src_coeff_src_a:2;
+ enum e_g2d_acoeff_mode src_coeff_dst_a:2;
+ enum e_g2d_coeff_mode dst_coeff:4;
+ enum e_g2d_acoeff_mode dst_coeff_src_a:2;
+ enum e_g2d_acoeff_mode dst_coeff_dst_a:2;
+ /* [16:19] */
+ unsigned int inv_src_color_coeff:1;
+ unsigned int resoled1:1;
+ unsigned int inv_dst_color_coeff:1;
+ unsigned int resoled2:1;
+ /* [20:23] */
+ unsigned int lighten_en:1;
+ unsigned int darken_en:1;
+ unsigned int win_ce_src_over_en:2;
+ /* [24:31] */
+ unsigned int reserved:8;
+ } data;
+};
+
+struct g2d_image {
+ enum e_g2d_select_mode select_mode;
+ enum e_g2d_color_mode color_mode;
+ enum e_g2d_repeat_mode repeat_mode;
+ enum e_g2d_scale_mode scale_mode;
+ unsigned int xscale;
+ unsigned int yscale;
+ unsigned char rotate_90;
+ unsigned char x_dir;
+ unsigned char y_dir;
+ unsigned char component_alpha;
+ unsigned int width;
+ unsigned int height;
+ unsigned int stride;
+ unsigned int need_free;
+ unsigned int color;
+ enum e_g2d_buf_type buf_type;
+ unsigned int bo[G2D_PLANE_MAX_NR];
+ struct drm_exynos_g2d_userptr user_ptr[G2D_PLANE_MAX_NR];
+ void *mapped_ptr[G2D_PLANE_MAX_NR];
+};
+
+struct g2d_context {
+ int fd;
+ unsigned int major;
+ unsigned int minor;
+ struct drm_exynos_g2d_cmd cmd[G2D_MAX_CMD_NR];
+ struct drm_exynos_g2d_cmd cmd_buf[G2D_MAX_GEM_CMD_NR];
+ unsigned int cmd_nr;
+ unsigned int cmd_buf_nr;
+ unsigned int cmdlist_nr;
+};
+
+struct g2d_context *g2d_init(int fd);
+void g2d_fini(struct g2d_context *ctx);
+int g2d_exec(struct g2d_context *ctx);
+int g2d_solid_fill(struct g2d_context *ctx, struct g2d_image *img,
+ unsigned int x, unsigned int y, unsigned int w,
+ unsigned int h);
+int g2d_copy(struct g2d_context *ctx, struct g2d_image *src,
+ struct g2d_image *dst, unsigned int src_x,
+ unsigned int src_y, unsigned int dst_x, unsigned int dst_y,
+ unsigned int w, unsigned int h);
+int g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
+ struct g2d_image *dst, unsigned int src_x,
+ unsigned int src_y, unsigned int src_w,
+ unsigned int src_h, unsigned int dst_x,
+ unsigned int dst_y, unsigned int dst_w,
+ unsigned int dst_h, unsigned int negative);
+int g2d_blend(struct g2d_context *ctx, struct g2d_image *src,
+ struct g2d_image *dst, unsigned int src_x,
+ unsigned int src_y, unsigned int dst_x, unsigned int dst_y,
+ unsigned int w, unsigned int h, enum e_g2d_op op);
+int g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src,
+ struct g2d_image *dst, unsigned int src_x, unsigned int src_y,
+ unsigned int src_w, unsigned int src_h, unsigned int dst_x,
+ unsigned int dst_y, unsigned int dst_w, unsigned int dst_h,
+ enum e_g2d_op op);
+#endif /* _FIMG2D_H_ */
diff --git a/exynos/fimg2d.h b/exynos/fimg2d.h
deleted file mode 100644
index f76f2a9..0000000
--- a/exynos/fimg2d.h
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright (C) 2013 Samsung Electronics Co.Ltd
- * Authors:
- * Inki Dae <inki.dae@samsung.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- */
-
-#ifndef _FIMG2D_H_
-#define _FIMG2D_H_
-
-#define G2D_MAX_CMD_NR 64
-#define G2D_MAX_GEM_CMD_NR 64
-#define G2D_MAX_CMD_LIST_NR 64
-#define G2D_PLANE_MAX_NR 2
-
-enum e_g2d_color_mode {
- /* COLOR FORMAT */
- G2D_COLOR_FMT_XRGB8888,
- G2D_COLOR_FMT_ARGB8888,
- G2D_COLOR_FMT_RGB565,
- G2D_COLOR_FMT_XRGB1555,
- G2D_COLOR_FMT_ARGB1555,
- G2D_COLOR_FMT_XRGB4444,
- G2D_COLOR_FMT_ARGB4444,
- G2D_COLOR_FMT_PRGB888,
- G2D_COLOR_FMT_YCbCr444,
- G2D_COLOR_FMT_YCbCr422,
- G2D_COLOR_FMT_YCbCr420,
- /* alpha 8bit */
- G2D_COLOR_FMT_A8,
- /* Luminance 8bit: gray color */
- G2D_COLOR_FMT_L8,
- /* alpha 1bit */
- G2D_COLOR_FMT_A1,
- /* alpha 4bit */
- G2D_COLOR_FMT_A4,
- G2D_COLOR_FMT_MASK, /* VER4.1 */
-
- /* COLOR ORDER */
- G2D_ORDER_AXRGB = (0 << 4), /* VER4.1 */
- G2D_ORDER_RGBAX = (1 << 4), /* VER4.1 */
- G2D_ORDER_AXBGR = (2 << 4), /* VER4.1 */
- G2D_ORDER_BGRAX = (3 << 4), /* VER4.1 */
- G2D_ORDER_MASK = (3 << 4), /* VER4.1 */
-
- /* Number of YCbCr plane */
- G2D_YCbCr_1PLANE = (0 << 8), /* VER4.1 */
- G2D_YCbCr_2PLANE = (1 << 8), /* VER4.1 */
- G2D_YCbCr_PLANE_MASK = (3 << 8), /* VER4.1 */
-
- /* Order in YCbCr */
- G2D_YCbCr_ORDER_CrY1CbY0 = (0 << 12), /* VER4.1 */
- G2D_YCbCr_ORDER_CbY1CrY0 = (1 << 12), /* VER4.1 */
- G2D_YCbCr_ORDER_Y1CrY0Cb = (2 << 12), /* VER4.1 */
- G2D_YCbCr_ORDER_Y1CbY0Cr = (3 << 12), /* VER4.1 */
- G2D_YCbCr_ORDER_CrCb = G2D_YCbCr_ORDER_CrY1CbY0, /* VER4.1 */
- G2D_YCbCr_ORDER_CbCr = G2D_YCbCr_ORDER_CbY1CrY0, /* VER4.1 */
- G2D_YCbCr_ORDER_MASK = (3 < 12), /* VER4.1 */
-
- /* CSC */
- G2D_CSC_601 = (0 << 16), /* VER4.1 */
- G2D_CSC_709 = (1 << 16), /* VER4.1 */
- G2D_CSC_MASK = (1 << 16), /* VER4.1 */
-
- /* Valid value range of YCbCr */
- G2D_YCbCr_RANGE_NARROW = (0 << 17), /* VER4.1 */
- G2D_YCbCr_RANGE_WIDE = (1 << 17), /* VER4.1 */
- G2D_YCbCr_RANGE_MASK = (1 << 17), /* VER4.1 */
-
- G2D_COLOR_MODE_MASK = 0xFFFFFFFF,
-};
-
-enum e_g2d_select_mode {
- G2D_SELECT_MODE_NORMAL = (0 << 0),
- G2D_SELECT_MODE_FGCOLOR = (1 << 0),
- G2D_SELECT_MODE_BGCOLOR = (2 << 0),
-};
-
-enum e_g2d_repeat_mode {
- G2D_REPEAT_MODE_REPEAT,
- G2D_REPEAT_MODE_PAD,
- G2D_REPEAT_MODE_REFLECT,
- G2D_REPEAT_MODE_CLAMP,
- G2D_REPEAT_MODE_NONE,
-};
-
-enum e_g2d_scale_mode {
- G2D_SCALE_MODE_NONE = 0,
- G2D_SCALE_MODE_NEAREST,
- G2D_SCALE_MODE_BILINEAR,
- G2D_SCALE_MODE_MAX,
-};
-
-enum e_g2d_buf_type {
- G2D_IMGBUF_COLOR,
- G2D_IMGBUF_GEM,
- G2D_IMGBUF_USERPTR,
-};
-
-enum e_g2d_rop3_type {
- G2D_ROP3_DST = 0xAA,
- G2D_ROP3_SRC = 0xCC,
- G2D_ROP3_3RD = 0xF0,
- G2D_ROP3_MASK = 0xFF,
-};
-
-enum e_g2d_select_alpha_src {
- G2D_SELECT_SRC_FOR_ALPHA_BLEND, /* VER4.1 */
- G2D_SELECT_ROP_FOR_ALPHA_BLEND, /* VER4.1 */
-};
-
-enum e_g2d_transparent_mode {
- G2D_TRANSPARENT_MODE_OPAQUE,
- G2D_TRANSPARENT_MODE_TRANSPARENT,
- G2D_TRANSPARENT_MODE_BLUESCREEN,
- G2D_TRANSPARENT_MODE_MAX,
-};
-
-enum e_g2d_color_key_mode {
- G2D_COLORKEY_MODE_DISABLE = 0,
- G2D_COLORKEY_MODE_SRC_RGBA = (1<<0),
- G2D_COLORKEY_MODE_DST_RGBA = (1<<1),
- G2D_COLORKEY_MODE_SRC_YCbCr = (1<<2), /* VER4.1 */
- G2D_COLORKEY_MODE_DST_YCbCr = (1<<3), /* VER4.1 */
- G2D_COLORKEY_MODE_MASK = 15,
-};
-
-enum e_g2d_alpha_blend_mode {
- G2D_ALPHA_BLEND_MODE_DISABLE,
- G2D_ALPHA_BLEND_MODE_ENABLE,
- G2D_ALPHA_BLEND_MODE_FADING, /* VER3.0 */
- G2D_ALPHA_BLEND_MODE_MAX,
-};
-
-enum e_g2d_op {
- G2D_OP_CLEAR = 0x00,
- G2D_OP_SRC = 0x01,
- G2D_OP_DST = 0x02,
- G2D_OP_OVER = 0x03,
- G2D_OP_INTERPOLATE = 0x04,
- G2D_OP_DISJOINT_CLEAR = 0x10,
- G2D_OP_DISJOINT_SRC = 0x11,
- G2D_OP_DISJOINT_DST = 0x12,
- G2D_OP_CONJOINT_CLEAR = 0x20,
- G2D_OP_CONJOINT_SRC = 0x21,
- G2D_OP_CONJOINT_DST = 0x22,
-};
-
-enum e_g2d_coeff_mode {
- G2D_COEFF_MODE_ONE,
- G2D_COEFF_MODE_ZERO,
- G2D_COEFF_MODE_SRC_ALPHA,
- G2D_COEFF_MODE_SRC_COLOR,
- G2D_COEFF_MODE_DST_ALPHA,
- G2D_COEFF_MODE_DST_COLOR,
- /* Global Alpha : Set by ALPHA_REG(0x618) */
- G2D_COEFF_MODE_GB_ALPHA,
- /* Global Color : Set by ALPHA_REG(0x618) */
- G2D_COEFF_MODE_GB_COLOR,
- /* (1-SRC alpha)/DST Alpha */
- G2D_COEFF_MODE_DISJOINT_S,
- /* (1-DST alpha)/SRC Alpha */
- G2D_COEFF_MODE_DISJOINT_D,
- /* SRC alpha/DST alpha */
- G2D_COEFF_MODE_CONJOINT_S,
- /* DST alpha/SRC alpha */
- G2D_COEFF_MODE_CONJOINT_D,
- /* DST alpha/SRC alpha */
- G2D_COEFF_MODE_MASK
-};
-
-enum e_g2d_acoeff_mode {
- G2D_ACOEFF_MODE_A, /* alpha */
- G2D_ACOEFF_MODE_APGA, /* alpha + global alpha */
- G2D_ACOEFF_MODE_AMGA, /* alpha * global alpha */
- G2D_ACOEFF_MODE_MASK
-};
-
-union g2d_point_val {
- unsigned int val;
- struct {
- /*
- * Coordinate of Source Image
- * Range: 0 ~ 8000 (Requirement: SrcLeftX < SrcRightX)
- * In YCbCr 422 and YCbCr 420 format with even number.
- */
- unsigned int x:16;
- /*
- * Y Coordinate of Source Image
- * Range: 0 ~ 8000 (Requirement: SrcTopY < SrcBottomY)
- * In YCbCr 420 format with even number.
- */
- unsigned int y:16;
- } data;
-};
-
-union g2d_rop4_val {
- unsigned int val;
- struct {
- enum e_g2d_rop3_type unmasked_rop3:8;
- enum e_g2d_rop3_type masked_rop3:8;
- unsigned int reserved:16;
- } data;
-};
-
-union g2d_bitblt_cmd_val {
- unsigned int val;
- struct {
- /* [0:3] */
- unsigned int mask_rop4_en:1;
- unsigned int masking_en:1;
- enum e_g2d_select_alpha_src rop4_alpha_en:1;
- unsigned int dither_en:1;
- /* [4:7] */
- unsigned int resolved1:4;
- /* [8:11] */
- unsigned int cw_en:4;
- /* [12:15] */
- enum e_g2d_transparent_mode transparent_mode:4;
- /* [16:19] */
- enum e_g2d_color_key_mode color_key_mode:4;
- /* [20:23] */
- enum e_g2d_alpha_blend_mode alpha_blend_mode:4;
- /* [24:27] */
- unsigned int src_pre_multiply:1;
- unsigned int pat_pre_multiply:1;
- unsigned int dst_pre_multiply:1;
- unsigned int dst_depre_multiply:1;
- /* [28:31] */
- unsigned int fast_solid_color_fill_en:1;
- unsigned int reserved:3;
- } data;
-};
-
-union g2d_blend_func_val {
- unsigned int val;
- struct {
- /* [0:15] */
- enum e_g2d_coeff_mode src_coeff:4;
- enum e_g2d_acoeff_mode src_coeff_src_a:2;
- enum e_g2d_acoeff_mode src_coeff_dst_a:2;
- enum e_g2d_coeff_mode dst_coeff:4;
- enum e_g2d_acoeff_mode dst_coeff_src_a:2;
- enum e_g2d_acoeff_mode dst_coeff_dst_a:2;
- /* [16:19] */
- unsigned int inv_src_color_coeff:1;
- unsigned int resoled1:1;
- unsigned int inv_dst_color_coeff:1;
- unsigned int resoled2:1;
- /* [20:23] */
- unsigned int lighten_en:1;
- unsigned int darken_en:1;
- unsigned int win_ce_src_over_en:2;
- /* [24:31] */
- unsigned int reserved:8;
- } data;
-};
-
-struct g2d_image {
- enum e_g2d_select_mode select_mode;
- enum e_g2d_color_mode color_mode;
- enum e_g2d_repeat_mode repeat_mode;
- enum e_g2d_scale_mode scale_mode;
- unsigned int xscale;
- unsigned int yscale;
- unsigned char rotate_90;
- unsigned char x_dir;
- unsigned char y_dir;
- unsigned char component_alpha;
- unsigned int width;
- unsigned int height;
- unsigned int stride;
- unsigned int need_free;
- unsigned int color;
- enum e_g2d_buf_type buf_type;
- unsigned int bo[G2D_PLANE_MAX_NR];
- struct drm_exynos_g2d_userptr user_ptr[G2D_PLANE_MAX_NR];
- void *mapped_ptr[G2D_PLANE_MAX_NR];
-};
-
-struct g2d_context {
- int fd;
- unsigned int major;
- unsigned int minor;
- struct drm_exynos_g2d_cmd cmd[G2D_MAX_CMD_NR];
- struct drm_exynos_g2d_cmd cmd_buf[G2D_MAX_GEM_CMD_NR];
- unsigned int cmd_nr;
- unsigned int cmd_buf_nr;
- unsigned int cmdlist_nr;
-};
-
-struct g2d_context *g2d_init(int fd);
-void g2d_fini(struct g2d_context *ctx);
-int g2d_exec(struct g2d_context *ctx);
-int g2d_solid_fill(struct g2d_context *ctx, struct g2d_image *img,
- unsigned int x, unsigned int y, unsigned int w,
- unsigned int h);
-int g2d_copy(struct g2d_context *ctx, struct g2d_image *src,
- struct g2d_image *dst, unsigned int src_x,
- unsigned int src_y, unsigned int dst_x, unsigned int dst_y,
- unsigned int w, unsigned int h);
-int g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
- struct g2d_image *dst, unsigned int src_x,
- unsigned int src_y, unsigned int src_w,
- unsigned int src_h, unsigned int dst_x,
- unsigned int dst_y, unsigned int dst_w,
- unsigned int dst_h, unsigned int negative);
-int g2d_blend(struct g2d_context *ctx, struct g2d_image *src,
- struct g2d_image *dst, unsigned int src_x,
- unsigned int src_y, unsigned int dst_x, unsigned int dst_y,
- unsigned int w, unsigned int h, enum e_g2d_op op);
-int g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src,
- struct g2d_image *dst, unsigned int src_x, unsigned int src_y,
- unsigned int src_w, unsigned int src_h, unsigned int dst_x,
- unsigned int dst_y, unsigned int dst_w, unsigned int dst_h,
- enum e_g2d_op op);
-#endif /* _FIMG2D_H_ */
diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index f674da8..880bb89 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -31,7 +31,7 @@
#include "exynos_drm.h"
#include "exynos_drmif.h"
-#include "fimg2d.h"
+#include "exynos_fimg2d.h"
#define DRM_MODULE_NAME "exynos"
#define MAX_TEST_CASE 8
commit 736d6a1f0f8292fe3f3d0b38f5d69b8693767537
Author: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Date: Mon Mar 16 22:19:28 2015 +0000
exynos: use structure initialization instead of memset
Keeps the code cleaner, since the structs have to be initialized
once anyway.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
[evelikov: squash trivial conflict]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Conflicts:
tests/exynos/exynos_fimg2d_test.c
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 5f9e9a7..aecd1c3 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -188,7 +188,7 @@ static void g2d_reset(struct g2d_context *ctx)
static int g2d_flush(struct g2d_context *ctx)
{
int ret;
- struct drm_exynos_g2d_set_cmdlist cmdlist;
+ struct drm_exynos_g2d_set_cmdlist cmdlist = {0};
if (ctx->cmd_nr == 0 && ctx->cmd_buf_nr == 0)
return -1;
@@ -198,8 +198,6 @@ static int g2d_flush(struct g2d_context *ctx)
return -EINVAL;
}
- memset(&cmdlist, 0, sizeof(struct drm_exynos_g2d_set_cmdlist));
-
cmdlist.cmd = (uint64_t)(uintptr_t)&ctx->cmd[0];
cmdlist.cmd_buf = (uint64_t)(uintptr_t)&ctx->cmd_buf[0];
cmdlist.cmd_nr = ctx->cmd_nr;
diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index 52d5543..f674da8 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -255,7 +255,7 @@ static void wait_for_user_input(int last)
static int g2d_solid_fill_test(struct exynos_device *dev, struct exynos_bo *dst)
{
struct g2d_context *ctx;
- struct g2d_image img;
+ struct g2d_image img = {0};
unsigned int count, img_w, img_h;
int ret = 0;
@@ -263,7 +263,6 @@ static int g2d_solid_fill_test(struct exynos_device *dev, struct exynos_bo *dst)
if (!ctx)
return -EFAULT;
- memset(&img, 0, sizeof(struct g2d_image));
img.bo[0] = dst->handle;
printf("solid fill test.\n");
@@ -306,7 +305,7 @@ static int g2d_copy_test(struct exynos_device *dev, struct exynos_bo *src,
enum e_g2d_buf_type type)
{
struct g2d_context *ctx;
- struct g2d_image src_img, dst_img;
+ struct g2d_image src_img = {0}, dst_img = {0};
unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
unsigned long userptr, size;
int ret;
@@ -315,8 +314,6 @@ static int g2d_copy_test(struct exynos_device *dev, struct exynos_bo *src,
if (!ctx)
return -EFAULT;
- memset(&src_img, 0, sizeof(struct g2d_image));
- memset(&dst_img, 0, sizeof(struct g2d_image));
dst_img.bo[0] = dst->handle;
src_x = 0;
@@ -389,7 +386,7 @@ static int g2d_copy_with_scale_test(struct exynos_device *dev,
enum e_g2d_buf_type type)
{
struct g2d_context *ctx;
- struct g2d_image src_img, dst_img;
+ struct g2d_image src_img = {0}, dst_img = {0};
unsigned int src_x, src_y, img_w, img_h;
unsigned long userptr, size;
int ret;
@@ -398,8 +395,6 @@ static int g2d_copy_with_scale_test(struct exynos_device *dev,
if (!ctx)
return -EFAULT;
- memset(&src_img, 0, sizeof(struct g2d_image));
- memset(&dst_img, 0, sizeof(struct g2d_image));
dst_img.bo[0] = dst->handle;
src_x = 0;
@@ -475,7 +470,7 @@ static int g2d_blend_test(struct exynos_device *dev,
enum e_g2d_buf_type type)
{
struct g2d_context *ctx;
- struct g2d_image src_img, dst_img;
+ struct g2d_image src_img = {0}, dst_img = {0};
unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
unsigned long userptr, size;
int ret;
@@ -484,8 +479,6 @@ static int g2d_blend_test(struct exynos_device *dev,
if (!ctx)
return -EFAULT;
- memset(&src_img, 0, sizeof(struct g2d_image));
- memset(&dst_img, 0, sizeof(struct g2d_image));
dst_img.bo[0] = dst->handle;
src_x = 0;
Reply to: