vmwgfx_so.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. // SPDX-License-Identifier: GPL-2.0 OR MIT
  2. /**************************************************************************
  3. * Copyright 2014-2015 VMware, Inc., Palo Alto, CA., USA
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a
  6. * copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sub license, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject to
  11. * the following conditions:
  12. *
  13. * The above copyright notice and this permission notice (including the
  14. * next paragraph) shall be included in all copies or substantial portions
  15. * of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  20. * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
  21. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  22. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  23. * USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. *
  25. **************************************************************************/
  26. #include "vmwgfx_drv.h"
  27. #include "vmwgfx_resource_priv.h"
  28. #include "vmwgfx_so.h"
  29. #include "vmwgfx_binding.h"
  30. /*
  31. * The currently only reason we need to keep track of views is that if we
  32. * destroy a hardware surface, all views pointing to it must also be destroyed,
  33. * otherwise the device will error.
  34. * So in particular if a surface is evicted, we must destroy all views pointing
  35. * to it, and all context bindings of that view. Similarly we must restore
  36. * the view bindings, views and surfaces pointed to by the views when a
  37. * context is referenced in the command stream.
  38. */
  39. /**
  40. * struct vmw_view - view metadata
  41. *
  42. * @rcu: RCU callback head
  43. * @res: The struct vmw_resource we derive from
  44. * @ctx: Non-refcounted pointer to the context this view belongs to.
  45. * @srf: Refcounted pointer to the surface pointed to by this view.
  46. * @cotable: Refcounted pointer to the cotable holding this view.
  47. * @srf_head: List head for the surface-to-view list.
  48. * @cotable_head: List head for the cotable-to_view list.
  49. * @view_type: View type.
  50. * @view_id: User-space per context view id. Currently used also as per
  51. * context device view id.
  52. * @cmd_size: Size of the SVGA3D define view command that we've copied from the
  53. * command stream.
  54. * @committed: Whether the view is actually created or pending creation at the
  55. * device level.
  56. * @cmd: The SVGA3D define view command copied from the command stream.
  57. */
  58. struct vmw_view {
  59. struct rcu_head rcu;
  60. struct vmw_resource res;
  61. struct vmw_resource *ctx; /* Immutable */
  62. struct vmw_resource *srf; /* Immutable */
  63. struct vmw_resource *cotable; /* Immutable */
  64. struct list_head srf_head; /* Protected by binding_mutex */
  65. struct list_head cotable_head; /* Protected by binding_mutex */
  66. unsigned view_type; /* Immutable */
  67. unsigned view_id; /* Immutable */
  68. u32 cmd_size; /* Immutable */
  69. bool committed; /* Protected by binding_mutex */
  70. u32 cmd[1]; /* Immutable */
  71. };
  72. static int vmw_view_create(struct vmw_resource *res);
  73. static int vmw_view_destroy(struct vmw_resource *res);
  74. static void vmw_hw_view_destroy(struct vmw_resource *res);
  75. static void vmw_view_commit_notify(struct vmw_resource *res,
  76. enum vmw_cmdbuf_res_state state);
  77. static const struct vmw_res_func vmw_view_func = {
  78. .res_type = vmw_res_view,
  79. .needs_backup = false,
  80. .may_evict = false,
  81. .type_name = "DX view",
  82. .backup_placement = NULL,
  83. .create = vmw_view_create,
  84. .commit_notify = vmw_view_commit_notify,
  85. };
  86. /**
  87. * struct vmw_view_define - view define command body stub
  88. *
  89. * @view_id: The device id of the view being defined
  90. * @sid: The surface id of the view being defined
  91. *
  92. * This generic struct is used by the code to change @view_id and @sid of a
  93. * saved view define command.
  94. */
  95. struct vmw_view_define {
  96. uint32 view_id;
  97. uint32 sid;
  98. };
  99. /**
  100. * vmw_view - Convert a struct vmw_resource to a struct vmw_view
  101. *
  102. * @res: Pointer to the resource to convert.
  103. *
  104. * Returns a pointer to a struct vmw_view.
  105. */
  106. static struct vmw_view *vmw_view(struct vmw_resource *res)
  107. {
  108. return container_of(res, struct vmw_view, res);
  109. }
  110. /**
  111. * vmw_view_commit_notify - Notify that a view operation has been committed to
  112. * hardware from a user-supplied command stream.
  113. *
  114. * @res: Pointer to the view resource.
  115. * @state: Indicating whether a creation or removal has been committed.
  116. *
  117. */
  118. static void vmw_view_commit_notify(struct vmw_resource *res,
  119. enum vmw_cmdbuf_res_state state)
  120. {
  121. struct vmw_view *view = vmw_view(res);
  122. struct vmw_private *dev_priv = res->dev_priv;
  123. mutex_lock(&dev_priv->binding_mutex);
  124. if (state == VMW_CMDBUF_RES_ADD) {
  125. struct vmw_surface *srf = vmw_res_to_srf(view->srf);
  126. list_add_tail(&view->srf_head, &srf->view_list);
  127. vmw_cotable_add_resource(view->cotable, &view->cotable_head);
  128. view->committed = true;
  129. res->id = view->view_id;
  130. } else {
  131. list_del_init(&view->cotable_head);
  132. list_del_init(&view->srf_head);
  133. view->committed = false;
  134. res->id = -1;
  135. }
  136. mutex_unlock(&dev_priv->binding_mutex);
  137. }
  138. /**
  139. * vmw_view_create - Create a hardware view.
  140. *
  141. * @res: Pointer to the view resource.
  142. *
  143. * Create a hardware view. Typically used if that view has previously been
  144. * destroyed by an eviction operation.
  145. */
  146. static int vmw_view_create(struct vmw_resource *res)
  147. {
  148. struct vmw_view *view = vmw_view(res);
  149. struct vmw_surface *srf = vmw_res_to_srf(view->srf);
  150. struct vmw_private *dev_priv = res->dev_priv;
  151. struct {
  152. SVGA3dCmdHeader header;
  153. struct vmw_view_define body;
  154. } *cmd;
  155. mutex_lock(&dev_priv->binding_mutex);
  156. if (!view->committed) {
  157. mutex_unlock(&dev_priv->binding_mutex);
  158. return 0;
  159. }
  160. cmd = VMW_CMD_CTX_RESERVE(res->dev_priv, view->cmd_size, view->ctx->id);
  161. if (!cmd) {
  162. mutex_unlock(&dev_priv->binding_mutex);
  163. return -ENOMEM;
  164. }
  165. memcpy(cmd, &view->cmd, view->cmd_size);
  166. WARN_ON(cmd->body.view_id != view->view_id);
  167. /* Sid may have changed due to surface eviction. */
  168. WARN_ON(view->srf->id == SVGA3D_INVALID_ID);
  169. cmd->body.sid = view->srf->id;
  170. vmw_cmd_commit(res->dev_priv, view->cmd_size);
  171. res->id = view->view_id;
  172. list_add_tail(&view->srf_head, &srf->view_list);
  173. vmw_cotable_add_resource(view->cotable, &view->cotable_head);
  174. mutex_unlock(&dev_priv->binding_mutex);
  175. return 0;
  176. }
  177. /**
  178. * vmw_view_destroy - Destroy a hardware view.
  179. *
  180. * @res: Pointer to the view resource.
  181. *
  182. * Destroy a hardware view. Typically used on unexpected termination of the
  183. * owning process or if the surface the view is pointing to is destroyed.
  184. */
  185. static int vmw_view_destroy(struct vmw_resource *res)
  186. {
  187. struct vmw_private *dev_priv = res->dev_priv;
  188. struct vmw_view *view = vmw_view(res);
  189. struct {
  190. SVGA3dCmdHeader header;
  191. union vmw_view_destroy body;
  192. } *cmd;
  193. lockdep_assert_held_once(&dev_priv->binding_mutex);
  194. vmw_binding_res_list_scrub(&res->binding_head);
  195. if (!view->committed || res->id == -1)
  196. return 0;
  197. cmd = VMW_CMD_CTX_RESERVE(dev_priv, sizeof(*cmd), view->ctx->id);
  198. if (!cmd)
  199. return -ENOMEM;
  200. cmd->header.id = vmw_view_destroy_cmds[view->view_type];
  201. cmd->header.size = sizeof(cmd->body);
  202. cmd->body.view_id = view->view_id;
  203. vmw_cmd_commit(dev_priv, sizeof(*cmd));
  204. res->id = -1;
  205. list_del_init(&view->cotable_head);
  206. list_del_init(&view->srf_head);
  207. return 0;
  208. }
  209. /**
  210. * vmw_hw_view_destroy - Destroy a hardware view as part of resource cleanup.
  211. *
  212. * @res: Pointer to the view resource.
  213. *
  214. * Destroy a hardware view if it's still present.
  215. */
  216. static void vmw_hw_view_destroy(struct vmw_resource *res)
  217. {
  218. struct vmw_private *dev_priv = res->dev_priv;
  219. mutex_lock(&dev_priv->binding_mutex);
  220. WARN_ON(vmw_view_destroy(res));
  221. res->id = -1;
  222. mutex_unlock(&dev_priv->binding_mutex);
  223. }
  224. /**
  225. * vmw_view_key - Compute a view key suitable for the cmdbuf resource manager
  226. *
  227. * @user_key: The user-space id used for the view.
  228. * @view_type: The view type.
  229. *
  230. * Destroy a hardware view if it's still present.
  231. */
  232. static u32 vmw_view_key(u32 user_key, enum vmw_view_type view_type)
  233. {
  234. return user_key | (view_type << 20);
  235. }
  236. /**
  237. * vmw_view_id_ok - Basic view id and type range checks.
  238. *
  239. * @user_key: The user-space id used for the view.
  240. * @view_type: The view type.
  241. *
  242. * Checks that the view id and type (typically provided by user-space) is
  243. * valid.
  244. */
  245. static bool vmw_view_id_ok(u32 user_key, enum vmw_view_type view_type)
  246. {
  247. return (user_key < SVGA_COTABLE_MAX_IDS &&
  248. view_type < vmw_view_max);
  249. }
  250. /**
  251. * vmw_view_res_free - resource res_free callback for view resources
  252. *
  253. * @res: Pointer to a struct vmw_resource
  254. *
  255. * Frees memory held by the struct vmw_view.
  256. */
  257. static void vmw_view_res_free(struct vmw_resource *res)
  258. {
  259. struct vmw_view *view = vmw_view(res);
  260. vmw_resource_unreference(&view->cotable);
  261. vmw_resource_unreference(&view->srf);
  262. kfree_rcu(view, rcu);
  263. }
  264. /**
  265. * vmw_view_add - Create a view resource and stage it for addition
  266. * as a command buffer managed resource.
  267. *
  268. * @man: Pointer to the compat shader manager identifying the shader namespace.
  269. * @ctx: Pointer to a struct vmw_resource identifying the active context.
  270. * @srf: Pointer to a struct vmw_resource identifying the surface the view
  271. * points to.
  272. * @view_type: The view type deduced from the view create command.
  273. * @user_key: The key that is used to identify the shader. The key is
  274. * unique to the view type and to the context.
  275. * @cmd: Pointer to the view create command in the command stream.
  276. * @cmd_size: Size of the view create command in the command stream.
  277. * @list: Caller's list of staged command buffer resource actions.
  278. */
  279. int vmw_view_add(struct vmw_cmdbuf_res_manager *man,
  280. struct vmw_resource *ctx,
  281. struct vmw_resource *srf,
  282. enum vmw_view_type view_type,
  283. u32 user_key,
  284. const void *cmd,
  285. size_t cmd_size,
  286. struct list_head *list)
  287. {
  288. static const size_t vmw_view_define_sizes[] = {
  289. [vmw_view_sr] = sizeof(SVGA3dCmdDXDefineShaderResourceView),
  290. [vmw_view_rt] = sizeof(SVGA3dCmdDXDefineRenderTargetView),
  291. [vmw_view_ds] = sizeof(SVGA3dCmdDXDefineDepthStencilView),
  292. [vmw_view_ua] = sizeof(SVGA3dCmdDXDefineUAView)
  293. };
  294. struct vmw_private *dev_priv = ctx->dev_priv;
  295. struct vmw_resource *res;
  296. struct vmw_view *view;
  297. size_t size;
  298. int ret;
  299. if (cmd_size != vmw_view_define_sizes[view_type] +
  300. sizeof(SVGA3dCmdHeader)) {
  301. VMW_DEBUG_USER("Illegal view create command size.\n");
  302. return -EINVAL;
  303. }
  304. if (!vmw_view_id_ok(user_key, view_type)) {
  305. VMW_DEBUG_USER("Illegal view add view id.\n");
  306. return -EINVAL;
  307. }
  308. size = offsetof(struct vmw_view, cmd) + cmd_size;
  309. view = kmalloc(size, GFP_KERNEL);
  310. if (!view) {
  311. return -ENOMEM;
  312. }
  313. res = &view->res;
  314. view->ctx = ctx;
  315. view->srf = vmw_resource_reference(srf);
  316. view->cotable = vmw_resource_reference
  317. (vmw_context_cotable(ctx, vmw_view_cotables[view_type]));
  318. view->view_type = view_type;
  319. view->view_id = user_key;
  320. view->cmd_size = cmd_size;
  321. view->committed = false;
  322. INIT_LIST_HEAD(&view->srf_head);
  323. INIT_LIST_HEAD(&view->cotable_head);
  324. memcpy(&view->cmd, cmd, cmd_size);
  325. ret = vmw_resource_init(dev_priv, res, true,
  326. vmw_view_res_free, &vmw_view_func);
  327. if (ret)
  328. goto out_resource_init;
  329. ret = vmw_cmdbuf_res_add(man, vmw_cmdbuf_res_view,
  330. vmw_view_key(user_key, view_type),
  331. res, list);
  332. if (ret)
  333. goto out_resource_init;
  334. res->id = view->view_id;
  335. res->hw_destroy = vmw_hw_view_destroy;
  336. out_resource_init:
  337. vmw_resource_unreference(&res);
  338. return ret;
  339. }
  340. /**
  341. * vmw_view_remove - Stage a view for removal.
  342. *
  343. * @man: Pointer to the view manager identifying the shader namespace.
  344. * @user_key: The key that is used to identify the view. The key is
  345. * unique to the view type.
  346. * @view_type: View type
  347. * @list: Caller's list of staged command buffer resource actions.
  348. * @res_p: If the resource is in an already committed state, points to the
  349. * struct vmw_resource on successful return. The pointer will be
  350. * non ref-counted.
  351. */
  352. int vmw_view_remove(struct vmw_cmdbuf_res_manager *man,
  353. u32 user_key, enum vmw_view_type view_type,
  354. struct list_head *list,
  355. struct vmw_resource **res_p)
  356. {
  357. if (!vmw_view_id_ok(user_key, view_type)) {
  358. VMW_DEBUG_USER("Illegal view remove view id.\n");
  359. return -EINVAL;
  360. }
  361. return vmw_cmdbuf_res_remove(man, vmw_cmdbuf_res_view,
  362. vmw_view_key(user_key, view_type),
  363. list, res_p);
  364. }
  365. /**
  366. * vmw_view_cotable_list_destroy - Evict all views belonging to a cotable.
  367. *
  368. * @dev_priv: Pointer to a device private struct.
  369. * @list: List of views belonging to a cotable.
  370. * @readback: Unused. Needed for function interface only.
  371. *
  372. * This function evicts all views belonging to a cotable.
  373. * It must be called with the binding_mutex held, and the caller must hold
  374. * a reference to the view resource. This is typically called before the
  375. * cotable is paged out.
  376. */
  377. void vmw_view_cotable_list_destroy(struct vmw_private *dev_priv,
  378. struct list_head *list,
  379. bool readback)
  380. {
  381. struct vmw_view *entry, *next;
  382. lockdep_assert_held_once(&dev_priv->binding_mutex);
  383. list_for_each_entry_safe(entry, next, list, cotable_head)
  384. WARN_ON(vmw_view_destroy(&entry->res));
  385. }
  386. /**
  387. * vmw_view_surface_list_destroy - Evict all views pointing to a surface
  388. *
  389. * @dev_priv: Pointer to a device private struct.
  390. * @list: List of views pointing to a surface.
  391. *
  392. * This function evicts all views pointing to a surface. This is typically
  393. * called before the surface is evicted.
  394. */
  395. void vmw_view_surface_list_destroy(struct vmw_private *dev_priv,
  396. struct list_head *list)
  397. {
  398. struct vmw_view *entry, *next;
  399. lockdep_assert_held_once(&dev_priv->binding_mutex);
  400. list_for_each_entry_safe(entry, next, list, srf_head)
  401. WARN_ON(vmw_view_destroy(&entry->res));
  402. }
  403. /**
  404. * vmw_view_srf - Return a non-refcounted pointer to the surface a view is
  405. * pointing to.
  406. *
  407. * @res: pointer to a view resource.
  408. *
  409. * Note that the view itself is holding a reference, so as long
  410. * the view resource is alive, the surface resource will be.
  411. */
  412. struct vmw_resource *vmw_view_srf(struct vmw_resource *res)
  413. {
  414. return vmw_view(res)->srf;
  415. }
  416. /**
  417. * vmw_view_lookup - Look up a view.
  418. *
  419. * @man: The context's cmdbuf ref manager.
  420. * @view_type: The view type.
  421. * @user_key: The view user id.
  422. *
  423. * returns a refcounted pointer to a view or an error pointer if not found.
  424. */
  425. struct vmw_resource *vmw_view_lookup(struct vmw_cmdbuf_res_manager *man,
  426. enum vmw_view_type view_type,
  427. u32 user_key)
  428. {
  429. return vmw_cmdbuf_res_lookup(man, vmw_cmdbuf_res_view,
  430. vmw_view_key(user_key, view_type));
  431. }
  432. /**
  433. * vmw_view_dirtying - Return whether a view type is dirtying its resource
  434. * @res: Pointer to the view
  435. *
  436. * Each time a resource is put on the validation list as the result of a
  437. * view pointing to it, we need to determine whether that resource will
  438. * be dirtied (written to by the GPU) as a result of the corresponding
  439. * GPU operation. Currently only rendertarget-, depth-stencil and unordered
  440. * access views are capable of dirtying its resource.
  441. *
  442. * Return: Whether the view type of @res dirties the resource it points to.
  443. */
  444. u32 vmw_view_dirtying(struct vmw_resource *res)
  445. {
  446. static u32 view_is_dirtying[vmw_view_max] = {
  447. [vmw_view_rt] = VMW_RES_DIRTY_SET,
  448. [vmw_view_ds] = VMW_RES_DIRTY_SET,
  449. [vmw_view_ua] = VMW_RES_DIRTY_SET,
  450. };
  451. /* Update this function as we add more view types */
  452. BUILD_BUG_ON(vmw_view_max != 4);
  453. return view_is_dirtying[vmw_view(res)->view_type];
  454. }
  455. const u32 vmw_view_destroy_cmds[] = {
  456. [vmw_view_sr] = SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW,
  457. [vmw_view_rt] = SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW,
  458. [vmw_view_ds] = SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW,
  459. [vmw_view_ua] = SVGA_3D_CMD_DX_DESTROY_UA_VIEW,
  460. };
  461. const SVGACOTableType vmw_view_cotables[] = {
  462. [vmw_view_sr] = SVGA_COTABLE_SRVIEW,
  463. [vmw_view_rt] = SVGA_COTABLE_RTVIEW,
  464. [vmw_view_ds] = SVGA_COTABLE_DSVIEW,
  465. [vmw_view_ua] = SVGA_COTABLE_UAVIEW,
  466. };
  467. const SVGACOTableType vmw_so_cotables[] = {
  468. [vmw_so_el] = SVGA_COTABLE_ELEMENTLAYOUT,
  469. [vmw_so_bs] = SVGA_COTABLE_BLENDSTATE,
  470. [vmw_so_ds] = SVGA_COTABLE_DEPTHSTENCIL,
  471. [vmw_so_rs] = SVGA_COTABLE_RASTERIZERSTATE,
  472. [vmw_so_ss] = SVGA_COTABLE_SAMPLER,
  473. [vmw_so_so] = SVGA_COTABLE_STREAMOUTPUT,
  474. [vmw_so_max]= SVGA_COTABLE_MAX
  475. };
  476. /* To remove unused function warning */
  477. static void vmw_so_build_asserts(void) __attribute__((used));
  478. /*
  479. * This function is unused at run-time, and only used to dump various build
  480. * asserts important for code optimization assumptions.
  481. */
  482. static void vmw_so_build_asserts(void)
  483. {
  484. /* Assert that our vmw_view_cmd_to_type() function is correct. */
  485. BUILD_BUG_ON(SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW !=
  486. SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW + 1);
  487. BUILD_BUG_ON(SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW !=
  488. SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW + 2);
  489. BUILD_BUG_ON(SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW !=
  490. SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW + 3);
  491. BUILD_BUG_ON(SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW !=
  492. SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW + 4);
  493. BUILD_BUG_ON(SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW !=
  494. SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW + 5);
  495. /* Assert that our "one body fits all" assumption is valid */
  496. BUILD_BUG_ON(sizeof(union vmw_view_destroy) != sizeof(u32));
  497. /* Assert that the view key space can hold all view ids. */
  498. BUILD_BUG_ON(SVGA_COTABLE_MAX_IDS >= ((1 << 20) - 1));
  499. /*
  500. * Assert that the offset of sid in all view define commands
  501. * is what we assume it to be.
  502. */
  503. BUILD_BUG_ON(offsetof(struct vmw_view_define, sid) !=
  504. offsetof(SVGA3dCmdDXDefineShaderResourceView, sid));
  505. BUILD_BUG_ON(offsetof(struct vmw_view_define, sid) !=
  506. offsetof(SVGA3dCmdDXDefineRenderTargetView, sid));
  507. BUILD_BUG_ON(offsetof(struct vmw_view_define, sid) !=
  508. offsetof(SVGA3dCmdDXDefineDepthStencilView, sid));
  509. BUILD_BUG_ON(offsetof(struct vmw_view_define, sid) !=
  510. offsetof(SVGA3dCmdDXDefineUAView, sid));
  511. BUILD_BUG_ON(offsetof(struct vmw_view_define, sid) !=
  512. offsetof(SVGA3dCmdDXDefineDepthStencilView_v2, sid));
  513. }