dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: rscheidegger.oss@gmail.com
To: dri-devel@lists.freedesktop.org
Cc: linux-graphics-maintainer@vmware.com
Subject: [PATCH 10/17] drm/vmwgfx: Add support for indirect and dispatch commands
Date: Thu, 19 Mar 2020 21:24:07 +0100	[thread overview]
Message-ID: <20200319202414.9296-11-sroland@vmware.com> (raw)
In-Reply-To: <20200319202414.9296-1-sroland@vmware.com>

From: Deepak Rawat <drawat.floss@gmail.com>

Validate indirect and dispatch commands in command buffer.

Signed-off-by: Deepak Rawat <drawat.floss@gmail.com>
Reviewed-by: Thomas Hellström (VMware) <thomas_os@shipmail.org>
Signed-off-by: Roland Scheidegger (VMware) <rscheidegger.oss@gmail.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 70 +++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index ed56d9918c6a..ecab6cbbc8d3 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -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)
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-03-19 20:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19 20:23 [PATCH 00/17] drm/vmwgfx add support for GL4 rscheidegger.oss
2020-03-19 20:23 ` [PATCH 01/17] drm/vmwgfx: Also check for SVGA_CAP_DX before reading DX context support rscheidegger.oss
2020-03-19 20:23 ` [PATCH 02/17] drm/vmwgfx: Sync legacy multisampling device capability rscheidegger.oss
2020-03-19 20:24 ` [PATCH 03/17] drm/vmwgfx: Deprecate logic ops commands rscheidegger.oss
2020-03-19 20:24 ` [PATCH 04/17] drm/vmwgfx: Use enum to represent graphics context capabilities rscheidegger.oss
2020-03-19 20:24 ` [PATCH 05/17] drm/vmwgfx: Sync virtual device headers for new feature rscheidegger.oss
2020-03-19 20:24 ` [PATCH 06/17] drm/vmwgfx: Add a new enum for SM5 graphics context capability rscheidegger.oss
2020-03-19 20:24 ` [PATCH 07/17] drm/vmwgfx: Read new register for GB memory when available rscheidegger.oss
2020-03-19 20:24 ` [PATCH 08/17] drm/vmwgfx: Support SM5 shader type in command buffer rscheidegger.oss
2020-03-19 20:24 ` [PATCH 09/17] drm/vmwgfx: Add support for UA view commands rscheidegger.oss
2020-03-19 20:24 ` rscheidegger.oss [this message]
2020-03-19 20:24 ` [PATCH 11/17] drm/vmwgfx: Rename stream output target binding tracker struct rscheidegger.oss
2020-03-19 20:24 ` [PATCH 12/17] drm/vmwgfx: Add support for streamoutput with mob commands rscheidegger.oss
2020-03-19 20:24 ` [PATCH 13/17] drm/vmwgfx: Split surface metadata from struct vmw_surface rscheidegger.oss
2020-03-19 20:24 ` [PATCH 14/17] drm/vmwgfx: Refactor surface_define to use vmw_surface_metadata rscheidegger.oss
2020-03-19 20:24 ` [PATCH 15/17] drm/vmwgfx: Add surface define v4 command rscheidegger.oss
2020-03-23 12:02   ` Emil Velikov
2020-03-23 17:02     ` Roland Scheidegger
2020-03-19 20:24 ` [PATCH 16/17] drm/vmwgfx: Add SM5 param for userspace rscheidegger.oss
2020-03-19 20:24 ` [PATCH 17/17] drm/vmwgfx: Use vmwgfx version 2.18 to signal SM5 compatibility rscheidegger.oss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200319202414.9296-11-sroland@vmware.com \
    --to=rscheidegger.oss@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-graphics-maintainer@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox