Commit 7cba9062 authored by Thomas Hellstrom's avatar Thomas Hellstrom

drm/vmwgfx: Update otable definitions

Update otable definitions and modify the otable setup code
accordingly.
Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
parent 0fd53cfb
...@@ -1938,6 +1938,7 @@ typedef enum SVGAMobFormat { ...@@ -1938,6 +1938,7 @@ typedef enum SVGAMobFormat {
#define SVGA3D_OTABLE_CONTEXT_ENTRY_SIZE 8 #define SVGA3D_OTABLE_CONTEXT_ENTRY_SIZE 8
#define SVGA3D_OTABLE_SURFACE_ENTRY_SIZE 64 #define SVGA3D_OTABLE_SURFACE_ENTRY_SIZE 64
#define SVGA3D_OTABLE_SHADER_ENTRY_SIZE 16 #define SVGA3D_OTABLE_SHADER_ENTRY_SIZE 16
#define SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE 64
#define SVGA3D_CONTEXT_DATA_SIZE 16384 #define SVGA3D_CONTEXT_DATA_SIZE 16384
/* /*
...@@ -1949,10 +1950,13 @@ typedef enum SVGAMobFormat { ...@@ -1949,10 +1950,13 @@ typedef enum SVGAMobFormat {
typedef enum { typedef enum {
SVGA_OTABLE_MOB = 0, SVGA_OTABLE_MOB = 0,
SVGA_OTABLE_MIN = 0,
SVGA_OTABLE_SURFACE = 1, SVGA_OTABLE_SURFACE = 1,
SVGA_OTABLE_CONTEXT = 2, SVGA_OTABLE_CONTEXT = 2,
SVGA_OTABLE_SHADER = 3, SVGA_OTABLE_SHADER = 3,
SVGA_OTABLE_COUNT = 4, SVGA_OTABLE_SCREEN_TARGET = 4,
SVGA_OTABLE_DX9_MAX = 5,
SVGA_OTABLE_MAX = 8
} SVGAOTableType; } SVGAOTableType;
typedef typedef
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#define VMWGFX_MAX_VALIDATIONS 2048 #define VMWGFX_MAX_VALIDATIONS 2048
#define VMWGFX_MAX_DISPLAYS 16 #define VMWGFX_MAX_DISPLAYS 16
#define VMWGFX_CMD_BOUNCE_INIT_SIZE 32768 #define VMWGFX_CMD_BOUNCE_INIT_SIZE 32768
#define VMWGFX_ENABLE_SCREEN_TARGET_OTABLE 0
/* /*
* Perhaps we should have sysfs entries for these. * Perhaps we should have sysfs entries for these.
...@@ -57,9 +58,11 @@ ...@@ -57,9 +58,11 @@
#define VMWGFX_NUM_GB_CONTEXT 256 #define VMWGFX_NUM_GB_CONTEXT 256
#define VMWGFX_NUM_GB_SHADER 20000 #define VMWGFX_NUM_GB_SHADER 20000
#define VMWGFX_NUM_GB_SURFACE 32768 #define VMWGFX_NUM_GB_SURFACE 32768
#define VMWGFX_NUM_GB_SCREEN_TARGET VMWGFX_MAX_DISPLAYS
#define VMWGFX_NUM_MOB (VMWGFX_NUM_GB_CONTEXT +\ #define VMWGFX_NUM_MOB (VMWGFX_NUM_GB_CONTEXT +\
VMWGFX_NUM_GB_SHADER +\ 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_GMR TTM_PL_PRIV0
#define VMW_PL_FLAG_GMR TTM_PL_FLAG_PRIV0 #define VMW_PL_FLAG_GMR TTM_PL_FLAG_PRIV0
......
...@@ -27,6 +27,12 @@ ...@@ -27,6 +27,12 @@
#include "vmwgfx_drv.h" #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. * 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 * This might change in the future to be similar to the GMR2 interface
...@@ -214,7 +220,7 @@ int vmw_otables_setup(struct vmw_private *dev_priv) ...@@ -214,7 +220,7 @@ int vmw_otables_setup(struct vmw_private *dev_priv)
SVGAOTableType i; SVGAOTableType i;
int ret; int ret;
otables = kzalloc(SVGA_OTABLE_COUNT * sizeof(*otables), otables = kzalloc(SVGA_OTABLE_DX9_MAX * sizeof(*otables),
GFP_KERNEL); GFP_KERNEL);
if (unlikely(otables == NULL)) { if (unlikely(otables == NULL)) {
DRM_ERROR("Failed to allocate space for otable " DRM_ERROR("Failed to allocate space for otable "
...@@ -230,9 +236,12 @@ int vmw_otables_setup(struct vmw_private *dev_priv) ...@@ -230,9 +236,12 @@ int vmw_otables_setup(struct vmw_private *dev_priv)
VMWGFX_NUM_GB_CONTEXT * SVGA3D_OTABLE_CONTEXT_ENTRY_SIZE; VMWGFX_NUM_GB_CONTEXT * SVGA3D_OTABLE_CONTEXT_ENTRY_SIZE;
otables[SVGA_OTABLE_SHADER].size = otables[SVGA_OTABLE_SHADER].size =
VMWGFX_NUM_GB_SHADER * SVGA3D_OTABLE_SHADER_ENTRY_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; 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 =
(otables[i].size + PAGE_SIZE - 1) & PAGE_MASK; (otables[i].size + PAGE_SIZE - 1) & PAGE_MASK;
bo_size += otables[i].size; bo_size += otables[i].size;
...@@ -259,7 +268,7 @@ int vmw_otables_setup(struct vmw_private *dev_priv) ...@@ -259,7 +268,7 @@ int vmw_otables_setup(struct vmw_private *dev_priv)
ttm_bo_unreserve(dev_priv->otable_bo); ttm_bo_unreserve(dev_priv->otable_bo);
offset = 0; 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, ret = vmw_setup_otable_base(dev_priv, i, offset,
&otables[i]); &otables[i]);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
...@@ -273,7 +282,7 @@ int vmw_otables_setup(struct vmw_private *dev_priv) ...@@ -273,7 +282,7 @@ int vmw_otables_setup(struct vmw_private *dev_priv)
out_unreserve: out_unreserve:
ttm_bo_unreserve(dev_priv->otable_bo); ttm_bo_unreserve(dev_priv->otable_bo);
out_no_setup: 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]); vmw_takedown_otable_base(dev_priv, i, &otables[i]);
ttm_bo_unref(&dev_priv->otable_bo); ttm_bo_unref(&dev_priv->otable_bo);
...@@ -296,7 +305,7 @@ void vmw_otables_takedown(struct vmw_private *dev_priv) ...@@ -296,7 +305,7 @@ void vmw_otables_takedown(struct vmw_private *dev_priv)
struct ttm_buffer_object *bo = dev_priv->otable_bo; struct ttm_buffer_object *bo = dev_priv->otable_bo;
int ret; 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, vmw_takedown_otable_base(dev_priv, i,
&dev_priv->otables[i]); &dev_priv->otables[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment