From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030423AbdADN1z (ORCPT ); Wed, 4 Jan 2017 08:27:55 -0500 Received: from mga06.intel.com ([134.134.136.31]:21243 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932168AbdADN1v (ORCPT ); Wed, 4 Jan 2017 08:27:51 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,459,1477983600"; d="scan'208";a="26041697" Date: Wed, 4 Jan 2017 15:27:37 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Neil Armstrong Cc: airlied@linux.ie, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH] drm/meson: Fix plane atomic check when no crtc for the plane Message-ID: <20170104132737.GF31595@intel.com> References: <1483435254-27955-1-git-send-email-narmstrong@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1483435254-27955-1-git-send-email-narmstrong@baylibre.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 03, 2017 at 10:20:54AM +0100, Neil Armstrong wrote: > When no CRTC is associated with the plane, the meson_plane_atomic_check() > call breaks the kernel with an Oops. > > Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller") > Signed-off-by: Neil Armstrong > --- > drivers/gpu/drm/meson/meson_plane.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c > index 4942ca0..7890e30 100644 > --- a/drivers/gpu/drm/meson/meson_plane.c > +++ b/drivers/gpu/drm/meson/meson_plane.c > @@ -51,6 +51,9 @@ static int meson_plane_atomic_check(struct drm_plane *plane, > struct drm_crtc_state *crtc_state; > struct drm_rect clip = { 0, }; > > + if (!state->crtc) > + return 0; > + Since you're not going to call drm_plane_helper_check_state() you will fail to update plane_state->visible. What i915 does in this case is look for state->crtc first, and if that's NULL it'll pick the crtc from the old state (plane->state->crtc). It looks a bit ugly, but maybe we should hide it in a small helper function that could be used by all drivers? > crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc); > if (IS_ERR(crtc_state)) > return PTR_ERR(crtc_state); > -- > 1.9.1 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrjälä Intel OTC