summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2019-04-27 15:25:35 +0200
committerAxel Davy <[email protected]>2019-04-30 19:18:52 +0200
commitb71c300c70fa33705ddd795998e0fe25452cb2af (patch)
treeb8b604af49dedce100e4aedecec34cade40721ec /src/gallium/state_trackers
parent562f5a35c88f0de62bb6f6c65fa668b6211e4bd0 (diff)
st/nine: Throttle rendering similarly for thread_submit
thread_submit's throttling depending on the number of internal back buffers, and wasn't affected by the driver requested throttling value. Now it is. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/nine/swapchain9.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c
index 8026ee16b7a..d299f62399f 100644
--- a/src/gallium/state_trackers/nine/swapchain9.c
+++ b/src/gallium/state_trackers/nine/swapchain9.c
@@ -693,12 +693,13 @@ static void work_present(void *data)
}
static void pend_present(struct NineSwapChain9 *This,
+ struct pipe_fence_handle *fence,
HWND hDestWindowOverride)
{
struct end_present_struct *work = calloc(1, sizeof(struct end_present_struct));
work->screen = This->screen;
- work->fence_to_wait = swap_fences_pop_front(This);
+ This->screen->fence_reference(This->screen, &work->fence_to_wait, fence);
work->present = This->present;
work->present_handle = This->present_handles[0];
work->hDestWindowOverride = hDestWindowOverride;
@@ -867,6 +868,12 @@ present( struct NineSwapChain9 *This,
fence = NULL;
pipe->flush(pipe, &fence, PIPE_FLUSH_END_OF_FRAME);
+
+ /* Present now for thread_submit, because we have the fence.
+ * It's possible we return WASSTILLDRAWING and still Present,
+ * but it should be fine. */
+ if (This->enable_threadpool)
+ pend_present(This, fence, hDestWindowOverride);
if (fence) {
swap_fences_push_back(This, fence);
This->screen->fence_reference(This->screen, &fence, NULL);
@@ -887,21 +894,22 @@ bypass_rendering:
return D3DERR_WASSTILLDRAWING;
}
+ /* Throttle rendering if needed */
+ fence = swap_fences_pop_front(This);
+ if (fence) {
+ (void) This->screen->fence_finish(This->screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
+ This->screen->fence_reference(This->screen, &fence, NULL);
+ }
+
+ This->rendering_done = FALSE;
+
if (!This->enable_threadpool) {
This->tasks[0]=NULL;
- fence = swap_fences_pop_front(This);
- if (fence) {
- (void) This->screen->fence_finish(This->screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
- This->screen->fence_reference(This->screen, &fence, NULL);
- }
hr = ID3DPresent_PresentBuffer(This->present, This->present_handles[0], hDestWindowOverride, pSourceRect, pDestRect, pDirtyRegion, dwFlags);
if (FAILED(hr)) { UNTESTED(3);return hr; }
- } else {
- pend_present(This, hDestWindowOverride);
}
- This->rendering_done = FALSE;
return D3D_OK;
}
@@ -1262,12 +1270,11 @@ NineSwapChain9_GetBackBufferCountForParams( struct NineSwapChain9 *This,
/* With DISCARD, as there is no guarantee about the buffer contents, we can use
* an arbitrary number of buffers */
if (pParams->SwapEffect == D3DSWAPEFFECT_DISCARD) {
- /* thread_submit has a throttling equivalent to the throttling
- * with throttling_value set to count-1. Most drivers use
- * 2 for throttling_value. For performance use count of at least 3
- * for thread_submit. */
- if (This->actx->thread_submit && count < 3)
- count = 3;
+ /* thread_submit's can have maximum count or This->actx->throttling_value + 1
+ * frames in flight being rendered and not shown.
+ * Do not let count decrease that number */
+ if (This->actx->thread_submit && count < This->desired_fences)
+ count = This->desired_fences;
/* When we enable AllowDISCARDDelayedRelease, we must ensure
* to have at least 4 buffers to meet INTERVAL_IMMEDIATE,
* since the display server/compositor can hold 3 buffers