From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 177BF384258 for ; Tue, 17 Mar 2026 07:00:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773730832; cv=none; b=MjBXegnG9RR9nX9SwjeoumPVmO1ulnyGMzTicOrOnS89+4VVBYiUFldskhlFMXRKQcTKvXtOjpttuLgsianmkSNNw1zQpuvy89M8+21FQZEWCMuoPGSZxs9Z+iPwuWEWWI56Pm37wWzxP81wr6CrgzhZZ7/5Acvt8H7jgqyCKUI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773730832; c=relaxed/simple; bh=b5PhsqhAXOYswCLGJkKFJNFv2TuhUjxWSaUU9dG1HCg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dpp2vwB4e/3RyUztolGJNTby5hQQjx9jHNPoztiDyAZJ8D6IbNOsrllWIA572+OZCixsRyb4HNrd7NJMlwsVxbWmQ0iphJbxjwnpIn+y862800bLcOsdcKjnfMqgF/5Sigjk0CPwqFKHkAO41n032XsRqjSOfGWb1SF09aelE04= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AxNuCHOX; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AxNuCHOX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1773730830; x=1805266830; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=b5PhsqhAXOYswCLGJkKFJNFv2TuhUjxWSaUU9dG1HCg=; b=AxNuCHOXB7KddmAzti9Z9VlfR21141DlaclF83ccw+J9RPXLIBAdR/5t Jdopu03MlxK6RwJtEh0LEsAfPhfEh2X6xl/d00h/SAaFgu+Q9CEwSs91w CRBhk9ArxIK6W9jbRwNOifJdbHUAbpstORSep1XaO9HE/3MUSetx7HEyK ho6Vy5h8qCVy2hYEbRQGW/WcAT7juYEPOzTZnJ0ZvTvGwnznH8lG1RISg XmO7BVsSlVzq9LT0v3pFaJgruCOPRmS8/YAiwsWtJtdE5/mtRtrGaFuef usiRzfUWWi37sQjd3TKPRrqWLKA3MfY8aEspGCBllLDornD92CvAqzTt8 g==; X-CSE-ConnectionGUID: 8Hm6RTODQxqLgJ/halXnRQ== X-CSE-MsgGUID: JHOTAl0ISsedau7AIpeGQg== X-IronPort-AV: E=McAfee;i="6800,10657,11731"; a="92137548" X-IronPort-AV: E=Sophos;i="6.23,124,1770624000"; d="scan'208";a="92137548" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2026 00:00:29 -0700 X-CSE-ConnectionGUID: w5y3+OfLQm+TgvgjYCUF7w== X-CSE-MsgGUID: X23hVS9aTdqQ1h2r+5VgEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,124,1770624000"; d="scan'208";a="221198127" Received: from pgcooper-mobl3.ger.corp.intel.com (HELO localhost) ([10.245.245.99]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2026 00:00:27 -0700 Date: Tue, 17 Mar 2026 09:00:24 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Austin Hu Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, robin.clark@oss.qualcomm.com Subject: Re: [PATCH] drm/atomic: clear the state of plane which is unused. Message-ID: References: <20260316225507.392191-1-austin.hu@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260316225507.392191-1-austin.hu@intel.com> X-Patchwork-Hint: comment Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs Bertel Jungin Aukio 5, 02600 Espoo, Finland On Mon, Mar 16, 2026 at 03:55:07PM -0700, Austin Hu wrote: > Some libdrm user mode apps (including compositor) disable unused > plane with its previously binded CRTC or frame buffer object, but > may not reset its properties like src/dst coordinates, so that some > values of the unused plane state would be sticky. And even with > some Display Engine IP like Intel, a plane disabled from user mode > in current frame may be linked with another plane (e.g. to DMA Y or > UV semi-planar buffer) in KMD driver, so that its sticky UAPI > settings mismatch with the ones programmed to registers. > > So clear the unused plane state during each atomic commit, to make > sure each plane state is up to date. This change might be > unnecessary if user mode already clears plane property, but keep it > just in case. The kernel isn't allowed to magically change the value of properties set by userspace, apart from a few special cases. No idea what you're actually trying to fix here, but sounds like your userspace might be broken and needs to be fixed. > > Signed-off-by: Austin Hu > --- > drivers/gpu/drm/drm_atomic.c | 62 ++++++++++++++++++++++++++++++++++-- > 1 file changed, 59 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index dd9f27cfe991..0ce57e540a86 100644 > --- a/drivers/gpu/drm/drm_atomic.c > +++ b/drivers/gpu/drm/drm_atomic.c > @@ -690,6 +690,59 @@ plane_switching_crtc(const struct drm_plane_state *old_plane_state, > return true; > } > > +/** > + * drm_atomic_plane_state_reset - reset plane state > + * @plane: plane to reset > + * @plane_state: plane state to reset > + * > + * This function resets the plane state to its default values, after > + * the plane is disabled or when the plane state is no longer valid. > + */ > +static int drm_atomic_plane_state_reset(struct drm_plane *plane, > + struct drm_plane_state *plane_state) > +{ > + int ret; > + > + ret = drm_atomic_set_crtc_for_plane(plane_state, NULL); > + if (ret != 0) > + return ret; > + > + drm_atomic_set_fb_for_plane(plane_state, NULL); > + > + plane_state->crtc_x = 0; > + plane_state->crtc_y = 0; > + plane_state->crtc_w = 0; > + plane_state->crtc_h = 0; > + plane_state->src_x = 0; > + plane_state->src_y = 0; > + plane_state->src_w = 0; > + plane_state->src_h = 0; > + > + plane_state->alpha = 0; > + plane_state->pixel_blend_mode = 0; > + plane_state->rotation = 0; > + plane_state->zpos = 0; > + plane_state->color_encoding = 0; > + plane_state->color_range = 0; > + > + drm_atomic_set_colorop_for_plane(plane_state, NULL); > + > + bool replaced = false; > + > + ret = drm_property_replace_blob_from_id( > + plane->dev, &plane_state->fb_damage_clips, 0, -1, -1, > + sizeof(struct drm_mode_rect), &replaced); > + if (ret) > + return ret; > + > + plane_state->scaling_filter = 0; > + plane_state->hotspot_x = 0; > + plane_state->hotspot_y = 0; > + plane_state->visible = false; > + > + return 0; > +} > + > /** > * drm_atomic_plane_check - check plane state > * @old_plane_state: old plane state to check > @@ -701,7 +754,7 @@ plane_switching_crtc(const struct drm_plane_state *old_plane_state, > * Zero on success, error code on failure > */ > static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state, > - const struct drm_plane_state *new_plane_state) > + struct drm_plane_state *new_plane_state) > { > struct drm_plane *plane = new_plane_state->plane; > struct drm_crtc *crtc = new_plane_state->crtc; > @@ -721,9 +774,12 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state, > return -EINVAL; > } > > - /* if disabled, we don't care about the rest of the state: */ > + /* > + * if disabled, we don't care about the rest of the state: > + * but clear the plane state. > + */ > if (!crtc) > - return 0; > + return drm_atomic_plane_state_reset(plane, new_plane_state); > > /* Check whether this plane is usable on this CRTC */ > if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) { > -- > 2.34.1 -- Ville Syrjälä Intel