From patchwork Thu Jan 16 20:39:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 3500631 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 18CBE9F169 for ; Thu, 16 Jan 2014 20:45:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 25F9520171 for ; Thu, 16 Jan 2014 20:45:16 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 395C820170 for ; Thu, 16 Jan 2014 20:45:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 58BAFFA475; Thu, 16 Jan 2014 12:45:09 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp-outbound-2.vmware.com (smtp-outbound-2.vmware.com [208.91.2.13]) by gabe.freedesktop.org (Postfix) with ESMTP id 2C553105B88 for ; Thu, 16 Jan 2014 12:41:06 -0800 (PST) Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id B914C283D3 for ; Thu, 16 Jan 2014 12:41:05 -0800 (PST) Received: from zcs-prod-mta-2.vmware.com (zcs-prod-mta-2.vmware.com [10.113.163.64]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 99019184F1 for ; Thu, 16 Jan 2014 12:41:05 -0800 (PST) Received: from zcs-prod-mta-2.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-mta-2.vmware.com (Postfix) with ESMTP id 6F277E0041; Thu, 16 Jan 2014 12:41:05 -0800 (PST) Received: from ubuntu.localdomain (unknown [10.113.160.14]) by zcs-prod-mta-2.vmware.com (Postfix) with ESMTPSA; Thu, 16 Jan 2014 12:41:03 -0800 (PST) From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH 30/33] drm/vmwgfx: Update otable definitions Date: Thu, 16 Jan 2014 21:39:18 +0100 Message-Id: <1389904761-16163-31-git-send-email-thellstrom@vmware.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1389904761-16163-1-git-send-email-thellstrom@vmware.com> References: <1389904761-16163-1-git-send-email-thellstrom@vmware.com> Cc: Thomas Hellstrom , linux-graphics-maintainer@vmware.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Update otable definitions and modify the otable setup code accordingly. Signed-off-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/svga3d_reg.h | 14 +++++++++----- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 5 ++++- drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 19 ++++++++++++++----- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/svga3d_reg.h b/drivers/gpu/drm/vmwgfx/svga3d_reg.h index b8fca2b..fce351b 100644 --- a/drivers/gpu/drm/vmwgfx/svga3d_reg.h +++ b/drivers/gpu/drm/vmwgfx/svga3d_reg.h @@ -1938,6 +1938,7 @@ typedef enum SVGAMobFormat { #define SVGA3D_OTABLE_CONTEXT_ENTRY_SIZE 8 #define SVGA3D_OTABLE_SURFACE_ENTRY_SIZE 64 #define SVGA3D_OTABLE_SHADER_ENTRY_SIZE 16 +#define SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE 64 #define SVGA3D_CONTEXT_DATA_SIZE 16384 /* @@ -1948,11 +1949,14 @@ typedef enum SVGAMobFormat { */ typedef enum { - SVGA_OTABLE_MOB = 0, - SVGA_OTABLE_SURFACE = 1, - SVGA_OTABLE_CONTEXT = 2, - SVGA_OTABLE_SHADER = 3, - SVGA_OTABLE_COUNT = 4, + SVGA_OTABLE_MOB = 0, + SVGA_OTABLE_MIN = 0, + SVGA_OTABLE_SURFACE = 1, + SVGA_OTABLE_CONTEXT = 2, + SVGA_OTABLE_SHADER = 3, + SVGA_OTABLE_SCREEN_TARGET = 4, + SVGA_OTABLE_DX9_MAX = 5, + SVGA_OTABLE_MAX = 8 } SVGAOTableType; typedef diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 2fe0acb..554e7fa 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h @@ -50,6 +50,7 @@ #define VMWGFX_MAX_VALIDATIONS 2048 #define VMWGFX_MAX_DISPLAYS 16 #define VMWGFX_CMD_BOUNCE_INIT_SIZE 32768 +#define VMWGFX_ENABLE_SCREEN_TARGET_OTABLE 0 /* * Perhaps we should have sysfs entries for these. @@ -57,9 +58,11 @@ #define VMWGFX_NUM_GB_CONTEXT 256 #define VMWGFX_NUM_GB_SHADER 20000 #define VMWGFX_NUM_GB_SURFACE 32768 +#define VMWGFX_NUM_GB_SCREEN_TARGET VMWGFX_MAX_DISPLAYS #define VMWGFX_NUM_MOB (VMWGFX_NUM_GB_CONTEXT +\ VMWGFX_NUM_GB_SHADER +\ - VMWGFX_NUM_GB_SURFACE) + VMWGFX_NUM_GB_SURFACE +\ + VMWGFX_NUM_GB_SCREEN_TARGET) #define VMW_PL_GMR TTM_PL_PRIV0 #define VMW_PL_FLAG_GMR TTM_PL_FLAG_PRIV0 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c index db03527..388b64d 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c @@ -28,6 +28,12 @@ #include "vmwgfx_drv.h" /* + * If we set up the screen target otable, screen objects stop working. + */ + +#define VMW_OTABLE_SETUP_SUB ((VMWGFX_ENABLE_SCREEN_TARGET_OTABLE) ? 0 : 1) + +/* * Currently the MOB interface does not support 64-bit page frame numbers. * This might change in the future to be similar to the GMR2 interface * when virtual machines support memory beyond 16TB. @@ -214,7 +220,7 @@ int vmw_otables_setup(struct vmw_private *dev_priv) SVGAOTableType i; int ret; - otables = kzalloc(SVGA_OTABLE_COUNT * sizeof(*otables), + otables = kzalloc(SVGA_OTABLE_DX9_MAX * sizeof(*otables), GFP_KERNEL); if (unlikely(otables == NULL)) { DRM_ERROR("Failed to allocate space for otable " @@ -230,9 +236,12 @@ int vmw_otables_setup(struct vmw_private *dev_priv) VMWGFX_NUM_GB_CONTEXT * SVGA3D_OTABLE_CONTEXT_ENTRY_SIZE; otables[SVGA_OTABLE_SHADER].size = VMWGFX_NUM_GB_SHADER * SVGA3D_OTABLE_SHADER_ENTRY_SIZE; + otables[SVGA_OTABLE_SCREEN_TARGET].size = + VMWGFX_NUM_GB_SCREEN_TARGET * + SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE; bo_size = 0; - for (i = 0; i < SVGA_OTABLE_COUNT; ++i) { + for (i = 0; i < SVGA_OTABLE_DX9_MAX; ++i) { otables[i].size = (otables[i].size + PAGE_SIZE - 1) & PAGE_MASK; bo_size += otables[i].size; @@ -259,7 +268,7 @@ int vmw_otables_setup(struct vmw_private *dev_priv) ttm_bo_unreserve(dev_priv->otable_bo); offset = 0; - for (i = 0; i < SVGA_OTABLE_COUNT; ++i) { + for (i = 0; i < SVGA_OTABLE_DX9_MAX - VMW_OTABLE_SETUP_SUB; ++i) { ret = vmw_setup_otable_base(dev_priv, i, offset, &otables[i]); if (unlikely(ret != 0)) @@ -273,7 +282,7 @@ int vmw_otables_setup(struct vmw_private *dev_priv) out_unreserve: ttm_bo_unreserve(dev_priv->otable_bo); out_no_setup: - for (i = 0; i < SVGA_OTABLE_COUNT; ++i) + for (i = 0; i < SVGA_OTABLE_DX9_MAX - VMW_OTABLE_SETUP_SUB; ++i) vmw_takedown_otable_base(dev_priv, i, &otables[i]); ttm_bo_unref(&dev_priv->otable_bo); @@ -296,7 +305,7 @@ void vmw_otables_takedown(struct vmw_private *dev_priv) struct ttm_buffer_object *bo = dev_priv->otable_bo; int ret; - for (i = 0; i < SVGA_OTABLE_COUNT; ++i) + for (i = 0; i < SVGA_OTABLE_DX9_MAX - VMW_OTABLE_SETUP_SUB; ++i) vmw_takedown_otable_base(dev_priv, i, &dev_priv->otables[i]);