From 6cc3a505dcd60894a3ecefcbb40058873924bcf0 Mon Sep 17 00:00:00 2001 From: Ayan Halder Date: Tue, 19 Dec 2017 16:20:16 +0000 Subject: drm: mali-dp: Fix bug on scaling with rotation In the case, when the user wants to scale and rotate a layer by 90/270 degrees, the scaling engine input dimensions' parameters ie width and height needs to be swapped with respect to the layer's input dimensions. This means scaling engine input height should be set to layer's input width and scaling engine input width should be set to layer's input height. Signed-off-by: Ayan Halder Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_crtc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/drm/arm/malidp_crtc.c') diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c index 904fff80917b..7b952559fc43 100644 --- a/drivers/gpu/drm/arm/malidp_crtc.c +++ b/drivers/gpu/drm/arm/malidp_crtc.c @@ -288,8 +288,14 @@ static int malidp_crtc_atomic_check_scaling(struct drm_crtc *crtc, s->enhancer_enable = ((h_upscale_factor >> 16) >= 2 || (v_upscale_factor >> 16) >= 2); - s->input_w = pstate->src_w >> 16; - s->input_h = pstate->src_h >> 16; + if (pstate->rotation & MALIDP_ROTATED_MASK) { + s->input_w = pstate->src_h >> 16; + s->input_h = pstate->src_w >> 16; + } else { + s->input_w = pstate->src_w >> 16; + s->input_h = pstate->src_h >> 16; + } + s->output_w = pstate->crtc_w; s->output_h = pstate->crtc_h; -- cgit From 084ffbd7fd147ce6e114d82298c84f143d4fff7f Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 17 Jan 2018 23:55:29 +0200 Subject: drm: arm: malidp: Don't destroy planes manually in error handlers The top-level error handler calls drm_mode_config_cleanup() which will destroy all planes. There's no need to destroy them manually in lower error handlers. As plane cleanup is now handled entirely by drm_mode_config_cleanup(), we must ensure that the plane .destroy() handler frees allocated memory for the plane object that was freed by malidp_de_planes_destroy(). Do so by replacing the call to devm_kfree() in the .destroy() handler by kfree(). devm_kfree() is currently a no-op as the plane memory is allocated with kzalloc(), not devm_kzalloc(). Signed-off-by: Laurent Pinchart Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_crtc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'drivers/gpu/drm/arm/malidp_crtc.c') diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c index 7b952559fc43..fcc62bc60f6a 100644 --- a/drivers/gpu/drm/arm/malidp_crtc.c +++ b/drivers/gpu/drm/arm/malidp_crtc.c @@ -531,14 +531,13 @@ int malidp_crtc_init(struct drm_device *drm) if (!primary) { DRM_ERROR("no primary plane found\n"); - ret = -EINVAL; - goto crtc_cleanup_planes; + return -EINVAL; } ret = drm_crtc_init_with_planes(drm, &malidp->crtc, primary, NULL, &malidp_crtc_funcs, NULL); if (ret) - goto crtc_cleanup_planes; + return ret; drm_crtc_helper_add(&malidp->crtc, &malidp_crtc_helper_funcs); drm_mode_crtc_set_gamma_size(&malidp->crtc, MALIDP_GAMMA_LUT_SIZE); @@ -548,9 +547,4 @@ int malidp_crtc_init(struct drm_device *drm) malidp_se_set_enh_coeffs(malidp->dev); return 0; - -crtc_cleanup_planes: - malidp_de_planes_destroy(drm); - - return ret; } -- cgit