summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2021-07-22 10:50:50 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2021-07-22 10:50:50 +0000
commit9130ec005fbc78a62420643414d8354d0929ca50 (patch)
tree6762777acdd2d4eee17ef87290e80dc7afe2b73d /lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c
parentca11beabae33eb59fb981b8adf50b1d47a2a98f0 (diff)
Merge Mesa 21.1.5
Diffstat (limited to 'lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c')
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c51
1 files changed, 16 insertions, 35 deletions
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c
index 6ab43cb99..da7506e77 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c
@@ -65,6 +65,7 @@
#define VMW_MAX_SURF_MEM_FACTOR 2
+
struct vmw_buffer_relocation
{
struct pb_buffer *buffer;
@@ -95,7 +96,7 @@ struct vmw_svga_winsys_context
struct svga_winsys_context base;
struct vmw_winsys_screen *vws;
- struct util_hash_table *hash;
+ struct hash_table *hash;
#ifdef DEBUG
boolean must_flush;
@@ -260,7 +261,7 @@ vmw_swc_flush(struct svga_winsys_context *swc,
vmw_svga_winsys_surface_reference(&isurf->vsurf, NULL);
}
- util_hash_table_clear(vswc->hash);
+ _mesa_hash_table_clear(vswc->hash, NULL);
vswc->surface.used = 0;
vswc->surface.reserved = 0;
@@ -504,12 +505,8 @@ vmw_swc_surface_only_relocation(struct svga_winsys_context *swc,
isrf = &vswc->surface.items[vswc->surface.used + vswc->surface.staged];
vmw_svga_winsys_surface_reference(&isrf->vsurf, vsurf);
isrf->referenced = FALSE;
- /*
- * Note that a failure here may just fall back to unhashed behavior
- * and potentially cause unnecessary flushing, so ignore the
- * return code.
- */
- (void) util_hash_table_set(vswc->hash, vsurf, isrf);
+
+ _mesa_hash_table_insert(vswc->hash, vsurf, isrf);
++vswc->surface.staged;
vswc->seen_surfaces += vsurf->size;
@@ -600,12 +597,8 @@ vmw_swc_shader_relocation(struct svga_winsys_context *swc,
ishader = &vswc->shader.items[vswc->shader.used + vswc->shader.staged];
vmw_svga_winsys_shader_reference(&ishader->vshader, vshader);
ishader->referenced = FALSE;
- /*
- * Note that a failure here may just fall back to unhashed behavior
- * and potentially cause unnecessary flushing, so ignore the
- * return code.
- */
- (void) util_hash_table_set(vswc->hash, vshader, ishader);
+
+ _mesa_hash_table_insert(vswc->hash, vshader, ishader);
++vswc->shader.staged;
}
@@ -682,7 +675,7 @@ vmw_swc_destroy(struct svga_winsys_context *swc)
vmw_svga_winsys_shader_reference(&ishader->vshader, NULL);
}
- util_hash_table_destroy(vswc->hash);
+ _mesa_hash_table_destroy(vswc->hash, NULL);
pb_validate_destroy(vswc->validate);
vmw_ioctl_context_destroy(vswc->vws, swc->cid);
#ifdef DEBUG
@@ -691,17 +684,6 @@ vmw_swc_destroy(struct svga_winsys_context *swc)
FREE(vswc);
}
-static unsigned vmw_hash_ptr(void *p)
-{
- return (unsigned)(unsigned long)p;
-}
-
-static int vmw_ptr_compare(void *key1, void *key2)
-{
- return (key1 == key2) ? 0 : 1;
-}
-
-
/**
* vmw_svga_winsys_vgpu10_shader_screate - The winsys shader_crate callback
*
@@ -720,20 +702,19 @@ vmw_svga_winsys_vgpu10_shader_create(struct svga_winsys_context *swc,
uint32 shaderId,
SVGA3dShaderType shaderType,
const uint32 *bytecode,
- uint32 bytecodeLen)
+ uint32 bytecodeLen,
+ const SVGA3dDXShaderSignatureHeader *sgnInfo,
+ uint32 sgnLen)
{
struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
struct vmw_svga_winsys_shader *shader;
- struct svga_winsys_gb_shader *gb_shader =
- vmw_svga_winsys_shader_create(&vswc->vws->base, shaderType, bytecode,
- bytecodeLen);
- if (!gb_shader)
+ shader = vmw_svga_shader_create(&vswc->vws->base, shaderType, bytecode,
+ bytecodeLen, sgnInfo, sgnLen);
+ if (!shader)
return NULL;
- shader = vmw_svga_winsys_shader(gb_shader);
shader->shid = shaderId;
-
- return gb_shader;
+ return svga_winsys_shader(shader);
}
/**
@@ -844,7 +825,7 @@ vmw_svga_winsys_context_create(struct svga_winsys_screen *sws)
if(!vswc->validate)
goto out_no_validate;
- vswc->hash = util_hash_table_create(vmw_hash_ptr, vmw_ptr_compare);
+ vswc->hash = util_hash_table_create_ptr_keys();
if (!vswc->hash)
goto out_no_hash;