diff options
Diffstat (limited to 'src/gallium/winsys/svga')
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_screen_svga.c | 1 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_surface.c | 61 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_surface.h | 6 |
4 files changed, 69 insertions, 0 deletions
diff --git a/src/gallium/winsys/svga/drm/vmw_screen.c b/src/gallium/winsys/svga/drm/vmw_screen.c index 2f70212de61..917c7ef2f25 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen.c +++ b/src/gallium/winsys/svga/drm/vmw_screen.c @@ -98,6 +98,7 @@ vmw_winsys_create( int fd ) vws->base.have_gb_dma = !vws->force_coherent; vws->base.need_to_rebind_resources = FALSE; vws->base.have_transfer_from_buffer_cmd = vws->base.have_vgpu10; + vws->base.have_constant_buffer_offset_cmd = FALSE; getenv_val = getenv("SVGA_FORCE_KERNEL_UNMAPS"); vws->cache_maps = !getenv_val || strcmp(getenv_val, "0") == 0; vws->fence_ops = vmw_fence_ops_create(vws); diff --git a/src/gallium/winsys/svga/drm/vmw_screen_svga.c b/src/gallium/winsys/svga/drm/vmw_screen_svga.c index fb0bee77822..38ef3bcb9fe 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen_svga.c +++ b/src/gallium/winsys/svga/drm/vmw_screen_svga.c @@ -495,6 +495,7 @@ vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws) vws->base.buffer_map = vmw_svga_winsys_buffer_map; vws->base.buffer_unmap = vmw_svga_winsys_buffer_unmap; vws->base.buffer_destroy = vmw_svga_winsys_buffer_destroy; + vws->base.surface_init = vmw_svga_winsys_surface_init; vws->base.fence_reference = vmw_svga_winsys_fence_reference; vws->base.fence_signalled = vmw_svga_winsys_fence_signalled; vws->base.shader_create = vmw_svga_winsys_shader_create; diff --git a/src/gallium/winsys/svga/drm/vmw_surface.c b/src/gallium/winsys/svga/drm/vmw_surface.c index 698cd11a28e..f6f40fcdf20 100644 --- a/src/gallium/winsys/svga/drm/vmw_surface.c +++ b/src/gallium/winsys/svga/drm/vmw_surface.c @@ -34,7 +34,68 @@ #include "vmw_context.h" #include "pipebuffer/pb_bufmgr.h" +void +vmw_svga_winsys_surface_init(struct svga_winsys_screen *sws, + struct svga_winsys_surface *srf, + unsigned surf_size, SVGA3dSurfaceAllFlags flags) +{ + struct vmw_svga_winsys_surface *vsrf = vmw_svga_winsys_surface(srf); + void *data = NULL; + struct pb_buffer *pb_buf; + uint32_t pb_flags; + struct vmw_winsys_screen *vws = vsrf->screen; + pb_flags = PIPE_TRANSFER_READ_WRITE | PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE; + + struct pb_manager *provider; + struct pb_desc desc; + + data = vmw_svga_winsys_buffer_map(&vws->base, vsrf->buf, + PIPE_TRANSFER_DONTBLOCK | pb_flags); + if (data) + goto out_unlock; + + provider = vws->pools.mob_fenced; + memset(&desc, 0, sizeof(desc)); + desc.alignment = 4096; + pb_buf = provider->create_buffer(provider, vsrf->size, &desc); + if (pb_buf != NULL) { + struct svga_winsys_buffer *vbuf = + vmw_svga_winsys_buffer_wrap(pb_buf); + + data = vmw_svga_winsys_buffer_map(&vws->base, vbuf, pb_flags); + if (data) { + if (vsrf->buf) { + vmw_svga_winsys_buffer_destroy(&vws->base, vsrf->buf); + vsrf->buf = vbuf; + goto out_unlock; + } else + vmw_svga_winsys_buffer_destroy(&vws->base, vbuf); + } + } + + data = vmw_svga_winsys_buffer_map(&vws->base, vsrf->buf, pb_flags); + if (data == NULL) + goto out_unlock; + +out_unlock: + mtx_unlock(&vsrf->mutex); + + if (data) + { + if (flags & SVGA3D_SURFACE_BIND_STREAM_OUTPUT) { + memset(data, 0, surf_size + sizeof(SVGA3dDXSOState)); + } + else { + memset(data, 0, surf_size); + } + } + mtx_lock(&vsrf->mutex); + vmw_svga_winsys_buffer_unmap(&vsrf->screen->base, vsrf->buf); + mtx_unlock(&vsrf->mutex); +} + + void * vmw_svga_winsys_surface_map(struct svga_winsys_context *swc, struct svga_winsys_surface *srf, diff --git a/src/gallium/winsys/svga/drm/vmw_surface.h b/src/gallium/winsys/svga/drm/vmw_surface.h index ab75fed5f97..4b1011aa3c7 100644 --- a/src/gallium/winsys/svga/drm/vmw_surface.h +++ b/src/gallium/winsys/svga/drm/vmw_surface.h @@ -95,4 +95,10 @@ void vmw_svga_winsys_surface_unmap(struct svga_winsys_context *swc, struct svga_winsys_surface *srf, boolean *rebind); + +void +vmw_svga_winsys_surface_init(struct svga_winsys_screen *sws, + struct svga_winsys_surface *surface, + unsigned surf_size, SVGA3dSurfaceAllFlags flags); + #endif /* VMW_SURFACE_H_ */ |