diff options
author | Thomas Hellstrom <[email protected]> | 2010-05-31 20:34:59 +0100 |
---|---|---|
committer | Jakob Bornecrantz <[email protected]> | 2010-05-31 22:34:59 +0100 |
commit | d12f2bb9c03a9e8a08824c849200f5b23c05914c (patch) | |
tree | a86af4658c5ec1d318b89537f1f477ad761b93ad /src/gallium/winsys | |
parent | cd151effe654c460c46ba55780eb89b3072077c0 (diff) |
st/xorg, vmware: Make throttling configurable.
The xorg state tracker gets two new options to let the user choose
whether to enable / disable dirty throttling and swapbuffer throttling.
The default value of these options are enabled, unless the winsys
supplies a customizer with other values. The customizer record has been
extended to allow this, and also to set winsys-based throttling on a per-
context basis.
The vmware part of this patch disables the dirty throttling if the kernel
supports command submission throttling, and also in that case sets kernel
based throttling for everything but swapbuffers. The vmware winsys does not
set throttling per context, even if it theoretically could, but instead
sets throttling per screen. This should perhaps be changed, should the
xorg state tracker start to use multiple rendering contexts. Kernel throttling
is off by default for all new screens/contexts, so the dri state tracker
is not affected.
This significantly improves interactivity of the vmware xorg driver.
Cherry-picked from commit a8f3b3f88acc1f0193fa740e76e9d815f07f32ab
Signed-off-by: Thomas Hellstrom <[email protected]>
Signed-off-by: Jakob Bornecrantz <[email protected]>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_context.c | 19 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_context.h | 3 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_screen.c | 10 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_screen.h | 12 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_screen_ioctl.c | 6 |
5 files changed, 44 insertions, 6 deletions
diff --git a/src/gallium/winsys/svga/drm/vmw_context.c b/src/gallium/winsys/svga/drm/vmw_context.c index 104d03f2730..11626ee637d 100644 --- a/src/gallium/winsys/svga/drm/vmw_context.c +++ b/src/gallium/winsys/svga/drm/vmw_context.c @@ -103,6 +103,9 @@ struct vmw_svga_winsys_context * referred. */ boolean preemptive_flush; + + boolean throttle_set; + uint32_t throttle_us; }; @@ -135,6 +138,7 @@ vmw_swc_flush(struct svga_winsys_context *swc, struct pipe_fence_handle *fence = NULL; unsigned i; enum pipe_error ret; + uint32_t throttle_us; ret = pb_validate_validate(vswc->validate); assert(ret == PIPE_OK); @@ -153,8 +157,13 @@ vmw_swc_flush(struct svga_winsys_context *swc, *reloc->where = ptr; } + throttle_us = vswc->throttle_set ? + vswc->throttle_us : vswc->vws->default_throttle_us; + if (vswc->command.used) vmw_ioctl_command(vswc->vws, + vswc->base.cid, + throttle_us, vswc->command.buffer, vswc->command.used, &vswc->last_fence); @@ -395,3 +404,13 @@ vmw_svga_winsys_context_create(struct svga_winsys_screen *sws) } +void +vmw_svga_context_set_throttling(struct pipe_context *pipe, + uint32_t throttle_us) +{ + struct svga_winsys_context *swc = svga_winsys_context(pipe); + struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc); + + vswc->throttle_us = throttle_us; + vswc->throttle_set = TRUE; +} diff --git a/src/gallium/winsys/svga/drm/vmw_context.h b/src/gallium/winsys/svga/drm/vmw_context.h index d4884d24e99..aed8b93734b 100644 --- a/src/gallium/winsys/svga/drm/vmw_context.h +++ b/src/gallium/winsys/svga/drm/vmw_context.h @@ -52,5 +52,8 @@ struct pipe_screen; struct svga_winsys_context * vmw_svga_winsys_context_create(struct svga_winsys_screen *sws); +void +vmw_svga_context_set_throttling(struct pipe_context *pipe, + uint32_t throttle_us); #endif /* VMW_CONTEXT_H_ */ diff --git a/src/gallium/winsys/svga/drm/vmw_screen.c b/src/gallium/winsys/svga/drm/vmw_screen.c index 6cc9b382932..51a4c55e5a2 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen.c +++ b/src/gallium/winsys/svga/drm/vmw_screen.c @@ -75,3 +75,13 @@ vmw_winsys_destroy(struct vmw_winsys_screen *vws) vmw_ioctl_cleanup(vws); FREE(vws); } + +void +vmw_winsys_screen_set_throttling(struct pipe_screen *screen, + uint32_t throttle_us) +{ + struct vmw_winsys_screen *vws = + vmw_winsys_screen(svga_winsys_screen(screen)); + + vws->default_throttle_us = throttle_us; +} diff --git a/src/gallium/winsys/svga/drm/vmw_screen.h b/src/gallium/winsys/svga/drm/vmw_screen.h index d3f2c2c7f56..b3de72df881 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen.h +++ b/src/gallium/winsys/svga/drm/vmw_screen.h @@ -53,6 +53,7 @@ struct vmw_winsys_screen struct svga_winsys_screen base; boolean use_old_scanout_flag; + uint32_t default_throttle_us; struct { volatile uint32_t *fifo_map; @@ -96,9 +97,11 @@ vmw_ioctl_surface_destroy(struct vmw_winsys_screen *vws, void vmw_ioctl_command(struct vmw_winsys_screen *vws, - void *commands, - uint32_t size, - uint32_t *fence); + int32_t cid, + uint32_t throttle_us, + void *commands, + uint32_t size, + uint32_t *fence); struct vmw_region * vmw_ioctl_region_create(struct vmw_winsys_screen *vws, uint32_t size); @@ -135,6 +138,7 @@ void vmw_pools_cleanup(struct vmw_winsys_screen *vws); struct vmw_winsys_screen *vmw_winsys_create(int fd, boolean use_old_scanout_flag); void vmw_winsys_destroy(struct vmw_winsys_screen *sws); - +void vmw_winsys_screen_set_throttling(struct pipe_screen *screen, + uint32_t throttle_us); #endif /* VMW_SCREEN_H_ */ diff --git a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c index 5d81fa8c4a6..d92ba389d35 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c +++ b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c @@ -241,8 +241,9 @@ vmw_ioctl_surface_destroy(struct vmw_winsys_screen *vws, uint32 sid) } void -vmw_ioctl_command(struct vmw_winsys_screen *vws, void *commands, uint32_t size, - uint32_t * pfence) +vmw_ioctl_command(struct vmw_winsys_screen *vws, int32_t cid, + uint32_t throttle_us, void *commands, uint32_t size, + uint32_t *pfence) { struct drm_vmw_execbuf_arg arg; struct drm_vmw_fence_rep rep; @@ -275,6 +276,7 @@ vmw_ioctl_command(struct vmw_winsys_screen *vws, void *commands, uint32_t size, arg.fence_rep = (unsigned long)&rep; arg.commands = (unsigned long)commands; arg.command_size = size; + arg.throttle_us = throttle_us; do { ret = drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_EXECBUF, &arg, sizeof(arg)); |