summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/winsys/svga
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2016-12-11 08:40:05 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2016-12-11 08:40:05 +0000
commit21ab4c9f31674b113c24177398ed39f29b7cd8e6 (patch)
tree8be392d7a792d9663c2586396be77bfd506f5164 /lib/mesa/src/gallium/winsys/svga
parenta8f0a7916e26e550dd2a26e7188835c481978004 (diff)
Import Mesa 13.0.2
Diffstat (limited to 'lib/mesa/src/gallium/winsys/svga')
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/SConscript10
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c5
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_buffer.c4
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c8
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c10
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_dri.c13
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c11
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c33
8 files changed, 82 insertions, 12 deletions
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/SConscript b/lib/mesa/src/gallium/winsys/svga/drm/SConscript
index 25850531d..2cb11e610 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/SConscript
+++ b/lib/mesa/src/gallium/winsys/svga/drm/SConscript
@@ -4,12 +4,10 @@ env = env.Clone()
env.PkgUseModules('DRM')
-if env['gcc'] or env['clang'] or env['icc']:
- env.Append(CCFLAGS = ['-fvisibility=hidden'])
- env.Append(CPPDEFINES = [
- 'HAVE_STDINT_H',
- '-D_FILE_OFFSET_BITS=64',
- ])
+env.Append(CPPDEFINES = [
+ 'HAVE_STDINT_H',
+ '-D_FILE_OFFSET_BITS=64',
+])
env.Prepend(CPPPATH = [
'#/src/gallium/drivers/svga',
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c b/lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
index c1b9eb95c..d049d1dbc 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
@@ -40,6 +40,7 @@
#include <unistd.h>
#include <sched.h>
#endif
+#include <inttypes.h>
#include "pipe/p_compiler.h"
#include "pipe/p_defines.h"
@@ -172,7 +173,7 @@ fenced_manager_dump_locked(struct fenced_manager *fenced_mgr)
while(curr != &fenced_mgr->unfenced) {
fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
assert(!fenced_buf->fence);
- debug_printf("%10p %7u %8u %7s\n",
+ debug_printf("%10p %"PRIu64" %8u %7s\n",
(void *) fenced_buf,
fenced_buf->base.size,
p_atomic_read(&fenced_buf->base.reference.count),
@@ -188,7 +189,7 @@ fenced_manager_dump_locked(struct fenced_manager *fenced_mgr)
fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
assert(fenced_buf->buffer);
signaled = ops->fence_signalled(ops, fenced_buf->fence, 0);
- debug_printf("%10p %7u %8u %7s %10p %s\n",
+ debug_printf("%10p %"PRIu64" %8u %7s %10p %s\n",
(void *) fenced_buf,
fenced_buf->base.size,
p_atomic_read(&fenced_buf->base.reference.count),
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_buffer.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_buffer.c
index c082dcc34..3ac80c7ca 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_buffer.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_buffer.c
@@ -154,7 +154,7 @@ vmw_gmr_buffer_unmap(struct pb_buffer *_buf)
static void
vmw_gmr_buffer_get_base_buffer(struct pb_buffer *buf,
struct pb_buffer **base_buf,
- unsigned *offset)
+ pb_size *offset)
{
*base_buf = buf;
*offset = 0;
@@ -266,7 +266,7 @@ vmw_gmr_bufmgr_region_ptr(struct pb_buffer *buf,
struct SVGAGuestPtr *ptr)
{
struct pb_buffer *base_buf;
- unsigned offset = 0;
+ pb_size offset = 0;
struct vmw_gmr_buffer *gmr_buf;
pb_get_base_buffer( buf, &base_buf, &offset );
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 dae121e40..8d23bff5d 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c
@@ -315,6 +315,13 @@ vmw_swc_reserve(struct svga_winsys_context *swc,
return vswc->command.buffer + vswc->command.used;
}
+static unsigned
+vmw_swc_get_command_buffer_size(struct svga_winsys_context *swc)
+{
+ const struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
+ return vswc->command.used;
+}
+
static void
vmw_swc_context_relocation(struct svga_winsys_context *swc,
uint32 *cid)
@@ -761,6 +768,7 @@ vmw_svga_winsys_context_create(struct svga_winsys_screen *sws)
vswc->base.destroy = vmw_swc_destroy;
vswc->base.reserve = vmw_swc_reserve;
+ vswc->base.get_command_buffer_size = vmw_swc_get_command_buffer_size;
vswc->base.surface_relocation = vmw_swc_surface_relocation;
vswc->base.region_relocation = vmw_swc_region_relocation;
vswc->base.mob_relocation = vmw_swc_mob_relocation;
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c
index 7fcb6d277..d0bfcd728 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c
@@ -31,9 +31,15 @@
#include "util/u_memory.h"
#include "pipe/p_compiler.h"
#include "util/u_hash_table.h"
-#include <sys/types.h>
+#ifdef MAJOR_IN_MKDEV
+#include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+#include <sys/sysmacros.h>
+#endif
#include <sys/stat.h>
#include <unistd.h>
+#include <fcntl.h>
static struct util_hash_table *dev_hash = NULL;
@@ -83,7 +89,7 @@ vmw_winsys_create( int fd )
vws->device = stat_buf.st_rdev;
vws->open_count = 1;
- vws->ioctl.drm_fd = dup(fd);
+ vws->ioctl.drm_fd = fcntl(fd, F_DUPFD_CLOEXEC, 3);
vws->base.have_gb_dma = TRUE;
vws->base.need_to_rebind_resources = FALSE;
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_dri.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_dri.c
index 01bb0e2d7..eae678a63 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_dri.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_dri.c
@@ -186,6 +186,12 @@ vmw_drm_gb_surface_from_handle(struct svga_winsys_screen *sws,
uint32_t handle;
int ret;
+ if (whandle->offset != 0) {
+ fprintf(stderr, "Attempt to import unsupported winsys offset %u\n",
+ whandle->offset);
+ return NULL;
+ }
+
ret = vmw_ioctl_gb_surface_ref(vws, whandle, &flags, format,
&mip_levels, &handle, &desc.region);
@@ -253,6 +259,12 @@ vmw_drm_surface_from_handle(struct svga_winsys_screen *sws,
int ret;
int i;
+ if (whandle->offset != 0) {
+ fprintf(stderr, "Attempt to import unsupported winsys offset %u\n",
+ whandle->offset);
+ return NULL;
+ }
+
switch (whandle->type) {
case DRM_API_HANDLE_TYPE_SHARED:
case DRM_API_HANDLE_TYPE_KMS:
@@ -357,6 +369,7 @@ vmw_drm_surface_get_handle(struct svga_winsys_screen *sws,
vsrf = vmw_svga_winsys_surface(surface);
whandle->handle = vsrf->sid;
whandle->stride = stride;
+ whandle->offset = 0;
switch (whandle->type) {
case DRM_API_HANDLE_TYPE_SHARED:
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
index 7fc93e748..1740d1ab0 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
@@ -1022,6 +1022,17 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws)
" (%i, %s).\n", ret, strerror(-ret));
goto out_no_caps;
}
+
+ if (((version->version_major == 2 && version->version_minor >= 10)
+ || version->version_major > 2) && vws->base.have_vgpu10) {
+
+ /* support for these commands didn't make it into vmwgfx kernel
+ * modules before 2.10.
+ */
+ vws->base.have_generate_mipmap_cmd = TRUE;
+ vws->base.have_set_predication_cmd = TRUE;
+ }
+
free(cap_buffer);
drmFreeVersion(version);
vmw_printf("%s OK\n", __FUNCTION__);
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c
index a18dd827c..3a936e7e6 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c
@@ -280,6 +280,18 @@ vmw_svga_winsys_surface_can_create(struct svga_winsys_screen *sws,
}
+static void
+vmw_svga_winsys_surface_invalidate(struct svga_winsys_screen *sws,
+ struct svga_winsys_surface *surf)
+{
+ /* this is a noop since surface invalidation is not needed for DMA path.
+ * DMA is enabled when guest-backed surface is not enabled or
+ * guest-backed dma is enabled. Since guest-backed dma is enabled
+ * when guest-backed surface is enabled, that implies DMA is always enabled;
+ * hence, surface invalidation is not needed.
+ */
+}
+
static boolean
vmw_svga_winsys_surface_is_flushed(struct svga_winsys_screen *sws,
struct svga_winsys_surface *surface)
@@ -395,6 +407,22 @@ vmw_svga_winsys_shader_destroy(struct svga_winsys_screen *sws,
vmw_svga_winsys_shader_reference(&d_shader, NULL);
}
+static void
+vmw_svga_winsys_stats_inc(enum svga_stats_count index)
+{
+}
+
+static void
+vmw_svga_winsys_stats_time_push(enum svga_stats_time index,
+ struct svga_winsys_stats_timeframe *tf)
+{
+}
+
+static void
+vmw_svga_winsys_stats_time_pop()
+{
+}
+
boolean
vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws)
{
@@ -406,6 +434,7 @@ vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws)
vws->base.surface_is_flushed = vmw_svga_winsys_surface_is_flushed;
vws->base.surface_reference = vmw_svga_winsys_surface_ref;
vws->base.surface_can_create = vmw_svga_winsys_surface_can_create;
+ vws->base.surface_invalidate = vmw_svga_winsys_surface_invalidate;
vws->base.buffer_create = vmw_svga_winsys_buffer_create;
vws->base.buffer_map = vmw_svga_winsys_buffer_map;
vws->base.buffer_unmap = vmw_svga_winsys_buffer_unmap;
@@ -421,6 +450,10 @@ vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws)
vws->base.query_destroy = vmw_svga_winsys_query_destroy;
vws->base.query_get_result = vmw_svga_winsys_query_get_result;
+ vws->base.stats_inc = vmw_svga_winsys_stats_inc;
+ vws->base.stats_time_push = vmw_svga_winsys_stats_time_push;
+ vws->base.stats_time_pop = vmw_svga_winsys_stats_time_pop;
+
return TRUE;
}