From patchwork Wed Feb 28 18:32:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Kiryushin X-Patchwork-Id: 207960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3540870dyb; Wed, 28 Feb 2024 10:46:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU3BqJpn8CsC/0sYORnJiArlwnpm72ma/aTFJ0jTcIWUDw4keooVS43R3GFOQxPuL25y96YYgJZ5SsVXev1MdjmSwgsDg== X-Google-Smtp-Source: AGHT+IE4Njzd+iie5nftpKOoIZUpnvlkjuR0tTT7X/236Ha+M0pNT/aM0EFKaeoEgK7/J9Jt0qK+ X-Received: by 2002:a05:6a00:198d:b0:6e4:7762:624d with SMTP id d13-20020a056a00198d00b006e47762624dmr3644pfl.10.1709145971118; Wed, 28 Feb 2024 10:46:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709145971; cv=pass; d=google.com; s=arc-20160816; b=PdeMq53CasPU/hXF8L77tEt2YAQlsudHRs+aKfZLwlbrtngfTxiicWgjnsQDWPDL5u +qF5Ds1VUP2cG5ggCmSjVemkRyapkB/u98gR4hoIG9NHKZkbFAz0vAjmJFaS9ycaMNM3 dvydqehsPZOFoKgIGJEBnylYsu3QitkABmzOcV5bgdDYQ8sGCLJtFbVss7O0KB7JjlTh 8sOJ1dDGpG4DFyTRQewiqv3d9he5f1BpBq2TvbwkzMDSkPMkOFddE9Xc9PEHodldaLXr BYsbfNSOtU2XcE/EnQ30E++QjV75bH8rfAIn/Lbwbeipiddla3TA0ZjVyzrUX7YwntIi cJAA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:cc:to:content-language :references:reply-to:subject:from:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=x9EGP0VfHwgtE+zhdEbqEGMyyEUW6NqX1LNB4JCeEfk=; fh=W3bCfKXBSeIuabwxGBI1D8VX5JIdo0RjVS3KibIPlB8=; b=EYlnGo5NKWCpXA7IhwoIL9j+n6cAYAbXPSXbOpBPzMRbAyvIkq1aq4Wtk+RpkjLnwN VZdQH0fUBEwo72nL06/+XOrEfwslS/F7JabsLOTtTQlTmqtVsMM0pjL+POObRJ3Ayrm1 KGH1+hq1vhPWXwtRH7EgHhfIo/4gQQuwMpfp3wc3n0MydGRBv4ju/J3QmbakW0Mdguqg POpS5h8kFI4ZJ9ZaowG60cfbpQ+/o2TF4c/jJ7u3v4rq6vJNs2Jr8HLRT0Ghz2FiA1qa FG6ZfA0phkyYd9F42FxtPPnRLM6Vs9DlkrQwXKo70XMQsxkTqVotODRDx9lyGqceTtXg iAmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=ancud.ru); spf=pass (google.com: domain of linux-kernel+bounces-85541-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85541-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m135-20020a633f8d000000b005cee03a1bf9si80075pga.448.2024.02.28.10.46.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 10:46:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85541-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=ancud.ru); spf=pass (google.com: domain of linux-kernel+bounces-85541-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85541-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 379ED28BE22 for ; Wed, 28 Feb 2024 18:38:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2D4871EC7; Wed, 28 Feb 2024 18:38:43 +0000 (UTC) Received: from relay161.nicmail.ru (relay161.nicmail.ru [91.189.117.5]) (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 EE15279B79 for ; Wed, 28 Feb 2024 18:38:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.189.117.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709145522; cv=none; b=St0U6VfDpMkL4WWjyTpiQ6+fQgZDV6Jq7lV9ZhDdt4NK5zOCm5iOpd7RpWuRrM9XjROtILVafBNuvPuVbUqwJyL3Jk4fgiGv0Ccz/5usU6IzBqTYyUMyBl8uGvmTyisJI9aUX3Du6F4EpmTGfo5U4XLpQZt95cww/FpuKxTu4sQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709145522; c=relaxed/simple; bh=MsJjh7TXS8JgWzGdB0v4jRwOparhSbtOtRlvrf4J/gU=; h=Message-ID:Date:MIME-Version:From:Subject:References:To:Cc: In-Reply-To:Content-Type; b=A2LGTywGplfT0AX8CmV0yTt9tEFv+uSUod+qkAIjo1tWu3miBF+6C3oOqGZq4BnMYHIabkIHLlTcXWG26rWMefMFM5Wix9qhEvZJz6I2A10vgJydg3Xiq9tOZXO0uavHF+Jvhl6kRgG35v0GF8OcGz9DHbT4L6NWqiYuGhdnj3s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ancud.ru; spf=pass smtp.mailfrom=ancud.ru; arc=none smtp.client-ip=91.189.117.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ancud.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ancud.ru Received: from [10.28.138.149] (port=32378 helo=[192.168.95.111]) by relay.hosting.mail.nic.ru with esmtp (Exim 5.55) (envelope-from ) id 1rfOja-00034v-6A; Wed, 28 Feb 2024 21:32:51 +0300 Received: from [87.245.155.195] (account kiryushin@ancud.ru HELO [192.168.95.111]) by incarp1102.mail.hosting.nic.ru (Exim 5.55) with id 1rfOja-000Yz9-2h; Wed, 28 Feb 2024 21:32:50 +0300 Message-ID: <79c92cfa-cf5a-4a23-8a93-11c1af7432fc@ancud.ru> Date: Wed, 28 Feb 2024 21:32:47 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Nikita Kiryushin Subject: [PATCH] drm/i915: Remove unneeded double drm_rect_visible call in check_overlay_dst Reply-To: Nikita Kiryushin References: <> Content-Language: en-US To: Jani Nikula Cc: Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , David Airlie , Daniel Vetter , Manasi Navare , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, project@linuxtesting.org In-Reply-To: <> X-MS-Exchange-Organization-SCL: -1 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792169445574088163 X-GMAIL-MSGID: 1792169445574088163 check_overlay_dst for clipped is called 2 times: in drm_rect_intersect and than directly. Change second call for check of drm_rect_intersect result to save some time (in locked code section). Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 8d8b2dd3995f ("drm/i915: Make the PIPESRC rect relative to the entire bigjoiner area") Signed-off-by: Nikita Kiryushin --- drivers/gpu/drm/i915/display/intel_overlay.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c index 2b1392d5a902..1cda1c163a92 100644 --- a/drivers/gpu/drm/i915/display/intel_overlay.c +++ b/drivers/gpu/drm/i915/display/intel_overlay.c @@ -972,9 +972,8 @@ static int check_overlay_dst(struct intel_overlay *overlay, rec->dst_width, rec->dst_height); clipped = req; - drm_rect_intersect(&clipped, &crtc_state->pipe_src); - if (!drm_rect_visible(&clipped) || + if (!drm_rect_intersect(&clipped, &crtc_state->pipe_src) || !drm_rect_equals(&clipped, &req)) return -EINVAL; -- 2.34.1