Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1257135pxb; Thu, 23 Sep 2021 23:48:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyavRSANRmwm0crqXt8ejrJCcoCxp1tVCcGueambUAuncF5KfNkPI+C4t0CapHREBP4FQxe X-Received: by 2002:a17:906:2691:: with SMTP id t17mr9169864ejc.522.1632466123820; Thu, 23 Sep 2021 23:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632466123; cv=none; d=google.com; s=arc-20160816; b=uAQtseGn8hTR5BoAQblUZsukHE0a4Cnl8d1Gs4PSpBgxbccE9B48lH7Ixt73K+MDzw B8MjikaRY67OZe6m2oL0tSCZ8AdH49hwpYrd+o87ajdVgzwvtQl3PU6l+7WG1+Kt7osm a9lL6m2kQo9ryGxKO0mJUfRFh+fbGLe+c6qlDi7oAKb8d6C9DnrMYTvK3ggtIXdoQcfP UaAEUHNjO4SySFmydngKTo6RVC+scHFFgwPic6TI62r3ckQLMVspr5PFw3VcjFsRPIny FAO+j5DANCAU3X3WNw7AmcwcARUxamoVthMappV7h14vS9mFO83N7WiVREh8O6Qnyp1a /FHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=zEFMk0/3+W+TWpGRDcGSN7JQyCbDlMqHTw1oH0NyBmo=; b=VT9ynQJ6gKgsAMB/G8f1Xjg2zcGlQM6Jxy6DzXAE2jp6eG82itJ6/jG32DdqjCzZut nquFSRHBil6zIWKMXlwAvRTFUfdJcvhQEFMQrU10i8mVv12kz9Ry2km5zaIC1ENqLvAs SdIz13zZIipLb8NxZgaJuCOLwEY6s7KBEByT8b/+xK1YCrqWqfRzO1Q33BDolraDAQyu UQolv8jMsb0wT0N4nJjWhgng74gUQMsjnh/4qOAQLuS1atyYtyb3cseeoMOZvikOA9l/ 57fn0qhUH0HOyBaTjXVBCDw79RryEe4uriDi1ktncA8Kc0hjeKTcqUOV4W3pNfbeAgxy K6Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@u92.eu header.s=fm3 header.b=ubfdzZdv; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=bxsGcpss; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si9824121edw.382.2021.09.23.23.48.20; Thu, 23 Sep 2021 23:48:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@u92.eu header.s=fm3 header.b=ubfdzZdv; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=bxsGcpss; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244394AbhIXGp6 (ORCPT + 99 others); Fri, 24 Sep 2021 02:45:58 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:55169 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244405AbhIXGpo (ORCPT ); Fri, 24 Sep 2021 02:45:44 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 34BF3581079; Fri, 24 Sep 2021 02:44:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 24 Sep 2021 02:44:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=u92.eu; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=zEFMk0/3+W+TW pGRDcGSN7JQyCbDlMqHTw1oH0NyBmo=; b=ubfdzZdv0AkYnrIUbTTyqE3wKzXNx xjeG+w5IjpXaBHY3PWzdSJDD/pD/0dAvAAmeuUqdr4vvHSEw/7/xxQtlEoe8IHzi A4+oD1jlyGHMv6BPr479DMIm/Ufdz5mZntUzx3hHIo4cdRjtzqD23rz4vpPGT+KT 0exhNUfDzgnqE1Gk3hdgWqrkzyyXGoPvUKP1hYuItoa3nJej9tV3wg2GdBqOCUqy sVBvS8ShNokNNeHmjQr9x5bpcxjc2mtKFcVnL0o2/exWSAsScFvZsnEhvOXVDt5Z sUybN6/quNGgSe25Bs1JMD7q9jtYMwGHbcxkSdE2Vgz85PWi7MkXbzJ8g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=zEFMk0/3+W+TWpGRDcGSN7JQyCbDlMqHTw1oH0NyBmo=; b=bxsGcpss 9jp14NiVTh8ZWAANK0zbhloZwpZ69UdTjr06SECA9ziDCBLUntJl4zXV96JmIDTf wE6lbIpl3nJEUrZiiHTlmpMurJIPIwdKNDqSASLfOn7km2kbLsu5vlrMDefz96t0 Ksbb6VurvIEv6KdjHqvbH9dTEqryF0p0bbgh7Jp7NiDK3obrMWLZoUjJ6kBuYNb4 0660XtAmrEK8qJs+atKiHs4zqzsyMudUDjI+I7Rbg+gMciDysMM6yNvBmfsqY264 8ShFH+FunoXTqVNw9ZbBmVtFXRDVYFAVWM43CthQhnje4cjOfr/FL8p+JUgY/vGY maakgLfXxs3tcw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudejtddguddtlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefhvghrnhgrnhguohcutfgrmhhoshcuoehgrhgvvghnfhho ohesuhelvddrvghuqeenucggtffrrghtthgvrhhnpeekleekjedtheejheekfefggeevvd fgueegffeuveduhfehueegkeeijedvvdejfeenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvvghnfhhoohesuhelvddrvghu X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 24 Sep 2021 02:44:08 -0400 (EDT) From: Fernando Ramos To: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, sean@poorly.run, linux-doc@vger.kernel.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 13/17] drm/i915: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN() part 2 Date: Fri, 24 Sep 2021 08:43:20 +0200 Message-Id: <20210924064324.229457-14-greenfoo@u92.eu> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210924064324.229457-1-greenfoo@u92.eu> References: <20210924064324.229457-1-greenfoo@u92.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As requested in Documentation/gpu/todo.rst, replace driver calls to drm_modeset_lock_all() with DRM_MODESET_LOCK_ALL_BEGIN() and DRM_MODESET_LOCK_ALL_END() While the previous commit was a simple "search and replace", this time I had to do a bit of refactoring as only one call to DRM_MODESET_LOCK_ALL_BEGIN() is allowed inside one same function. Signed-off-by: Fernando Ramos --- drivers/gpu/drm/i915/display/intel_overlay.c | 40 ++++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c index c0ee135e5499..c623738c59c8 100644 --- a/drivers/gpu/drm/i915/display/intel_overlay.c +++ b/drivers/gpu/drm/i915/display/intel_overlay.c @@ -1105,6 +1105,7 @@ int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data, struct drm_crtc *drmmode_crtc; struct intel_crtc *crtc; struct drm_i915_gem_object *new_bo; + struct drm_modeset_acquire_ctx ctx; int ret; overlay = dev_priv->overlay; @@ -1113,24 +1114,24 @@ int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data, return -ENODEV; } - if (!(params->flags & I915_OVERLAY_ENABLE)) { - drm_modeset_lock_all(dev); - ret = intel_overlay_switch_off(overlay); - drm_modeset_unlock_all(dev); + if (params->flags & I915_OVERLAY_ENABLE) { - return ret; - } + drmmode_crtc = drm_crtc_find(dev, file_priv, params->crtc_id); + if (!drmmode_crtc) + return -ENOENT; + crtc = to_intel_crtc(drmmode_crtc); - drmmode_crtc = drm_crtc_find(dev, file_priv, params->crtc_id); - if (!drmmode_crtc) - return -ENOENT; - crtc = to_intel_crtc(drmmode_crtc); + new_bo = i915_gem_object_lookup(file_priv, params->bo_handle); + if (!new_bo) + return -ENOENT; + } - new_bo = i915_gem_object_lookup(file_priv, params->bo_handle); - if (!new_bo) - return -ENOENT; + DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret); - drm_modeset_lock_all(dev); + if (!(params->flags & I915_OVERLAY_ENABLE)) { + ret = intel_overlay_switch_off(overlay); + goto out_unlock; + } if (i915_gem_object_is_tiled(new_bo)) { drm_dbg_kms(&dev_priv->drm, @@ -1195,14 +1196,11 @@ int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data, if (ret != 0) goto out_unlock; - drm_modeset_unlock_all(dev); - i915_gem_object_put(new_bo); - - return 0; - out_unlock: - drm_modeset_unlock_all(dev); - i915_gem_object_put(new_bo); + DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); + + if (params->flags & I915_OVERLAY_ENABLE) + i915_gem_object_put(new_bo); return ret; } -- 2.33.0