diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2018-01-25 15:00:25 +0100 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2018-03-15 14:44:06 +0100 |
commit | a25c7e06b01a3c8cf23ed2b11a95cc86f2f242fb (patch) | |
tree | b0e25ad63d8eae93dc99e93051674f9f2cc62773 | |
parent | 94a7a4d301969bb071645c78a038bf9678b15b87 (diff) | |
download | linux-exynos-a25c7e06b01a3c8cf23ed2b11a95cc86f2f242fb.tar.gz linux-exynos-a25c7e06b01a3c8cf23ed2b11a95cc86f2f242fb.tar.bz2 linux-exynos-a25c7e06b01a3c8cf23ed2b11a95cc86f2f242fb.zip |
drm/exynos: ipp: Fix support for image rotation and buffer offset
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: If70132b04d37845ea99d798faea52743063774a7
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_gsc.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_ipp.c | 16 |
2 files changed, 13 insertions, 12 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 1fdb20d2a9f4..a00411abbf3c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c @@ -528,12 +528,11 @@ static void gsc_src_set_transf(struct gsc_context *ctx, unsigned int rotation) cfg |= GSC_IN_ROT_YFLIP; break; case DRM_MODE_ROTATE_90: + cfg |= GSC_IN_ROT_90; if (rotation & DRM_MODE_REFLECT_Y) - cfg |= GSC_IN_ROT_90_XFLIP; - else if (rotation & DRM_MODE_REFLECT_X) - cfg |= GSC_IN_ROT_90_YFLIP; - else - cfg |= GSC_IN_ROT_90; + cfg |= GSC_IN_ROT_XFLIP; + if (rotation & DRM_MODE_REFLECT_X) + cfg |= GSC_IN_ROT_YFLIP; break; case DRM_MODE_ROTATE_180: cfg |= GSC_IN_ROT_180; diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index e5815a87974a..7cd050cbb0a5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c @@ -470,8 +470,7 @@ static int exynos_drm_ipp_task_setup_buffer(struct drm_device *dev, for (i = 0; i < buf->format->num_planes; i++) { unsigned int height = (i == 0) ? buf->buf.height : DIV_ROUND_UP(buf->buf.height, buf->format->vsub); - unsigned long size = height * buf->buf.pitch[i] + - buf->buf.offset[i]; + unsigned long size = height * buf->buf.pitch[i]; struct drm_gem_object *obj = drm_gem_object_lookup(dev, filp, buf->buf.gem_id[i]); if (!obj) { @@ -480,7 +479,7 @@ static int exynos_drm_ipp_task_setup_buffer(struct drm_device *dev, } buf->exynos_gem[i] = to_exynos_gem_obj(obj); - if (size > buf->exynos_gem[i]->size) { + if (size + buf->buf.offset[i] > buf->exynos_gem[i]->size) { i++; ret = -EINVAL; goto gem_free; @@ -650,6 +649,7 @@ static int exynos_drm_ipp_check_scale_limits( unsigned int num_limits, bool swap) { const struct drm_exynos_ipp_limit_val *lh, *lv; + int dw, dh; for (; num_limits; limits++, num_limits--) if ((limits->type & DRM_EXYNOS_IPP_LIMIT_TYPE_MASK) == @@ -660,9 +660,11 @@ static int exynos_drm_ipp_check_scale_limits( lh = (!swap) ? &limits->h : &limits->v; lv = (!swap) ? &limits->v : &limits->h; + dw = (!swap) ? dst->w : dst->h; + dh = (!swap) ? dst->h : dst->w; - if (!__scale_limit_check(src->w, dst->w, lh->min, lh->max) || - !__scale_limit_check(src->h, dst->h, lv->min, lv->max)) + if (!__scale_limit_check(src->w, dw, lh->min, lh->max) || + !__scale_limit_check(src->h, dh, lv->min, lv->max)) return -EINVAL; return 0; @@ -741,7 +743,7 @@ static int exynos_drm_ipp_task_check(struct exynos_drm_ipp_task *task, } ret = exynos_drm_ipp_check_size_limits(dst, dst_fmt->limits, dst_fmt->num_limits, - rotate, swap); + false, swap); if (ret) return ret; ret = exynos_drm_ipp_check_scale_limits(&src->rect, &dst->rect, @@ -866,7 +868,7 @@ void exynos_drm_ipp_task_done(struct exynos_drm_ipp_task *task, int ret) struct exynos_drm_ipp *ipp = task->ipp; unsigned long flags; - DRM_DEBUG_DRIVER("ipp: %d, task %pK done\n", ipp->id, task); + DRM_DEBUG_DRIVER("ipp: %d, task %pK done: %d\n", ipp->id, task, ret); spin_lock_irqsave(&ipp->lock, flags); if (ipp->task == task) |