From eba9f6349634a83dea518249a39f09f3d2c40965 Mon Sep 17 00:00:00 2001 From: Cho KyongHo Date: Fri, 18 May 2018 12:12:18 +0900 Subject: [PATCH] [9610] g2d: add support for Exynos9610 The features of G2D of Exynos9610 is the same as Exynos9810 except supporting source layers. Change-Id: Ia5b69fd25b5ab02c742a8ec71eafc4fe601ead3a Signed-off-by: Cho KyongHo --- drivers/gpu/exynos/g2d/g2d.h | 1 + drivers/gpu/exynos/g2d/g2d_drv.c | 15 +++++++++++++++ drivers/gpu/exynos/g2d/g2d_task.h | 1 + drivers/gpu/exynos/g2d/g2d_uapi_process.c | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/exynos/g2d/g2d.h b/drivers/gpu/exynos/g2d/g2d.h index b7f6f19c0322..81aae54c984d 100644 --- a/drivers/gpu/exynos/g2d/g2d.h +++ b/drivers/gpu/exynos/g2d/g2d.h @@ -116,6 +116,7 @@ struct g2d_device { struct mutex lock_qos; struct list_head qos_contexts; u32 hw_ppc[PPC_END]; + u32 max_layers; struct g2d_dvfs_table *dvfs_table; u32 dvfs_table_cnt; diff --git a/drivers/gpu/exynos/g2d/g2d_drv.c b/drivers/gpu/exynos/g2d/g2d_drv.c index 0bd47ab9b463..434817dd80b5 100644 --- a/drivers/gpu/exynos/g2d/g2d_drv.c +++ b/drivers/gpu/exynos/g2d/g2d_drv.c @@ -774,15 +774,29 @@ static int g2d_parse_dt(struct g2d_device *g2d_dev) struct g2d_device_data { unsigned long caps; + unsigned int max_layers; +}; + +const struct g2d_device_data g2d_9610_data __initconst = { + .max_layers = G2D_MAX_IMAGES_HALF, +}; + +const struct g2d_device_data g2d_9810_data __initconst = { + .max_layers = G2D_MAX_IMAGES, }; const struct g2d_device_data g2d_9820_data __initconst = { .caps = G2D_DEVICE_CAPS_SELF_PROTECTION | G2D_DEVICE_CAPS_YUV_BITDEPTH, + .max_layers = G2D_MAX_IMAGES, }; static const struct of_device_id of_g2d_match[] __refconst = { { .compatible = "samsung,exynos9810-g2d", + .data = &g2d_9810_data, + }, { + .compatible = "samsung,exynos9610-g2d", + .data = &g2d_9610_data, }, { .compatible = "samsung,exynos9820-g2d", .data = &g2d_9820_data, @@ -843,6 +857,7 @@ static int g2d_probe(struct platform_device *pdev) const struct g2d_device_data *devdata = of_id->data; g2d_dev->caps = devdata->caps; + g2d_dev->max_layers = devdata->max_layers; } ret = iovmm_activate(&pdev->dev); diff --git a/drivers/gpu/exynos/g2d/g2d_task.h b/drivers/gpu/exynos/g2d/g2d_task.h index 43e925b626cc..a3898d4202aa 100644 --- a/drivers/gpu/exynos/g2d/g2d_task.h +++ b/drivers/gpu/exynos/g2d/g2d_task.h @@ -27,6 +27,7 @@ #include "g2d_format.h" #define G2D_MAX_IMAGES 16 +#define G2D_MAX_IMAGES_HALF 8 #define G2D_MAX_JOBS 16 #define G2D_CMD_LIST_SIZE 8192 diff --git a/drivers/gpu/exynos/g2d/g2d_uapi_process.c b/drivers/gpu/exynos/g2d/g2d_uapi_process.c index 6c9957ce09f4..fde5b2f933e4 100644 --- a/drivers/gpu/exynos/g2d/g2d_uapi_process.c +++ b/drivers/gpu/exynos/g2d/g2d_uapi_process.c @@ -763,7 +763,7 @@ int g2d_get_userdata(struct g2d_device *g2d_dev, struct g2d_context *ctx, int ret; /* invalid range check */ - if ((data->num_source < 1) || (data->num_source > G2D_MAX_IMAGES)) { + if ((data->num_source < 1) || (data->num_source > g2d_dev->max_layers)) { dev_err(dev, "%s: Invalid number of source images %u\n", __func__, data->num_source); return -EINVAL; -- 2.20.1