From patchwork Tue Aug 23 11:29:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Hogander, Jouni" X-Patchwork-Id: 12951968 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19093C32792 for ; Tue, 23 Aug 2022 11:31:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9CC0211AF07; Tue, 23 Aug 2022 11:31:15 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 012BC11AF46; Tue, 23 Aug 2022 11:30:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661254256; x=1692790256; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dhcs9iy7LyjmqdjtvPN2uVgUJMjbzgk4nJ1LzrDMKr0=; b=HlRs15k0KQ9JSwZrxarnrpG6wZ2/lZWg0RQYzMarxmm78YwxmqajTOak IbLdOqeybOJkzUU026fu0mzsdBW4jwFP9OwzXGcuVA375f68KkgdEo+BP fa93RLv2eug8NJZ1k56oLSjRJAPq9zJzfZNLhfbQQQWIeiL8iVv2YUVlQ O5LGqtlqlmK7S+fdvnDASIK+NRDmPKTsjHtewVDxhpdWAvahCt5+bVhIv LnnOGx9ce4aYopKLnFWiz/qzRGeq/Ws+5pIFmCPNp/q/mL7kfnfvG4f/k z+VgS8iIwrPocsyizpix3V320MBD4Ejl6qnG3BdR/JHMH4RM+pKJS5VF0 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10447"; a="273415842" X-IronPort-AV: E=Sophos;i="5.93,257,1654585200"; d="scan'208";a="273415842" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 04:30:55 -0700 X-IronPort-AV: E=Sophos;i="5.93,257,1654585200"; d="scan'208";a="669990877" Received: from fjohn-mobl.ger.corp.intel.com (HELO jhogande-mobl1.ger.corp.intel.com) ([10.249.42.156]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 04:30:54 -0700 From: =?utf-8?q?Jouni_H=C3=B6gander?= To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Tue, 23 Aug 2022 14:29:17 +0300 Message-Id: <20220823112920.352563-2-jouni.hogander@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220823112920.352563-1-jouni.hogander@intel.com> References: <20220823112920.352563-1-jouni.hogander@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Subject: [Intel-gfx] [PATCH v2 1/4] drm: Use original src rect while initializing damage iterator X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" drm_plane_state->src might be modified by the driver. This is done e.g. in i915 driver when there is bigger framebuffer than the plane and there is some offset within framebuffer. I915 driver calculates separate offset and adjusts src rect coords to be relative to this offset. Damage clips are still relative to original src coords provided by user-space. This patch ensures original coordinates provided by user-space are used when initiliazing damage iterator. Signed-off-by: Jouni Högander Reviewed-by: Mika Kahola --- drivers/gpu/drm/drm_damage_helper.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_damage_helper.c b/drivers/gpu/drm/drm_damage_helper.c index 937b699ac2a8..d8b2955e88fd 100644 --- a/drivers/gpu/drm/drm_damage_helper.c +++ b/drivers/gpu/drm/drm_damage_helper.c @@ -224,6 +224,7 @@ drm_atomic_helper_damage_iter_init(struct drm_atomic_helper_damage_iter *iter, const struct drm_plane_state *old_state, const struct drm_plane_state *state) { + struct drm_rect src; memset(iter, 0, sizeof(*iter)); if (!state || !state->crtc || !state->fb || !state->visible) @@ -233,10 +234,12 @@ drm_atomic_helper_damage_iter_init(struct drm_atomic_helper_damage_iter *iter, iter->num_clips = drm_plane_get_damage_clips_count(state); /* Round down for x1/y1 and round up for x2/y2 to catch all pixels */ - iter->plane_src.x1 = state->src.x1 >> 16; - iter->plane_src.y1 = state->src.y1 >> 16; - iter->plane_src.x2 = (state->src.x2 >> 16) + !!(state->src.x2 & 0xFFFF); - iter->plane_src.y2 = (state->src.y2 >> 16) + !!(state->src.y2 & 0xFFFF); + src = drm_plane_state_src(state); + + iter->plane_src.x1 = src.x1 >> 16; + iter->plane_src.y1 = src.y1 >> 16; + iter->plane_src.x2 = (src.x2 >> 16) + !!(src.x2 & 0xFFFF); + iter->plane_src.y2 = (src.y2 >> 16) + !!(src.y2 & 0xFFFF); if (!iter->clips || !drm_rect_equals(&state->src, &old_state->src)) { iter->clips = NULL; From patchwork Tue Aug 23 11:29:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Hogander, Jouni" X-Patchwork-Id: 12951967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 166BDC32772 for ; Tue, 23 Aug 2022 11:31:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8ED4E11AF46; Tue, 23 Aug 2022 11:31:12 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9EDD011BC8E; Tue, 23 Aug 2022 11:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661254258; x=1692790258; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J4TaDGzj9N9JOB/TT+BPw7LVCm7qKt22L+Gg4k72Bfc=; b=WpRcKjEE68TTSLDd+MYFk2bHeICfkvES55oIr7/SeoEhsH0xVaM2KZJf W43wDns839cA4SJHQG/10IQ9rQiRqpm9zx9/gpNJlmovj6mJGPh3WmU+j 9xtWGtN0INZ9bVpjWmYWIqw5zILEGuuM9Af8JmNt2kUGaEYEUy79egs2s fJbDZUmuNRP9iOnDg0jLiKiQAUk/HY6b3aU1iQ+JZwpzmwGarvKgorjo8 n4uy/DEJ7TMlw6d7F1F343F9ybE6XeMz5wIJwm2ZOlu0pl7fBc9DLyWP1 lTdbcXMMUKfd2qSlfh6WoIEeJ+Tmgt+Ik+42nKIE5+NBwBpys5kINuuIP g==; X-IronPort-AV: E=McAfee;i="6500,9779,10447"; a="273415853" X-IronPort-AV: E=Sophos;i="5.93,257,1654585200"; d="scan'208";a="273415853" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 04:30:58 -0700 X-IronPort-AV: E=Sophos;i="5.93,257,1654585200"; d="scan'208";a="669990898" Received: from fjohn-mobl.ger.corp.intel.com (HELO jhogande-mobl1.ger.corp.intel.com) ([10.249.42.156]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 04:30:56 -0700 From: =?utf-8?q?Jouni_H=C3=B6gander?= To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Tue, 23 Aug 2022 14:29:18 +0300 Message-Id: <20220823112920.352563-3-jouni.hogander@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220823112920.352563-1-jouni.hogander@intel.com> References: <20220823112920.352563-1-jouni.hogander@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Subject: [Intel-gfx] [PATCH v2 2/4] drm/i915/display: Use original src in psr2 sel fetch area calculation X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" drm_plane_state->src is modified when offset is calculated: before calculation: src.x1 = 8192, src.y1 = 8192 after calculation (pitch = 65536, cpp = 4, alignment = 262144) src.x1 = 8192, src.y1 = 0, offset = 0x20000000 Damage clips are relative to original coodrdinates provided by user-space. To compare these against src coordinates we need to use original coordinates as provided by user-space. These can be obtained by using drm_plane_state_src. Signed-off-by: Jouni Högander Reviewed-by: Mika Kahola --- drivers/gpu/drm/i915/display/intel_psr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c index 98c3c8015a5c..16985de24019 100644 --- a/drivers/gpu/drm/i915/display/intel_psr.c +++ b/drivers/gpu/drm/i915/display/intel_psr.c @@ -1767,7 +1767,8 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, continue; } - drm_rect_fp_to_int(&src, &new_plane_state->uapi.src); + src = drm_plane_state_src(&new_plane_state->uapi); + drm_rect_fp_to_int(&src, &src); drm_atomic_helper_damage_iter_init(&iter, &old_plane_state->uapi, From patchwork Tue Aug 23 11:29:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Hogander, Jouni" X-Patchwork-Id: 12951969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CC5BC32772 for ; Tue, 23 Aug 2022 11:31:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 813E011B09E; Tue, 23 Aug 2022 11:31:20 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 532C511A6B5; Tue, 23 Aug 2022 11:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661254262; x=1692790262; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RIVu2TPn4w7Z9DgnTG78XKczUccr+4MnnZ5D6WCpEPk=; b=m5XYMaR8vYViAvxB08fkdOjF5TC/6QYT9GWHb5OunN2dijsAEQHYQFAy k3OofW3/t3HD7X6DvYoVph1T2c5NdqX8LxEluWdt4HxH8goarMTCyaDKe J0pBO1PH0JvmzpVjh503JbOQ9EI5WpEJkgRc3gFHAntwt4Y5u796EXjB/ ugFRXj8DqcK1SiePyKYjiziWf/uK+fEALmVPYxvpu32bycUGTwQygrUMo koyU7FkVPVWPnlhWC/SStSj/6LF96l5K8ee8Rfn/VrOi88Od23E8eJvig cXokAtJcQeOPuzevH6WeLXVNBTpG/Yk1Io1c4oiUJu1szkGmm20L5kaaZ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10447"; a="273415863" X-IronPort-AV: E=Sophos;i="5.93,257,1654585200"; d="scan'208";a="273415863" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 04:31:02 -0700 X-IronPort-AV: E=Sophos;i="5.93,257,1654585200"; d="scan'208";a="669990921" Received: from fjohn-mobl.ger.corp.intel.com (HELO jhogande-mobl1.ger.corp.intel.com) ([10.249.42.156]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 04:31:00 -0700 From: =?utf-8?q?Jouni_H=C3=B6gander?= To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Tue, 23 Aug 2022 14:29:19 +0300 Message-Id: <20220823112920.352563-4-jouni.hogander@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220823112920.352563-1-jouni.hogander@intel.com> References: <20220823112920.352563-1-jouni.hogander@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Subject: [Intel-gfx] [PATCH v2 3/4] drm/i915/display: Use drm helper instead of own loop for damage clips X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Use existing drm_atomic_helper_damage_merged from generic drm code instead of implementing own loop to iterate over damage_clips. Signed-off-by: Jouni Högander Reviewed-by: Mika Kahola --- drivers/gpu/drm/i915/display/intel_psr.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c index 16985de24019..0ce8076be000 100644 --- a/drivers/gpu/drm/i915/display/intel_psr.c +++ b/drivers/gpu/drm/i915/display/intel_psr.c @@ -1721,8 +1721,6 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, new_plane_state, i) { struct drm_rect src, damaged_area = { .x1 = 0, .y1 = -1, .x2 = INT_MAX }; - struct drm_atomic_helper_damage_iter iter; - struct drm_rect clip; if (new_plane_state->uapi.crtc != crtc_state->uapi.crtc) continue; @@ -1770,20 +1768,15 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, src = drm_plane_state_src(&new_plane_state->uapi); drm_rect_fp_to_int(&src, &src); - drm_atomic_helper_damage_iter_init(&iter, - &old_plane_state->uapi, - &new_plane_state->uapi); - drm_atomic_for_each_plane_damage(&iter, &clip) { - if (drm_rect_intersect(&clip, &src)) - clip_area_update(&damaged_area, &clip, - &crtc_state->pipe_src); - } - - if (damaged_area.y1 == -1) + if (!drm_atomic_helper_damage_merged(&old_plane_state->uapi, + &new_plane_state->uapi, &damaged_area)) continue; damaged_area.y1 += new_plane_state->uapi.dst.y1 - src.y1; damaged_area.y2 += new_plane_state->uapi.dst.y1 - src.y1; + damaged_area.x1 += new_plane_state->uapi.dst.x1 - src.x1; + damaged_area.x2 += new_plane_state->uapi.dst.x1 - src.x1; + clip_area_update(&pipe_clip, &damaged_area, &crtc_state->pipe_src); } From patchwork Tue Aug 23 11:29:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Hogander, Jouni" X-Patchwork-Id: 12951970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A7542C32772 for ; Tue, 23 Aug 2022 11:31:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3C32511B990; Tue, 23 Aug 2022 11:31:29 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id D717511A6B5; Tue, 23 Aug 2022 11:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661254265; x=1692790265; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q+RysrBb1ykLU47KP6NsqGGk4VJcDn3GVM5qaCdIaVA=; b=DyA7ZkMNo5iUyy8zLjTAzwhCCDvQFyL9F3IAsjFqW4HnmfjnT3kGabIQ jrmnJzEroNNawoNqONTmuRCumzb9eRmV+aO7Y5snTKb86yEEmKeILzhER VYdFK6Uysh/eIj2TtZWeSSMbO3BRWe30cGlEb8VqXX0H9FP7nOnJF/UoQ Hx52Q2IxwMacYe1d8GMVrQi8RsVryOSYTmRqVN23DwCOJQ58tEwIE3lQj JDWWOu5ybrvzdC2dyNMIFXzSM32J28pqaQQDjWW1XwzIK3uwW7ZK5ewkF PRbF73495zorD2joiqC6CKbpNUoCVGFo8j/UC+qyhgkBee1vRWt9aSHHz A==; X-IronPort-AV: E=McAfee;i="6500,9779,10447"; a="273415877" X-IronPort-AV: E=Sophos;i="5.93,257,1654585200"; d="scan'208";a="273415877" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 04:31:05 -0700 X-IronPort-AV: E=Sophos;i="5.93,257,1654585200"; d="scan'208";a="669990932" Received: from fjohn-mobl.ger.corp.intel.com (HELO jhogande-mobl1.ger.corp.intel.com) ([10.249.42.156]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 04:31:03 -0700 From: =?utf-8?q?Jouni_H=C3=B6gander?= To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Tue, 23 Aug 2022 14:29:20 +0300 Message-Id: <20220823112920.352563-5-jouni.hogander@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220823112920.352563-1-jouni.hogander@intel.com> References: <20220823112920.352563-1-jouni.hogander@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Subject: [Intel-gfx] [PATCH v2 4/4] drm/tests: Set also mock plane src_x, src_y, src_w and src_h X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We need to set also src_x, src_y, src_w and src_h for the mock plane. After fix for drm_atomic_helper_damage_iter_init we are using these when iterating damage_clips. Signed-off-by: Jouni Högander Reviewed-by: Mika Kahola Tested-by: Maíra Canal --- drivers/gpu/drm/tests/drm_damage_helper_test.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_damage_helper_test.c b/drivers/gpu/drm/tests/drm_damage_helper_test.c index bf250bd08d7e..c608ae06f0e3 100644 --- a/drivers/gpu/drm/tests/drm_damage_helper_test.c +++ b/drivers/gpu/drm/tests/drm_damage_helper_test.c @@ -59,6 +59,11 @@ static int drm_damage_helper_init(struct kunit *test) static void set_plane_src(struct drm_plane_state *state, int x1, int y1, int x2, int y2) { + state->src_x = x1; + state->src_y = y1; + state->src_w = x2 - x1; + state->src_h = y2 - y1; + state->src.x1 = x1; state->src.y1 = y1; state->src.x2 = x2;