* [v3] libdrm: improvements to userspace exynos component
@ 2015-02-24 14:20 Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 01/17] tests/exynos: fimg2d: add a checkerboard test Tobias Jakobi
` (15 more replies)
0 siblings, 16 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark
Hello,
here are some miscellaneous improvements (small features, bugfixes, spelling fixes, etc.) for the exynos component of libdrm. The general idea is to let userspace use the G2D engine functionality more
efficiently.
If someone is interested in an application that actually makes use of this, the RetroArch frontend has a custom video backend:
https://github.com/libretro/RetroArch/blob/master/gfx/drivers/exynos_gfx.c
Please review and let me know what I can improve.
v2:
- Mention value of G2D scaling normalization factor (02/15).
- Moved patch (04/15) description from commit message to source itself, like suggested by Joonyoung Shim.
v3:
I integrated the suggestions by Emil Velikov and added two additional patches to the series. One doing the header cleanup that Emil point out, another one just a trivial whitespace thing. I'm resending
the whole series, since number of patches and order changed.
With best wishes,
Tobias
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v3 01/17] tests/exynos: fimg2d: add a checkerboard test
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 02/17] exynos: replace G2D_DOUBLE_TO_FIXED macro with function Tobias Jakobi
` (14 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
This makes it easier to spot memory corruptions which don't become
visible when using a plain buffer filled with a solid color (so
corruptions that are just a permutation of the bytes in the buffer).
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
tests/exynos/exynos_fimg2d_test.c | 117 ++++++++++++++++++++++++++++++++++++++
1 file changed, 117 insertions(+)
diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index c6bd558..41fb869 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -55,6 +55,9 @@ struct fimg2d_test_case {
int (*blend)(struct exynos_device *dev,
struct exynos_bo *src, struct exynos_bo *dst,
enum e_g2d_buf_type);
+ int (*checkerboard)(struct exynos_device *dev,
+ struct exynos_bo *src, struct exynos_bo *dst,
+ enum e_g2d_buf_type);
};
struct connector {
@@ -207,6 +210,33 @@ static struct exynos_bo *exynos_create_buffer(struct exynos_device *dev,
return bo;
}
+/* Allocate buffer and fill it with checkerboard pattern, where the tiles *
+ * have a random color. The caller has to free the buffer. */
+void *create_checkerboard_pattern(unsigned int num_tiles_x,
+ unsigned int num_tiles_y, unsigned int tile_size)
+{
+ unsigned int *buf;
+ unsigned int x, y, i, j;
+ const unsigned int stride = num_tiles_x * tile_size;
+
+ if (posix_memalign((void*)&buf, 64, num_tiles_y * tile_size * stride * 4) != 0)
+ return NULL;
+
+ for (x = 0; x < num_tiles_x; ++x) {
+ for (y = 0; y < num_tiles_y; ++y) {
+ const unsigned int color = 0xff000000 + (random() & 0xffffff);
+
+ for (i = 0; i < tile_size; ++i) {
+ for (j = 0; j < tile_size; ++j) {
+ buf[x * tile_size + y * stride * tile_size + i + j * stride] = color;
+ }
+ }
+ }
+ }
+
+ return buf;
+}
+
static void exynos_destroy_buffer(struct exynos_bo *bo)
{
exynos_bo_destroy(bo);
@@ -533,11 +563,90 @@ err_free_userptr:
return 0;
}
+static int g2d_checkerboard_test(struct exynos_device *dev,
+ struct exynos_bo *src,
+ struct exynos_bo *dst,
+ enum e_g2d_buf_type type)
+{
+ struct g2d_context *ctx;
+ struct g2d_image src_img = {0}, dst_img = {0};
+ unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
+ void *checkerboard = NULL;
+ int ret;
+
+ ctx = g2d_init(dev->fd);
+ if (!ctx)
+ return -EFAULT;
+
+ dst_img.bo[0] = dst->handle;
+
+ src_x = 0;
+ src_y = 0;
+ dst_x = 0;
+ dst_y = 0;
+
+ checkerboard = create_checkerboard_pattern(screen_width / 32, screen_height / 32, 32);
+ if (checkerboard == NULL) {
+ ret = -1;
+ goto fail;
+ }
+
+ img_w = screen_width - (screen_width % 32);
+ img_h = screen_height - (screen_height % 32);
+
+ switch (type) {
+ case G2D_IMGBUF_GEM:
+ memcpy(src->vaddr, checkerboard, img_w * img_h * 4);
+ src_img.bo[0] = src->handle;
+ break;
+ case G2D_IMGBUF_USERPTR:
+ src_img.user_ptr[0].userptr = (unsigned long)checkerboard;
+ src_img.user_ptr[0].size = img_w * img_h * 4;
+ break;
+ default:
+ ret = -EFAULT;
+ goto fail;
+ }
+
+ printf("checkerboard test with %s.\n",
+ type == G2D_IMGBUF_GEM ? "gem" : "userptr");
+
+ src_img.width = img_w;
+ src_img.height = img_h;
+ src_img.stride = src_img.width * 4;
+ src_img.buf_type = type;
+ src_img.color_mode = G2D_COLOR_FMT_ARGB8888 | G2D_ORDER_AXRGB;
+
+ dst_img.width = screen_width;
+ dst_img.height = screen_height;
+ dst_img.stride = dst_img.width * 4;
+ dst_img.buf_type = G2D_IMGBUF_GEM;
+ dst_img.color_mode = G2D_COLOR_FMT_ARGB8888 | G2D_ORDER_AXRGB;
+ src_img.color = 0xff000000;
+ ret = g2d_solid_fill(ctx, &dst_img, src_x, src_y, screen_width, screen_height);
+ if (ret < 0)
+ goto fail;
+
+ ret = g2d_copy(ctx, &src_img, &dst_img, src_x, src_y, dst_x, dst_y,
+ img_w, img_h);
+ if (ret < 0)
+ goto fail;
+
+ g2d_exec(ctx);
+
+fail:
+ free(checkerboard);
+ g2d_fini(ctx);
+
+ return ret;
+}
+
static struct fimg2d_test_case test_case = {
.solid_fill = &g2d_solid_fill_test,
.copy = &g2d_copy_test,
.copy_with_scale = &g2d_copy_with_scale_test,
.blend = &g2d_blend_test,
+ .checkerboard = &g2d_checkerboard_test,
};
static void usage(char *name)
@@ -671,6 +780,14 @@ int main(int argc, char **argv)
getchar();
+ ret = test_case.checkerboard(dev, src, bo, G2D_IMGBUF_GEM);
+ if (ret < 0) {
+ fprintf(stderr, "failed to issue checkerboard test.\n");
+ goto err_free_src;
+ }
+
+ getchar();
+
ret = test_case.blend(dev, src, bo, G2D_IMGBUF_USERPTR);
if (ret < 0)
fprintf(stderr, "failed to test blend operation.\n");
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 02/17] exynos: replace G2D_DOUBLE_TO_FIXED macro with function
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 01/17] tests/exynos: fimg2d: add a checkerboard test Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 03/17] tests/exynos: fix typos and change wording Tobias Jakobi
` (13 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
This also avoids the floating point conversion steps and just
uses pure integer arithmetic.
Since the G2D hardware scaling approach is a bit unintuitive,
document it in the function as well.
v2: Explicitly mention the normalization constant.
v3: Use common commenting style as pointed out by
Emil Velikov <emil.l.velikov at gmail.com>.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
exynos/exynos_fimg2d.c | 22 +++++++++++++++++-----
exynos/fimg2d.h | 2 --
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index ce1ba1e..9c66c3a 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -41,6 +41,18 @@
#define MIN(a, b) ((a) < (b) ? (a) : (b))
+static unsigned int g2d_get_scaling(unsigned int src, unsigned int dst)
+{
+ /*
+ * The G2D hw scaling factor is a normalized inverse of the scaling factor.
+ * For example: When source width is 100 and destination width is 200
+ * (scaling of 2x), then the hw factor is NC * 100 / 200.
+ * The normalization factor (NC) is 2^16 = 0x10000.
+ */
+
+ return ((src << 16) / dst);
+}
+
static unsigned int g2d_get_blend_op(enum e_g2d_op op)
{
union g2d_blend_func_val val;
@@ -428,7 +440,7 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
union g2d_rop4_val rop4;
union g2d_point_val pt;
unsigned int scale;
- double scale_x = 0.0f, scale_y = 0.0f;
+ unsigned int scale_x, scale_y;
g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR);
g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
@@ -454,8 +466,8 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
scale = 0;
else {
scale = 1;
- scale_x = (double)src_w / (double)dst_w;
- scale_y = (double)src_h / (double)dst_h;
+ scale_x = g2d_get_scaling(src_w, dst_w);
+ scale_y = g2d_get_scaling(src_h, dst_h);
}
if (src_x + src_w > src->width)
@@ -487,8 +499,8 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
if (scale) {
g2d_add_cmd(ctx, SRC_SCALE_CTRL_REG, G2D_SCALE_MODE_BILINEAR);
- g2d_add_cmd(ctx, SRC_XSCALE_REG, G2D_DOUBLE_TO_FIXED(scale_x));
- g2d_add_cmd(ctx, SRC_YSCALE_REG, G2D_DOUBLE_TO_FIXED(scale_y));
+ g2d_add_cmd(ctx, SRC_XSCALE_REG, scale_x);
+ g2d_add_cmd(ctx, SRC_YSCALE_REG, scale_y);
}
pt.val = 0;
diff --git a/exynos/fimg2d.h b/exynos/fimg2d.h
index 4785e2f..8e0321c 100644
--- a/exynos/fimg2d.h
+++ b/exynos/fimg2d.h
@@ -25,8 +25,6 @@
#define G2D_MAX_CMD_LIST_NR 64
#define G2D_PLANE_MAX_NR 2
-#define G2D_DOUBLE_TO_FIXED(d) ((unsigned int)((d) * 65536.0))
-
enum e_g2d_color_mode {
/* COLOR FORMAT */
G2D_COLOR_FMT_XRGB8888,
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 03/17] tests/exynos: fix typos and change wording
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 01/17] tests/exynos: fimg2d: add a checkerboard test Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 02/17] exynos: replace G2D_DOUBLE_TO_FIXED macro with function Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 04/17] tests/exynos: disable the G2D userptr/blend test Tobias Jakobi
` (12 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
No functional changes.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
exynos/exynos_fimg2d.c | 8 ++++----
tests/exynos/exynos_fimg2d_test.c | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 9c66c3a..df18a08 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -148,13 +148,13 @@ static void g2d_reset(struct g2d_context *ctx)
}
/*
- * g2d_flush - summit all commands and values in user side command buffer
+ * g2d_flush - submit all commands and values in user side command buffer
* to command queue aware of fimg2d dma.
*
* @ctx: a pointer to g2d_context structure.
*
* This function should be called after all commands and values to user
- * side command buffer is set to summit that buffer to kernel side driver.
+ * side command buffer are set. It submits that buffer to the kernel side driver.
*/
static int g2d_flush(struct g2d_context *ctx)
{
@@ -195,7 +195,7 @@ static int g2d_flush(struct g2d_context *ctx)
/**
* g2d_init - create a new g2d context and get hardware version.
*
- * fd: a file descriptor to drm device driver opened.
+ * fd: a file descriptor to an opened drm device.
*/
drm_public struct g2d_context *g2d_init(int fd)
{
@@ -527,7 +527,7 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
}
/**
- * g2d_blend - blend image data in source and destion buffers
+ * g2d_blend - blend image data in source and destination buffers.
*
* @ctx: a pointer to g2d_context structure.
* @src: a pointer to g2d_image structure including image and buffer
diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index 41fb869..aa140e5 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -39,7 +39,7 @@ static unsigned int screen_width, screen_height;
/*
* A structure to test fimg2d hw.
*
- * @solid_fild: fill given color data to source buffer.
+ * @solid_fill: fill given color data to source buffer.
* @copy: copy source to destination buffer.
* @copy_with_scale: copy source to destination buffer scaling up or
* down properly.
@@ -256,7 +256,7 @@ static int g2d_solid_fill_test(struct exynos_device *dev, struct exynos_bo *dst)
memset(&img, 0, sizeof(struct g2d_image));
img.bo[0] = dst->handle;
- printf("soild fill test.\n");
+ printf("solid fill test.\n");
srand(time(NULL));
img_w = screen_width;
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 04/17] tests/exynos: disable the G2D userptr/blend test
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (2 preceding siblings ...)
2015-02-24 14:20 ` [PATCH v3 03/17] tests/exynos: fix typos and change wording Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 05/17] exynos: add g2d_scale_and_blend Tobias Jakobi
` (11 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
v2: Move the commit description into the patch itself.
v3: Use common commenting style as pointed out by
Emil Velikov <emil.l.velikov at gmail.com>.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
tests/exynos/exynos_fimg2d_test.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index aa140e5..0f7cf24 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -788,11 +788,21 @@ int main(int argc, char **argv)
getchar();
+ /*
+ * The blend test uses the userptr functionality of exynos-drm, which
+ * is currently not safe to use. If the kernel hasn't been build with
+ * exynos-iommu support, then the blend test is going to produce (kernel)
+ * memory corruption, eventually leading to a system crash.
+ *
+ * Disable the test for now, until the kernel code has been sanitized.
+ */
+#if 0
ret = test_case.blend(dev, src, bo, G2D_IMGBUF_USERPTR);
if (ret < 0)
fprintf(stderr, "failed to test blend operation.\n");
getchar();
+#endif
err_free_src:
if (src)
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 05/17] exynos: add g2d_scale_and_blend
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (3 preceding siblings ...)
2015-02-24 14:20 ` [PATCH v3 04/17] tests/exynos: disable the G2D userptr/blend test Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 06/17] tests/exynos: introduce wait_for_user_input Tobias Jakobi
` (10 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
This is a combination of g2d_copy_with_scale and g2d_scale.
It is a pretty common operation to scale one buffer and then
blend it on top of another, so provide a direct way to that
operation.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
exynos/exynos_fimg2d.c | 129 +++++++++++++++++++++++++++++++++++++++++++++++++
exynos/fimg2d.h | 5 ++
2 files changed, 134 insertions(+)
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index df18a08..88e0ee6 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -645,3 +645,132 @@ g2d_blend(struct g2d_context *ctx, struct g2d_image *src,
return 0;
}
+/**
+ * g2d_scale_and_blend - apply scaling to source buffer and then blend to destination buffer
+ *
+ * @ctx: a pointer to g2d_context structure.
+ * @src: a pointer to g2d_image structure including image and buffer
+ * information to source.
+ * @dst: a pointer to g2d_image structure including image and buffer
+ * information to destination.
+ * @src_x: x start position to source buffer.
+ * @src_y: y start position to source buffer.
+ * @src_w: width value to source buffer.
+ * @src_h: height value to source buffer.
+ * @dst_x: x start position to destination buffer.
+ * @dst_y: y start position to destination buffer.
+ * @dst_w: width value to destination buffer.
+ * @dst_h: height value to destination buffer.
+ * @op: blend operation type.
+ */
+drm_public 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)
+{
+ union g2d_point_val pt;
+ union g2d_bitblt_cmd_val bitblt;
+ union g2d_blend_func_val blend;
+ unsigned int scale;
+ unsigned int scale_x, scale_y;
+
+ bitblt.val = 0;
+ blend.val = 0;
+
+ if (op == G2D_OP_SRC || op == G2D_OP_CLEAR)
+ g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR);
+ else
+ g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_NORMAL);
+
+ g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
+ if (dst->buf_type == G2D_IMGBUF_USERPTR)
+ g2d_add_cmd(ctx, DST_BASE_ADDR_REG | G2D_BUF_USERPTR,
+ (unsigned long)&dst->user_ptr[0]);
+ else
+ g2d_add_cmd(ctx, DST_BASE_ADDR_REG, dst->bo[0]);
+
+ g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride);
+
+ g2d_add_cmd(ctx, SRC_SELECT_REG, src->select_mode);
+ g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode);
+
+ switch (src->select_mode) {
+ case G2D_SELECT_MODE_NORMAL:
+ if (src->buf_type == G2D_IMGBUF_USERPTR)
+ g2d_add_cmd(ctx, SRC_BASE_ADDR_REG | G2D_BUF_USERPTR,
+ (unsigned long)&src->user_ptr[0]);
+ else
+ g2d_add_cmd(ctx, SRC_BASE_ADDR_REG, src->bo[0]);
+
+ g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride);
+ break;
+ case G2D_SELECT_MODE_FGCOLOR:
+ g2d_add_cmd(ctx, FG_COLOR_REG, src->color);
+ break;
+ case G2D_SELECT_MODE_BGCOLOR:
+ g2d_add_cmd(ctx, BG_COLOR_REG, src->color);
+ break;
+ default:
+ fprintf(stderr , "failed to set src.\n");
+ return -EINVAL;
+ }
+
+ if (src_w == dst_w && src_h == dst_h)
+ scale = 0;
+ else {
+ scale = 1;
+ scale_x = g2d_get_scaling(src_w, dst_w);
+ scale_y = g2d_get_scaling(src_h, dst_h);
+ }
+
+ if (src_x + src_w > src->width)
+ src_w = src->width - src_x;
+ if (src_y + src_h > src->height)
+ src_h = src->height - src_y;
+
+ if (dst_x + dst_w > dst->width)
+ dst_w = dst->width - dst_x;
+ if (dst_y + dst_h > dst->height)
+ dst_h = dst->height - dst_y;
+
+ if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0) {
+ fprintf(stderr, "invalid width or height.\n");
+ g2d_reset(ctx);
+ return -EINVAL;
+ }
+
+ if (scale) {
+ g2d_add_cmd(ctx, SRC_SCALE_CTRL_REG, G2D_SCALE_MODE_BILINEAR);
+ g2d_add_cmd(ctx, SRC_XSCALE_REG, scale_x);
+ g2d_add_cmd(ctx, SRC_YSCALE_REG, scale_y);
+ }
+
+ bitblt.data.alpha_blend_mode = G2D_ALPHA_BLEND_MODE_ENABLE;
+ blend.val = g2d_get_blend_op(op);
+ g2d_add_cmd(ctx, BITBLT_COMMAND_REG, bitblt.val);
+ g2d_add_cmd(ctx, BLEND_FUNCTION_REG, blend.val);
+
+ pt.val = 0;
+ pt.data.x = src_x;
+ pt.data.y = src_y;
+ g2d_add_cmd(ctx, SRC_LEFT_TOP_REG, pt.val);
+ pt.val = 0;
+ pt.data.x = src_x + src_w;
+ pt.data.y = src_y + src_h;
+ g2d_add_cmd(ctx, SRC_RIGHT_BOTTOM_REG, pt.val);
+
+ pt.val = 0;
+ pt.data.x = dst_x;
+ pt.data.y = dst_y;
+ g2d_add_cmd(ctx, DST_LEFT_TOP_REG, pt.val);
+ pt.val = 0;
+ pt.data.x = dst_x + dst_w;
+ pt.data.y = dst_y + dst_h;
+ g2d_add_cmd(ctx, DST_RIGHT_BOTTOM_REG, pt.val);
+
+ g2d_flush(ctx);
+
+ return 0;
+}
diff --git a/exynos/fimg2d.h b/exynos/fimg2d.h
index 8e0321c..bd116cf 100644
--- a/exynos/fimg2d.h
+++ b/exynos/fimg2d.h
@@ -320,4 +320,9 @@ 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_ */
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 06/17] tests/exynos: introduce wait_for_user_input
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (4 preceding siblings ...)
2015-02-24 14:20 ` [PATCH v3 05/17] exynos: add g2d_scale_and_blend Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 07/17] exynos: honor the repeat mode in g2d_copy_with_scale Tobias Jakobi
` (9 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
Currently getchar() is used to pause execution after each test.
The user isn't informed if one is supposed to do anything for
the tests to continue, so print a simple message to make this
more clear.
v3: Compactify printf calls as pointed out by
Emil Velikov <emil.l.velikov at gmail.com>.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
tests/exynos/exynos_fimg2d_test.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index 0f7cf24..5a2a351 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -237,6 +237,14 @@ void *create_checkerboard_pattern(unsigned int num_tiles_x,
return buf;
}
+static void wait_for_user_input(int last)
+{
+ printf("press <ENTER> to %s\n", last ? "exit test application" :
+ "skip to next test");
+
+ getchar();
+}
+
static void exynos_destroy_buffer(struct exynos_bo *bo)
{
exynos_bo_destroy(bo);
@@ -756,7 +764,7 @@ int main(int argc, char **argv)
goto err_rm_fb;
}
- getchar();
+ wait_for_user_input(0);
src = exynos_create_buffer(dev, screen_width * screen_height * 4, 0);
if (!src) {
@@ -770,7 +778,7 @@ int main(int argc, char **argv)
goto err_free_src;
}
- getchar();
+ wait_for_user_input(0);
ret = test_case.copy_with_scale(dev, src, bo, G2D_IMGBUF_GEM);
if (ret < 0) {
@@ -778,7 +786,7 @@ int main(int argc, char **argv)
goto err_free_src;
}
- getchar();
+ wait_for_user_input(0);
ret = test_case.checkerboard(dev, src, bo, G2D_IMGBUF_GEM);
if (ret < 0) {
@@ -786,7 +794,7 @@ int main(int argc, char **argv)
goto err_free_src;
}
- getchar();
+ wait_for_user_input(1);
/*
* The blend test uses the userptr functionality of exynos-drm, which
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 07/17] exynos: honor the repeat mode in g2d_copy_with_scale
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (5 preceding siblings ...)
2015-02-24 14:20 ` [PATCH v3 06/17] tests/exynos: introduce wait_for_user_input Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 08/17] exynos: introduce g2d_add_base_addr helper function Tobias Jakobi
` (8 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
This is useful when the default repeat mode, which is 'repeat'
produces artifacts at the borders of the copied image.
Choose the 'pad' mode to make use of the color of the destination
image.
In my usage case the destination is the framebuffer, which is
solid filled with a background color. Scaling with 'pad' mode
would then just do the right thing and also produces nice
borders on the output.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
exynos/exynos_fimg2d.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 88e0ee6..5314c36 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -454,6 +454,11 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
g2d_add_cmd(ctx, SRC_SELECT_REG, G2D_SELECT_MODE_NORMAL);
g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode);
+
+ g2d_add_cmd(ctx, SRC_REPEAT_MODE_REG, src->repeat_mode);
+ if (src->repeat_mode == G2D_REPEAT_MODE_PAD)
+ g2d_add_cmd(ctx, SRC_PAD_VALUE_REG, dst->color);
+
if (src->buf_type == G2D_IMGBUF_USERPTR)
g2d_add_cmd(ctx, SRC_BASE_ADDR_REG | G2D_BUF_USERPTR,
(unsigned long)&src->user_ptr[0]);
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 08/17] exynos: introduce g2d_add_base_addr helper function
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (6 preceding siblings ...)
2015-02-24 14:20 ` [PATCH v3 07/17] exynos: honor the repeat mode in g2d_copy_with_scale Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 09/17] exynos: use structure initialization instead of memset Tobias Jakobi
` (7 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
In almost all functions the base address register is written, so it
makes sense to have a helper function for this.
v3: Wrap line as pointed out by Emil Velikov
<emil.l.velikov at gmail.com>.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
exynos/exynos_fimg2d.c | 88 +++++++++++++++++++-------------------------------
1 file changed, 34 insertions(+), 54 deletions(-)
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 5314c36..17d7342 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -41,6 +41,11 @@
#define MIN(a, b) ((a) < (b) ? (a) : (b))
+enum g2d_base_addr_reg {
+ g2d_dst = 0,
+ g2d_src
+};
+
static unsigned int g2d_get_scaling(unsigned int src, unsigned int dst)
{
/*
@@ -134,6 +139,26 @@ static int g2d_add_cmd(struct g2d_context *ctx, unsigned long cmd,
}
/*
+ * g2d_add_base_addr - helper function to set dst/src base address register.
+ *
+ * @ctx: a pointer to g2d_context structure.
+ * @img: a pointer to the dst/src g2d_image structure.
+ * @reg: the register that should be set.
+ */
+static void g2d_add_base_addr(struct g2d_context *ctx, struct g2d_image *img,
+ enum g2d_base_addr_reg reg)
+{
+ const unsigned long cmd = (reg == g2d_dst) ?
+ DST_BASE_ADDR_REG : SRC_BASE_ADDR_REG;
+
+ if (img->buf_type == G2D_IMGBUF_USERPTR)
+ g2d_add_cmd(ctx, cmd | G2D_BUF_USERPTR,
+ (unsigned long)&img->user_ptr[0]);
+ else
+ g2d_add_cmd(ctx, cmd, img->bo[0]);
+}
+
+/*
* g2d_reset - reset fimg2d hardware.
*
* @ctx: a pointer to g2d_context structure.
@@ -278,13 +303,7 @@ g2d_solid_fill(struct g2d_context *ctx, struct g2d_image *img,
g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_NORMAL);
g2d_add_cmd(ctx, DST_COLOR_MODE_REG, img->color_mode);
-
- if (img->buf_type == G2D_IMGBUF_USERPTR)
- g2d_add_cmd(ctx, DST_BASE_ADDR_REG | G2D_BUF_USERPTR,
- (unsigned long)&img->user_ptr[0]);
- else
- g2d_add_cmd(ctx, DST_BASE_ADDR_REG, img->bo[0]);
-
+ g2d_add_base_addr(ctx, img, g2d_dst);
g2d_add_cmd(ctx, DST_STRIDE_REG, img->stride);
if (x + w > img->width)
@@ -341,22 +360,12 @@ g2d_copy(struct g2d_context *ctx, struct g2d_image *src,
g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR);
g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
- if (dst->buf_type == G2D_IMGBUF_USERPTR)
- g2d_add_cmd(ctx, DST_BASE_ADDR_REG | G2D_BUF_USERPTR,
- (unsigned long)&dst->user_ptr[0]);
- else
- g2d_add_cmd(ctx, DST_BASE_ADDR_REG, dst->bo[0]);
-
+ g2d_add_base_addr(ctx, dst, g2d_dst);
g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride);
g2d_add_cmd(ctx, SRC_SELECT_REG, G2D_SELECT_MODE_NORMAL);
g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode);
- if (src->buf_type == G2D_IMGBUF_USERPTR)
- g2d_add_cmd(ctx, SRC_BASE_ADDR_REG | G2D_BUF_USERPTR,
- (unsigned long)&src->user_ptr[0]);
- else
- g2d_add_cmd(ctx, SRC_BASE_ADDR_REG, src->bo[0]);
-
+ g2d_add_base_addr(ctx, src, g2d_src);
g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride);
src_w = w;
@@ -444,12 +453,7 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR);
g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
- if (dst->buf_type == G2D_IMGBUF_USERPTR)
- g2d_add_cmd(ctx, DST_BASE_ADDR_REG | G2D_BUF_USERPTR,
- (unsigned long)&dst->user_ptr[0]);
- else
- g2d_add_cmd(ctx, DST_BASE_ADDR_REG, dst->bo[0]);
-
+ g2d_add_base_addr(ctx, dst, g2d_dst);
g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride);
g2d_add_cmd(ctx, SRC_SELECT_REG, G2D_SELECT_MODE_NORMAL);
@@ -459,11 +463,7 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src,
if (src->repeat_mode == G2D_REPEAT_MODE_PAD)
g2d_add_cmd(ctx, SRC_PAD_VALUE_REG, dst->color);
- if (src->buf_type == G2D_IMGBUF_USERPTR)
- g2d_add_cmd(ctx, SRC_BASE_ADDR_REG | G2D_BUF_USERPTR,
- (unsigned long)&src->user_ptr[0]);
- else
- g2d_add_cmd(ctx, SRC_BASE_ADDR_REG, src->bo[0]);
+ g2d_add_base_addr(ctx, src, g2d_src);
g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride);
@@ -567,12 +567,7 @@ g2d_blend(struct g2d_context *ctx, struct g2d_image *src,
g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_NORMAL);
g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
- if (dst->buf_type == G2D_IMGBUF_USERPTR)
- g2d_add_cmd(ctx, DST_BASE_ADDR_REG | G2D_BUF_USERPTR,
- (unsigned long)&dst->user_ptr[0]);
- else
- g2d_add_cmd(ctx, DST_BASE_ADDR_REG, dst->bo[0]);
-
+ g2d_add_base_addr(ctx, dst, g2d_dst);
g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride);
g2d_add_cmd(ctx, SRC_SELECT_REG, src->select_mode);
@@ -580,12 +575,7 @@ g2d_blend(struct g2d_context *ctx, struct g2d_image *src,
switch (src->select_mode) {
case G2D_SELECT_MODE_NORMAL:
- if (src->buf_type == G2D_IMGBUF_USERPTR)
- g2d_add_cmd(ctx, SRC_BASE_ADDR_REG | G2D_BUF_USERPTR,
- (unsigned long)&src->user_ptr[0]);
- else
- g2d_add_cmd(ctx, SRC_BASE_ADDR_REG, src->bo[0]);
-
+ g2d_add_base_addr(ctx, src, g2d_src);
g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride);
break;
case G2D_SELECT_MODE_FGCOLOR:
@@ -690,12 +680,7 @@ g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src,
g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_NORMAL);
g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
- if (dst->buf_type == G2D_IMGBUF_USERPTR)
- g2d_add_cmd(ctx, DST_BASE_ADDR_REG | G2D_BUF_USERPTR,
- (unsigned long)&dst->user_ptr[0]);
- else
- g2d_add_cmd(ctx, DST_BASE_ADDR_REG, dst->bo[0]);
-
+ g2d_add_base_addr(ctx, dst, g2d_dst);
g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride);
g2d_add_cmd(ctx, SRC_SELECT_REG, src->select_mode);
@@ -703,12 +688,7 @@ g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src,
switch (src->select_mode) {
case G2D_SELECT_MODE_NORMAL:
- if (src->buf_type == G2D_IMGBUF_USERPTR)
- g2d_add_cmd(ctx, SRC_BASE_ADDR_REG | G2D_BUF_USERPTR,
- (unsigned long)&src->user_ptr[0]);
- else
- g2d_add_cmd(ctx, SRC_BASE_ADDR_REG, src->bo[0]);
-
+ g2d_add_base_addr(ctx, src, g2d_src);
g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride);
break;
case G2D_SELECT_MODE_FGCOLOR:
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 09/17] exynos: use structure initialization instead of memset
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (7 preceding siblings ...)
2015-02-24 14:20 ` [PATCH v3 08/17] exynos: introduce g2d_add_base_addr helper function Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 10/17] tests/exynos: improve error handling Tobias Jakobi
` (6 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
Keeps the code cleaner, since the structs have to be initialized
once anyway.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
exynos/exynos_fimg2d.c | 4 +---
tests/exynos/exynos_fimg2d_test.c | 15 ++++-----------
2 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 17d7342..746502a 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -184,7 +184,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 FALSE;
@@ -194,8 +194,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 5a2a351..5e54d78 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -253,7 +253,7 @@ static void exynos_destroy_buffer(struct exynos_bo *bo)
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;
@@ -261,7 +261,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");
@@ -304,7 +303,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 count;
unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
unsigned long userptr, size;
@@ -314,8 +313,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;
@@ -388,7 +385,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 count;
unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
unsigned long userptr, size;
@@ -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;
@@ -477,7 +472,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 count;
unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
unsigned long userptr, size;
@@ -487,8 +482,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;
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 10/17] tests/exynos: improve error handling
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (8 preceding siblings ...)
2015-02-24 14:20 ` [PATCH v3 09/17] exynos: use structure initialization instead of memset Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 11/17] exynos: add exynos prefix to fimg2d header Tobias Jakobi
` (5 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
Check for a useable connector and also if the resolution is sane
(width and height are both non-zero).
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
tests/exynos/exynos_fimg2d_test.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index 5e54d78..a780d8d 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -721,10 +721,22 @@ int main(int argc, char **argv)
connector_find_mode(dev->fd, &con, resources);
drmModeFreeResources(resources);
+ if (!con.mode) {
+ fprintf(stderr, "failed to find usable connector\n");
+ ret = -EFAULT;
+ goto err_drm_close;
+ }
+
screen_width = con.mode->hdisplay;
screen_height = con.mode->vdisplay;
- printf("screen width = %d, screen height = %d\n", screen_width,
+ if (screen_width == 0 || screen_height == 0) {
+ fprintf(stderr, "failed to find sane resolution on connector\n");
+ ret = -EFAULT;
+ goto err_drm_close;
+ }
+
+ printf("screen width = %d, screen height = %d\n", screen_width,
screen_height);
bo = exynos_create_buffer(dev, screen_width * screen_height * 4, 0);
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 11/17] exynos: add exynos prefix to fimg2d header
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (9 preceding siblings ...)
2015-02-24 14:20 ` [PATCH v3 10/17] tests/exynos: improve error handling Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 12/17] exynos: fimg2d: remove TRUE/FALSE from header Tobias Jakobi
` (4 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
exynos/Makefile.am | 2 +-
exynos/exynos_fimg2d.c | 2 +-
exynos/exynos_fimg2d.h | 328 ++++++++++++++++++++++++++++++++++++++
exynos/fimg2d.h | 328 --------------------------------------
tests/exynos/exynos_fimg2d_test.c | 2 +-
5 files changed, 331 insertions(+), 331 deletions(-)
create mode 100644 exynos/exynos_fimg2d.h
delete mode 100644 exynos/fimg2d.h
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 746502a..c37670c 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..bd116cf
--- /dev/null
+++ b/exynos/exynos_fimg2d.h
@@ -0,0 +1,328 @@
+/*
+ * 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_
+
+#ifndef TRUE
+#define TRUE 0
+#endif
+#ifndef FALSE
+#define FALSE -1
+#endif
+
+#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_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 Alpha : 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 bd116cf..0000000
--- a/exynos/fimg2d.h
+++ /dev/null
@@ -1,328 +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_
-
-#ifndef TRUE
-#define TRUE 0
-#endif
-#ifndef FALSE
-#define FALSE -1
-#endif
-
-#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_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 Alpha : 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 a780d8d..b582ef4 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -29,7 +29,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
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 12/17] exynos: fimg2d: remove TRUE/FALSE from header
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (10 preceding siblings ...)
2015-02-24 14:20 ` [PATCH v3 11/17] exynos: add exynos prefix to fimg2d header Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 13/17] exynos: add fimg2d header to common includes Tobias Jakobi
` (3 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
The fimg2d header was defining TRUE and FALSE, but actually
these defines are just used once. Remove them, since they
don't make the code better readable/understandable.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
exynos/exynos_fimg2d.c | 4 ++--
exynos/exynos_fimg2d.h | 7 -------
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index c37670c..974ee64 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -135,7 +135,7 @@ static int g2d_add_cmd(struct g2d_context *ctx, unsigned long cmd,
break;
}
- return TRUE;
+ return 0;
}
/*
@@ -187,7 +187,7 @@ static int g2d_flush(struct g2d_context *ctx)
struct drm_exynos_g2d_set_cmdlist cmdlist = {0};
if (ctx->cmd_nr == 0 && ctx->cmd_buf_nr == 0)
- return FALSE;
+ return -1;
if (ctx->cmdlist_nr >= G2D_MAX_CMD_LIST_NR) {
fprintf(stderr, "Overflow cmdlist.\n");
diff --git a/exynos/exynos_fimg2d.h b/exynos/exynos_fimg2d.h
index bd116cf..dbcb764 100644
--- a/exynos/exynos_fimg2d.h
+++ b/exynos/exynos_fimg2d.h
@@ -13,13 +13,6 @@
#ifndef _FIMG2D_H_
#define _FIMG2D_H_
-#ifndef TRUE
-#define TRUE 0
-#endif
-#ifndef FALSE
-#define FALSE -1
-#endif
-
#define G2D_MAX_CMD_NR 64
#define G2D_MAX_GEM_CMD_NR 64
#define G2D_MAX_CMD_LIST_NR 64
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 13/17] exynos: add fimg2d header to common includes
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (11 preceding siblings ...)
2015-02-24 14:20 ` [PATCH v3 12/17] exynos: fimg2d: remove TRUE/FALSE from header Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 14/17] exynos: fimg2d: fix comment for G2D_COEFF_MODE_GB_COLOR Tobias Jakobi
` (2 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
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>
---
exynos/Makefile.am | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v3 14/17] exynos: fimg2d: fix comment for G2D_COEFF_MODE_GB_COLOR
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (12 preceding siblings ...)
2015-02-24 14:20 ` [PATCH v3 13/17] exynos: add fimg2d header to common includes Tobias Jakobi
@ 2015-02-24 14:20 ` Tobias Jakobi
2015-03-11 13:11 ` Inki Dae
2015-02-25 15:54 ` [v3] libdrm: improvements to userspace exynos component Emil Velikov
2015-03-11 13:31 ` Inki Dae
15 siblings, 1 reply; 24+ messages in thread
From: Tobias Jakobi @ 2015-02-24 14:20 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, emil.l.velikov, jy0922.shim, m.szyprowski, robclark,
Tobias Jakobi
The coefficient mode enables use of global color, not alpha.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
exynos/exynos_fimg2d.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/exynos/exynos_fimg2d.h b/exynos/exynos_fimg2d.h
index dbcb764..418757f 100644
--- a/exynos/exynos_fimg2d.h
+++ b/exynos/exynos_fimg2d.h
@@ -159,7 +159,7 @@ enum e_g2d_coeff_mode {
G2D_COEFF_MODE_DST_COLOR,
/* Global Alpha : Set by ALPHA_REG(0x618) */
G2D_COEFF_MODE_GB_ALPHA,
- /* Global Alpha : Set by ALPHA_REG(0x618) */
+ /* Global Color : Set by ALPHA_REG(0x618) */
G2D_COEFF_MODE_GB_COLOR,
/* (1-SRC alpha)/DST Alpha */
G2D_COEFF_MODE_DISJOINT_S,
--
2.0.5
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [v3] libdrm: improvements to userspace exynos component
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (13 preceding siblings ...)
2015-02-24 14:20 ` [PATCH v3 14/17] exynos: fimg2d: fix comment for G2D_COEFF_MODE_GB_COLOR Tobias Jakobi
@ 2015-02-25 15:54 ` Emil Velikov
2015-03-08 14:30 ` Emil Velikov
2015-03-11 13:31 ` Inki Dae
15 siblings, 1 reply; 24+ messages in thread
From: Emil Velikov @ 2015-02-25 15:54 UTC (permalink / raw)
To: Tobias Jakobi, Inki Dae
Cc: linux-samsung-soc, Rob Clark, ML dri-devel, Marek Szyprowski
On 24 February 2015 at 14:20, Tobias Jakobi
<tjakobi@math.uni-bielefeld.de> wrote:
> Hello,
>
> here are some miscellaneous improvements (small features, bugfixes, spelling fixes, etc.) for the exynos component of libdrm. The general idea is to let userspace use the G2D engine functionality more
> efficiently.
>
> If someone is interested in an application that actually makes use of this, the RetroArch frontend has a custom video backend:
> https://github.com/libretro/RetroArch/blob/master/gfx/drivers/exynos_gfx.c
>
>
> Please review and let me know what I can improve.
>
> v2:
> - Mention value of G2D scaling normalization factor (02/15).
> - Moved patch (04/15) description from commit message to source itself, like suggested by Joonyoung Shim.
>
> v3:
> I integrated the suggestions by Emil Velikov and added two additional patches to the series. One doing the header cleanup that Emil point out, another one just a trivial whitespace thing. I'm resending
> the whole series, since number of patches and order changed.
>
Thanks for the update. For the future please add the tags
(tested-by,etc.) when resending patches.
Don't worry about these I'll add them before pushing. The two extra
patches look good imho.
Inki,
This cleanup series has been around for a little while now. v3 can be found at
http://lists.freedesktop.org/archives/dri-devel/2015-February/078111.html
Do you mind if we apply the trivial and tested* patches within the
next week or so ?
The more serious patches hw specific, etc are lacking preview and can
be committed at a later stage.
Thanks
Emil
[*] Patches 2-4, 6, 8, 10, 12, 14-17, out of which Joonyoung Shim has
tested all but 12 and 17.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [v3] libdrm: improvements to userspace exynos component
2015-02-25 15:54 ` [v3] libdrm: improvements to userspace exynos component Emil Velikov
@ 2015-03-08 14:30 ` Emil Velikov
2015-03-08 23:12 ` Tobias Jakobi
0 siblings, 1 reply; 24+ messages in thread
From: Emil Velikov @ 2015-03-08 14:30 UTC (permalink / raw)
To: Tobias Jakobi, Inki Dae
Cc: linux-samsung-soc, Rob Clark, ML dri-devel, Marek Szyprowski
On 25 February 2015 at 15:54, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> On 24 February 2015 at 14:20, Tobias Jakobi
> <tjakobi@math.uni-bielefeld.de> wrote:
>> Hello,
>>
>> here are some miscellaneous improvements (small features, bugfixes, spelling fixes, etc.) for the exynos component of libdrm. The general idea is to let userspace use the G2D engine functionality more
>> efficiently.
>>
>> If someone is interested in an application that actually makes use of this, the RetroArch frontend has a custom video backend:
>> https://github.com/libretro/RetroArch/blob/master/gfx/drivers/exynos_gfx.c
>>
>>
>> Please review and let me know what I can improve.
>>
>> v2:
>> - Mention value of G2D scaling normalization factor (02/15).
>> - Moved patch (04/15) description from commit message to source itself, like suggested by Joonyoung Shim.
>>
>> v3:
>> I integrated the suggestions by Emil Velikov and added two additional patches to the series. One doing the header cleanup that Emil point out, another one just a trivial whitespace thing. I'm resending
>> the whole series, since number of patches and order changed.
>>
> Thanks for the update. For the future please add the tags
> (tested-by,etc.) when resending patches.
> Don't worry about these I'll add them before pushing. The two extra
> patches look good imho.
>
> Inki,
>
> This cleanup series has been around for a little while now. v3 can be found at
> http://lists.freedesktop.org/archives/dri-devel/2015-February/078111.html
>
> Do you mind if we apply the trivial and tested* patches within the
> next week or so ?
> The more serious patches hw specific, etc are lacking preview and can
> be committed at a later stage.
>
> Thanks
> Emil
>
> [*] Patches 2-4, 6, 8, 10, 12, 14-17, out of which Joonyoung Shim has
> tested all but 12 and 17.
I'm planning to push the above mentioned patches around lunchtime this
Tuesday. If anyone has objections please speak up.
-Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [v3] libdrm: improvements to userspace exynos component
2015-03-08 14:30 ` Emil Velikov
@ 2015-03-08 23:12 ` Tobias Jakobi
2015-03-10 19:36 ` Emil Velikov
0 siblings, 1 reply; 24+ messages in thread
From: Tobias Jakobi @ 2015-03-08 23:12 UTC (permalink / raw)
To: Emil Velikov, Inki Dae
Cc: linux-samsung-soc, ML dri-devel, jy0922.shim, Marek Szyprowski,
Rob Clark
Hello Emil,
Emil Velikov wrote:
> I'm planning to push the above mentioned patches around lunchtime this
> Tuesday. If anyone has objections please speak up.
I doubt you're going to hear anything from Inki Dae. I've contacted him
a few times with questions when I wrote the series, but never heard
anything back from him.
Anyway, thanks for considering to merge this, even though it lacks the
review of the exynos-drm maintainer.
At least this gives me confidence to continue to work on this (I also
want to expose async g2d operation to userspace).
With best wishes,
Tobias
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [v3] libdrm: improvements to userspace exynos component
2015-03-08 23:12 ` Tobias Jakobi
@ 2015-03-10 19:36 ` Emil Velikov
2015-03-11 1:09 ` Inki Dae
0 siblings, 1 reply; 24+ messages in thread
From: Emil Velikov @ 2015-03-10 19:36 UTC (permalink / raw)
To: Tobias Jakobi, Inki Dae
Cc: emil.l.velikov, linux-samsung-soc, ML dri-devel, jy0922.shim,
Marek Szyprowski, Rob Clark
On 08/03/15 23:12, Tobias Jakobi wrote:
> Hello Emil,
> Emil Velikov wrote:
>> I'm planning to push the above mentioned patches around lunchtime this
>> Tuesday. If anyone has objections please speak up.
> I doubt you're going to hear anything from Inki Dae.
Despite that it might sound a bit rude, I sincerely hope that you're
wrong on this one. I'm would assume that the lack of reply from Inki was
due to being him busy, rather than ignoring you.
> Anyway, thanks for considering to merge this, even though it lacks the
> review of the exynos-drm maintainer.
>
> At least this gives me confidence to continue to work on this (I also
> want to expose async g2d operation to userspace).
>
Glad that you're still planning to work on this. Ideally the
Exynos/Samsung guys will take a look at the rest of your patches which
require someone with greater knowledge of the hardware than me :-)
Cheers,
Emil
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [v3] libdrm: improvements to userspace exynos component
2015-03-10 19:36 ` Emil Velikov
@ 2015-03-11 1:09 ` Inki Dae
0 siblings, 0 replies; 24+ messages in thread
From: Inki Dae @ 2015-03-11 1:09 UTC (permalink / raw)
To: Emil Velikov
Cc: linux-samsung-soc, Rob Clark, Tobias Jakobi, ML dri-devel,
Marek Szyprowski
Hi Tobias and Emil
On 2015년 03월 11일 04:36, Emil Velikov wrote:
> On 08/03/15 23:12, Tobias Jakobi wrote:
>> Hello Emil,
>> Emil Velikov wrote:
>>> I'm planning to push the above mentioned patches around lunchtime this
>>> Tuesday. If anyone has objections please speak up.
>> I doubt you're going to hear anything from Inki Dae.
> Despite that it might sound a bit rude, I sincerely hope that you're
> wrong on this one. I'm would assume that the lack of reply from Inki was
> due to being him busy, rather than ignoring you.
>
I was busy so I didn't care of it. Sorry for this.
>> Anyway, thanks for considering to merge this, even though it lacks the
>> review of the exynos-drm maintainer.
>>
>> At least this gives me confidence to continue to work on this (I also
>> want to expose async g2d operation to userspace).
>>
> Glad that you're still planning to work on this. Ideally the
> Exynos/Samsung guys will take a look at the rest of your patches which
> require someone with greater knowledge of the hardware than me :-)
>
Right. We will review this patch and reply at least until tomorrow.
Thanks,
Inki Dae
> Cheers,
> Emil
>
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 14/17] exynos: fimg2d: fix comment for G2D_COEFF_MODE_GB_COLOR
2015-02-24 14:20 ` [PATCH v3 14/17] exynos: fimg2d: fix comment for G2D_COEFF_MODE_GB_COLOR Tobias Jakobi
@ 2015-03-11 13:11 ` Inki Dae
0 siblings, 0 replies; 24+ messages in thread
From: Inki Dae @ 2015-03-11 13:11 UTC (permalink / raw)
To: Tobias Jakobi
Cc: linux-samsung-soc, emil.l.velikov, dri-devel, robclark,
m.szyprowski
Hi Tobias,
On 2015년 02월 24일 23:20, Tobias Jakobi wrote:
> The coefficient mode enables use of global color, not alpha.
>
> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> ---
> exynos/exynos_fimg2d.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/exynos/exynos_fimg2d.h b/exynos/exynos_fimg2d.h
> index dbcb764..418757f 100644
> --- a/exynos/exynos_fimg2d.h
> +++ b/exynos/exynos_fimg2d.h
> @@ -159,7 +159,7 @@ enum e_g2d_coeff_mode {
> G2D_COEFF_MODE_DST_COLOR,
> /* Global Alpha : Set by ALPHA_REG(0x618) */
> G2D_COEFF_MODE_GB_ALPHA,
> - /* Global Alpha : Set by ALPHA_REG(0x618) */
> + /* Global Color : Set by ALPHA_REG(0x618) */
Actually, above register sets not only global color value but also
global alpha value. Below shows fields of the register,
ColorValue [31:8] Global color value (RGB order)
AlphaValue [7:0] Global alpha value
So right comment would be "Global Color and Global Alpha".
Thanks,
Inki Dae
> G2D_COEFF_MODE_GB_COLOR,
> /* (1-SRC alpha)/DST Alpha */
> G2D_COEFF_MODE_DISJOINT_S,
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [v3] libdrm: improvements to userspace exynos component
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
` (14 preceding siblings ...)
2015-02-25 15:54 ` [v3] libdrm: improvements to userspace exynos component Emil Velikov
@ 2015-03-11 13:31 ` Inki Dae
2015-03-11 18:56 ` Emil Velikov
15 siblings, 1 reply; 24+ messages in thread
From: Inki Dae @ 2015-03-11 13:31 UTC (permalink / raw)
To: Tobias Jakobi
Cc: linux-samsung-soc, emil.l.velikov, robclark, dri-devel,
m.szyprowski
Hi,
On 2015년 02월 24일 23:20, Tobias Jakobi wrote:
> Hello,
>
> here are some miscellaneous improvements (small features, bugfixes, spelling fixes, etc.) for the exynos component of libdrm. The general idea is to let userspace use the G2D engine functionality more
> efficiently.
>
> If someone is interested in an application that actually makes use of this, the RetroArch frontend has a custom video backend:
> https://github.com/libretro/RetroArch/blob/master/gfx/drivers/exynos_gfx.c
>
>
> Please review and let me know what I can improve.
>
> v2:
> - Mention value of G2D scaling normalization factor (02/15).
> - Moved patch (04/15) description from commit message to source itself, like suggested by Joonyoung Shim.
>
> v3:
> I integrated the suggestions by Emil Velikov and added two additional patches to the series. One doing the header cleanup that Emil point out, another one just a trivial whitespace thing. I'm resending
> the whole series, since number of patches and order changed.
Looks good to me except for 14/17 patch. For the patch, I commented
already, which may be very trivial but should be fixed correctly. I
think Emil could fix it before merging it.
To Emil,
Could you please fix the patch 14/17 like below?,
before
- /* Global Alpha : Set by ALPHA_REG(0x618) */
+ /* Global Color : Set by ALPHA_REG(0x618) */
after
- /* Global Alpha : Set by ALPHA_REG(0x618) */
+ /* Global Color and Alpha: Set by ALPHA_REG(0x618) */
for all patches - 1 though 17, Signed-off-by : Inki Dae
<inki.dae@samsung.com>
Thanks,
Inki Dae
>
>
> With best wishes,
> Tobias
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [v3] libdrm: improvements to userspace exynos component
2015-03-11 13:31 ` Inki Dae
@ 2015-03-11 18:56 ` Emil Velikov
2015-03-11 19:40 ` Tobias Jakobi
0 siblings, 1 reply; 24+ messages in thread
From: Emil Velikov @ 2015-03-11 18:56 UTC (permalink / raw)
To: Inki Dae
Cc: Tobias Jakobi, linux-samsung-soc, ML dri-devel, jy0922.shim,
Marek Szyprowski, Rob Clark
On 11 March 2015 at 13:31, Inki Dae <inki.dae@samsung.com> wrote:
> Hi,
>
> On 2015년 02월 24일 23:20, Tobias Jakobi wrote:
>> Hello,
>>
>> here are some miscellaneous improvements (small features, bugfixes, spelling fixes, etc.) for the exynos component of libdrm. The general idea is to let userspace use the G2D engine functionality more
>> efficiently.
>>
>> If someone is interested in an application that actually makes use of this, the RetroArch frontend has a custom video backend:
>> https://github.com/libretro/RetroArch/blob/master/gfx/drivers/exynos_gfx.c
>>
>>
>> Please review and let me know what I can improve.
>>
>> v2:
>> - Mention value of G2D scaling normalization factor (02/15).
>> - Moved patch (04/15) description from commit message to source itself, like suggested by Joonyoung Shim.
>>
>> v3:
>> I integrated the suggestions by Emil Velikov and added two additional patches to the series. One doing the header cleanup that Emil point out, another one just a trivial whitespace thing. I'm resending
>> the whole series, since number of patches and order changed.
>
Wohoo Inki's back !
> Looks good to me except for 14/17 patch. For the patch, I commented
> already, which may be very trivial but should be fixed correctly. I
> think Emil could fix it before merging it.
>
> To Emil,
> Could you please fix the patch 14/17 like below?,
>
> before
> - /* Global Alpha : Set by ALPHA_REG(0x618) */
> + /* Global Color : Set by ALPHA_REG(0x618) */
>
> after
> - /* Global Alpha : Set by ALPHA_REG(0x618) */
> + /* Global Color and Alpha: Set by ALPHA_REG(0x618) */
>
>
If you don't mind I'll leave this to Tobias as a follow up patch, as
the one you've looked at is already in master.
> for all patches - 1 though 17, Signed-off-by : Inki Dae
> <inki.dae@samsung.com>
>
I believe you mean Reviewed-by, isn't that right ?
Tobias,
Can you please re-spin the remaining patches on top of master, and
address Inki's comment.
Also please add Inki's and Joonyoung Shim's tags.
Thanks
Emil
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [v3] libdrm: improvements to userspace exynos component
2015-03-11 18:56 ` Emil Velikov
@ 2015-03-11 19:40 ` Tobias Jakobi
0 siblings, 0 replies; 24+ messages in thread
From: Tobias Jakobi @ 2015-03-11 19:40 UTC (permalink / raw)
To: Emil Velikov
Cc: Inki Dae, linux-samsung-soc, ML dri-devel, jy0922.shim,
Marek Szyprowski, Rob Clark
On 2015-03-11 19:56, Emil Velikov wrote:
> Tobias,
> Can you please re-spin the remaining patches on top of master, and
> address Inki's comment.
> Also please add Inki's and Joonyoung Shim's tags.
Done. I hope I did the tagging correctly.
With best wishes,
Tobias
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2015-03-11 19:40 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 14:20 [v3] libdrm: improvements to userspace exynos component Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 01/17] tests/exynos: fimg2d: add a checkerboard test Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 02/17] exynos: replace G2D_DOUBLE_TO_FIXED macro with function Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 03/17] tests/exynos: fix typos and change wording Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 04/17] tests/exynos: disable the G2D userptr/blend test Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 05/17] exynos: add g2d_scale_and_blend Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 06/17] tests/exynos: introduce wait_for_user_input Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 07/17] exynos: honor the repeat mode in g2d_copy_with_scale Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 08/17] exynos: introduce g2d_add_base_addr helper function Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 09/17] exynos: use structure initialization instead of memset Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 10/17] tests/exynos: improve error handling Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 11/17] exynos: add exynos prefix to fimg2d header Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 12/17] exynos: fimg2d: remove TRUE/FALSE from header Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 13/17] exynos: add fimg2d header to common includes Tobias Jakobi
2015-02-24 14:20 ` [PATCH v3 14/17] exynos: fimg2d: fix comment for G2D_COEFF_MODE_GB_COLOR Tobias Jakobi
2015-03-11 13:11 ` Inki Dae
2015-02-25 15:54 ` [v3] libdrm: improvements to userspace exynos component Emil Velikov
2015-03-08 14:30 ` Emil Velikov
2015-03-08 23:12 ` Tobias Jakobi
2015-03-10 19:36 ` Emil Velikov
2015-03-11 1:09 ` Inki Dae
2015-03-11 13:31 ` Inki Dae
2015-03-11 18:56 ` Emil Velikov
2015-03-11 19:40 ` Tobias Jakobi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.