[PATCH] drm/exynos/gsc: fix the hardware limitations

2016-11-24 Thread Inki Dae


2016년 11월 24일 16:51에 Hoegeun Kwon 이(가) 쓴 글:
> The maximum size of input or output rotation is 2047 x 2047.
> Fixed an error on limitations.

You would need to consider other SoC - Exynos5250/5250/5410/5420/5433 because 
other have different rotation limitations like below,

Exynos5250
Maximum size : 2048x2048 for Tile Mode or Rotation

Exynos5410/5420
Maximum size : 2016x2016 for Tile mode or Rotation

In case of Exynos5433, it seems more complicated. Refer to Chapter 45.5.4 Size 
Constraints of TRM document.

Thanks.

> 
> Signed-off-by: Hoegeun Kwon 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_gsc.c | 11 +--
>  include/uapi/drm/exynos_drm.h   |  2 ++
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> index bef5798..36e05ae 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> @@ -71,6 +71,7 @@
>  #define GSC_CROP_MIN 32
>  #define GSC_SCALE_MAX4224
>  #define GSC_SCALE_MIN32
> +#define GSC_ROT_MAX  2047
>  #define GSC_COEF_RATIO   7
>  #define GSC_COEF_PHASE   9
>  #define GSC_COEF_ATTR16
> @@ -1371,6 +1372,8 @@ static int gsc_init_prop_list(struct exynos_drm_ippdrv 
> *ippdrv)
>   prop_list->scale_max.vsize = GSC_SCALE_MAX;
>   prop_list->scale_min.hsize = GSC_SCALE_MIN;
>   prop_list->scale_min.vsize = GSC_SCALE_MIN;
> + prop_list->rot_max.hsize = GSC_ROT_MAX;
> + prop_list->rot_max.vsize = GSC_ROT_MAX;
>  
>   return 0;
>  }
> @@ -1444,7 +1447,9 @@ static int gsc_ippdrv_check_property(struct device *dev,
>   if ((pos->h < pp->crop_min.hsize) ||
>   (sz->vsize > pp->crop_max.hsize) ||
>   (pos->w < pp->crop_min.vsize) ||
> - (sz->hsize > pp->crop_max.vsize)) {
> + (sz->hsize > pp->crop_max.vsize) ||
> + (pos->h > pp->rot_max.hsize) ||
> + (pos->w > pp->rot_max.vsize)) {
>   DRM_ERROR("out of crop size.\n");
>   goto err_property;
>   }
> @@ -1465,7 +1470,9 @@ static int gsc_ippdrv_check_property(struct device *dev,
>   if ((pos->h < pp->scale_min.hsize) ||
>   (sz->vsize > pp->scale_max.hsize) ||
>   (pos->w < pp->scale_min.vsize) ||
> - (sz->hsize > pp->scale_max.vsize)) {
> + (sz->hsize > pp->scale_max.vsize) ||
> + (pos->h > pp->rot_max.hsize) ||
> + (pos->w > pp->rot_max.vsize)) {
>   DRM_ERROR("out of scale size.\n");
>   goto err_property;
>   }
> diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
> index cb3e9f9..d5d5518 100644
> --- a/include/uapi/drm/exynos_drm.h
> +++ b/include/uapi/drm/exynos_drm.h
> @@ -192,6 +192,7 @@ enum drm_exynos_planer {
>   * @crop_max: crop max resolution.
>   * @scale_min: scale min resolution.
>   * @scale_max: scale max resolution.
> + * @rot_max: rotation max resolution.
>   */
>  struct drm_exynos_ipp_prop_list {
>   __u32   version;
> @@ -210,6 +211,7 @@ struct drm_exynos_ipp_prop_list {
>   struct drm_exynos_szcrop_max;
>   struct drm_exynos_szscale_min;
>   struct drm_exynos_szscale_max;
> + struct drm_exynos_szrot_max;
>  };
>  
>  /**
> 


[PATCH] drm/exynos/gsc: fix the hardware limitations

2016-11-24 Thread Hoegeun Kwon
The maximum size of input or output rotation is 2047 x 2047.
Fixed an error on limitations.

Signed-off-by: Hoegeun Kwon 
---
 drivers/gpu/drm/exynos/exynos_drm_gsc.c | 11 +--
 include/uapi/drm/exynos_drm.h   |  2 ++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c 
b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
index bef5798..36e05ae 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
@@ -71,6 +71,7 @@
 #define GSC_CROP_MIN   32
 #define GSC_SCALE_MAX  4224
 #define GSC_SCALE_MIN  32
+#define GSC_ROT_MAX2047
 #define GSC_COEF_RATIO 7
 #define GSC_COEF_PHASE 9
 #define GSC_COEF_ATTR  16
@@ -1371,6 +1372,8 @@ static int gsc_init_prop_list(struct exynos_drm_ippdrv 
*ippdrv)
prop_list->scale_max.vsize = GSC_SCALE_MAX;
prop_list->scale_min.hsize = GSC_SCALE_MIN;
prop_list->scale_min.vsize = GSC_SCALE_MIN;
+   prop_list->rot_max.hsize = GSC_ROT_MAX;
+   prop_list->rot_max.vsize = GSC_ROT_MAX;

return 0;
 }
@@ -1444,7 +1447,9 @@ static int gsc_ippdrv_check_property(struct device *dev,
if ((pos->h < pp->crop_min.hsize) ||
(sz->vsize > pp->crop_max.hsize) ||
(pos->w < pp->crop_min.vsize) ||
-   (sz->hsize > pp->crop_max.vsize)) {
+   (sz->hsize > pp->crop_max.vsize) ||
+   (pos->h > pp->rot_max.hsize) ||
+   (pos->w > pp->rot_max.vsize)) {
DRM_ERROR("out of crop size.\n");
goto err_property;
}
@@ -1465,7 +1470,9 @@ static int gsc_ippdrv_check_property(struct device *dev,
if ((pos->h < pp->scale_min.hsize) ||
(sz->vsize > pp->scale_max.hsize) ||
(pos->w < pp->scale_min.vsize) ||
-   (sz->hsize > pp->scale_max.vsize)) {
+   (sz->hsize > pp->scale_max.vsize) ||
+   (pos->h > pp->rot_max.hsize) ||
+   (pos->w > pp->rot_max.vsize)) {
DRM_ERROR("out of scale size.\n");
goto err_property;
}
diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
index cb3e9f9..d5d5518 100644
--- a/include/uapi/drm/exynos_drm.h
+++ b/include/uapi/drm/exynos_drm.h
@@ -192,6 +192,7 @@ enum drm_exynos_planer {
  * @crop_max: crop max resolution.
  * @scale_min: scale min resolution.
  * @scale_max: scale max resolution.
+ * @rot_max: rotation max resolution.
  */
 struct drm_exynos_ipp_prop_list {
__u32   version;
@@ -210,6 +211,7 @@ struct drm_exynos_ipp_prop_list {
struct drm_exynos_szcrop_max;
struct drm_exynos_szscale_min;
struct drm_exynos_szscale_max;
+   struct drm_exynos_szrot_max;
 };

 /**
-- 
1.9.1