From patchwork Fri Nov 1 13:03:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 11223101 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C5F11515 for ; Fri, 1 Nov 2019 13:05:13 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 23CC3217D9 for ; Fri, 1 Nov 2019 13:05:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23CC3217D9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 202266E21E; Fri, 1 Nov 2019 13:05:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id E124F6E21E for ; Fri, 1 Nov 2019 13:05:09 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id 6so8742601wmf.0 for ; Fri, 01 Nov 2019 06:05:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ImCE5nJq/DYo2Ok76YGyMffnMJmXxt+3gqtE07/WUSI=; b=fENz8N7m0OeqmbL0srL3jgpsAWcGW89zAbsj1eh+8XilIcoU8LhwYamoqQhJVCZYmC RhEM3wXNLhb9aezBsPWCZjzGI2spPKkZ0rMQhpyVi1m26I6gkhyyy27mm3mPffxhii6V g5Dqox9BHMBdooLz6tTiiprZjpB6+3xQ3IFn2pyqt3pguwIhK31DdD3WENcJxNKQfQmh qt5WWQO6MyXQtoHUyi/8ZFrFDJttUgbR2aRCv3PycTCXV+LoF1aElXS48kmwZpHKWL0g hDehs0mYvAz496QTR/+DbdR7DC8NJSGt95hBO6a9XyqP/S4S2Vx9YqvHOE7NeDniLeRh yYsw== X-Gm-Message-State: APjAAAXOPEROPSdXulAC+/RDCxN9D+3RkVISMU6cD+BQlCuo6FaY+9uW +0ptE6qJuFU7HniODUHz3ENJlkRK X-Google-Smtp-Source: APXvYqzjnXie8oyxobwQdtqji8WUXzhYkb/Dr5sBkWbjmRgNCHXCiWC9TGVN5+TnSeZinkv4jFySfA== X-Received: by 2002:a1c:16:: with SMTP id 22mr10887064wma.0.1572613507589; Fri, 01 Nov 2019 06:05:07 -0700 (PDT) Received: from arch-x1c3.cbg.collabora.co.uk ([2a00:5f00:102:0:9665:9cff:feee:aa4d]) by smtp.gmail.com with ESMTPSA id a15sm2450562wmm.12.2019.11.01.06.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 06:05:06 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/5] drm/vmwgfx: move the require_exist handling together Date: Fri, 1 Nov 2019 13:03:09 +0000 Message-Id: <20191101130313.8862-1-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ImCE5nJq/DYo2Ok76YGyMffnMJmXxt+3gqtE07/WUSI=; b=cCjLvEeoKSNZfi/JAs0L9/InfUMN4ecIybnYK42YHI6MLFXrXIC4LXE1aFJq4B97sW bIWR4g3Uo1dtzB+LqvF4plqP+DyJZ7PmEnNYc0btx04TSQCTglCY7jtuHT/BR3/dVaZg 4JS4bLmnXXt6a90AtZOvSGFhigKCXXvtCWboggskiyoRi1rlBHZYtjBXwlO06ZXa0ejD rtfk7QomTER+TWhctwADWdIzVQTZOJ7k/SUkh+klx1Mr78ZtoA9qgTDmN0tYGMfqJ/63 AUpH9x/hvJj526j3Upl+s4FvNtDoOTE1RXr0ehpQ3KcICY3QvmtN2eDdgPtxPhY/ksBQ KIcw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: VMware Graphics , Thomas Hellstrom , emil.l.velikov@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Emil Velikov Move the render_client hunk for require_exist alongside the rest. Keeping all the reasons why an existing object is needed, in a single place makes it easier to follow. Cc: VMware Graphics Cc: Thomas Hellstrom Signed-off-by: Emil Velikov Reviewed-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index 29d8794f0421..1f989f3605c8 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -909,16 +909,12 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv, uint32_t handle; struct ttm_base_object *base; int ret; - bool require_exist = false; if (handle_type == DRM_VMW_HANDLE_PRIME) { ret = ttm_prime_fd_to_handle(tfile, u_handle, &handle); if (unlikely(ret != 0)) return ret; } else { - if (unlikely(drm_is_render_client(file_priv))) - require_exist = true; - handle = u_handle; } @@ -935,6 +931,8 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv, } if (handle_type != DRM_VMW_HANDLE_PRIME) { + bool require_exist = false; + user_srf = container_of(base, struct vmw_user_surface, prime.base); @@ -946,6 +944,9 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv, user_srf->master != file_priv->master) require_exist = true; + if (unlikely(drm_is_render_client(file_priv))) + require_exist = true; + ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, require_exist); if (unlikely(ret != 0)) {