From patchwork Wed Apr 1 18:42:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 11470243 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 DD8DF92A for ; Thu, 2 Apr 2020 07:18:39 +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 BC0C320784 for ; Thu, 2 Apr 2020 07:18:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="guEAQIjG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC0C320784 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 190EB6E9F2; Thu, 2 Apr 2020 07:18:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id B42FB6E983 for ; Wed, 1 Apr 2020 18:38:42 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id h15so1264751wrx.9 for ; Wed, 01 Apr 2020 11:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lTLML4qHVOZd27zNow6npQ5Y380GiSw3REsv0q0S9OI=; b=guEAQIjGyE1c1MIer5DCdAny6uB4kMqf48dNU4g6Ue4DdL8pbXHxBF+9wdYXwL4M/+ LZNcqXtVH219MEBxzM6oAPqIsDAMAx/u8pu7zNwL4VgPR3zdTTsOrtW31Rqh4eCzLm3u R9lRlPr0uxAfnY9wShaaJLka0kD8Jx1iN3G/V0R4rlGHAAPk+VM60K/UVPSMZ3NeHr0l cIJGf3oVQo4BDccs71nWg8zrQDmH8W/7RroO72+1slWxfXVt61PRfINJA7XIYUYus0C4 SF8HPGpwGJCnnDV5NxxgLrQ+Fr6yA76AOIkKlxl8KXd/CB6I4pwSSq5u2Cb2hnn0vIJR p6sQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=lTLML4qHVOZd27zNow6npQ5Y380GiSw3REsv0q0S9OI=; b=j2uspsZezKlhPWwrjEcJwI1kelQjuHRSgzAPoLXHDb6N2xY3Q6/g6JwF3qGSBQxx6x 3tvweZPpQCk8zwA+EJdSEtCkAjLfxn369Dm+eQzBK7458ZRwX20VAcniTZ20gFY8Fi6F GTQkUvsYcWedSqrhup/KVF524Mjnr+h/NkkbTGDH3tApGglWcvlB464OhBcVex4hxows xG/Jmquqe1yzaZ3S/4HiY+XwCkQH6k7cl+GXL4tzq7sf5AI1vlm5Cw0xI16DtKwU2pVl LX0WTVqcLCE5cXgGyRmCFm9TIwxnh1k0u4xR3qRNkt/eNODhejO6NCAcR8OSezYqJs1/ 6PRg== X-Gm-Message-State: ANhLgQ1Lxf6H0ZrO+VQqIqYPyhmpHmSBuo1UfueBHMcCEwEfnkS+vBvx TP5aQBx0BWLR0wYXRiZm165zM+GYCb8= X-Google-Smtp-Source: ADFU+vu8iJ7bqfXdOD995DXcQitIoNLS7W4YqozRkkL03JLs4+OE1ogSZox0TmGtfmgRvHUr12rOdg== X-Received: by 2002:adf:f7cb:: with SMTP id a11mr26859348wrq.79.1585766320963; Wed, 01 Apr 2020 11:38:40 -0700 (PDT) Received: from brihaspati.fritz.box (p5DE52E4E.dip0.t-ipconnect.de. [93.229.46.78]) by smtp.gmail.com with ESMTPSA id b11sm3976973wrq.26.2020.04.01.11.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 11:38:40 -0700 (PDT) From: Nirmoy Das X-Google-Original-From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/8] drm/vmwgfx: don't use ttm bo->offset Date: Wed, 1 Apr 2020 20:42:42 +0200 Message-Id: <20200401184247.16643-4-nirmoy.das@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200401184247.16643-1-nirmoy.das@amd.com> References: <20200401184247.16643-1-nirmoy.das@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 02 Apr 2020 07:17:56 +0000 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: thellstrom@vmware.com, airlied@linux.ie, kenny.ho@amd.com, brian.welty@intel.com, nirmoy.das@amd.com, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, alexander.deucher@amd.com, sean@poorly.run, christian.koenig@amd.com, kraxel@redhat.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Calculate GPU offset within vmwgfx driver itself without depending on bo->offset. Signed-off-by: Nirmoy Das Acked-by: Christian König Acked-by: Thomas Hellstrom Tested-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 -- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c index 8b71bf6b58ef..1e59c019affa 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c @@ -258,7 +258,7 @@ int vmw_bo_pin_in_start_of_vram(struct vmw_private *dev_priv, ret = ttm_bo_validate(bo, &placement, &ctx); /* For some reason we didn't end up at the start of vram */ - WARN_ON(ret == 0 && bo->offset != 0); + WARN_ON(ret == 0 && bo->mem.start != 0); if (!ret) vmw_bo_pin_reserved(buf, true); @@ -317,7 +317,7 @@ void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *bo, { if (bo->mem.mem_type == TTM_PL_VRAM) { ptr->gmrId = SVGA_GMR_FRAMEBUFFER; - ptr->offset = bo->offset; + ptr->offset = bo->mem.start << PAGE_SHIFT; } else { ptr->gmrId = bo->mem.start; ptr->offset = 0; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 367d5b87ee6a..4284c4bd444d 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -3696,7 +3696,7 @@ static void vmw_apply_relocations(struct vmw_sw_context *sw_context) bo = &reloc->vbo->base; switch (bo->mem.mem_type) { case TTM_PL_VRAM: - reloc->location->offset += bo->offset; + reloc->location->offset += bo->mem.start << PAGE_SHIFT; reloc->location->gmrId = SVGA_GMR_FRAMEBUFFER; break; case VMW_PL_GMR: diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c index 6941689085ed..a95156fc5db7 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c @@ -610,7 +610,7 @@ static int vmw_fifo_emit_dummy_legacy_query(struct vmw_private *dev_priv, if (bo->mem.mem_type == TTM_PL_VRAM) { cmd->body.guestResult.gmrId = SVGA_GMR_FRAMEBUFFER; - cmd->body.guestResult.offset = bo->offset; + cmd->body.guestResult.offset = bo->mem.start << PAGE_SHIFT; } else { cmd->body.guestResult.gmrId = bo->mem.start; cmd->body.guestResult.offset = 0; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c index 3f3b2c7a208a..e7134aebeb81 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c @@ -750,7 +750,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, case TTM_PL_VRAM: /* "On-card" video ram */ man->func = &ttm_bo_manager_func; - man->gpu_offset = 0; man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE; man->available_caching = TTM_PL_FLAG_CACHED; man->default_caching = TTM_PL_FLAG_CACHED; @@ -763,7 +762,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, * slots as well as the bo size. */ man->func = &vmw_gmrid_manager_func; - man->gpu_offset = 0; man->flags = TTM_MEMTYPE_FLAG_CMA | TTM_MEMTYPE_FLAG_MAPPABLE; man->available_caching = TTM_PL_FLAG_CACHED; man->default_caching = TTM_PL_FLAG_CACHED;