From patchwork Sat Mar 25 17:27:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Grillo X-Patchwork-Id: 13187825 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 50E69C6FD1F for ; Sat, 25 Mar 2023 17:29:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2ECDE10E19E; Sat, 25 Mar 2023 17:28:55 +0000 (UTC) Received: from mx1.riseup.net (mx1.riseup.net [198.252.153.129]) by gabe.freedesktop.org (Postfix) with ESMTPS id A82D310E053; Sat, 25 Mar 2023 17:28:53 +0000 (UTC) Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4PkQzS5ZSWzDr1r; Sat, 25 Mar 2023 17:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1679765333; bh=a7cIYAiwZ09xv6n94pofKkkL5zxjN5XJBatIhLW6cRc=; h=From:To:Cc:Subject:Date:From; b=d5N8tsNnjnTtU9HBR0Wnb0R+5QEgiZCA8ZTjelbrukNLlIL8LZqPH83C6TCyPhoaX foZFQ63+RKO0QpbvXzH9U7LHT1LiIWbhUCUrPQ4G0FsMdtzKQNHRoHGEG69lGatWWI UjVXvQOP+U6oqpyNWQYdXjOowp4g6Iddw8c3vLR8= X-Riseup-User-ID: DFFDE329F4163AA6BE3EDC0BB6655159F995F415CFE1D37105CFD61B346B7E09 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4PkQzM3knxz1yPW; Sat, 25 Mar 2023 17:28:47 +0000 (UTC) From: Arthur Grillo To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2] drm/i915/overlay: Remove redundant drm_rect_visible() use Date: Sat, 25 Mar 2023 14:27:19 -0300 Message-Id: <20230325172719.92102-1-arthurgrillo@riseup.net> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tvrtko.ursulin@linux.intel.com, tales.aparecida@gmail.com, lucas.demarchi@intel.com, mairacanal@riseup.net, rodrigo.vivi@intel.com, andrealmeid@riseup.net, Arthur Grillo Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The drm_rect_intersect() already returns if the intersection is visible or not, so the use of drm_rect_visible() is duplicate. Signed-off-by: Arthur Grillo --- v1->v2: https://lore.kernel.org/all/20230324142533.6357-1-arthurgrillo@riseup.net/ - Split the if condition. --- drivers/gpu/drm/i915/display/intel_overlay.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c index c12bdca8da9b..d55153587cae 100644 --- a/drivers/gpu/drm/i915/display/intel_overlay.c +++ b/drivers/gpu/drm/i915/display/intel_overlay.c @@ -966,10 +966,11 @@ 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) || - !drm_rect_equals(&clipped, &req)) + if (!drm_rect_intersect(&clipped, &crtc_state->pipe_src)) + return -EINVAL; + + if (!drm_rect_equals(&clipped, &req)) return -EINVAL; return 0;