Skip to content

Commit 4dec280

Browse files
deepak-rawatRoland Scheidegger
authored andcommitted
drm/vmwgfx: Add a new enum for SM5 graphics context capability
A new enum to represent new SM5 graphics context capability in vmwgfx. v2: use new correct cap bits (merged several later commits into it). Signed-off-by: Deepak Rawat <[email protected]> Signed-off-by: Thomas Hellström (VMware) <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Signed-off-by: Roland Scheidegger <[email protected]>
1 parent 0651dfa commit 4dec280

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_drv.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ static void vmw_print_capabilities2(uint32_t capabilities2)
290290
DRM_INFO(" Grow oTable.\n");
291291
if (capabilities2 & SVGA_CAP2_INTRA_SURFACE_COPY)
292292
DRM_INFO(" IntraSurface copy.\n");
293+
if (capabilities2 & SVGA_CAP2_DX3)
294+
DRM_INFO(" DX3.\n");
293295
}
294296

295297
static void vmw_print_capabilities(uint32_t capabilities)
@@ -900,6 +902,13 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
900902

901903
if (vmw_read(dev_priv, SVGA_REG_DEV_CAP))
902904
dev_priv->sm_type = VMW_SM_4_1;
905+
906+
if (has_sm4_1_context(dev_priv) &&
907+
(dev_priv->capabilities2 & SVGA_CAP2_DX3)) {
908+
vmw_write(dev_priv, SVGA_REG_DEV_CAP, SVGA3D_DEVCAP_SM5);
909+
if (vmw_read(dev_priv, SVGA_REG_DEV_CAP))
910+
dev_priv->sm_type = VMW_SM_5;
911+
}
903912
}
904913

905914
ret = vmw_kms_init(dev_priv);
@@ -913,6 +922,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
913922

914923
DRM_INFO("Atomic: %s\n", (dev->driver->driver_features & DRIVER_ATOMIC)
915924
? "yes." : "no.");
925+
if (dev_priv->sm_type == VMW_SM_5)
926+
DRM_INFO("SM5 support available.\n");
916927
if (dev_priv->sm_type == VMW_SM_4_1)
917928
DRM_INFO("SM4_1 support available.\n");
918929
if (dev_priv->sm_type == VMW_SM_4)

drivers/gpu/drm/vmwgfx/vmwgfx_drv.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,14 @@ enum {
446446
* @VMW_SM_LEGACY: Pre DX context.
447447
* @VMW_SM_4: Context support upto SM4.
448448
* @VMW_SM_4_1: Context support upto SM4_1.
449+
* @VMW_SM_5: Context support up to SM5.
449450
* @VMW_SM_MAX: Should be the last.
450451
*/
451452
enum vmw_sm_type {
452453
VMW_SM_LEGACY = 0,
453454
VMW_SM_4,
454455
VMW_SM_4_1,
456+
VMW_SM_5,
455457
VMW_SM_MAX
456458
};
457459

@@ -684,6 +686,17 @@ static inline bool has_sm4_1_context(const struct vmw_private *dev_priv)
684686
return (dev_priv->sm_type >= VMW_SM_4_1);
685687
}
686688

689+
/**
690+
* has_sm5_context - Does the device support SM5 context.
691+
* @dev_priv: Device private.
692+
*
693+
* Return: Bool value if device support SM5 context or not.
694+
*/
695+
static inline bool has_sm5_context(const struct vmw_private *dev_priv)
696+
{
697+
return (dev_priv->sm_type >= VMW_SM_5);
698+
}
699+
687700
extern void vmw_svga_enable(struct vmw_private *dev_priv);
688701
extern void vmw_svga_disable(struct vmw_private *dev_priv);
689702

0 commit comments

Comments
 (0)