aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/svga/drm/vmw_context.c
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2014-08-12 07:37:12 -0600
committerBrian Paul <[email protected]>2014-08-12 08:03:24 -0600
commit0c065270c0ff063edba03516b22d734023cac912 (patch)
tree33a6cf749f9a93cf1f24c3c9c747f659d28c3e97 /src/gallium/winsys/svga/drm/vmw_context.c
parentd839be24b3b53717fcc153c3d00afb1c516d926e (diff)
svga: Add a limit to the maximum surface size
This patch adds a limit to the maximum surface size which is based on the maximum size of a single mob. If this value is not available, the maximum surface size is by default set to 128 MB. Reviewed-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/winsys/svga/drm/vmw_context.c')
-rw-r--r--src/gallium/winsys/svga/drm/vmw_context.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/gallium/winsys/svga/drm/vmw_context.c b/src/gallium/winsys/svga/drm/vmw_context.c
index 1234a5edce3..4e1c41db886 100644
--- a/src/gallium/winsys/svga/drm/vmw_context.c
+++ b/src/gallium/winsys/svga/drm/vmw_context.c
@@ -49,6 +49,21 @@
#define VMW_MUST_FLUSH_STACK 8
+/*
+ * A factor applied to the maximum mob memory size to determine
+ * the optimial time to preemptively flush the command buffer.
+ * The constant is based on some performance trials with SpecViewperf.
+ */
+#define VMW_MAX_MOB_MEM_FACTOR 2
+
+/*
+ * A factor applied to the maximum surface memory size to determine
+ * the optimial time to preemptively flush the command buffer.
+ * The constant is based on some performance trials with SpecViewperf.
+ */
+#define VMW_MAX_SURF_MEM_FACTOR 2
+
+
struct vmw_buffer_relocation
{
struct pb_buffer *buffer;
@@ -395,7 +410,7 @@ vmw_swc_mob_relocation(struct svga_winsys_context *swc,
if (vmw_swc_add_validate_buffer(vswc, reloc->buffer, flags)) {
vswc->seen_mobs += reloc->buffer->size;
/* divide by 5, tested for best performance */
- if (vswc->seen_mobs >= vswc->vws->ioctl.max_mob_memory / 5)
+ if (vswc->seen_mobs >= vswc->vws->ioctl.max_mob_memory / VMW_MAX_MOB_MEM_FACTOR)
vswc->preemptive_flush = TRUE;
}
@@ -457,7 +472,7 @@ vmw_swc_surface_only_relocation(struct svga_winsys_context *swc,
vswc->seen_surfaces += vsurf->size;
/* divide by 5 not well tuned for performance */
- if (vswc->seen_surfaces >= vswc->vws->ioctl.max_surface_memory / 5)
+ if (vswc->seen_surfaces >= vswc->vws->ioctl.max_surface_memory / VMW_MAX_SURF_MEM_FACTOR)
vswc->preemptive_flush = TRUE;
}