From patchwork Thu Mar 5 13:29:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 11423303 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 8A2DE1395 for ; Fri, 6 Mar 2020 08:03:40 +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 6898F2073D for ; Fri, 6 Mar 2020 08:03:40 +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="NdlYPR+p" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6898F2073D 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 ADD896EC79; Fri, 6 Mar 2020 08:03:17 +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 81CC76EBC8; Thu, 5 Mar 2020 13:25:54 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id u9so5731074wml.3; Thu, 05 Mar 2020 05:25:54 -0800 (PST) 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=vScGlTm3RMoTnCUXVQs7PdhOxyTxBaaaUaVLYZM2rfI=; b=NdlYPR+pcRCgzaI7AE0S/cmPQfhPNqP5CdwlHZhl1ApKohm11/4XEi2sbOz77jczaT zIF2wcJ07JWmG/YOZP2Nws3CvmOzgk0x/SuaOLPBqb029Mc4szYpYKU98SKDCegPzNFK Yd6T0bIbF4Op6iX1uF6r0YHN5mnR/eAiM7r8jF8FATFVFDXto7UyWHYp6z5R4EponHP2 N7Ni+cI5uhxAqe6C25EfVXbadLBSTWxj1g6TkXkeYMNrIx/xMdSHZBD+yDD9ELu5+KXs jfXWh/yGwbMX4sVeHIZkfFULyN0+XQTCLuP17CNWsuaXBKOG699QYkl+NoaOet4jxS/D Q21w== 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=vScGlTm3RMoTnCUXVQs7PdhOxyTxBaaaUaVLYZM2rfI=; b=Ba5PyKKMJuG2H53+Z6yGrS6c5HRt7ntoYs0iGRz0EEBUn5tGHRwSTIe2vul7yDlXVp GA7+qI01zD1PH1fdLYabiTwDvNItfz1Irwn4jgUmF5OW2UOV1ZpFd9+kofkh5l1RrHME hzCY6q2RlxNOc/C4DC6MJFW4j/l2UC1+NxMm1DGRx9+jaEUlIg6BVDiUqgCJIkcDjsx+ KuaHUpwAos4qYKgWiZL2hHrSltjuA40LcZwnSn+QauRpbvwgeBlD1IqMuCDS7m/ieQvo nAj71Rbc8aKMoLuMSJh49ha0KcGnCLNJWXjAwQJhOpL+b0nGqV2AwyD7MPqNXl4naxo9 YKpw== X-Gm-Message-State: ANhLgQ0CZxN0BWGiyZEZFzQ+5smmth9OFmJVUADlXz8sxCpMFJCW78oq TjMnyY2hfFfWlSlXQEGMfEXJ9eQ6Sg+wzQ== X-Google-Smtp-Source: ADFU+vs85lXCppGUIFQEDworhZZb2QxgYkmDm6MBTiAP14hct5wwvzC97x+VFr+17eiuoe3L+yFu3A== X-Received: by 2002:a05:600c:280b:: with SMTP id m11mr9754971wmb.93.1583414752813; Thu, 05 Mar 2020 05:25:52 -0800 (PST) Received: from brihaspati.fritz.box (p200300C58F2EA5001F22CF19908511A1.dip0.t-ipconnect.de. [2003:c5:8f2e:a500:1f22:cf19:9085:11a1]) by smtp.gmail.com with ESMTPSA id g14sm45424819wrv.58.2020.03.05.05.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 05:25:51 -0800 (PST) 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: Thu, 5 Mar 2020 14:29:05 +0100 Message-Id: <20200305132910.17515-4-nirmoy.das@amd.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200305132910.17515-1-nirmoy.das@amd.com> References: <20200305132910.17515-1-nirmoy.das@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 06 Mar 2020 08:03:01 +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, amd-gfx@lists.freedesktop.org, 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(-) -- 2.25.0 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 73489a45decb..72c2cf4053df 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -3313,7 +3313,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 e5252ef3812f..1cdc445b24c3 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c @@ -612,7 +612,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;