drm/vmwgfx add support for GL4
Subsystems (3)
v2 cover drm/vmwgfx add support for GL4
This series updates vmwgfx to support newer vmware svga device protocol and expose new commands to userspace..
This is required for supporting newer GL4 features in the guest.
This syncs up the device headers, adds support for the new commands, and also refactors some code (in particular around surface definition) to more easily support the new commands.
Preliminary mesa userspace code using these new vmwgfx features can be found at: https://gitlab.freedesktop.org/bhenden/mesa
v2: rebased on newer drm-next version, fixed up the email addresses in some R-b and Signed-off-by to what they really should be, hopefully fixed up sender email from header, no actual code changes
Deepak Rawat (16):
drm/vmwgfx: Also check for SVGA_CAP_DX before reading DX context
support
drm/vmwgfx: Sync legacy multisampling device capability drm/vmwgfx: Deprecate logic ops commands
drm/vmwgfx: Use enum to represent graphics context capabilities drm/vmwgfx: Sync virtual device headers for new feature drm/vmwgfx: Add a new enum for SM5 graphics context capability drm/vmwgfx: Read new register for GB memory when available drm/vmwgfx: Support SM5 shader type in command buffer drm/vmwgfx: Add support for UA view commands drm/vmwgfx: Add support for indirect and dispatch commands drm/vmwgfx: Rename stream output target binding tracker struct drm/vmwgfx: Add support for streamoutput with mob commands drm/vmwgfx: Split surface metadata from struct vmw_surface drm/vmwgfx: Refactor surface_define to use vmw_surface_metadata drm/vmwgfx: Add surface define v4 command
drm/vmwgfx: Add SM5 param for userspace
Thomas Hellström (VMware) (1):
drm/vmwgfx: Use vmwgfx version 2.18 to signal SM5 compatibility
drivers/gpu/drm/vmwgfx/Makefile | 2 +- .../drm/vmwgfx/device_include/svga3d_cmd.h | 161 +++- .../vmwgfx/device_include/svga3d_devcaps.h | 787 +++++++++--------- .../gpu/drm/vmwgfx/device_include/svga3d_dx.h | 466 ++++++++++- .../drm/vmwgfx/device_include/svga3d_limits.h | 36 +- .../device_include/svga3d_surfacedefs.h | 58 +- .../drm/vmwgfx/device_include/svga3d_types.h | 347 +++++++- .../gpu/drm/vmwgfx/device_include/svga_reg.h | 382 ++++++--- .../drm/vmwgfx/device_include/svga_types.h | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_binding.c | 213 ++++- drivers/gpu/drm/vmwgfx/vmwgfx_binding.h | 33 +- drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 28 +- drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 6 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 59 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 140 +++- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 429 +++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 18 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 43 +- drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_so.c | 12 +- drivers/gpu/drm/vmwgfx/vmwgfx_so.h | 7 + drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 61 +- drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c | 387 +++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 608 +++++++------- include/uapi/drm/vmwgfx_drm.h | 16 +- 25 files changed, 3252 insertions(+), 1050 deletions(-) create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 4/17 drm/vmwgfx: Use enum to represent graphics context capabilities
From: Deepak Rawat <[email protected]>
Instead of having different bool in device private to represent incremental graphics context capabilities, add a new sm type enum.
v2: Use enum instead of bit flag.
v3: Incorporated review comments.
--- drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 34 ++++++++++----------- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 40 +++++++++++++++++++++++-- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 6 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 4 +-- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 10 +++---- 8 files changed, 69 insertions(+), 31 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_context.c +1 -1
@@ -731,7 +731,7 @@ static int vmw_context_define(struct drm_device *dev, void *data, };int ret; -if (!dev_priv->has_dx && dx) { +if (!has_sm4_context (dev_priv) && dx) {VMW_DEBUG_USER ("DX contexts not supported by device.\n" );return -EINVAL ; }
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +17 -17
@@ -449,7 +449,7 @@ static int vmw_request_device(struct vmw_private *dev_priv) dev_priv->cman =vmw_cmdbuf_man_create (dev_priv);if (IS_ERR (dev_priv->cman)) { dev_priv->cman =NULL ; - dev_priv->has_dx = false; + dev_priv->sm_type =VMW_SM_LEGACY ; } ret =vmw_request_device_late (dev_priv);
@@ -886,11 +886,22 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)if (dev_priv->has_mob && (dev_priv->capabilities &SVGA_CAP_DX )) {spin_lock (&dev_priv->cap_lock);vmw_write (dev_priv,SVGA_REG_DEV_CAP ,SVGA3D_DEVCAP_DXCONTEXT ); - dev_priv->has_dx = !!vmw_read (dev_priv,SVGA_REG_DEV_CAP ); +if (vmw_read (dev_priv,SVGA_REG_DEV_CAP )) + dev_priv->sm_type =VMW_SM_4 ;spin_unlock (&dev_priv->cap_lock); }vmw_validation_mem_init_ttm (dev_priv,VMWGFX_VALIDATION_MEM_GRAN ); + +/* SVGA_CAP2_DX2 (DefineGBSurface_v3) is needed for SM4_1 support */ +if (has_sm4_context (dev_priv) && + (dev_priv->capabilities2 &SVGA_CAP2_DX2 )) { +vmw_write (dev_priv,SVGA_REG_DEV_CAP ,SVGA3D_DEVCAP_SM41 ); + +if (vmw_read (dev_priv,SVGA_REG_DEV_CAP )) + dev_priv->sm_type =VMW_SM_4_1 ; + } + ret =vmw_kms_init (dev_priv);if (unlikely (ret !=0 )) goto out_no_kms;
@@ -900,23 +911,12 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)if (ret) goto out_no_fifo; -if (dev_priv->has_dx) { -/* -* SVGA_CAP2_DX2 (DefineGBSurface_v3) is needed for SM4_1 -* support -*/ -if ((dev_priv->capabilities2 &SVGA_CAP2_DX2 ) !=0 ) { -vmw_write (dev_priv,SVGA_REG_DEV_CAP , -SVGA3D_DEVCAP_SM41 ); - dev_priv->has_sm4_1 =vmw_read (dev_priv, -SVGA_REG_DEV_CAP ); - } - } - -DRM_INFO ("DX: %s\n" , dev_priv->has_dx ?"yes." :"no." );DRM_INFO ("Atomic: %s\n" , (dev->driver->driver_features &DRIVER_ATOMIC ) ?"yes." :"no." ); -DRM_INFO ("SM4_1: %s\n" , dev_priv->has_sm4_1 ?"yes." :"no." ); +if (dev_priv->sm_type ==VMW_SM_4_1 ) +DRM_INFO ("SM4_1 support available.\n" ); +if (dev_priv->sm_type ==VMW_SM_4 ) +DRM_INFO ("SM4 support available.\n" );snprintf (host_log,sizeof (host_log),"vmwgfx: %s-%s" ,VMWGFX_REPO ,VMWGFX_GIT_VERSION );
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +38 -2
@@ -441,6 +441,20 @@ enum {VMW_IRQTHREAD_MAX }; +/** +* enum vmw_sm_type - Graphics context capability supported by device. +* @VMW_SM_LEGACY: Pre DX context. +* @VMW_SM_4: Context support upto SM4. +* @VMW_SM_4_1: Context support upto SM4_1. +* @VMW_SM_MAX: Should be the last. +*/ +enum vmw_sm_type { +VMW_SM_LEGACY =0 , +VMW_SM_4 , +VMW_SM_4_1 , +VMW_SM_MAX +}; +struct vmw_private {struct ttm_bo_device bdev;
@@ -475,9 +489,9 @@ struct vmw_private {bool has_mob;spinlock_t hw_lock;spinlock_t cap_lock; -bool has_dx;bool assume_16bpp; -bool has_sm4_1; + +enum vmw_sm_type sm_type;/* * Framebuffer info.
@@ -648,6 +662,28 @@ static inline uint32_t vmw_read(struct vmw_private *dev_priv,return val; } +/** +* has_sm4_context - Does the device support SM4 context. +* @dev_priv: Device private. +* +* Return: Bool value if device support SM4 context or not. +*/ +static inline bool has_sm4_context (const struct vmw_private *dev_priv) +{ +return (dev_priv->sm_type >=VMW_SM_4 ); +} + +/** +* has_sm4_1_context - Does the device support SM4_1 context. +* @dev_priv: Device private. +* +* Return: Bool value if device support SM4_1 context or not. +*/ +static inline bool has_sm4_1_context (const struct vmw_private *dev_priv) +{ +return (dev_priv->sm_type >=VMW_SM_4_1 ); +} +extern void vmw_svga_enable (struct vmw_private *dev_priv);extern void vmw_svga_disable (struct vmw_private *dev_priv);
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +4 -2
@@ -461,7 +461,8 @@ static int vmw_resource_context_res_add(struct vmw_private *dev_priv,u32 i;/* Add all cotables to the validation list. */ -if (dev_priv->has_dx &&vmw_res_type (ctx) == vmw_res_dx_context) { +if (has_sm4_context (dev_priv) && +vmw_res_type (ctx) == vmw_res_dx_context) {for (i =0 ; i <SVGA_COTABLE_DX10_MAX ; ++i) { res =vmw_context_cotable (ctx, i);if (IS_ERR (res))
@@ -489,7 +490,8 @@ static int vmw_resource_context_res_add(struct vmw_private *dev_priv,break ; } -if (dev_priv->has_dx &&vmw_res_type (ctx) == vmw_res_dx_context) { +if (has_sm4_context (dev_priv) && +vmw_res_type (ctx) == vmw_res_dx_context) {struct vmw_buffer_object *dx_query_mob; dx_query_mob =vmw_context_get_dx_query_mob (ctx);
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +2 -2
@@ -114,10 +114,10 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, (dev_priv->active_display_unit == vmw_du_screen_target);break ;case DRM_VMW_PARAM_DX : - param->value = dev_priv->has_dx; + param->value =has_sm4_context (dev_priv);break ;case DRM_VMW_PARAM_SM4_1 : - param->value = dev_priv->has_sm4_1; + param->value =has_sm4_1_context (dev_priv);break ;default :return -EINVAL ;
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -1
@@ -941,7 +941,7 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,* For DX, surface format validation is done when surface->scanout * is set. */ -if (!dev_priv->has_dx && format != surface->format) { +if (!has_sm4_context (dev_priv) && format != surface->format) {DRM_ERROR ("Invalid surface format for requested mode.\n" );return -EINVAL ; }
drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +1 -1
@@ -320,7 +320,7 @@ int vmw_otables_setup(struct vmw_private *dev_priv)struct vmw_otable **otables = &dev_priv->otable_batch.otables;int ret; -if (dev_priv->has_dx) { +if (has_sm4_context (dev_priv)) { *otables =kmemdup (dx_tables,sizeof (dx_tables),GFP_KERNEL );if (!(*otables))return -ENOMEM ;
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +5 -5
@@ -1092,12 +1092,12 @@ static int vmw_gb_surface_create(struct vmw_resource *res) goto out_no_fifo; } -if (dev_priv->has_sm4_1 && srf->array_size >0 ) { +if (has_sm4_1_context (dev_priv) && srf->array_size >0 ) { cmd_id =SVGA_3D_CMD_DEFINE_GB_SURFACE_V3 ; cmd_len =sizeof (cmd3->body); submit_len =sizeof (*cmd3); }else if (srf->array_size >0 ) { -/* has_dx checked on creation time. */ +/* VMW_SM_4 support verified at creation time. */ cmd_id =SVGA_3D_CMD_DEFINE_GB_SURFACE_V2 ; cmd_len =sizeof (cmd2->body); submit_len =sizeof (*cmd2);
@@ -1115,7 +1115,7 @@ static int vmw_gb_surface_create(struct vmw_resource *res) goto out_no_fifo; } -if (dev_priv->has_sm4_1 && srf->array_size >0 ) { +if (has_sm4_1_context (dev_priv) && srf->array_size >0 ) { cmd3->header.id = cmd_id; cmd3->header.size = cmd_len; cmd3->body.sid = srf->res.id;
@@ -1443,7 +1443,7 @@ int vmw_surface_gb_priv_define(struct drm_device *dev, }/* array_size must be null for non-GL3 host. */ -if (array_size >0 && !dev_priv->has_dx) { +if (array_size >0 && !has_sm4_context (dev_priv)) {VMW_DEBUG_USER ("Tried to create DX surface on non-DX host.\n" );return -EINVAL ; }
@@ -1601,7 +1601,7 @@ vmw_gb_surface_define_internal(struct drm_device *dev,SVGA3D_FLAGS_64 (req->svga3d_flags_upper_32_bits, req->base.svga3d_flags); -if (!dev_priv->has_sm4_1) { +if (!has_sm4_1_context (dev_priv)) {/* * If SM4_1 is not support then cannot send 64-bit flag to * device.
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 3/17 drm/vmwgfx: Deprecate logic ops commands
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
Logic ops commands are marked as deprecated by virtual device and were never used by vmwgfx.
--- .../gpu/drm/vmwgfx/device_include/svga3d_cmd.h | 12 ++++++------ drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 18 ++++++------------ 2 files changed, 12 insertions(+), 18 deletions(-)
drivers/gpu/drm/vmwgfx/device_include/svga3d_cmd.h +6 -6
@@ -104,12 +104,12 @@ typedef enum {SVGA_3D_CMD_DEAD1 =1083 ,SVGA_3D_CMD_DEAD2 =1084 , -SVGA_3D_CMD_LOGICOPS_BITBLT =1085 , -SVGA_3D_CMD_LOGICOPS_TRANSBLT =1086 , -SVGA_3D_CMD_LOGICOPS_STRETCHBLT =1087 , -SVGA_3D_CMD_LOGICOPS_COLORFILL =1088 , -SVGA_3D_CMD_LOGICOPS_ALPHABLEND =1089 , -SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND =1090 , +SVGA_3D_CMD_DEAD12 =1085 , +SVGA_3D_CMD_DEAD13 =1086 , +SVGA_3D_CMD_DEAD14 =1087 , +SVGA_3D_CMD_DEAD15 =1088 , +SVGA_3D_CMD_DEAD16 =1089 , +SVGA_3D_CMD_DEAD17 =1090 ,SVGA_3D_CMD_SET_OTABLE_BASE =1091 , SVGA_3D_CMD_READBACK_OTABLE = 1092,
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +6 -12
@@ -2922,18 +2922,12 @@ static const struct vmw_cmd_entry vmw_cmd_entries[SVGA_3D_CMD_MAX] = { false, false, false),VMW_CMD_DEF (SVGA_3D_CMD_DEAD2 , &vmw_cmd_invalid, false, false, false), -VMW_CMD_DEF (SVGA_3D_CMD_LOGICOPS_BITBLT , &vmw_cmd_invalid, - false, false, false), -VMW_CMD_DEF (SVGA_3D_CMD_LOGICOPS_TRANSBLT , &vmw_cmd_invalid, - false, false, false), -VMW_CMD_DEF (SVGA_3D_CMD_LOGICOPS_STRETCHBLT , &vmw_cmd_invalid, - false, false, false), -VMW_CMD_DEF (SVGA_3D_CMD_LOGICOPS_COLORFILL , &vmw_cmd_invalid, - false, false, false), -VMW_CMD_DEF (SVGA_3D_CMD_LOGICOPS_ALPHABLEND , &vmw_cmd_invalid, - false, false, false), -VMW_CMD_DEF (SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND , &vmw_cmd_invalid, - false, false, false), +VMW_CMD_DEF (SVGA_3D_CMD_DEAD12 , &vmw_cmd_invalid, false, false, false), +VMW_CMD_DEF (SVGA_3D_CMD_DEAD13 , &vmw_cmd_invalid, false, false, false), +VMW_CMD_DEF (SVGA_3D_CMD_DEAD14 , &vmw_cmd_invalid, false, false, false), +VMW_CMD_DEF (SVGA_3D_CMD_DEAD15 , &vmw_cmd_invalid, false, false, false), +VMW_CMD_DEF (SVGA_3D_CMD_DEAD16 , &vmw_cmd_invalid, false, false, false), +VMW_CMD_DEF (SVGA_3D_CMD_DEAD17 , &vmw_cmd_invalid, false, false, false),VMW_CMD_DEF (SVGA_3D_CMD_SET_OTABLE_BASE , &vmw_cmd_invalid, false, false, true), VMW_CMD_DEF(SVGA_3D_CMD_READBACK_OTABLE, &vmw_cmd_invalid,
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 9/17 drm/vmwgfx: Add support for UA view commands
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
Virtual device now support new commands to manage unordered access views. Allow them as part of user-space command buffer. This involves adding UA view cotable, binding tracker info, new view type and command verifier functions.
v2: fix comment typo
v3: style fixes (don't use deprecated PTR_RET)
--- drivers/gpu/drm/vmwgfx/vmwgfx_binding.c | 129 ++++++++++++++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_binding.h | 16 +++ drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 26 +++-- drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 144 +++++++++++++++++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_so.c | 12 +- drivers/gpu/drm/vmwgfx/vmwgfx_so.h | 6 + 7 files changed, 319 insertions(+), 18 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_binding.c +125 -4
@@ -59,7 +59,9 @@#define VMW_BINDING_PS_BIT 1#define VMW_BINDING_SO_BIT 2#define VMW_BINDING_VB_BIT 3 -#define VMW_BINDING_NUM_BITS 4 +#define VMW_BINDING_UAV_BIT 4 +#define VMW_BINDING_CS_UAV_BIT 5 +#define VMW_BINDING_NUM_BITS 6#define VMW_BINDING_PS_SR_BIT 0
@@ -75,6 +77,7 @@* @vertex_buffers: Vertex buffer bindings. * @index_buffer: Index buffer binding. * @per_shader: Per shader-type bindings. +* @ua_views: UAV bindings. * @dirty: Bitmap tracking per binding-type changes that have not yet * been emitted to the device. * @dirty_vb: Bitmap tracking individual vertex buffer binding changes that
@@ -99,6 +102,7 @@ struct vmw_ctx_binding_state {struct vmw_ctx_bindinfo_vb vertex_buffers[SVGA3D_DX_MAX_VERTEXBUFFERS ];struct vmw_ctx_bindinfo_ib index_buffer;struct vmw_dx_shader_bindings per_shader[SVGA3D_NUM_SHADERTYPE ]; +struct vmw_ctx_bindinfo_uav ua_views[VMW_MAX_UAV_BIND_TYPE ];unsigned long dirty;DECLARE_BITMAP (dirty_vb,SVGA3D_DX_MAX_VERTEXBUFFERS );
@@ -121,6 +125,9 @@ static int vmw_binding_scrub_dx_shader(struct vmw_ctx_bindinfo *bi, bool rebind);static int vmw_binding_scrub_ib (struct vmw_ctx_bindinfo *bi,bool rebind);static int vmw_binding_scrub_vb (struct vmw_ctx_bindinfo *bi,bool rebind); +static int vmw_binding_scrub_uav (struct vmw_ctx_bindinfo *bi,bool rebind); +static int vmw_binding_scrub_cs_uav (struct vmw_ctx_bindinfo *bi,bool rebind); +static void vmw_binding_build_asserts (void ) __attribute__ ((unused));typedef int (*vmw_scrub_func )(struct vmw_ctx_bindinfo *,bool );
@@ -189,6 +196,12 @@ static const size_t vmw_binding_vb_offsets[] = {static const size_t vmw_binding_ib_offsets[] = { offsetof(struct vmw_ctx_binding_state , index_buffer), }; +static const size_t vmw_binding_uav_offsets[] = { + offsetof(struct vmw_ctx_binding_state, ua_views[0].views), +}; +static const size_t vmw_binding_cs_uav_offsets[] = { + offsetof(struct vmw_ctx_binding_state, ua_views[1].views), +};static const struct vmw_binding_info vmw_binding_infos[] = { [vmw_ctx_binding_shader] = {
@@ -235,6 +248,14 @@ static const struct vmw_binding_info vmw_binding_infos[] = { .size = sizeof(struct vmw_ctx_bindinfo_ib), .offsets = vmw_binding_ib_offsets, .scrub_func = vmw_binding_scrub_ib}, + [vmw_ctx_binding_uav] = { + .size = sizeof(struct vmw_ctx_bindinfo_view), + .offsets = vmw_binding_uav_offsets, + .scrub_func = vmw_binding_scrub_uav}, + [vmw_ctx_binding_cs_uav] = { + .size = sizeof(struct vmw_ctx_bindinfo_view), + .offsets = vmw_binding_cs_uav_offsets, + .scrub_func = vmw_binding_scrub_cs_uav}, };/**
@@ -320,6 +341,18 @@ void vmw_binding_add(struct vmw_ctx_binding_state *cbs,INIT_LIST_HEAD (&loc->res_list); } +/** +* vmw_binding_add_uav_index - Add UAV index for tracking. +* @cbs: Pointer to the context binding state tracker. +* @slot: UAV type to which bind this index. +* @index: The splice index to track. +*/ +void vmw_binding_add_uav_index (struct vmw_ctx_binding_state *cbs,uint32 slot, +uint32 index) +{ + cbs->ua_views[slot].index = index; +} +/** * vmw_binding_transfer: Transfer a context binding tracking entry. *
@@ -459,6 +492,10 @@ void vmw_binding_state_commit(struct vmw_ctx_binding_state *to,vmw_binding_transfer (to, from, entry);vmw_binding_drop (entry); } + +/* Also transfer uav splice indices */ + to->ua_views[0 ].index = from->ua_views[0 ].index; + to->ua_views[1 ].index = from->ua_views[1 ].index; }/**
@@ -1014,6 +1051,66 @@ static int vmw_emit_set_vb(struct vmw_ctx_binding_state *cbs)return 0 ; } +static int vmw_emit_set_uav (struct vmw_ctx_binding_state *cbs) +{ +const struct vmw_ctx_bindinfo *loc = &cbs->ua_views[0 ].views[0 ].bi; +struct { +SVGA3dCmdHeader header; +SVGA3dCmdDXSetUAViews body; + } *cmd; +size_t cmd_size, view_id_size; +const struct vmw_resource *ctx =vmw_cbs_context (cbs); + +vmw_collect_view_ids (cbs, loc,SVGA3D_MAX_UAVIEWS ); + view_id_size = cbs->bind_cmd_count*sizeof (uint32); + cmd_size =sizeof (*cmd) + view_id_size; + cmd =VMW_FIFO_RESERVE_DX (ctx->dev_priv, cmd_size, ctx->id); +if (!cmd) +return -ENOMEM ; + + cmd->header.id =SVGA_3D_CMD_DX_SET_UA_VIEWS ; + cmd->header.size =sizeof (cmd->body) + view_id_size; + +/* Splice index is specified user-space */ + cmd->body.uavSpliceIndex = cbs->ua_views[0 ].index; + +memcpy (&cmd[1 ], cbs->bind_cmd_buffer, view_id_size); + +vmw_fifo_commit (ctx->dev_priv, cmd_size); + +return 0 ; +} + +static int vmw_emit_set_cs_uav (struct vmw_ctx_binding_state *cbs) +{ +const struct vmw_ctx_bindinfo *loc = &cbs->ua_views[1 ].views[0 ].bi; +struct { +SVGA3dCmdHeader header; +SVGA3dCmdDXSetCSUAViews body; + } *cmd; +size_t cmd_size, view_id_size; +const struct vmw_resource *ctx =vmw_cbs_context (cbs); + +vmw_collect_view_ids (cbs, loc,SVGA3D_MAX_UAVIEWS ); + view_id_size = cbs->bind_cmd_count*sizeof (uint32); + cmd_size =sizeof (*cmd) + view_id_size; + cmd =VMW_FIFO_RESERVE_DX (ctx->dev_priv, cmd_size, ctx->id); +if (!cmd) +return -ENOMEM ; + + cmd->header.id =SVGA_3D_CMD_DX_SET_CS_UA_VIEWS ; + cmd->header.size =sizeof (cmd->body) + view_id_size; + +/* Start index is specified user-space */ + cmd->body.startIndex = cbs->ua_views[1 ].index; + +memcpy (&cmd[1 ], cbs->bind_cmd_buffer, view_id_size); + +vmw_fifo_commit (ctx->dev_priv, cmd_size); + +return 0 ; +} +/** * vmw_binding_emit_dirty - Issue delayed binding commands *
@@ -1045,6 +1142,12 @@ static int vmw_binding_emit_dirty(struct vmw_ctx_binding_state *cbs)case VMW_BINDING_VB_BIT : ret =vmw_emit_set_vb (cbs);break ; +case VMW_BINDING_UAV_BIT : + ret =vmw_emit_set_uav (cbs); +break ; +case VMW_BINDING_CS_UAV_BIT : + ret =vmw_emit_set_cs_uav (cbs); +break ;default :BUG (); }
@@ -1171,6 +1274,22 @@ static int vmw_binding_scrub_ib(struct vmw_ctx_bindinfo *bi, bool rebind)return 0 ; } +static int vmw_binding_scrub_uav (struct vmw_ctx_bindinfo *bi,bool rebind) +{ +struct vmw_ctx_binding_state *cbs =vmw_context_binding_state (bi->ctx); + +__set_bit (VMW_BINDING_UAV_BIT , &cbs->dirty); +return 0 ; +} + +static int vmw_binding_scrub_cs_uav (struct vmw_ctx_bindinfo *bi,bool rebind) +{ +struct vmw_ctx_binding_state *cbs =vmw_context_binding_state (bi->ctx); + +__set_bit (VMW_BINDING_CS_UAV_BIT , &cbs->dirty); +return 0 ; +} +/** * vmw_binding_state_alloc - Allocate a struct vmw_ctx_binding_state with * memory accounting.
@@ -1257,8 +1376,8 @@ void vmw_binding_state_reset(struct vmw_ctx_binding_state *cbs)* Each time a resource is put on the validation list as the result of a * context binding referencing it, we need to determine whether that resource * will be dirtied (written to by the GPU) as a result of the corresponding -* GPU operation. Currently rendertarget-, depth-stencil-, and -* stream-output-target bindings are capable of dirtying its resource. +* GPU operation. Currently rendertarget-, depth-stencil-, stream-output-target +* and unordered access view bindings are capable of dirtying its resource. * * Return: Whether the binding type dirties the resource its binding points to. */
@@ -1269,10 +1388,12 @@ u32 vmw_binding_dirtying(enum vmw_ctx_binding_type binding_type) [vmw_ctx_binding_dx_rt] = VMW_RES_DIRTY_SET, [vmw_ctx_binding_ds] = VMW_RES_DIRTY_SET, [vmw_ctx_binding_so] = VMW_RES_DIRTY_SET, + [vmw_ctx_binding_uav] = VMW_RES_DIRTY_SET, + [vmw_ctx_binding_cs_uav] =VMW_RES_DIRTY_SET , };/* Review this function as new bindings are added. */ -BUILD_BUG_ON (vmw_ctx_binding_max !=11 ); +BUILD_BUG_ON (vmw_ctx_binding_max !=13 );return is_binding_dirtying[binding_type]; }
drivers/gpu/drm/vmwgfx/vmwgfx_binding.h +16 -0
@@ -33,6 +33,8 @@#define VMW_MAX_VIEW_BINDINGS 128 +#define VMW_MAX_UAV_BIND_TYPE 2 +struct vmw_private ;struct vmw_ctx_binding_state ;
@@ -51,6 +53,8 @@ enum vmw_ctx_binding_type { vmw_ctx_binding_so, vmw_ctx_binding_vb, vmw_ctx_binding_ib, + vmw_ctx_binding_uav, + vmw_ctx_binding_cs_uav, vmw_ctx_binding_max };
@@ -189,9 +193,21 @@ struct vmw_dx_shader_bindings {unsigned long dirty; }; +/** +* struct vmw_ctx_bindinfo_uav - UAV context binding state. +* @views: UAV view bindings. +* @splice_index: The device splice index set by user-space. +*/ +struct vmw_ctx_bindinfo_uav { +struct vmw_ctx_bindinfo_view views[SVGA3D_MAX_UAVIEWS ]; +uint32 index; +}; +extern void vmw_binding_add (struct vmw_ctx_binding_state *cbs,const struct vmw_ctx_bindinfo *ci,u32 shader_slot,u32 slot); +extern void vmw_binding_add_uav_index (struct vmw_ctx_binding_state *cbs, +uint32 slot,uint32 splice_index);extern void vmw_binding_state_commit (struct vmw_ctx_binding_state *to,struct vmw_ctx_binding_state *from);
drivers/gpu/drm/vmwgfx/vmwgfx_context.c +18 -8
@@ -36,7 +36,7 @@ struct vmw_user_context {struct vmw_resource res;struct vmw_ctx_binding_state *cbs;struct vmw_cmdbuf_res_manager *man; -struct vmw_resource *cotables[SVGA_COTABLE_DX10_MAX ]; +struct vmw_resource *cotables[SVGA_COTABLE_MAX ];spinlock_t cotable_lock;struct vmw_buffer_object *dx_query_mob; };
@@ -116,12 +116,15 @@ static const struct vmw_res_func vmw_dx_context_func = {* Context management: */ -static void vmw_context_cotables_unref (struct vmw_user_context *uctx) +static void vmw_context_cotables_unref (struct vmw_private *dev_priv, +struct vmw_user_context *uctx) {struct vmw_resource *res;int i; +u32 cotable_max =has_sm5_context (dev_priv) ? +SVGA_COTABLE_MAX :SVGA_COTABLE_DX10_MAX ; -for (i =0 ; i <SVGA_COTABLE_DX10_MAX ; ++i) { +for (i =0 ; i < cotable_max; ++i) {spin_lock (&uctx->cotable_lock); res = uctx->cotables[i]; uctx->cotables[i] =NULL ;
@@ -155,7 +158,7 @@ static void vmw_hw_context_destroy(struct vmw_resource *res) !dev_priv->query_cid_valid)__vmw_execbuf_release_pinned_bo (dev_priv,NULL );mutex_unlock (&dev_priv->cmdbuf_mutex); -vmw_context_cotables_unref (uctx); +vmw_context_cotables_unref (dev_priv, uctx);return ; }
@@ -208,7 +211,9 @@ static int vmw_gb_context_init(struct vmw_private *dev_priv,spin_lock_init (&uctx->cotable_lock);if (dx) { -for (i =0 ; i <SVGA_COTABLE_DX10_MAX ; ++i) { +u32 cotable_max =has_sm5_context (dev_priv) ? +SVGA_COTABLE_MAX :SVGA_COTABLE_DX10_MAX ; +for (i =0 ; i < cotable_max; ++i) { uctx->cotables[i] =vmw_cotable_alloc (dev_priv, &uctx->res, i);if (IS_ERR (uctx->cotables[i])) {
@@ -222,7 +227,7 @@ static int vmw_gb_context_init(struct vmw_private *dev_priv,return 0 ; out_cotables: -vmw_context_cotables_unref (uctx); +vmw_context_cotables_unref (dev_priv, uctx); out_err:if (res_free)res_free (res);
@@ -545,10 +550,12 @@ void vmw_dx_context_scrub_cotables(struct vmw_resource *ctx, {struct vmw_user_context *uctx = container_of(ctx, struct vmw_user_context, res); +u32 cotable_max =has_sm5_context (ctx->dev_priv) ? +SVGA_COTABLE_MAX :SVGA_COTABLE_DX10_MAX ;int i;vmw_binding_state_scrub (uctx->cbs); -for (i =0 ; i <SVGA_COTABLE_DX10_MAX ; ++i) { +for (i =0 ; i < cotable_max; ++i) {struct vmw_resource *res;/* Avoid racing with ongoing cotable destruction. */
@@ -839,7 +846,10 @@ struct vmw_cmdbuf_res_manager *vmw_context_res_man(struct vmw_resource *ctx)struct vmw_resource *vmw_context_cotable (struct vmw_resource *ctx,SVGACOTableType cotable_type) { -if (cotable_type >=SVGA_COTABLE_DX10_MAX ) +u32 cotable_max =has_sm5_context (ctx->dev_priv) ? +SVGA_COTABLE_MAX :SVGA_COTABLE_DX10_MAX ; + +if (cotable_type >= cotable_max)return ERR_PTR (-EINVAL ); return container_of(ctx, struct vmw_user_context, res)->
drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c +3 -1
@@ -82,7 +82,8 @@ static const struct vmw_cotable_info co_info[] = { {1, sizeof(SVGACOTableDXSamplerEntry), NULL}, {1, sizeof(SVGACOTableDXStreamOutputEntry), NULL}, {1, sizeof(SVGACOTableDXQueryEntry), NULL}, - {1, sizeof(SVGACOTableDXShaderEntry), &vmw_dx_shader_cotable_list_scrub} + {1, sizeof(SVGACOTableDXShaderEntry), &vmw_dx_shader_cotable_list_scrub}, + {1, sizeof(SVGACOTableDXUAViewEntry), &vmw_view_cotable_list_destroy} };/*
@@ -102,6 +103,7 @@ const SVGACOTableType vmw_cotable_scrub_order[] = {SVGA_COTABLE_SAMPLER ,SVGA_COTABLE_STREAMOUTPUT ,SVGA_COTABLE_DXQUERY , + SVGA_COTABLE_UAVIEW, }; static int vmw_cotable_bind(struct vmw_resource *res,
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +143 -1
166 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_so.c +8 -4
@@ -319,7 +319,8 @@ int vmw_view_add(struct vmw_cmdbuf_res_manager *man,static const size_t vmw_view_define_sizes[] = { [vmw_view_sr] =sizeof (SVGA3dCmdDXDefineShaderResourceView), [vmw_view_rt] =sizeof (SVGA3dCmdDXDefineRenderTargetView), - [vmw_view_ds] =sizeof (SVGA3dCmdDXDefineDepthStencilView) + [vmw_view_ds] =sizeof (SVGA3dCmdDXDefineDepthStencilView), + [vmw_view_ua] =sizeof (SVGA3dCmdDXDefineUAView) };struct vmw_private *dev_priv = ctx->dev_priv;
@@ -499,8 +500,8 @@ struct vmw_resource *vmw_view_lookup(struct vmw_cmdbuf_res_manager *man,* Each time a resource is put on the validation list as the result of a * view pointing to it, we need to determine whether that resource will * be dirtied (written to by the GPU) as a result of the corresponding -* GPU operation. Currently only rendertarget- and depth-stencil views are -* capable of dirtying its resource. +* GPU operation. Currently only rendertarget-, depth-stencil and unordered +* access views are capable of dirtying its resource. * * Return: Whether the view type of @res dirties the resource it points to. */
@@ -509,10 +510,11 @@ u32 vmw_view_dirtying(struct vmw_resource *res)static u32 view_is_dirtying[vmw_view_max] = { [vmw_view_rt] =VMW_RES_DIRTY_SET , [vmw_view_ds] =VMW_RES_DIRTY_SET , + [vmw_view_ua] =VMW_RES_DIRTY_SET , };/* Update this function as we add more view types */ -BUILD_BUG_ON (vmw_view_max !=3 ); +BUILD_BUG_ON (vmw_view_max !=4 );return view_is_dirtying[vmw_view (res)->view_type]; }
@@ -520,12 +522,14 @@ const u32 vmw_view_destroy_cmds[] = { [vmw_view_sr] = SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW, [vmw_view_rt] = SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW, [vmw_view_ds] = SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW, + [vmw_view_ua] = SVGA_3D_CMD_DX_DESTROY_UA_VIEW, };const SVGACOTableType vmw_view_cotables[] = { [vmw_view_sr] =SVGA_COTABLE_SRVIEW , [vmw_view_rt] =SVGA_COTABLE_RTVIEW , [vmw_view_ds] =SVGA_COTABLE_DSVIEW , + [vmw_view_ua] =SVGA_COTABLE_UAVIEW , };const SVGACOTableType vmw_so_cotables[] = {
drivers/gpu/drm/vmwgfx/vmwgfx_so.h +6 -0
@@ -30,6 +30,7 @@ enum vmw_view_type { vmw_view_sr, vmw_view_rt, vmw_view_ds, + vmw_view_ua, vmw_view_max, };
@@ -61,6 +62,7 @@ union vmw_view_destroy {struct SVGA3dCmdDXDestroyRenderTargetView rtv;struct SVGA3dCmdDXDestroyShaderResourceView srv;struct SVGA3dCmdDXDestroyDepthStencilView dsv; +struct SVGA3dCmdDXDestroyUAView uav;u32 view_id; };
@@ -87,6 +89,10 @@ static inline enum vmw_view_type vmw_view_cmd_to_type(u32 id) {u32 tmp = (id -SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW ) /2 ; +if (id ==SVGA_3D_CMD_DX_DEFINE_UA_VIEW || + id ==SVGA_3D_CMD_DX_DESTROY_UA_VIEW ) +return vmw_view_ua; +if (tmp > (u32 )vmw_view_max)return vmw_view_max;
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 7/17 drm/vmwgfx: Read new register for GB memory when available
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
Virtual device added new register for suggested GB memory, read the new register when available.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +9 -3
@@ -720,9 +720,15 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) dev_priv->max_mob_pages =0 ; dev_priv->max_mob_size =0 ;if (dev_priv->capabilities &SVGA_CAP_GBOBJECTS ) { -uint64_t mem_size = -vmw_read (dev_priv, -SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB ); +uint64_t mem_size; + +if (dev_priv->capabilities2 &SVGA_CAP2_GB_MEMSIZE_2 ) + mem_size =vmw_read (dev_priv, +SVGA_REG_GBOBJECT_MEM_SIZE_KB ); +else + mem_size = +vmw_read (dev_priv, +SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB );/* * Workaround for low memory 2D VMs to compensate for the
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 10/17 drm/vmwgfx: Add support for indirect and dispatch commands
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
Validate indirect and dispatch commands in command buffer.
--- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 70 +++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +70 -0
@@ -2816,6 +2816,16 @@ static int vmw_cmd_intra_surface_copy(struct vmw_private *dev_priv, &cmd->body.surface.sid, NULL); } +static int vmw_cmd_sm5 (struct vmw_private *dev_priv, +struct vmw_sw_context *sw_context, +SVGA3dCmdHeader *header) +{ +if (!has_sm5_context (dev_priv)) +return -EINVAL ; + +return 0 ; +} +static int vmw_cmd_sm5_view_define (struct vmw_private *dev_priv,struct vmw_sw_context *sw_context,SVGA3dCmdHeader *header)
@@ -2938,6 +2948,57 @@ static int vmw_cmd_set_cs_uav(struct vmw_private *dev_priv,return ret; } +static int vmw_cmd_indexed_instanced_indirect (struct vmw_private *dev_priv, +struct vmw_sw_context *sw_context, +SVGA3dCmdHeader *header) +{ +struct vmw_draw_indexed_instanced_indirect_cmd { +SVGA3dCmdHeader header; +SVGA3dCmdDXDrawIndexedInstancedIndirect body; + } *cmd =container_of (header,typeof (*cmd), header); + +if (!has_sm5_context (dev_priv)) +return -EINVAL ; + +return vmw_cmd_res_check (dev_priv, sw_context, vmw_res_surface, +VMW_RES_DIRTY_NONE , user_surface_converter, + &cmd->body.argsBufferSid,NULL ); +} + +static int vmw_cmd_instanced_indirect (struct vmw_private *dev_priv, +struct vmw_sw_context *sw_context, +SVGA3dCmdHeader *header) +{ +struct vmw_draw_instanced_indirect_cmd { +SVGA3dCmdHeader header; +SVGA3dCmdDXDrawInstancedIndirect body; + } *cmd =container_of (header,typeof (*cmd), header); + +if (!has_sm5_context (dev_priv)) +return -EINVAL ; + +return vmw_cmd_res_check (dev_priv, sw_context, vmw_res_surface, +VMW_RES_DIRTY_NONE , user_surface_converter, + &cmd->body.argsBufferSid,NULL ); +} + +static int vmw_cmd_dispatch_indirect (struct vmw_private *dev_priv, +struct vmw_sw_context *sw_context, +SVGA3dCmdHeader *header) +{ +struct vmw_dispatch_indirect_cmd { +SVGA3dCmdHeader header; +SVGA3dCmdDXDispatchIndirect body; + } *cmd =container_of (header,typeof (*cmd), header); + +if (!has_sm5_context (dev_priv)) +return -EINVAL ; + +return vmw_cmd_res_check (dev_priv, sw_context, vmw_res_surface, +VMW_RES_DIRTY_NONE , user_surface_converter, + &cmd->body.argsBufferSid,NULL ); +} +static int vmw_cmd_check_not_3d (struct vmw_private *dev_priv,struct vmw_sw_context *sw_context,void *buf,uint32_t *size)
@@ -3303,8 +3364,17 @@ static const struct vmw_cmd_entry vmw_cmd_entries[SVGA_3D_CMD_MAX] = { false, true),VMW_CMD_DEF (SVGA_3D_CMD_DX_SET_UA_VIEWS , &vmw_cmd_set_uav, true, false, true), +VMW_CMD_DEF (SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT , + &vmw_cmd_indexed_instanced_indirect, true, false, true), +VMW_CMD_DEF (SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT , + &vmw_cmd_instanced_indirect, true, false, true), +VMW_CMD_DEF (SVGA_3D_CMD_DX_DISPATCH , &vmw_cmd_sm5, true, false, true), +VMW_CMD_DEF (SVGA_3D_CMD_DX_DISPATCH_INDIRECT , + &vmw_cmd_dispatch_indirect, true, false, true),VMW_CMD_DEF (SVGA_3D_CMD_DX_SET_CS_UA_VIEWS , &vmw_cmd_set_cs_uav, true, false, true), +VMW_CMD_DEF (SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2 , + &vmw_cmd_sm5_view_define, true, false, true), };bool vmw_cmd_describe (const void *buf,u32 *size,char const **cmd)
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/17 drm/vmwgfx: Also check for SVGA_CAP_DX before reading DX context support
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
Virtual device consider SVGA_CAP_DX and SVGA3D_DEVCAP_DXCONTEXT independent of each other. Some of the commands in cmd_buf depends on SVGA_CAP_DX, so better to check for that as well.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +1 -1
@@ -883,7 +883,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) } } -if (dev_priv->has_mob) { +if (dev_priv->has_mob && (dev_priv->capabilities &SVGA_CAP_DX )) {spin_lock (&dev_priv->cap_lock);vmw_write (dev_priv,SVGA_REG_DEV_CAP ,SVGA3D_DEVCAP_DXCONTEXT ); dev_priv->has_dx = !!vmw_read (dev_priv,SVGA_REG_DEV_CAP );
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 8/17 drm/vmwgfx: Support SM5 shader type in command buffer
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
Virtual device now supports new shader types, allow them as valid shader type in command buffer. Also add per shader bind info in binding manager state for new shader type.
--- drivers/gpu/drm/vmwgfx/vmwgfx_binding.c | 11 ++++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 14 +++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_binding.c +10 -1
@@ -98,7 +98,7 @@ struct vmw_ctx_binding_state {struct vmw_ctx_bindinfo_so so_targets[SVGA3D_DX_MAX_SOTARGETS ];struct vmw_ctx_bindinfo_vb vertex_buffers[SVGA3D_DX_MAX_VERTEXBUFFERS ];struct vmw_ctx_bindinfo_ib index_buffer; -struct vmw_dx_shader_bindings per_shader[SVGA3D_NUM_SHADERTYPE_DX10 ]; +struct vmw_dx_shader_bindings per_shader[SVGA3D_NUM_SHADERTYPE ];unsigned long dirty;DECLARE_BITMAP (dirty_vb,SVGA3D_DX_MAX_VERTEXBUFFERS );
@@ -151,6 +151,9 @@ static const size_t vmw_binding_shader_offsets[] = { offsetof(struct vmw_ctx_binding_state, per_shader[0].shader), offsetof(struct vmw_ctx_binding_state, per_shader[1].shader), offsetof(struct vmw_ctx_binding_state, per_shader[2].shader), + offsetof(struct vmw_ctx_binding_state, per_shader[3].shader), + offsetof(struct vmw_ctx_binding_state, per_shader[4].shader), + offsetof(struct vmw_ctx_binding_state, per_shader[5].shader), };static const size_t vmw_binding_rt_offsets[] = { offsetof(struct vmw_ctx_binding_state , render_targets),
@@ -162,6 +165,9 @@ static const size_t vmw_binding_cb_offsets[] = { offsetof(struct vmw_ctx_binding_state, per_shader[0].const_buffers), offsetof(struct vmw_ctx_binding_state, per_shader[1].const_buffers), offsetof(struct vmw_ctx_binding_state, per_shader[2].const_buffers), + offsetof(struct vmw_ctx_binding_state, per_shader[3].const_buffers), + offsetof(struct vmw_ctx_binding_state, per_shader[4].const_buffers), + offsetof(struct vmw_ctx_binding_state, per_shader[5].const_buffers), };static const size_t vmw_binding_dx_ds_offsets[] = { offsetof(struct vmw_ctx_binding_state , ds_view),
@@ -170,6 +176,9 @@ static const size_t vmw_binding_sr_offsets[] = { offsetof(struct vmw_ctx_binding_state, per_shader[0].shader_res), offsetof(struct vmw_ctx_binding_state, per_shader[1].shader_res), offsetof(struct vmw_ctx_binding_state, per_shader[2].shader_res), + offsetof(struct vmw_ctx_binding_state, per_shader[3].shader_res), + offsetof(struct vmw_ctx_binding_state, per_shader[4].shader_res), + offsetof(struct vmw_ctx_binding_state, per_shader[5].shader_res), };static const size_t vmw_binding_so_offsets[] = { offsetof(struct vmw_ctx_binding_state , so_targets),
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +11 -3
@@ -2118,6 +2118,9 @@ vmw_cmd_dx_set_single_constant_buffer(struct vmw_private *dev_priv, SVGA3dCmdHeader *header) {VMW_DECLARE_CMD_VAR (*cmd, SVGA3dCmdDXSetSingleConstantBuffer); +SVGA3dShaderType max_shader_num =has_sm5_context (dev_priv) ? +SVGA3D_NUM_SHADERTYPE :SVGA3D_NUM_SHADERTYPE_DX10 ; +struct vmw_resource *res =NULL ;struct vmw_ctx_validation_info *ctx_node =VMW_GET_CTX_NODE (sw_context);struct vmw_ctx_bindinfo_cb binding;
@@ -2141,7 +2144,7 @@ vmw_cmd_dx_set_single_constant_buffer(struct vmw_private *dev_priv, binding.size = cmd->body.sizeInBytes; binding.slot = cmd->body.slot; -if (binding.shader_slot >=SVGA3D_NUM_SHADERTYPE_DX10 || +if (binding.shader_slot >= max_shader_num || binding.slot >=SVGA3D_DX_MAX_CONSTBUFFERS ) { VMW_DEBUG_USER("Illegal const buffer shader %u slot %u.\n", (unsigned int) cmd->body.type,
@@ -2169,12 +2172,15 @@ static int vmw_cmd_dx_set_shader_res(struct vmw_private *dev_priv, {VMW_DECLARE_CMD_VAR (*cmd, SVGA3dCmdDXSetShaderResources) =container_of (header,typeof (*cmd), header); +SVGA3dShaderType max_allowed =has_sm5_context (dev_priv) ? +SVGA3D_SHADERTYPE_MAX :SVGA3D_SHADERTYPE_DX10_MAX ; +u32 num_sr_view = (cmd->header.size -sizeof (cmd->body)) /sizeof (SVGA3dShaderResourceViewId);if ((u64 ) cmd->body.startView + (u64 ) num_sr_view > (u64 )SVGA3D_DX_MAX_SRVIEWS || - cmd->body.type >=SVGA3D_SHADERTYPE_DX10_MAX ) { + cmd->body.type >= max_allowed) {VMW_DEBUG_USER ("Invalid shader binding.\n" );return -EINVAL ; }
@@ -2198,6 +2204,8 @@ static int vmw_cmd_dx_set_shader(struct vmw_private *dev_priv, SVGA3dCmdHeader *header) {VMW_DECLARE_CMD_VAR (*cmd, SVGA3dCmdDXSetShader); +SVGA3dShaderType max_allowed =has_sm5_context (dev_priv) ? +SVGA3D_SHADERTYPE_MAX :SVGA3D_SHADERTYPE_DX10_MAX ;struct vmw_resource *res =NULL ;struct vmw_ctx_validation_info *ctx_node =VMW_GET_CTX_NODE (sw_context);struct vmw_ctx_bindinfo_shader binding;
@@ -2208,7 +2216,7 @@ static int vmw_cmd_dx_set_shader(struct vmw_private *dev_priv, cmd =container_of (header,typeof (*cmd), header); -if (cmd->body.type >=SVGA3D_SHADERTYPE_DX10_MAX || +if (cmd->body.type >= max_allowed || cmd->body.type <SVGA3D_SHADERTYPE_MIN ) {VMW_DEBUG_USER ("Illegal shader type %u.\n" , (unsigned int ) cmd->body.type);
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 15/17 drm/vmwgfx: Add surface define v4 command
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
Surface define v4 added new member buffer_byte_stride. With this patch add buffer_byte_stride in surface metadata and create surface using new command if support is available.
Also with this patch replace device specific data types with kernel types.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 36 +++++++++++++++++++++++-- include/uapi/drm/vmwgfx_drm.h | 12 +++++---- 3 files changed, 43 insertions(+), 7 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +2 -0
@@ -238,6 +238,7 @@ struct vmw_surface_offset; * @array_size: Number of array elements for a 1D/2D texture. For cubemap texture number of faces * array_size. This should be 0 for pre SM4 device. + * @buffer_byte_stride: Buffer byte stride. * @num_sizes: Size of @sizes. For GB surface this should always be 1. * @base_size: Surface dimension. * @sizes: Array representing mip sizes. Legacy only.
@@ -255,6 +256,7 @@ struct vmw_surface_metadata {u32 autogen_filter;u32 array_size;u32 num_sizes; +u32 buffer_byte_stride;struct drm_vmw_size base_size;struct drm_vmw_size *sizes;bool scanout;
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +34 -2
@@ -1082,6 +1082,10 @@ static int vmw_gb_surface_create(struct vmw_resource *res)SVGA3dCmdHeader header;SVGA3dCmdDefineGBSurface_v3 body; } *cmd3; +struct { +SVGA3dCmdHeader header; +SVGA3dCmdDefineGBSurface_v4 body; + } *cmd4;if (likely (res->id !=-1 ))return 0 ;
@@ -1098,7 +1102,11 @@ static int vmw_gb_surface_create(struct vmw_resource *res) goto out_no_fifo; } -if (has_sm4_1_context (dev_priv) && metadata->array_size >0 ) { +if (has_sm5_context (dev_priv) && metadata->array_size >0 ) { + cmd_id =SVGA_3D_CMD_DEFINE_GB_SURFACE_V4 ; + cmd_len =sizeof (cmd4->body); + submit_len =sizeof (*cmd4); + }else if (has_sm4_1_context (dev_priv) && metadata->array_size >0 ) { cmd_id =SVGA_3D_CMD_DEFINE_GB_SURFACE_V3 ; cmd_len =sizeof (cmd3->body); submit_len =sizeof (*cmd3);
@@ -1116,12 +1124,29 @@ static int vmw_gb_surface_create(struct vmw_resource *res) cmd =VMW_FIFO_RESERVE (dev_priv, submit_len); cmd2 = (typeof (cmd2 ))cmd; cmd3 = (typeof (cmd3 ))cmd; + cmd4 = (typeof (cmd4 ))cmd;if (unlikely (!cmd)) { ret = -ENOMEM ; goto out_no_fifo; } -if (has_sm4_1_context (dev_priv) && metadata->array_size >0 ) { +if (has_sm5_context (dev_priv) && metadata->array_size >0 ) { + cmd4->header.id = cmd_id; + cmd4->header.size = cmd_len; + cmd4->body.sid = srf->res.id; + cmd4->body.surfaceFlags = metadata->flags; + cmd4->body.format = metadata->format; + cmd4->body.numMipLevels = metadata->mip_levels[0 ]; + cmd4->body.multisampleCount = metadata->multisample_count; + cmd4->body.multisamplePattern = metadata->multisample_pattern; + cmd4->body.qualityLevel = metadata->quality_level; + cmd4->body.autogenFilter = metadata->autogen_filter; + cmd4->body.size.width = metadata->base_size.width; + cmd4->body.size.height = metadata->base_size.height; + cmd4->body.size.depth = metadata->base_size.depth; + cmd4->body.arraySize = metadata->array_size; + cmd4->body.bufferByteStride = metadata->buffer_byte_stride; + }else if (has_sm4_1_context (dev_priv) && metadata->array_size >0 ) { cmd3->header.id = cmd_id; cmd3->header.size = cmd_len; cmd3->body.sid = srf->res.id;
@@ -1341,6 +1366,7 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, req_ext.svga3d_flags_upper_32_bits =0 ; req_ext.multisample_pattern =SVGA3D_MS_PATTERN_NONE ; req_ext.quality_level =SVGA3D_MS_QUALITY_NONE ; + req_ext.buffer_byte_stride =0 ; req_ext.must_be_zero =0 ;return vmw_gb_surface_define_internal (dev, &req_ext, rep, file_priv);
@@ -1467,6 +1493,11 @@ vmw_gb_surface_define_internal(struct drm_device *dev, } } +if (req->buffer_byte_stride >0 && !has_sm5_context (dev_priv)) { +VMW_DEBUG_USER ("SM5 surface not supported.\n" ); +return -EINVAL ; + } +if ((svga3d_flags_64 &SVGA3D_SURFACE_MULTISAMPLE ) && req->base.multisample_count ==0 ) {VMW_DEBUG_USER ("Invalid sample count.\n" );
@@ -1491,6 +1522,7 @@ vmw_gb_surface_define_internal(struct drm_device *dev, metadata.multisample_pattern = req->multisample_pattern; metadata.quality_level = req->quality_level; metadata.array_size = req->base.array_size; + metadata.buffer_byte_stride = req->buffer_byte_stride; metadata.num_sizes =1 ; metadata.base_size = req->base.base_size; metadata.scanout = req->base.drm_surface_flags &
include/uapi/drm/vmwgfx_drm.h +7 -5
@@ -1133,7 +1133,7 @@ struct drm_vmw_handle_close_arg {* svga3d surface flags split into 2, upper half and lower half. */ enum drm_vmw_surface_version { - drm_vmw_gb_surface_v1 + drm_vmw_gb_surface_v1, };/**
@@ -1144,6 +1144,7 @@ enum drm_vmw_surface_version {* @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags. * @multisample_pattern: Multisampling pattern when msaa is supported. * @quality_level: Precision settings for each sample. +* @buffer_byte_stride: Buffer byte stride. * @must_be_zero: Reserved for future usage. * * Input argument to the DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl.
@@ -1152,10 +1153,11 @@ enum drm_vmw_surface_version {struct drm_vmw_gb_surface_create_ext_req {struct drm_vmw_gb_surface_create_req base;enum drm_vmw_surface_version version; -uint32_t svga3d_flags_upper_32_bits; -SVGA3dMSPattern multisample_pattern; -SVGA3dMSQualityLevel quality_level; -uint64_t must_be_zero; +__u32 svga3d_flags_upper_32_bits; +__u32 multisample_pattern; +__u32 quality_level; +__u32 buffer_byte_stride; +__u32 must_be_zero; };/**
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 12/17 drm/vmwgfx: Add support for streamoutput with mob commands
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
With SM5 capability a new version of streamoutput is supported by device which need backing mob and a new field. With this change the new command is supported in command buffer.
v2: Also track streamoutput context binding in binding manager.
v3: Track only one streamoutput as only one can be set to context.
v4: Fix comment typos
--- drivers/gpu/drm/vmwgfx/Makefile | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_binding.c | 39 +- drivers/gpu/drm/vmwgfx/vmwgfx_binding.h | 11 + drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 22 +- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 173 ++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_so.h | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c | 387 +++++++++++++++++++ 8 files changed, 630 insertions(+), 7 deletions(-) create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c
drivers/gpu/drm/vmwgfx/Makefile +1 -1
@@ -8,7 +8,7 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \ vmwgfx_cmdbuf_res.o vmwgfx_cmdbuf.o vmwgfx_stdu.o \ vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o \ vmwgfx_simple_resource.o vmwgfx_va.o vmwgfx_blit.o \ - vmwgfx_validation.o vmwgfx_page_dirty.o \ + vmwgfx_validation.o vmwgfx_page_dirty.o vmwgfx_streamoutput.o \ ttm_object.o ttm_lock.o obj-$(CONFIG_DRM_VMWGFX) := vmwgfx.o
drivers/gpu/drm/vmwgfx/vmwgfx_binding.c +38 -1
@@ -78,6 +78,7 @@* @index_buffer: Index buffer binding. * @per_shader: Per shader-type bindings. * @ua_views: UAV bindings. +* @so_state: StreamOutput bindings. * @dirty: Bitmap tracking per binding-type changes that have not yet * been emitted to the device. * @dirty_vb: Bitmap tracking individual vertex buffer binding changes that
@@ -103,6 +104,7 @@ struct vmw_ctx_binding_state {struct vmw_ctx_bindinfo_ib index_buffer;struct vmw_dx_shader_bindings per_shader[SVGA3D_NUM_SHADERTYPE ];struct vmw_ctx_bindinfo_uav ua_views[VMW_MAX_UAV_BIND_TYPE ]; +struct vmw_ctx_bindinfo_so so_state;unsigned long dirty;DECLARE_BITMAP (dirty_vb,SVGA3D_DX_MAX_VERTEXBUFFERS );
@@ -127,6 +129,7 @@ static int vmw_binding_scrub_ib(struct vmw_ctx_bindinfo *bi, bool rebind);static int vmw_binding_scrub_vb (struct vmw_ctx_bindinfo *bi,bool rebind);static int vmw_binding_scrub_uav (struct vmw_ctx_bindinfo *bi,bool rebind);static int vmw_binding_scrub_cs_uav (struct vmw_ctx_bindinfo *bi,bool rebind); +static int vmw_binding_scrub_so (struct vmw_ctx_bindinfo *bi,bool rebind);static void vmw_binding_build_asserts (void ) __attribute__ ((unused));
@@ -202,6 +205,9 @@ static const size_t vmw_binding_uav_offsets[] = {static const size_t vmw_binding_cs_uav_offsets[] = { offsetof(struct vmw_ctx_binding_state, ua_views[1].views), }; +static const size_t vmw_binding_so_offsets[] = { + offsetof(struct vmw_ctx_binding_state , so_state), +};static const struct vmw_binding_info vmw_binding_infos[] = { [vmw_ctx_binding_shader] = {
@@ -256,6 +262,10 @@ static const struct vmw_binding_info vmw_binding_infos[] = { .size = sizeof(struct vmw_ctx_bindinfo_view), .offsets = vmw_binding_cs_uav_offsets, .scrub_func = vmw_binding_scrub_cs_uav}, + [vmw_ctx_binding_so] = { + .size = sizeof(struct vmw_ctx_bindinfo_so), + .offsets = vmw_binding_so_offsets, + .scrub_func = vmw_binding_scrub_so}, };/**
@@ -1290,6 +1300,33 @@ static int vmw_binding_scrub_cs_uav(struct vmw_ctx_bindinfo *bi, bool rebind)return 0 ; } +/** +* vmw_binding_scrub_so - Scrub a streamoutput binding from context. +* @bi: Single binding information. +* @rebind: Whether to issue a bind instead of scrub command. +*/ +static int vmw_binding_scrub_so (struct vmw_ctx_bindinfo *bi,bool rebind) +{ +struct vmw_ctx_bindinfo_so *binding = +container_of (bi,typeof (*binding), bi); +struct vmw_private *dev_priv = bi->ctx->dev_priv; +struct { +SVGA3dCmdHeader header; +SVGA3dCmdDXSetStreamOutput body; + } *cmd; + + cmd =VMW_FIFO_RESERVE_DX (dev_priv,sizeof (*cmd), bi->ctx->id); +if (!cmd) +return -ENOMEM ; + + cmd->header.id =SVGA_3D_CMD_DX_SET_STREAMOUTPUT ; + cmd->header.size =sizeof (cmd->body); + cmd->body.soid = rebind ? bi->res->id :SVGA3D_INVALID_ID ; +vmw_fifo_commit (dev_priv,sizeof (*cmd)); + +return 0 ; +} +/** * vmw_binding_state_alloc - Allocate a struct vmw_ctx_binding_state with * memory accounting.
@@ -1393,7 +1430,7 @@ u32 vmw_binding_dirtying(enum vmw_ctx_binding_type binding_type) };/* Review this function as new bindings are added. */ -BUILD_BUG_ON (vmw_ctx_binding_max !=13 ); +BUILD_BUG_ON (vmw_ctx_binding_max !=14 );return is_binding_dirtying[binding_type]; }
drivers/gpu/drm/vmwgfx/vmwgfx_binding.h +11 -0
@@ -55,6 +55,7 @@ enum vmw_ctx_binding_type { vmw_ctx_binding_ib, vmw_ctx_binding_uav, vmw_ctx_binding_cs_uav, + vmw_ctx_binding_so, vmw_ctx_binding_max };
@@ -203,6 +204,16 @@ struct vmw_ctx_bindinfo_uav {uint32 index; }; +/** +* struct vmw_ctx_bindinfo_so - Stream output binding metadata. +* @bi: struct vmw_ctx_bindinfo we derive from. +* @slot: Device data used to reconstruct binding command. +*/ +struct vmw_ctx_bindinfo_so { +struct vmw_ctx_bindinfo bi; +uint32 slot; +}; +extern void vmw_binding_add (struct vmw_ctx_binding_state *cbs,const struct vmw_ctx_bindinfo *ci,u32 shader_slot,u32 slot);
drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c +1 -1
@@ -80,7 +80,7 @@ static const struct vmw_cotable_info co_info[] = { {1, sizeof(SVGACOTableDXDepthStencilEntry), NULL}, {1, sizeof(SVGACOTableDXRasterizerStateEntry), NULL}, {1, sizeof(SVGACOTableDXSamplerEntry), NULL}, - {1, sizeof(SVGACOTableDXStreamOutputEntry), NULL}, + {1, sizeof(SVGACOTableDXStreamOutputEntry), &vmw_dx_streamoutput_cotable_list_scrub}, {1, sizeof(SVGACOTableDXQueryEntry), NULL}, {1, sizeof(SVGACOTableDXShaderEntry), &vmw_dx_shader_cotable_list_scrub}, {1, sizeof(SVGACOTableDXUAViewEntry), &vmw_view_cotable_list_destroy}
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +21 -1
@@ -202,6 +202,7 @@ enum vmw_res_type { vmw_res_dx_context, vmw_res_cotable, vmw_res_view, + vmw_res_streamoutput, vmw_res_max };
@@ -210,7 +211,8 @@ enum vmw_res_type {*/ enum vmw_cmdbuf_res_type { vmw_cmdbuf_res_shader, - vmw_cmdbuf_res_view + vmw_cmdbuf_res_view, + vmw_cmdbuf_res_streamoutput };struct vmw_cmdbuf_res_manager ;
@@ -1307,6 +1309,24 @@ extern struct vmw_resource * vmw_shader_lookup(struct vmw_cmdbuf_res_manager *man, u32 user_key, SVGA3dShaderType shader_type); +/* +* Streamoutput management +*/ +struct vmw_resource * +vmw_dx_streamoutput_lookup (struct vmw_cmdbuf_res_manager *man, +u32 user_key); +int vmw_dx_streamoutput_add (struct vmw_cmdbuf_res_manager *man, +struct vmw_resource *ctx, +SVGA3dStreamOutputId user_key, +struct list_head *list); +void vmw_dx_streamoutput_set_size (struct vmw_resource *res,u32 size); +int vmw_dx_streamoutput_remove (struct vmw_cmdbuf_res_manager *man, +SVGA3dStreamOutputId user_key, +struct list_head *list); +void vmw_dx_streamoutput_cotable_list_scrub (struct vmw_private *dev_priv, +struct list_head *list, +bool readback); +/* * Command buffer managed resources - vmwgfx_cmdbuf_res.c */
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +170 -3
191 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_so.h +1 -0
@@ -129,6 +129,7 @@ static inline enum vmw_so_type vmw_so_cmd_to_type(u32 id)case SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE :return vmw_so_ss;case SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT : +case SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB :case SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT :return vmw_so_so;default :
drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c new file +387 -0
387 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 14/17 drm/vmwgfx: Refactor surface_define to use vmw_surface_metadata
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
Makes surface_define cleaner by sending vmw_surface_metadata instead of all the arguments individually.
v2: fix uninitialized return value, error message
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 5 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 27 +- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 51 +--- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 378 ++++++++++++------------ 4 files changed, 215 insertions(+), 246 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +5 -0
@@ -1309,6 +1309,11 @@ extern int vmw_gb_surface_reference_ext_ioctl(struct drm_device *dev,void *data, struct drm_file *file_priv); +int vmw_gb_surface_define (struct vmw_private *dev_priv, +uint32_t user_accounting_size, +const struct vmw_surface_metadata *req, +struct vmw_surface **srf_out); +/* * Shader management - vmwgfx_shader.c */
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +10 -17
@@ -1144,8 +1144,8 @@ static int vmw_create_bo_proxy(struct drm_device *dev,struct vmw_buffer_object *bo_mob, struct vmw_surface **srf_out) { + struct vmw_surface_metadata metadata = {0};uint32_t format; -struct drm_vmw_size content_base_size = {0 };struct vmw_resource *res;unsigned int bytes_pp;struct drm_format_name_buf format_name;
@@ -1175,22 +1175,15 @@ static int vmw_create_bo_proxy(struct drm_device *dev,return -EINVAL ; } - content_base_size.width = mode_cmd->pitches[0 ] / bytes_pp; - content_base_size.height = mode_cmd->height; - content_base_size.depth =1 ; - - ret =vmw_surface_gb_priv_define (dev, -0 ,/* kernel visible only */ -0 ,/* flags */ - format, - true,/* can be a scanout buffer */ -1 ,/* num of mip levels */ -0 , -0 , - content_base_size, -SVGA3D_MS_PATTERN_NONE , -SVGA3D_MS_QUALITY_NONE , - srf_out); + metadata.format = format; + metadata.mip_levels[0 ] =1 ; + metadata.num_sizes =1 ; + metadata.base_size.width = mode_cmd->pitches[0 ] / bytes_pp; + metadata.base_size.height = mode_cmd->height; + metadata.base_size.depth =1 ; + metadata.scanout = true; + + ret =vmw_gb_surface_define (vmw_priv (dev),0 , &metadata, srf_out);if (ret) {DRM_ERROR ("Failed to allocate proxy content buffer\n" );return ret;
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +16 -35
95 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +184 -194
432 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 11/17 drm/vmwgfx: Rename stream output target binding tracker struct
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
Previous name vmw_ctx_bindinfo_so is misleading because it actually represent so target and stream output is a new resource type that needs tracking for SM5 capable device. Also rename binding type enum and internal functions to reflect these belongs to so targets.
--- drivers/gpu/drm/vmwgfx/vmwgfx_binding.c | 36 ++++++++++++------------- drivers/gpu/drm/vmwgfx/vmwgfx_binding.h | 6 ++--- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 +-- 3 files changed, 23 insertions(+), 23 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_binding.c +18 -18
@@ -57,7 +57,7 @@#define VMW_BINDING_RT_BIT 0#define VMW_BINDING_PS_BIT 1 -#define VMW_BINDING_SO_BIT 2 +#define VMW_BINDING_SO_T_BIT 2#define VMW_BINDING_VB_BIT 3#define VMW_BINDING_UAV_BIT 4#define VMW_BINDING_CS_UAV_BIT 5
@@ -98,7 +98,7 @@ struct vmw_ctx_binding_state {struct vmw_ctx_bindinfo_view render_targets[SVGA3D_RT_MAX ];struct vmw_ctx_bindinfo_tex texture_units[SVGA3D_NUM_TEXTURE_UNITS ];struct vmw_ctx_bindinfo_view ds_view; -struct vmw_ctx_bindinfo_so so_targets[SVGA3D_DX_MAX_SOTARGETS ]; +struct vmw_ctx_bindinfo_so_target so_targets[SVGA3D_DX_MAX_SOTARGETS ];struct vmw_ctx_bindinfo_vb vertex_buffers[SVGA3D_DX_MAX_VERTEXBUFFERS ];struct vmw_ctx_bindinfo_ib index_buffer;struct vmw_dx_shader_bindings per_shader[SVGA3D_NUM_SHADERTYPE ];
@@ -119,7 +119,7 @@ static int vmw_binding_scrub_texture(struct vmw_ctx_bindinfo *bi, bool rebind);static int vmw_binding_scrub_cb (struct vmw_ctx_bindinfo *bi,bool rebind);static int vmw_binding_scrub_dx_rt (struct vmw_ctx_bindinfo *bi,bool rebind);static int vmw_binding_scrub_sr (struct vmw_ctx_bindinfo *bi,bool rebind); -static int vmw_binding_scrub_so (struct vmw_ctx_bindinfo *bi,bool rebind); +static int vmw_binding_scrub_so_target (struct vmw_ctx_bindinfo *bi,bool rebind);static int vmw_binding_emit_dirty (struct vmw_ctx_binding_state *cbs);static int vmw_binding_scrub_dx_shader (struct vmw_ctx_bindinfo *bi,bool rebind);
@@ -187,7 +187,7 @@ static const size_t vmw_binding_sr_offsets[] = { offsetof(struct vmw_ctx_binding_state, per_shader[4].shader_res), offsetof(struct vmw_ctx_binding_state, per_shader[5].shader_res), }; -static const size_t vmw_binding_so_offsets[] = { +static const size_t vmw_binding_so_target_offsets[] = { offsetof(struct vmw_ctx_binding_state , so_targets), };static const size_t vmw_binding_vb_offsets[] = {
@@ -236,10 +236,10 @@ static const struct vmw_binding_info vmw_binding_infos[] = { .size = sizeof(struct vmw_ctx_bindinfo_view), .offsets = vmw_binding_dx_ds_offsets, .scrub_func = vmw_binding_scrub_dx_rt}, - [vmw_ctx_binding_so] = { - .size = sizeof(struct vmw_ctx_bindinfo_so), - .offsets = vmw_binding_so_offsets, - .scrub_func = vmw_binding_scrub_so}, + [vmw_ctx_binding_so_target] = { + .size = sizeof(struct vmw_ctx_bindinfo_so_target), + .offsets = vmw_binding_so_target_offsets, + .scrub_func = vmw_binding_scrub_so_target}, [vmw_ctx_binding_vb] = { .size = sizeof(struct vmw_ctx_bindinfo_vb), .offsets = vmw_binding_vb_offsets,
@@ -874,8 +874,8 @@ static void vmw_collect_so_targets(struct vmw_ctx_binding_state *cbs, const struct vmw_ctx_bindinfo *bi, u32 max_num) { -const struct vmw_ctx_bindinfo_so *biso = - container_of(bi, struct vmw_ctx_bindinfo_so, bi); +const struct vmw_ctx_bindinfo_so_target *biso = + container_of(bi, struct vmw_ctx_bindinfo_so_target, bi);unsigned long i;SVGA3dSoTarget *so_buffer = (SVGA3dSoTarget *) cbs->bind_cmd_buffer;
@@ -900,11 +900,11 @@ static void vmw_collect_so_targets(struct vmw_ctx_binding_state *cbs, }/** -* vmw_binding_emit_set_so - Issue delayed streamout binding commands +* vmw_emit_set_so_target - Issue delayed streamout binding commands * * @cbs: Pointer to the context's struct vmw_ctx_binding_state */ -static int vmw_emit_set_so (struct vmw_ctx_binding_state *cbs) +static int vmw_emit_set_so_target (struct vmw_ctx_binding_state *cbs) {const struct vmw_ctx_bindinfo *loc = &cbs->so_targets[0 ].bi;struct {
@@ -1136,8 +1136,8 @@ static int vmw_binding_emit_dirty(struct vmw_ctx_binding_state *cbs)case VMW_BINDING_PS_BIT : ret =vmw_binding_emit_dirty_ps (cbs);break ; -case VMW_BINDING_SO_BIT : - ret =vmw_emit_set_so (cbs); +case VMW_BINDING_SO_T_BIT : + ret =vmw_emit_set_so_target (cbs);break ;case VMW_BINDING_VB_BIT : ret =vmw_emit_set_vb (cbs);
@@ -1201,18 +1201,18 @@ static int vmw_binding_scrub_dx_rt(struct vmw_ctx_bindinfo *bi, bool rebind) }/** -* vmw_binding_scrub_so - Schedule a dx streamoutput buffer binding +* vmw_binding_scrub_so_target - Schedule a dx streamoutput buffer binding * scrub from a context * * @bi: single binding information. * @rebind: Whether to issue a bind instead of scrub command. */ -static int vmw_binding_scrub_so (struct vmw_ctx_bindinfo *bi,bool rebind) +static int vmw_binding_scrub_so_target (struct vmw_ctx_bindinfo *bi,bool rebind) {struct vmw_ctx_binding_state *cbs =vmw_context_binding_state (bi->ctx); -__set_bit (VMW_BINDING_SO_BIT , &cbs->dirty); +__set_bit (VMW_BINDING_SO_T_BIT , &cbs->dirty);return 0 ; }
@@ -1387,7 +1387,7 @@ u32 vmw_binding_dirtying(enum vmw_ctx_binding_type binding_type) [vmw_ctx_binding_rt] = VMW_RES_DIRTY_SET, [vmw_ctx_binding_dx_rt] = VMW_RES_DIRTY_SET, [vmw_ctx_binding_ds] = VMW_RES_DIRTY_SET, - [vmw_ctx_binding_so] = VMW_RES_DIRTY_SET, + [vmw_ctx_binding_so_target] = VMW_RES_DIRTY_SET, [vmw_ctx_binding_uav] = VMW_RES_DIRTY_SET, [vmw_ctx_binding_cs_uav] = VMW_RES_DIRTY_SET, };
drivers/gpu/drm/vmwgfx/vmwgfx_binding.h +3 -3
@@ -50,7 +50,7 @@ enum vmw_ctx_binding_type { vmw_ctx_binding_dx_rt, vmw_ctx_binding_sr, vmw_ctx_binding_ds, - vmw_ctx_binding_so, + vmw_ctx_binding_so_target, vmw_ctx_binding_vb, vmw_ctx_binding_ib, vmw_ctx_binding_uav,
@@ -132,14 +132,14 @@ struct vmw_ctx_bindinfo_view { };/** -* struct vmw_ctx_bindinfo_so - StreamOutput binding metadata +* struct vmw_ctx_bindinfo_so_target - StreamOutput binding metadata * * @bi: struct vmw_ctx_bindinfo we derive from. * @offset: Device data used to reconstruct binding command. * @size: Device data used to reconstruct binding command. * @slot: Device data used to reconstruct binding command. */ -struct vmw_ctx_bindinfo_so { +struct vmw_ctx_bindinfo_so_target {struct vmw_ctx_bindinfo bi;uint32 offset;uint32 size;
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +2 -2
@@ -2479,7 +2479,7 @@ static int vmw_cmd_dx_set_so_targets(struct vmw_private *dev_priv, SVGA3dCmdHeader *header) {struct vmw_ctx_validation_info *ctx_node =VMW_GET_CTX_NODE (sw_context); -struct vmw_ctx_bindinfo_so binding; +struct vmw_ctx_bindinfo_so_target binding;struct vmw_resource *res;struct {SVGA3dCmdHeader header;
@@ -2509,7 +2509,7 @@ static int vmw_cmd_dx_set_so_targets(struct vmw_private *dev_priv, binding.bi.ctx = ctx_node->ctx; binding.bi.res = res; - binding.bi.bt = vmw_ctx_binding_so, + binding.bi.bt = vmw_ctx_binding_so_target, binding.offset = cmd->targets[i].offset; binding.size = cmd->targets[i].sizeInBytes; binding.slot = i;
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 5/17 drm/vmwgfx: Sync virtual device headers for new feature
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
Get the latest device headers for SM5 and other features development.
v2: sync to newer bits (merge later commits)
v3: sync to even newer bits
--- .../drm/vmwgfx/device_include/svga3d_cmd.h | 149 +++- .../vmwgfx/device_include/svga3d_devcaps.h | 792 +++++++++--------- .../gpu/drm/vmwgfx/device_include/svga3d_dx.h | 466 ++++++++++- .../drm/vmwgfx/device_include/svga3d_limits.h | 36 +- .../device_include/svga3d_surfacedefs.h | 58 +- .../drm/vmwgfx/device_include/svga3d_types.h | 347 +++++++- .../gpu/drm/vmwgfx/device_include/svga_reg.h | 382 ++++++--- .../drm/vmwgfx/device_include/svga_types.h | 1 + 8 files changed, 1646 insertions(+), 585 deletions(-)
drivers/gpu/drm/vmwgfx/device_include/svga3d_cmd.h +120 -29
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR MIT */ /********************************************************** -* Copyright 1998-2015 VMware, Inc. +* Copyright 1998-2020 VMware, Inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation
@@ -261,30 +261,23 @@ typedef enum {SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET =1220 ,SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET =1221 ,SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET =1222 , - -/* -* Reserve some IDs to be used for the SM5 shader types. -*/ -SVGA_3D_CMD_DX_RESERVED1 =1223 , -SVGA_3D_CMD_DX_RESERVED2 =1224 , -SVGA_3D_CMD_DX_RESERVED3 =1225 , +SVGA_3D_CMD_DX_SET_HS_CONSTANT_BUFFER_OFFSET =1223 , +SVGA_3D_CMD_DX_SET_DS_CONSTANT_BUFFER_OFFSET =1224 , +SVGA_3D_CMD_DX_SET_CS_CONSTANT_BUFFER_OFFSET =1225 ,SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER =1226 ,SVGA_3D_CMD_DX_MAX =1227 ,SVGA_3D_CMD_SCREEN_COPY =1227 , -/* -* Reserve some IDs to be used for video. -*/ -SVGA_3D_CMD_VIDEO_RESERVED1 =1228 , -SVGA_3D_CMD_VIDEO_RESERVED2 =1229 , -SVGA_3D_CMD_VIDEO_RESERVED3 =1230 , -SVGA_3D_CMD_VIDEO_RESERVED4 =1231 , -SVGA_3D_CMD_VIDEO_RESERVED5 =1232 , -SVGA_3D_CMD_VIDEO_RESERVED6 =1233 , -SVGA_3D_CMD_VIDEO_RESERVED7 =1234 , -SVGA_3D_CMD_VIDEO_RESERVED8 =1235 , +SVGA_3D_CMD_RESERVED1 =1228 , +SVGA_3D_CMD_RESERVED2 =1229 , +SVGA_3D_CMD_RESERVED3 =1230 , +SVGA_3D_CMD_RESERVED4 =1231 , +SVGA_3D_CMD_RESERVED5 =1232 , +SVGA_3D_CMD_RESERVED6 =1233 , +SVGA_3D_CMD_RESERVED7 =1234 , +SVGA_3D_CMD_RESERVED8 =1235 ,SVGA_3D_CMD_GROW_OTABLE =1236 , SVGA_3D_CMD_DX_GROW_COTABLE = 1237,
@@ -298,7 +291,46 @@ typedef enum {SVGA_3D_CMD_DX_PRED_CONVERT =1243 ,SVGA_3D_CMD_WHOLE_SURFACE_COPY =1244 , -SVGA_3D_CMD_MAX =1245 , +SVGA_3D_CMD_DX_DEFINE_UA_VIEW =1245 , +SVGA_3D_CMD_DX_DESTROY_UA_VIEW =1246 , +SVGA_3D_CMD_DX_CLEAR_UA_VIEW_UINT =1247 , +SVGA_3D_CMD_DX_CLEAR_UA_VIEW_FLOAT =1248 , +SVGA_3D_CMD_DX_COPY_STRUCTURE_COUNT =1249 , +SVGA_3D_CMD_DX_SET_UA_VIEWS =1250 , + +SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT =1251 , +SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT =1252 , +SVGA_3D_CMD_DX_DISPATCH =1253 , +SVGA_3D_CMD_DX_DISPATCH_INDIRECT =1254 , + +SVGA_3D_CMD_WRITE_ZERO_SURFACE =1255 , +SVGA_3D_CMD_HINT_ZERO_SURFACE =1256 , +SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER =1257 , +SVGA_3D_CMD_DX_SET_STRUCTURE_COUNT =1258 , + +SVGA_3D_CMD_LOGICOPS_BITBLT =1259 , +SVGA_3D_CMD_LOGICOPS_TRANSBLT =1260 , +SVGA_3D_CMD_LOGICOPS_STRETCHBLT =1261 , +SVGA_3D_CMD_LOGICOPS_COLORFILL =1262 , +SVGA_3D_CMD_LOGICOPS_ALPHABLEND =1263 , +SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND =1264 , + +SVGA_3D_CMD_RESERVED2_1 =1265 , + +SVGA_3D_CMD_RESERVED2_2 =1266 , +SVGA_3D_CMD_DEFINE_GB_SURFACE_V4 =1267 , +SVGA_3D_CMD_DX_SET_CS_UA_VIEWS =1268 , +SVGA_3D_CMD_DX_SET_MIN_LOD =1269 , +SVGA_3D_CMD_RESERVED2_3 =1270 , +SVGA_3D_CMD_RESERVED2_4 =1271 , +SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2 =1272 , +SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB =1273 , +SVGA_3D_CMD_DX_SET_SHADER_IFACE =1274 , +SVGA_3D_CMD_DX_BIND_STREAMOUTPUT =1275 , +SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS =1276 , +SVGA_3D_CMD_DX_BIND_SHADER_IFACE =1277 , + +SVGA_3D_CMD_MAX =1278 , SVGA_3D_CMD_FUTURE_MAX = 3000 } SVGAFifo3dCmdId;
@@ -334,6 +366,7 @@ struct {uint32 sid;SVGA3dSurface1Flags surfaceFlags;SVGA3dSurfaceFormat format; +/* * If surfaceFlags has SVGA3D_SURFACE_CUBEMAP bit set, all SVGA3dSurfaceFace * structures must have the same value of numMipLevels field.
@@ -341,6 +374,7 @@ struct {* numMipLevels set to 0. */ SVGA3dSurfaceFace face[SVGA3D_MAX_SURFACE_FACES ]; +/* * Followed by an SVGA3dSize structure for each mip level in each face. *
@@ -360,6 +394,7 @@ struct {uint32 sid;SVGA3dSurface1Flags surfaceFlags;SVGA3dSurfaceFormat format; +/* * If surfaceFlags has SVGA3D_SURFACE_CUBEMAP bit set, all SVGA3dSurfaceFace * structures must have the same value of numMipLevels field.
@@ -369,6 +404,7 @@ struct {SVGA3dSurfaceFace face[SVGA3D_MAX_SURFACE_FACES ];uint32 multisampleCount;SVGA3dTextureFilter autogenFilter; +/* * Followed by an SVGA3dSize structure for each mip level in each face. *
@@ -512,6 +548,18 @@ struct {#include "vmware_pack_end.h" SVGA3dCmdWholeSurfaceCopy;/* SVGA_3D_CMD_WHOLE_SURFACE_COPY */ +typedef +#include "vmware_pack_begin.h" +struct { +SVGA3dSurfaceImageId src; +SVGA3dSurfaceImageId dest; +SVGA3dBox boxSrc; +SVGA3dBox boxDest; +} +#include "vmware_pack_end.h" +SVGA3dCmdSurfaceStretchBltNonMSToMS; +/* SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS */ + typedef#include "vmware_pack_begin.h" struct {
@@ -555,6 +603,7 @@ struct {SVGAGuestImage guest;SVGA3dSurfaceImageId host;SVGA3dTransferType transfer; +/* * Followed by variable number of SVGA3dCopyBox structures. For consistency * in all clipping logic and coordinate translation, we define the
@@ -789,7 +838,7 @@ struct {uint32 indexBufferSid;/* Valid index buffer sid. */ uint32 indexBufferOffset;/* Byte offset into the vertex buffer, almost */ -/* always 0 for DX9 guests, non-zero for OpenGL */ +/* always 0 for pre SM guests, non-zero for OpenGL */ /* guests. We can't represent non-multiple of */ /* stride offsets in D3D9Renderer... */ uint8 indexBufferStride;/* Allowable values = 1, 2, or 4 */
@@ -1228,6 +1277,7 @@ struct SVGA3dCmdLogicOpsBitBlt {SVGA3dSurfaceImageId src;SVGA3dSurfaceImageId dst;SVGA3dLogicOp logicOp; +SVGA3dLogicOpRop3 logicOpRop3;/* Followed by variable number of SVGA3dCopyBox structures */ }#include "vmware_pack_end.h"
@@ -1247,7 +1297,8 @@ struct SVGA3dCmdLogicOpsTransBlt {uint32 color;uint32 flags;SVGA3dBox srcBox; -SVGA3dBox dstBox; +SVGA3dSignedBox dstBox; +SVGA3dBox clipBox; }#include "vmware_pack_end.h" SVGA3dCmdLogicOpsTransBlt;/* SVGA_3D_CMD_LOGICOPS_TRANSBLT */
@@ -1266,7 +1317,8 @@ struct SVGA3dCmdLogicOpsStretchBlt {uint16 mode;uint16 flags;SVGA3dBox srcBox; -SVGA3dBox dstBox; +SVGA3dSignedBox dstBox; +SVGA3dBox clipBox; }#include "vmware_pack_end.h" SVGA3dCmdLogicOpsStretchBlt;/* SVGA_3D_CMD_LOGICOPS_STRETCHBLT */
@@ -1283,6 +1335,7 @@ struct SVGA3dCmdLogicOpsColorFill {SVGA3dSurfaceImageId dst;uint32 color;SVGA3dLogicOp logicOp; +SVGA3dLogicOpRop3 logicOpRop3;/* Followed by variable number of SVGA3dRect structures. */ }#include "vmware_pack_end.h"
@@ -1302,7 +1355,8 @@ struct SVGA3dCmdLogicOpsAlphaBlend {uint32 alphaVal;uint32 flags;SVGA3dBox srcBox; -SVGA3dBox dstBox; +SVGA3dSignedBox dstBox; +SVGA3dBox clipBox; }#include "vmware_pack_end.h" SVGA3dCmdLogicOpsAlphaBlend;/* SVGA_3D_CMD_LOGICOPS_ALPHABLEND */
@@ -1365,8 +1419,9 @@ struct {SVGA3dSurface2Flags surface2Flags;uint8 multisamplePattern;uint8 qualityLevel; -uint8 pad0[2 ]; -uint32 pad1[3 ]; +uint16 bufferByteStride; +float minLOD; +uint32 pad0[2 ]; }#include "vmware_pack_end.h" SVGAOTableSurfaceEntry;
@@ -1543,7 +1598,7 @@ typedef#include "vmware_pack_begin.h" struct {SVGAOTableType type; -PPN baseAddress; +PPN32 baseAddress;uint32 sizeInBytes;uint32 validSizeInBytes;SVGAMobFormat ptDepth;
@@ -1599,7 +1654,7 @@ typedefstruct SVGA3dCmdDefineGBMob {SVGAMobId mobid;SVGAMobFormat ptDepth; -PPN base; +PPN32 base;uint32 sizeInBytes; }#include "vmware_pack_end.h"
@@ -1618,7 +1673,6 @@ struct SVGA3dCmdDestroyGBMob {#include "vmware_pack_end.h" SVGA3dCmdDestroyGBMob;/* SVGA_3D_CMD_DESTROY_GB_MOB */ -/* * Define a memory object (Mob) in the OTable with a PPN64 base. */
@@ -1718,6 +1772,27 @@ struct SVGA3dCmdDefineGBSurface_v3 {#include "vmware_pack_end.h" SVGA3dCmdDefineGBSurface_v3;/* SVGA_3D_CMD_DEFINE_GB_SURFACE_V3 */ +/* +* Defines a guest-backed surface, adding buffer byte stride. +*/ +typedef +#include "vmware_pack_begin.h" +struct SVGA3dCmdDefineGBSurface_v4 { +uint32 sid; +SVGA3dSurfaceAllFlags surfaceFlags; +SVGA3dSurfaceFormat format; +uint32 numMipLevels; +uint32 multisampleCount; +SVGA3dMSPattern multisamplePattern; +SVGA3dMSQualityLevel qualityLevel; +SVGA3dTextureFilter autogenFilter; +SVGA3dSize size; +uint32 arraySize; +uint32 bufferByteStride; +} +#include "vmware_pack_end.h" +SVGA3dCmdDefineGBSurface_v4;/* SVGA_3D_CMD_DEFINE_GB_SURFACE_V4 */ +/* * Destroy a guest-backed surface. */
@@ -2181,4 +2256,20 @@ SVGA3dCmdScreenCopy; /* SVGA_3D_CMD_SCREEN_COPY */#define SVGA_SCREEN_COPY_STATUS_SUCCESS 0x01#define SVGA_SCREEN_COPY_STATUS_INVALID 0xFFFFFFFF +typedef +#include "vmware_pack_begin.h" +struct { +uint32 sid; +} +#include "vmware_pack_end.h" +SVGA3dCmdWriteZeroSurface;/* SVGA_3D_CMD_WRITE_ZERO_SURFACE */ + +typedef +#include "vmware_pack_begin.h" +struct { +uint32 sid; +} +#include "vmware_pack_end.h" +SVGA3dCmdHintZeroSurface;/* SVGA_3D_CMD_HINT_ZERO_SURFACE */ +#endif /* _SVGA3D_CMD_H_ */
drivers/gpu/drm/vmwgfx/device_include/svga3d_devcaps.h +408 -384
816 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/device_include/svga3d_dx.h +449 -17
629 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/device_include/svga3d_limits.h +32 -4
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR MIT */ /********************************************************** -* Copyright 2007-2015 VMware, Inc. +* Copyright 2007-2019 VMware, Inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation
@@ -40,11 +40,25 @@#include "includeCheck.h" #define SVGA3D_NUM_CLIPPLANES 6 +#define SVGA3D_MAX_CONTEXT_IDS 256 +#define SVGA3D_MAX_SURFACE_IDS (32 * 1024) + +/* +* While there are separate bind-points for RenderTargetViews and +* UnorderedAccessViews in a DXContext, there is in fact one shared +* semantic space that the guest-driver can use on any given draw call. +* So there are really only 8 slots that can be spilt up between them, with the +* spliceIndex controlling where the UAV's sit in the collapsed array. +*/ #define SVGA3D_MAX_RENDER_TARGETS 8#define SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS (SVGA3D_MAX_RENDER_TARGETS)#define SVGA3D_MAX_UAVIEWS 8 -#define SVGA3D_MAX_CONTEXT_IDS 256 -#define SVGA3D_MAX_SURFACE_IDS (32 * 1024) +#define SVGA3D_DX11_1_MAX_UAVIEWS 64 + +/* +* Maximum canonical size of a surface in host-backed mode (pre-GBObjects). +*/ +#define SVGA3D_HB_MAX_SURFACE_SIZE MBYTES_2_BYTES(128)/* * Maximum ID a shader can be assigned on a given context.
@@ -59,6 +73,8 @@#define SVGA3D_NUM_TEXTURE_UNITS 32#define SVGA3D_NUM_LIGHTS 8 +#define SVGA3D_MAX_VIDEOPROCESSOR_SAMPLERS 32 +/* * Maximum size in dwords of shader text the SVGA device will allow. * Currently 8 MB.
@@ -67,6 +83,11 @@#define SVGA3D_MAX_SHADER_MEMORY (SVGA3D_MAX_SHADER_MEMORY_BYTES / \ sizeof(uint32)) +/* +* The maximum value of threadGroupCount in each dimension +*/ +#define SVGA3D_MAX_SHADER_THREAD_GROUPS 65535 +#define SVGA3D_MAX_CLIP_PLANES 6/*
@@ -85,7 +106,9 @@/* * Maximum number of array indexes in a GB surface (with DX enabled). */ -#define SVGA3D_MAX_SURFACE_ARRAYSIZE 512 +#define SVGA3D_SM4_MAX_SURFACE_ARRAYSIZE 512 +#define SVGA3D_SM5_MAX_SURFACE_ARRAYSIZE 2048 +#define SVGA3D_MAX_SURFACE_ARRAYSIZE SVGA3D_SM5_MAX_SURFACE_ARRAYSIZE/* * The maximum number of vertex arrays we're guaranteed to support in
@@ -99,4 +122,9 @@*/ #define SVGA3D_MAX_DRAW_PRIMITIVE_RANGES 32 +/* +* The maximum number of samples that can be contained in a surface. +*/ +#define SVGA3D_MAX_SAMPLES 8 +#endif /* _SVGA3D_LIMITS_H_ */
drivers/gpu/drm/vmwgfx/device_include/svga3d_surfacedefs.h +56 -2
88 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/device_include/svga3d_types.h +301 -46
470 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/device_include/svga_reg.h +279 -103
497 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/device_include/svga_types.h +1 -0
@@ -37,6 +37,7 @@ typedef s8 int8;typedef uint64 PA ;typedef uint32 PPN ; +typedef uint32 PPN32 ;typedef uint64 PPN64 ;typedef bool Bool ;
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 17/17 drm/vmwgfx: Use vmwgfx version 2.18 to signal SM5 compatibility
In reply to Roland Scheidegger (VMware)From: Thomas Hellström (VMware) <[email protected]>
___
v2: Use 2.18 instead of 2.17
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +1 -1
@@ -58,7 +58,7 @@#define VMWGFX_DRIVER_NAME "vmwgfx"#define VMWGFX_DRIVER_DATE "20200114"#define VMWGFX_DRIVER_MAJOR 2 -#define VMWGFX_DRIVER_MINOR 17 +#define VMWGFX_DRIVER_MINOR 18#define VMWGFX_DRIVER_PATCHLEVEL 0#define VMWGFX_FIFO_STATIC_SIZE (1024*1024)#define VMWGFX_MAX_RELOCATIONS 2048
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 6/17 drm/vmwgfx: Add a new enum for SM5 graphics context capability
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
A new enum to represent new SM5 graphics context capability in vmwgfx.
v2: use new correct cap bits (merged several later commits into it).
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 11 +++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 13 +++++++++++++ 2 files changed, 24 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +11 -0
@@ -290,6 +290,8 @@ static void vmw_print_capabilities2(uint32_t capabilities2)DRM_INFO (" Grow oTable.\n" );if (capabilities2 &SVGA_CAP2_INTRA_SURFACE_COPY )DRM_INFO (" IntraSurface copy.\n" ); +if (capabilities2 &SVGA_CAP2_DX3 ) +DRM_INFO (" DX3.\n" ); }static void vmw_print_capabilities (uint32_t capabilities)
@@ -900,6 +902,13 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)if (vmw_read (dev_priv,SVGA_REG_DEV_CAP )) dev_priv->sm_type =VMW_SM_4_1 ; + +if (has_sm4_1_context (dev_priv) && + (dev_priv->capabilities2 &SVGA_CAP2_DX3 )) { +vmw_write (dev_priv,SVGA_REG_DEV_CAP ,SVGA3D_DEVCAP_SM5 ); +if (vmw_read (dev_priv,SVGA_REG_DEV_CAP )) + dev_priv->sm_type =VMW_SM_5 ; + } } ret =vmw_kms_init (dev_priv);
@@ -913,6 +922,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)DRM_INFO ("Atomic: %s\n" , (dev->driver->driver_features &DRIVER_ATOMIC ) ?"yes." :"no." ); +if (dev_priv->sm_type ==VMW_SM_5 ) +DRM_INFO ("SM5 support available.\n" );if (dev_priv->sm_type ==VMW_SM_4_1 )DRM_INFO ("SM4_1 support available.\n" );if (dev_priv->sm_type ==VMW_SM_4 )
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +13 -0
@@ -446,12 +446,14 @@ enum {* @VMW_SM_LEGACY: Pre DX context. * @VMW_SM_4: Context support upto SM4. * @VMW_SM_4_1: Context support upto SM4_1. +* @VMW_SM_5: Context support up to SM5. * @VMW_SM_MAX: Should be the last. */ enum vmw_sm_type {VMW_SM_LEGACY =0 ,VMW_SM_4 ,VMW_SM_4_1 , +VMW_SM_5 ,VMW_SM_MAX };
@@ -684,6 +686,17 @@ static inline bool has_sm4_1_context(const struct vmw_private *dev_priv)return (dev_priv->sm_type >=VMW_SM_4_1 ); } +/** +* has_sm5_context - Does the device support SM5 context. +* @dev_priv: Device private. +* +* Return: Bool value if device support SM5 context or not. +*/ +static inline bool has_sm5_context (const struct vmw_private *dev_priv) +{ +return (dev_priv->sm_type >=VMW_SM_5 ); +} +extern void vmw_svga_enable (struct vmw_private *dev_priv);extern void vmw_svga_disable (struct vmw_private *dev_priv);
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 16/17 drm/vmwgfx: Add SM5 param for userspace
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
Add a new param for user-space to determine if kernel module is SM5 capable.
--- drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 3 +++ include/uapi/drm/vmwgfx_drm.h | 4 ++++ 2 files changed, 7 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +3 -0
@@ -119,6 +119,9 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data,case DRM_VMW_PARAM_SM4_1 : param->value =has_sm4_1_context (dev_priv);break ; +case DRM_VMW_PARAM_SM5 : + param->value =has_sm5_context (dev_priv); +break ;default :return -EINVAL ; }
include/uapi/drm/vmwgfx_drm.h +4 -0
@@ -86,6 +86,9 @@ extern "C" {* * DRM_VMW_PARAM_SM4_1 * SM4_1 support is enabled. +* +* DRM_VMW_PARAM_SM5 +* SM5 support is enabled. */ #define DRM_VMW_PARAM_NUM_STREAMS 0
@@ -103,6 +106,7 @@ extern "C" {#define DRM_VMW_PARAM_DX 12#define DRM_VMW_PARAM_HW_CAPS2 13#define DRM_VMW_PARAM_SM4_1 14 +#define DRM_VMW_PARAM_SM5 15/** * enum drm_vmw_handle_type - handle type for ref ioctls
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 2/17 drm/vmwgfx: Sync legacy multisampling device capability
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
In favor of SM4.1 multisampling capability, virtual device deprecated old multisampling device capability. Mark legacy multisampling device capability as dead. Rename the function that masks legacy multisample capability to reflect that now it is masking a deprecated feature.
--- .../gpu/drm/vmwgfx/device_include/svga3d_devcaps.h | 13 +++++++++---- drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 11 +++++++---- 2 files changed, 16 insertions(+), 8 deletions(-)
drivers/gpu/drm/vmwgfx/device_include/svga3d_devcaps.h +9 -4
@@ -163,10 +163,15 @@ typedef enum {SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16 =67 ,SVGA3D_DEVCAP_SURFACEFMT_UYVY =68 ,SVGA3D_DEVCAP_SURFACEFMT_YUY2 =69 , -SVGA3D_DEVCAP_MULTISAMPLE_NONMASKABLESAMPLES =70 , -SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES =71 , -SVGA3D_DEVCAP_ALPHATOCOVERAGE =72 , -SVGA3D_DEVCAP_SUPERSAMPLE =73 , + +/* +* Deprecated. +*/ +SVGA3D_DEVCAP_DEAD4 =70 , +SVGA3D_DEVCAP_DEAD5 =71 , +SVGA3D_DEVCAP_DEAD7 =72 , +SVGA3D_DEVCAP_DEAD6 =73 , +SVGA3D_DEVCAP_AUTOGENMIPMAPS =74 ,SVGA3D_DEVCAP_SURFACEFMT_NV12 =75 , SVGA3D_DEVCAP_SURFACEFMT_AYUV = 76,
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +7 -4
@@ -126,14 +126,17 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data,return 0 ; } -static u32 vmw_mask_multisample (unsigned int cap,u32 fmt_value) +static u32 vmw_mask_legacy_multisample (unsigned int cap,u32 fmt_value) {/* * A version of user-space exists which use MULTISAMPLE_MASKABLESAMPLES * to check the sample count supported by virtual device. Since there * never was support for multisample count for backing MOB return 0. +* +* MULTISAMPLE_MASKABLESAMPLES devcap is marked as deprecated by virtual +* device. */ -if (cap ==SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES ) +if (cap ==SVGA3D_DEVCAP_DEAD5 )return 0 ;return fmt_value;
@@ -164,7 +167,7 @@ static int vmw_fill_compat_cap(struct vmw_private *dev_priv, void *bounce,for (i =0 ; i < max_size; ++i) {vmw_write (dev_priv,SVGA_REG_DEV_CAP , i); compat_cap->pairs[i][0 ] = i; - compat_cap->pairs[i][1 ] =vmw_mask_multisample + compat_cap->pairs[i][1 ] =vmw_mask_legacy_multisample (i,vmw_read (dev_priv,SVGA_REG_DEV_CAP )); }spin_unlock (&dev_priv->cap_lock);
@@ -220,7 +223,7 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data,spin_lock (&dev_priv->cap_lock);for (i =0 ; i < num; ++i) {vmw_write (dev_priv,SVGA_REG_DEV_CAP , i); - *bounce32++ =vmw_mask_multisample + *bounce32++ =vmw_mask_legacy_multisample (i,vmw_read (dev_priv,SVGA_REG_DEV_CAP )); }spin_unlock (&dev_priv->cap_lock);
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 13/17 drm/vmwgfx: Split surface metadata from struct vmw_surface
In reply to Roland Scheidegger (VMware)From: Deepak Rawat <[email protected]>
Create a new structure vmw_surface_metadata representing the metadata used for creating surface. With this can make the surface_define_priv a bit cleaner.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 56 ++++-- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 16 +- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 44 +++-- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 240 +++++++++++++----------- 4 files changed, 202 insertions(+), 154 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +44 -12
@@ -225,24 +225,56 @@ struct vmw_cursor_snooper {struct vmw_framebuffer ;struct vmw_surface_offset ; -struct vmw_surface { -struct vmw_resource res; -SVGA3dSurfaceAllFlags flags; -uint32_t format; -uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES ]; +/** +* struct vmw_surface_metadata - Metadata describing a surface. +* +* @flags: Device flags. +* @format: Surface SVGA3D_x format. +* @mip_levels: Mip level for each face. For GB first index is used only. +* @multisample_count: Sample count. +* @multisample_pattern: Sample patterns. +* @quality_level: Quality level. +* @autogen_filter: Filter for automatically generated mipmaps. +* @array_size: Number of array elements for a 1D/2D texture. For cubemap +texture number of faces * array_size. This should be 0 for pre +SM4 device. +* @num_sizes: Size of @sizes. For GB surface this should always be 1. +* @base_size: Surface dimension. +* @sizes: Array representing mip sizes. Legacy only. +* @scanout: Whether this surface will be used for scanout. +* +* This tracks metadata for both legacy and guest backed surface. +*/ +struct vmw_surface_metadata { +u64 flags; +u32 format; +u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES ]; +u32 multisample_count; +u32 multisample_pattern; +u32 quality_level; +u32 autogen_filter; +u32 array_size; +u32 num_sizes;struct drm_vmw_size base_size;struct drm_vmw_size *sizes; -uint32_t num_sizes;bool scanout; -uint32_t array_size; -/* TODO so far just a extra pointer */ +}; + +/** +* struct vmw_surface: Resource structure for a surface. +* +* @res: The base resource for this surface. +* @metadata: Metadata for this surface resource. +* @snooper: Cursor data. Legacy surface only. +* @offsets: Legacy surface only. +* @view_list: List of views bound to this surface. +*/ +struct vmw_surface { +struct vmw_resource res; +struct vmw_surface_metadata metadata;struct vmw_cursor_snooper snooper;struct vmw_surface_offset *offsets; -SVGA3dTextureFilter autogen_filter; -uint32_t multisample_count;struct list_head view_list; -SVGA3dMSPattern multisample_pattern; -SVGA3dMSQualityLevel quality_level; };struct vmw_marker_queue {
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +8 -8
@@ -905,14 +905,14 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,*/ /* Surface must be marked as a scanout. */ -if (unlikely (!surface->scanout)) +if (unlikely (!surface->metadata.scanout))return -EINVAL ; -if (unlikely (surface->mip_levels[0 ] !=1 || - surface->num_sizes !=1 || - surface->base_size.width < mode_cmd->width || - surface->base_size.height < mode_cmd->height || - surface->base_size.depth !=1 )) { +if (unlikely (surface->metadata.mip_levels[0 ] !=1 || + surface->metadata.num_sizes !=1 || + surface->metadata.base_size.width < mode_cmd->width || + surface->metadata.base_size.height < mode_cmd->height || + surface->metadata.base_size.depth !=1 )) {DRM_ERROR ("Incompatible surface dimensions " "for requested mode.\n" );return -EINVAL ;
@@ -941,7 +941,7 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,* For DX, surface format validation is done when surface->scanout * is set. */ -if (!has_sm4_context (dev_priv) && format != surface->format) { +if (!has_sm4_context (dev_priv) && format != surface->metadata.format) {DRM_ERROR ("Invalid surface format for requested mode.\n" );return -EINVAL ; }
@@ -2516,7 +2516,7 @@ int vmw_kms_update_proxy(struct vmw_resource *res, int increment) {struct vmw_private *dev_priv = res->dev_priv; -struct drm_vmw_size *size = &vmw_res_to_srf (res)->base_size; +struct drm_vmw_size *size = &vmw_res_to_srf (res)->metadata.base_size;struct {SVGA3dCmdHeader header;SVGA3dCmdUpdateGBImage body;
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +24 -20
98 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +126 -114
452 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel