diff mbox

[2/7] drm/exynos/mixer: replace direct cross-driver call with drm mode validation

Message ID 1445861025-23266-3-git-send-email-a.hajda@samsung.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Andrzej Hajda Oct. 26, 2015, 12:03 p.m. UTC
HDMI driver called directly function from MIXER driver to invalidate modes
not supported by MIXER. The patch replaces the hack with proper .atomic_check
callback.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c  |  5 -----
 drivers/gpu/drm/exynos/exynos_mixer.c |  6 ++++--
 drivers/gpu/drm/exynos/exynos_mixer.h | 20 --------------------
 3 files changed, 4 insertions(+), 27 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_mixer.h

Comments

Javier Martinez Canillas Nov. 24, 2015, 9:40 p.m. UTC | #1
Hello Andrzej,

On Mon, Oct 26, 2015 at 9:03 AM, Andrzej Hajda <a.hajda@samsung.com> wrote:
> HDMI driver called directly function from MIXER driver to invalidate modes
> not supported by MIXER. The patch replaces the hack with proper .atomic_check
> callback.
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---

It seems this patch is not a drop-in replacement since it causes a
"Division by zero in kernel" error with v4.4-rc2 on an Exynos5800
Peach Pi, causing the display console to not be initialized. X works
correctly though.

An interesting data point is that it only happens when the HDMI
monitor is not plugged on the first mode set, everything works
correctly when booting with a HDMI monitor plugged.

Following is the relevant messages from the kernel log buffer:

[   14.295702] Division by zero in kernel.
[   14.298191] CPU: 0 PID: 2008 Comm: Xorg Not tainted 4.4.0-rc2 #111
[   14.304243] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   14.310334] [<c0015f08>] (unwind_backtrace) from [<c0012c94>]
(show_stack+0x10/0x14)
[   14.318072] [<c0012c94>] (show_stack) from [<c01f8f80>]
(dump_stack+0x84/0xc4)
[   14.325264] [<c01f8f80>] (dump_stack) from [<c01f7a90>] (Ldiv0+0x8/0x10)
[   14.331943] [<c01f7a90>] (Ldiv0) from [<c02b34f8>] (fimd_commit+0x1f0/0x2b4)
[   14.338968] [<c02b34f8>] (fimd_commit) from [<c02b0788>]
(exynos_drm_crtc_enable+0x1c/0x28)
[   14.347303] [<c02b0788>] (exynos_drm_crtc_enable) from [<c028b328>]
(drm_atomic_helper_commit_modeset_enables+0x98/0x198)
[   14.358227] [<c028b328>] (drm_atomic_helper_commit_modeset_enables)
from [<c02afc40>] (exynos_atomic_commit_complete+0x2c/0x1c4)
[   14.369761] [<c02afc40>] (exynos_atomic_commit_complete) from
[<c02b0604>] (exynos_atomic_commit+0x180/0x1cc)
[   14.379681] [<c02b0604>] (exynos_atomic_commit) from [<c028c770>]
(drm_atomic_helper_set_config+0x6c/0x90)
[   14.389301] [<c028c770>] (drm_atomic_helper_set_config) from
[<c029cabc>] (drm_mode_set_config_internal+0x58/0xd4)
[   14.399629] [<c029cabc>] (drm_mode_set_config_internal) from
[<c02a18d0>] (drm_mode_setcrtc+0x148/0x4bc)
[   14.409078] [<c02a18d0>] (drm_mode_setcrtc) from [<c029489c>]
(drm_ioctl+0x12c/0x49c)
[   14.416892] [<c029489c>] (drm_ioctl) from [<c00ec19c>]
(do_vfs_ioctl+0x498/0x6c8)
[   14.424346] [<c00ec19c>] (do_vfs_ioctl) from [<c00ec400>]
(SyS_ioctl+0x34/0x5c)
[   14.431638] [<c00ec400>] (SyS_ioctl) from [<c000f600>]
(ret_fast_syscall+0x0/0x3c)

Best regards,
Javier
--
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
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index b0f5ff4..57b6755 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -44,7 +44,6 @@ 
 
 #include "exynos_drm_drv.h"
 #include "exynos_drm_crtc.h"
-#include "exynos_mixer.h"
 
 #define HOTPLUG_DEBOUNCE_MS		1100
 
@@ -1017,10 +1016,6 @@  static int hdmi_mode_valid(struct drm_connector *connector,
 		(mode->flags & DRM_MODE_FLAG_INTERLACE) ? true :
 		false, mode->clock * 1000);
 
-	ret = mixer_check_mode(mode);
-	if (ret)
-		return MODE_BAD;
-
 	ret = hdmi_find_phy_conf(hdata, mode->clock * 1000);
 	if (ret < 0)
 		return MODE_BAD;
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 3f9f072..d09f8f9 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -39,7 +39,6 @@ 
 #include "exynos_drm_crtc.h"
 #include "exynos_drm_plane.h"
 #include "exynos_drm_iommu.h"
-#include "exynos_mixer.h"
 
 #define MIXER_WIN_NR		3
 #define VP_DEFAULT_WIN		2
@@ -1096,8 +1095,10 @@  static void mixer_disable(struct exynos_drm_crtc *crtc)
 }
 
 /* Only valid for Mixer version 16.0.33.0 */
-int mixer_check_mode(struct drm_display_mode *mode)
+static int mixer_atomic_check(struct exynos_drm_crtc *crtc,
+		       struct drm_crtc_state *state)
 {
+	struct drm_display_mode *mode = &state->adjusted_mode;
 	u32 w, h;
 
 	w = mode->hdisplay;
@@ -1123,6 +1124,7 @@  static const struct exynos_drm_crtc_ops mixer_crtc_ops = {
 	.wait_for_vblank	= mixer_wait_for_vblank,
 	.update_plane		= mixer_update_plane,
 	.disable_plane		= mixer_disable_plane,
+	.atomic_check		= mixer_atomic_check,
 };
 
 static struct mixer_drv_data exynos5420_mxr_drv_data = {
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.h b/drivers/gpu/drm/exynos/exynos_mixer.h
deleted file mode 100644
index 3811e41..0000000
--- a/drivers/gpu/drm/exynos/exynos_mixer.h
+++ /dev/null
@@ -1,20 +0,0 @@ 
-/*
- * Copyright (C) 2013 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef _EXYNOS_MIXER_H_
-#define _EXYNOS_MIXER_H_
-
-/* This function returns 0 if the given timing is valid for the mixer */
-int mixer_check_mode(struct drm_display_mode *mode);
-
-#endif