From a2fbc97b8ef95e8f89927f554ba27d34f3699cf8 Mon Sep 17 00:00:00 2001 From: alihanozturk Date: Wed, 15 Feb 2017 13:48:00 +0300 Subject: [PATCH] mesa:update --- ...iff => N_01-WIP-nouveau-add-locking.patch} | 469 ++++++++---------- ...s-done-with-the-push-mutex-acquired.patch} | 30 +- ...eb2.diff => N_03-nv30-locking-fixes.patch} | 54 +- ...-lock-in-nv50_hw_sm_get_query_result.patch | 24 + ..._condition-in-nv50_blitctx_post_blit.patch | 29 ++ ..._Define-GLAPIVAR-separate-from-GLAPI.patch | 40 ++ ...C-libs-Replace-hardlinks-with-copies.patch | 52 ++ x11/library/mesa/pspec.xml | 12 +- 8 files changed, 427 insertions(+), 283 deletions(-) rename x11/library/mesa/files/{2e6b0e24cfb0f467e8b6d6f394730442a72dcdaf.diff => N_01-WIP-nouveau-add-locking.patch} (73%) rename x11/library/mesa/files/{2733e5483e1c2b80e4b0ae21187ec5e3e1579397.diff => N_02-nouveau-more-locking-make-sure-that-fence-work-is-always-done-with-the-push-mutex-acquired.patch} (81%) rename x11/library/mesa/files/{940b3a773f264f3f52574160f0d06c48f8e8aeb2.diff => N_03-nv30-locking-fixes.patch} (83%) create mode 100644 x11/library/mesa/files/N_04-nv50-Fix-double-lock-in-nv50_hw_sm_get_query_result.patch create mode 100644 x11/library/mesa/files/N_05-Use-nv50_render_condition-in-nv50_blitctx_post_blit.patch create mode 100644 x11/library/mesa/files/n_Define-GLAPIVAR-separate-from-GLAPI.patch create mode 100644 x11/library/mesa/files/n_VDPAU-XVMC-libs-Replace-hardlinks-with-copies.patch diff --git a/x11/library/mesa/files/2e6b0e24cfb0f467e8b6d6f394730442a72dcdaf.diff b/x11/library/mesa/files/N_01-WIP-nouveau-add-locking.patch similarity index 73% rename from x11/library/mesa/files/2e6b0e24cfb0f467e8b6d6f394730442a72dcdaf.diff rename to x11/library/mesa/files/N_01-WIP-nouveau-add-locking.patch index c12843c38b..9fffa59b95 100644 --- a/x11/library/mesa/files/2e6b0e24cfb0f467e8b6d6f394730442a72dcdaf.diff +++ b/x11/library/mesa/files/N_01-WIP-nouveau-add-locking.patch @@ -1,8 +1,6 @@ -diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c -index 7c1421b..58fa453 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c -@@ -380,6 +380,7 @@ nouveau_buffer_transfer_map(struct pipe_context *pipe, +@@ -380,6 +380,7 @@ struct pipe_transfer **ptransfer) { struct nouveau_context *nv = nouveau_context(pipe); @@ -10,7 +8,7 @@ index 7c1421b..58fa453 100644 struct nv04_resource *buf = nv04_resource(resource); struct nouveau_transfer *tx = MALLOC_STRUCT(nouveau_transfer); uint8_t *map; -@@ -427,14 +428,19 @@ nouveau_buffer_transfer_map(struct pipe_context *pipe, +@@ -427,14 +428,19 @@ buf->data = NULL; } nouveau_transfer_staging(nv, tx, false); @@ -31,7 +29,7 @@ index 7c1421b..58fa453 100644 } } return buf->data ? (buf->data + box->x) : tx->map; -@@ -479,7 +485,9 @@ nouveau_buffer_transfer_map(struct pipe_context *pipe, +@@ -479,7 +485,9 @@ if (unlikely(usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE)) { /* Discarding was not possible, must sync because * subsequent transfers might use UNSYNCHRONIZED. */ @@ -41,7 +39,7 @@ index 7c1421b..58fa453 100644 } else if (usage & PIPE_TRANSFER_DISCARD_RANGE) { /* The whole range is being discarded, so it doesn't matter what was -@@ -488,10 +496,13 @@ nouveau_buffer_transfer_map(struct pipe_context *pipe, +@@ -488,10 +496,13 @@ map = tx->map; } else if (nouveau_buffer_busy(buf, PIPE_TRANSFER_READ)) { @@ -57,13 +55,14 @@ index 7c1421b..58fa453 100644 } else { /* It is expected that the returned buffer be a representation of the * data in question, so we must copy it over from the buffer. */ -@@ -515,9 +526,13 @@ nouveau_buffer_transfer_flush_region(struct pipe_context *pipe, +@@ -515,9 +526,13 @@ { struct nouveau_transfer *tx = nouveau_transfer(transfer); struct nv04_resource *buf = nv04_resource(transfer->resource); -+ struct nouveau_screen *screen = nouveau_context(pipe)->screen; - +- - if (tx->map) ++ struct nouveau_screen *screen = nouveau_context(pipe)->screen; ++ + if (tx->map) { + pipe_mutex_lock(screen->push_mutex); nouveau_transfer_write(nouveau_context(pipe), tx, box->x, box->width); @@ -72,7 +71,7 @@ index 7c1421b..58fa453 100644 util_range_add(&buf->valid_buffer_range, tx->base.box.x + box->x, -@@ -537,11 +552,15 @@ nouveau_buffer_transfer_unmap(struct pipe_context *pipe, +@@ -537,11 +552,15 @@ struct nouveau_context *nv = nouveau_context(pipe); struct nouveau_transfer *tx = nouveau_transfer(transfer); struct nv04_resource *buf = nv04_resource(transfer->resource); @@ -89,11 +88,9 @@ index 7c1421b..58fa453 100644 util_range_add(&buf->valid_buffer_range, tx->base.box.x, tx->base.box.x + tx->base.box.width); -diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c b/src/gallium/drivers/nouveau/nouveau_fence.c -index 691553a..9cbfc2a 100644 --- a/src/gallium/drivers/nouveau/nouveau_fence.c +++ b/src/gallium/drivers/nouveau/nouveau_fence.c -@@ -71,12 +71,14 @@ nouveau_fence_emit(struct nouveau_fence *fence) +@@ -71,12 +71,14 @@ ++fence->ref; @@ -108,7 +105,7 @@ index 691553a..9cbfc2a 100644 screen->fence.emit(&screen->base, &fence->sequence); -@@ -90,6 +92,9 @@ nouveau_fence_del(struct nouveau_fence *fence) +@@ -90,6 +92,9 @@ struct nouveau_fence *it; struct nouveau_screen *screen = fence->screen; @@ -118,7 +115,7 @@ index 691553a..9cbfc2a 100644 if (fence->state == NOUVEAU_FENCE_STATE_EMITTED || fence->state == NOUVEAU_FENCE_STATE_FLUSHED) { if (fence == screen->fence.head) { -@@ -123,6 +128,7 @@ nouveau_fence_update(struct nouveau_screen *screen, bool flushed) +@@ -123,6 +128,7 @@ return; screen->fence.sequence_ack = sequence; @@ -126,7 +123,7 @@ index 691553a..9cbfc2a 100644 for (fence = screen->fence.head; fence; fence = next) { next = fence->next; sequence = fence->sequence; -@@ -144,6 +150,7 @@ nouveau_fence_update(struct nouveau_screen *screen, bool flushed) +@@ -144,6 +150,7 @@ if (fence->state == NOUVEAU_FENCE_STATE_EMITTED) fence->state = NOUVEAU_FENCE_STATE_FLUSHED; } @@ -134,7 +131,7 @@ index 691553a..9cbfc2a 100644 } #define NOUVEAU_FENCE_MAX_SPINS (1 << 31) -@@ -198,18 +205,27 @@ nouveau_fence_wait(struct nouveau_fence *fence, struct pipe_debug_callback *debu +@@ -198,11 +205,19 @@ uint32_t spins = 0; int64_t start = 0; @@ -149,12 +146,12 @@ index 691553a..9cbfc2a 100644 if (!nouveau_fence_kick(fence)) return false; - -+ pipe_mutex_unlock(screen->push_mutex); + ++ pipe_mutex_unlock(screen->push_mutex); + do { if (fence->state == NOUVEAU_FENCE_STATE_SIGNALLED) { - if (debug && debug->debug_message) +@@ -210,6 +225,7 @@ pipe_debug_message(debug, PERF_INFO, "stalled %.3f ms waiting for fence", (os_time_get_nano() - start) / 1000000.f); @@ -162,17 +159,17 @@ index 691553a..9cbfc2a 100644 return true; } if (!spins) -@@ -227,6 +243,8 @@ nouveau_fence_wait(struct nouveau_fence *fence, struct pipe_debug_callback *debu +@@ -226,6 +242,8 @@ + debug_printf("Wait on fence %u (ack = %u, next = %u) timed out !\n", fence->sequence, screen->fence.sequence_ack, screen->fence.sequence); - -+ pipe_mutex_lock(screen->push_mutex); + ++ pipe_mutex_lock(screen->push_mutex); + return false; } - -diff --git a/src/gallium/drivers/nouveau/nouveau_fence.h b/src/gallium/drivers/nouveau/nouveau_fence.h -index f10016d..98d021e 100644 + + --- a/src/gallium/drivers/nouveau/nouveau_fence.h +++ b/src/gallium/drivers/nouveau/nouveau_fence.h @@ -2,6 +2,7 @@ @@ -183,7 +180,7 @@ index f10016d..98d021e 100644 #include "util/u_inlines.h" #include "util/list.h" -@@ -47,10 +48,10 @@ static inline void +@@ -47,10 +48,10 @@ nouveau_fence_ref(struct nouveau_fence *fence, struct nouveau_fence **ref) { if (fence) @@ -196,11 +193,14 @@ index f10016d..98d021e 100644 nouveau_fence_del(*ref); } -diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c -index 2c421cc..634fdc3 100644 + +src/gallium/drivers/nouveau/nouveau_screen.c +Diff +Switch to side-by-side view + --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c -@@ -73,10 +73,14 @@ nouveau_screen_fence_finish(struct pipe_screen *screen, +@@ -74,10 +74,14 @@ struct pipe_fence_handle *pfence, uint64_t timeout) { @@ -216,17 +216,17 @@ index 2c421cc..634fdc3 100644 } -@@ -153,6 +157,9 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) +@@ -153,6 +157,9 @@ + char *nv_dbg = getenv("NOUVEAU_MESA_DEBUG"); if (nv_dbg) nouveau_mesa_debug = atoi(nv_dbg); - ++ + pipe_mutex_init(screen->push_mutex); + pipe_mutex_init(screen->fence.list_mutex); -+ + /* These must be set before any failure is possible, as the cleanup * paths assume they're responsible for deleting them. - */ -@@ -253,6 +260,9 @@ nouveau_screen_fini(struct nouveau_screen *screen) +@@ -254,6 +261,9 @@ nouveau_device_del(&screen->device); nouveau_drm_del(&screen->drm); close(fd); @@ -236,8 +236,6 @@ index 2c421cc..634fdc3 100644 } static void -diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h -index 28c4760..28c8620 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.h +++ b/src/gallium/drivers/nouveau/nouveau_screen.h @@ -3,6 +3,7 @@ @@ -248,7 +246,7 @@ index 28c4760..28c8620 100644 #ifdef DEBUG # define NOUVEAU_ENABLE_DRIVER_STATISTICS -@@ -22,6 +23,7 @@ struct nouveau_screen { +@@ -22,6 +23,7 @@ struct nouveau_object *channel; struct nouveau_client *client; struct nouveau_pushbuf *pushbuf; @@ -256,7 +254,7 @@ index 28c4760..28c8620 100644 int refcount; -@@ -39,6 +41,7 @@ struct nouveau_screen { +@@ -39,6 +41,7 @@ struct nouveau_fence *head; struct nouveau_fence *tail; struct nouveau_fence *current; @@ -264,11 +262,9 @@ index 28c4760..28c8620 100644 u32 sequence; u32 sequence_ack; void (*emit)(struct pipe_screen *, u32 *sequence); -diff --git a/src/gallium/drivers/nouveau/nv30/nv30_clear.c b/src/gallium/drivers/nouveau/nv30/nv30_clear.c -index c8fa38e..3a72354 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_clear.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_clear.c -@@ -58,8 +58,11 @@ nv30_clear(struct pipe_context *pipe, unsigned buffers, +@@ -58,8 +58,11 @@ struct pipe_framebuffer_state *fb = &nv30->framebuffer; uint32_t colr = 0, zeta = 0, mode = 0; @@ -281,7 +277,7 @@ index c8fa38e..3a72354 100644 if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) { colr = pack_rgba(fb->cbufs[0]->format, color->f); -@@ -96,6 +99,7 @@ nv30_clear(struct pipe_context *pipe, unsigned buffers, +@@ -96,6 +99,7 @@ PUSH_DATA (push, mode); nv30_state_release(nv30); @@ -289,7 +285,7 @@ index c8fa38e..3a72354 100644 } static void -@@ -125,11 +129,15 @@ nv30_clear_render_target(struct pipe_context *pipe, struct pipe_surface *ps, +@@ -126,11 +130,15 @@ rt_format |= NV30_3D_RT_FORMAT_TYPE_LINEAR; } @@ -297,7 +293,7 @@ index c8fa38e..3a72354 100644 + refn.bo = mt->base.bo; refn.flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_WR; - if (nouveau_pushbuf_space(push, 16, 1, 0) || + if (nouveau_pushbuf_space(push, 32, 1, 0) || - nouveau_pushbuf_refn (push, &refn, 1)) + nouveau_pushbuf_refn (push, &refn, 1)) { + pipe_mutex_unlock(nv30->screen->base.push_mutex); @@ -306,7 +302,7 @@ index c8fa38e..3a72354 100644 BEGIN_NV04(push, NV30_3D(RT_ENABLE), 1); PUSH_DATA (push, NV30_3D_RT_ENABLE_COLOR0); -@@ -154,6 +162,8 @@ nv30_clear_render_target(struct pipe_context *pipe, struct pipe_surface *ps, +@@ -155,6 +163,8 @@ NV30_3D_CLEAR_BUFFERS_COLOR_B | NV30_3D_CLEAR_BUFFERS_COLOR_A); @@ -315,7 +311,7 @@ index c8fa38e..3a72354 100644 nv30->dirty |= NV30_NEW_FRAMEBUFFER | NV30_NEW_SCISSOR; } -@@ -189,11 +199,15 @@ nv30_clear_depth_stencil(struct pipe_context *pipe, struct pipe_surface *ps, +@@ -191,11 +201,15 @@ if (buffers & PIPE_CLEAR_STENCIL) mode |= NV30_3D_CLEAR_BUFFERS_STENCIL; @@ -332,7 +328,7 @@ index c8fa38e..3a72354 100644 BEGIN_NV04(push, NV30_3D(RT_ENABLE), 1); PUSH_DATA (push, 0); -@@ -219,6 +233,8 @@ nv30_clear_depth_stencil(struct pipe_context *pipe, struct pipe_surface *ps, +@@ -221,6 +235,8 @@ BEGIN_NV04(push, NV30_3D(CLEAR_BUFFERS), 1); PUSH_DATA (push, mode); @@ -341,11 +337,9 @@ index c8fa38e..3a72354 100644 nv30->dirty |= NV30_NEW_FRAMEBUFFER | NV30_NEW_SCISSOR; } -diff --git a/src/gallium/drivers/nouveau/nv30/nv30_context.c b/src/gallium/drivers/nouveau/nv30/nv30_context.c -index 3ed0889..fbc4136 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_context.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_context.c -@@ -201,6 +201,8 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) +@@ -201,6 +201,8 @@ if (!nv30) return NULL; @@ -354,7 +348,7 @@ index 3ed0889..fbc4136 100644 nv30->screen = screen; nv30->base.screen = &screen->base; nv30->base.copy_data = nv30_transfer_copy_data; -@@ -226,6 +228,7 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) +@@ -226,6 +228,7 @@ ret = nouveau_bufctx_new(nv30->base.client, 64, &nv30->bufctx); if (ret) { nv30_context_destroy(pipe); @@ -362,7 +356,7 @@ index 3ed0889..fbc4136 100644 return NULL; } -@@ -259,10 +262,13 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) +@@ -259,10 +262,13 @@ nv30->blitter = util_blitter_create(pipe); if (!nv30->blitter) { nv30_context_destroy(pipe); @@ -376,11 +370,9 @@ index 3ed0889..fbc4136 100644 + return pipe; } -diff --git a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c -index c6f6965..389bfaa 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c -@@ -130,10 +130,12 @@ nv30_resource_copy_region(struct pipe_context *pipe, +@@ -130,10 +130,12 @@ struct nv30_context *nv30 = nv30_context(pipe); struct nv30_rect src, dst; @@ -393,7 +385,7 @@ index c6f6965..389bfaa 100644 return; } -@@ -143,6 +145,7 @@ nv30_resource_copy_region(struct pipe_context *pipe, +@@ -143,6 +145,7 @@ src_box->width, src_box->height, &dst); nv30_transfer_rect(nv30, NEAREST, &src, &dst); @@ -401,7 +393,7 @@ index c6f6965..389bfaa 100644 } static void -@@ -163,6 +166,7 @@ nv30_resource_resolve(struct nv30_context *nv30, +@@ -163,6 +166,7 @@ y1 = src.y1; /* On nv3x we must use sifm which is restricted to 1024x1024 tiles */ @@ -409,7 +401,7 @@ index c6f6965..389bfaa 100644 for (y = src.y0; y < y1; y += h) { h = y1 - y; if (h > 1024) -@@ -193,6 +197,7 @@ nv30_resource_resolve(struct nv30_context *nv30, +@@ -193,6 +197,7 @@ nv30_transfer_rect(nv30, BILINEAR, &src, &dst); } } @@ -417,7 +409,7 @@ index c6f6965..389bfaa 100644 } void -@@ -308,8 +313,12 @@ nv30_miptree_transfer_map(struct pipe_context *pipe, struct pipe_resource *pt, +@@ -308,8 +313,12 @@ tx->tmp.y1 = tx->tmp.h; tx->tmp.z = 0; @@ -431,7 +423,7 @@ index c6f6965..389bfaa 100644 if (tx->tmp.bo->map) { *ptransfer = &tx->base; -@@ -340,11 +349,13 @@ nv30_miptree_transfer_unmap(struct pipe_context *pipe, +@@ -340,11 +349,13 @@ struct nv30_transfer *tx = nv30_transfer(ptx); if (ptx->usage & PIPE_TRANSFER_WRITE) { @@ -445,11 +437,9 @@ index c6f6965..389bfaa 100644 } else { nouveau_bo_ref(NULL, &tx->tmp.bo); } -diff --git a/src/gallium/drivers/nouveau/nv30/nv30_query.c b/src/gallium/drivers/nouveau/nv30/nv30_query.c -index aa9a12f..a047e15 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_query.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_query.c -@@ -152,6 +152,7 @@ nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq) +@@ -152,6 +152,7 @@ struct nv30_query *q = nv30_query(pq); struct nouveau_pushbuf *push = nv30->base.pushbuf; @@ -457,7 +447,7 @@ index aa9a12f..a047e15 100644 switch (q->type) { case PIPE_QUERY_TIME_ELAPSED: q->qo[0] = nv30_query_object_new(nv30->screen); -@@ -161,7 +162,7 @@ nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq) +@@ -161,7 +162,7 @@ } break; case PIPE_QUERY_TIMESTAMP: @@ -466,7 +456,7 @@ index aa9a12f..a047e15 100644 default: BEGIN_NV04(push, NV30_3D(QUERY_RESET), 1); PUSH_DATA (push, q->report); -@@ -172,6 +173,7 @@ nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq) +@@ -172,6 +173,7 @@ BEGIN_NV04(push, SUBC_3D(q->enable), 1); PUSH_DATA (push, 1); } @@ -474,7 +464,7 @@ index aa9a12f..a047e15 100644 return true; } -@@ -183,6 +185,7 @@ nv30_query_end(struct pipe_context *pipe, struct pipe_query *pq) +@@ -183,6 +185,7 @@ struct nv30_query *q = nv30_query(pq); struct nouveau_pushbuf *push = nv30->base.pushbuf; @@ -482,7 +472,7 @@ index aa9a12f..a047e15 100644 q->qo[1] = nv30_query_object_new(screen); if (q->qo[1]) { BEGIN_NV04(push, NV30_3D(QUERY_GET), 1); -@@ -194,6 +197,7 @@ nv30_query_end(struct pipe_context *pipe, struct pipe_query *pq) +@@ -194,6 +197,7 @@ PUSH_DATA (push, 0); } PUSH_KICK (push); @@ -490,7 +480,7 @@ index aa9a12f..a047e15 100644 return true; } -@@ -248,9 +252,11 @@ nv40_query_render_condition(struct pipe_context *pipe, +@@ -248,9 +252,11 @@ nv30->render_cond_mode = mode; nv30->render_cond_cond = condition; @@ -502,7 +492,7 @@ index aa9a12f..a047e15 100644 return; } -@@ -262,6 +268,7 @@ nv40_query_render_condition(struct pipe_context *pipe, +@@ -262,6 +268,7 @@ BEGIN_NV04(push, SUBC_3D(0x1e98), 1); PUSH_DATA (push, 0x02000000 | q->qo[1]->hw->start); @@ -510,11 +500,9 @@ index aa9a12f..a047e15 100644 } static void -diff --git a/src/gallium/drivers/nouveau/nv30/nv30_vbo.c b/src/gallium/drivers/nouveau/nv30/nv30_vbo.c -index bc9b9a1..8e3fdee 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_vbo.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_vbo.c -@@ -563,6 +563,8 @@ nv30_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) +@@ -563,6 +563,8 @@ if (nv30->vbo_push_hint != !!nv30->vbo_fifo) nv30->dirty |= NV30_NEW_ARRAYS; @@ -523,7 +511,7 @@ index bc9b9a1..8e3fdee 100644 push->user_priv = &nv30->bufctx; if (nv30->vbo_user && !(nv30->dirty & (NV30_NEW_VERTEX | NV30_NEW_ARRAYS))) nv30_update_user_vbufs(nv30); -@@ -570,10 +572,12 @@ nv30_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) +@@ -570,10 +572,12 @@ nv30_state_validate(nv30, ~0, true); if (nv30->draw_flags) { nv30_render_vbo(pipe, info); @@ -536,7 +524,7 @@ index bc9b9a1..8e3fdee 100644 return; } -@@ -630,6 +634,7 @@ nv30_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) +@@ -630,6 +634,7 @@ nv30_state_release(nv30); nv30_release_user_vbufs(nv30); @@ -544,11 +532,9 @@ index bc9b9a1..8e3fdee 100644 } void -diff --git a/src/gallium/drivers/nouveau/nv50/nv50_compute.c b/src/gallium/drivers/nouveau/nv50/nv50_compute.c -index d781f6f..3c174e4 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_compute.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_compute.c -@@ -249,9 +249,11 @@ nv50_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info) +@@ -249,9 +249,11 @@ struct nv50_program *cp = nv50->compprog; bool ret; @@ -560,7 +546,7 @@ index d781f6f..3c174e4 100644 return; } -@@ -284,6 +286,8 @@ nv50_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info) +@@ -284,6 +286,8 @@ BEGIN_NV04(push, SUBC_CP(NV50_GRAPH_SERIALIZE), 1); PUSH_DATA (push, 0); @@ -569,11 +555,11 @@ index d781f6f..3c174e4 100644 /* bind a compute shader clobbers fragment shader state */ nv50->dirty_3d |= NV50_NEW_3D_FRAGPROG; } -diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c -index fc852d7..84b5e3f 100644 + + --- a/src/gallium/drivers/nouveau/nv50/nv50_context.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c -@@ -37,7 +37,9 @@ nv50_flush(struct pipe_context *pipe, +@@ -37,7 +37,9 @@ if (fence) nouveau_fence_ref(screen->fence.current, (struct nouveau_fence **)fence); @@ -583,7 +569,7 @@ index fc852d7..84b5e3f 100644 nouveau_context_update_frame_stats(nouveau_context(pipe)); } -@@ -47,10 +49,12 @@ nv50_texture_barrier(struct pipe_context *pipe) +@@ -47,10 +49,12 @@ { struct nouveau_pushbuf *push = nv50_context(pipe)->base.pushbuf; @@ -596,7 +582,7 @@ index fc852d7..84b5e3f 100644 } static void -@@ -107,6 +111,7 @@ nv50_emit_string_marker(struct pipe_context *pipe, const char *str, int len) +@@ -107,6 +111,7 @@ data_words = string_words; else data_words = string_words + !!(len & 3); @@ -604,7 +590,7 @@ index fc852d7..84b5e3f 100644 BEGIN_NI04(push, SUBC_3D(NV04_GRAPH_NOP), data_words); if (string_words) PUSH_DATAp(push, str, string_words); -@@ -115,6 +120,7 @@ nv50_emit_string_marker(struct pipe_context *pipe, const char *str, int len) +@@ -115,6 +120,7 @@ memcpy(&data, &str[string_words * 4], len & 3); PUSH_DATA (push, data); } @@ -612,16 +598,16 @@ index fc852d7..84b5e3f 100644 } void -@@ -291,6 +297,8 @@ nv50_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) +@@ -290,6 +296,8 @@ + if (!nv50) return NULL; pipe = &nv50->base.pipe; - -+ pipe_mutex_lock(screen->base.push_mutex); + ++ pipe_mutex_lock(screen->base.push_mutex); + if (!nv50_blitctx_create(nv50)) goto out_err; - -@@ -384,9 +392,12 @@ nv50_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) +@@ -384,9 +392,12 @@ util_dynarray_init(&nv50->global_residents); @@ -634,11 +620,9 @@ index fc852d7..84b5e3f 100644 if (nv50->bufctx_3d) nouveau_bufctx_del(&nv50->bufctx_3d); if (nv50->bufctx_cp) -diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.h b/src/gallium/drivers/nouveau/nv50/nv50_context.h -index cb94c8e..ba005e1 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_context.h +++ b/src/gallium/drivers/nouveau/nv50/nv50_context.h -@@ -219,6 +219,11 @@ void nv50_default_kick_notify(struct nouveau_pushbuf *); +@@ -222,6 +222,11 @@ /* nv50_draw.c */ extern struct draw_stage *nv50_draw_render_stage(struct nv50_context *); @@ -650,11 +634,9 @@ index cb94c8e..ba005e1 100644 /* nv50_shader_state.c */ void nv50_vertprog_validate(struct nv50_context *); void nv50_gmtyprog_validate(struct nv50_context *); -diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c b/src/gallium/drivers/nouveau/nv50/nv50_query.c -index 9a1397a..c90e20e 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_query.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c -@@ -70,7 +70,7 @@ nv50_get_query_result(struct pipe_context *pipe, struct pipe_query *pq, +@@ -70,7 +70,7 @@ return q->funcs->get_query_result(nv50_context(pipe), q, wait, result); } @@ -663,7 +645,7 @@ index 9a1397a..c90e20e 100644 nv50_render_condition(struct pipe_context *pipe, struct pipe_query *pq, boolean condition, uint mode) -@@ -145,6 +145,16 @@ nv50_render_condition(struct pipe_context *pipe, +@@ -145,6 +145,16 @@ } static void @@ -680,7 +662,7 @@ index 9a1397a..c90e20e 100644 nv50_set_active_query_state(struct pipe_context *pipe, boolean enable) { } -@@ -160,7 +170,7 @@ nv50_init_query_functions(struct nv50_context *nv50) +@@ -160,7 +170,7 @@ pipe->end_query = nv50_end_query; pipe->get_query_result = nv50_get_query_result; pipe->set_active_query_state = nv50_set_active_query_state; @@ -689,11 +671,9 @@ index 9a1397a..c90e20e 100644 nv50->cond_condmode = NV50_3D_COND_MODE_ALWAYS; } -diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c b/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c -index 727b509..9067bcc 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c -@@ -129,6 +129,7 @@ nv50_hw_begin_query(struct nv50_context *nv50, struct nv50_query *q) +@@ -129,6 +129,7 @@ { struct nouveau_pushbuf *push = nv50->base.pushbuf; struct nv50_hw_query *hq = nv50_hw_query(q); @@ -701,7 +681,7 @@ index 727b509..9067bcc 100644 if (hq->funcs && hq->funcs->begin_query) return hq->funcs->begin_query(nv50, hq); -@@ -154,6 +155,7 @@ nv50_hw_begin_query(struct nv50_context *nv50, struct nv50_query *q) +@@ -154,6 +155,7 @@ if (!hq->is64bit) hq->data[0] = hq->sequence++; /* the previously used one */ @@ -709,16 +689,17 @@ index 727b509..9067bcc 100644 switch (q->type) { case PIPE_QUERY_OCCLUSION_COUNTER: case PIPE_QUERY_OCCLUSION_PREDICATE: -@@ -193,10 +195,13 @@ nv50_hw_begin_query(struct nv50_context *nv50, struct nv50_query *q) +@@ -193,10 +195,13 @@ break; default: assert(0); - return false; -+ ret = false; -+ break; - } +- } - hq->state = NV50_HW_QUERY_STATE_ACTIVE; - return true; ++ ret = false; ++ break; ++ } + pipe_mutex_unlock(nv50->screen->base.push_mutex); + if (ret) + hq->state = NV50_HW_QUERY_STATE_ACTIVE; @@ -726,7 +707,7 @@ index 727b509..9067bcc 100644 } static void -@@ -212,6 +217,7 @@ nv50_hw_end_query(struct nv50_context *nv50, struct nv50_query *q) +@@ -212,6 +217,7 @@ hq->state = NV50_HW_QUERY_STATE_ENDED; @@ -734,7 +715,7 @@ index 727b509..9067bcc 100644 switch (q->type) { case PIPE_QUERY_OCCLUSION_COUNTER: case PIPE_QUERY_OCCLUSION_PREDICATE: -@@ -264,6 +270,7 @@ nv50_hw_end_query(struct nv50_context *nv50, struct nv50_query *q) +@@ -264,6 +270,7 @@ assert(0); break; } @@ -742,7 +723,7 @@ index 727b509..9067bcc 100644 if (hq->is64bit) nouveau_fence_ref(nv50->screen->base.fence.current, &hq->fence); } -@@ -286,16 +293,21 @@ nv50_hw_get_query_result(struct nv50_context *nv50, struct nv50_query *q, +@@ -286,16 +293,21 @@ nv50_hw_query_update(q); if (hq->state != NV50_HW_QUERY_STATE_READY) { @@ -765,11 +746,9 @@ index 727b509..9067bcc 100644 } hq->state = NV50_HW_QUERY_STATE_READY; -diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c b/src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c -index bcfba9f..31445eb 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c -@@ -176,6 +176,7 @@ nv50_hw_sm_begin_query(struct nv50_context *nv50, struct nv50_hw_query *hq) +@@ -176,6 +176,7 @@ return false; } @@ -777,7 +756,7 @@ index bcfba9f..31445eb 100644 assert(cfg->num_counters <= 4); PUSH_SPACE(push, 4 * 4); -@@ -208,6 +209,7 @@ nv50_hw_sm_begin_query(struct nv50_context *nv50, struct nv50_hw_query *hq) +@@ -208,6 +209,7 @@ BEGIN_NV04(push, NV50_CP(MP_PM_SET(c)), 1); PUSH_DATA (push, 0); } @@ -785,7 +764,7 @@ index bcfba9f..31445eb 100644 return true; } -@@ -237,6 +239,7 @@ nv50_hw_sm_end_query(struct nv50_context *nv50, struct nv50_hw_query *hq) +@@ -237,6 +239,7 @@ screen->pm.prog = prog; } @@ -793,7 +772,7 @@ index bcfba9f..31445eb 100644 /* disable all counting */ PUSH_SPACE(push, 8); for (c = 0; c < 4; c++) { -@@ -260,6 +263,7 @@ nv50_hw_sm_end_query(struct nv50_context *nv50, struct nv50_hw_query *hq) +@@ -260,6 +263,7 @@ PUSH_SPACE(push, 2); BEGIN_NV04(push, SUBC_CP(NV50_GRAPH_SERIALIZE), 1); PUSH_DATA (push, 0); @@ -801,7 +780,7 @@ index bcfba9f..31445eb 100644 pipe->bind_compute_state(pipe, screen->pm.prog); input[0] = hq->bo->offset + hq->base_offset; -@@ -276,6 +280,7 @@ nv50_hw_sm_end_query(struct nv50_context *nv50, struct nv50_hw_query *hq) +@@ -276,6 +280,7 @@ nouveau_bufctx_reset(nv50->bufctx_cp, NV50_BIND_CP_QUERY); @@ -809,7 +788,7 @@ index bcfba9f..31445eb 100644 /* re-active other counters */ PUSH_SPACE(push, 8); mask = 0; -@@ -302,6 +307,7 @@ nv50_hw_sm_end_query(struct nv50_context *nv50, struct nv50_hw_query *hq) +@@ -302,6 +307,7 @@ | cfg->ctr[i].unit | cfg->ctr[i].mode); } } @@ -817,7 +796,7 @@ index bcfba9f..31445eb 100644 } static inline bool -@@ -343,7 +349,9 @@ nv50_hw_sm_get_query_result(struct nv50_context *nv50, struct nv50_hw_query *hq, +@@ -343,7 +349,9 @@ cfg = nv50_hw_sm_query_get_cfg(nv50, hq); @@ -827,11 +806,9 @@ index bcfba9f..31445eb 100644 if (!ret) return false; -diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c -index fbb5129..164ec72 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c -@@ -204,10 +204,13 @@ nv50_resource_copy_region(struct pipe_context *pipe, +@@ -204,10 +204,13 @@ bool m2mf; unsigned dst_layer = dstz, src_layer = src_box->z; @@ -845,7 +822,7 @@ index fbb5129..164ec72 100644 return; } -@@ -247,6 +250,7 @@ nv50_resource_copy_region(struct pipe_context *pipe, +@@ -247,6 +250,7 @@ else srect.base += src_mt->layer_stride; } @@ -853,7 +830,7 @@ index fbb5129..164ec72 100644 return; } -@@ -270,6 +274,7 @@ nv50_resource_copy_region(struct pipe_context *pipe, +@@ -270,6 +274,7 @@ break; } nouveau_bufctx_reset(nv50->bufctx, NV50_BIND_2D); @@ -861,7 +838,7 @@ index fbb5129..164ec72 100644 } static void -@@ -288,14 +293,18 @@ nv50_clear_render_target(struct pipe_context *pipe, +@@ -289,14 +294,18 @@ assert(dst->texture->target != PIPE_BUFFER); @@ -873,24 +850,24 @@ index fbb5129..164ec72 100644 PUSH_DATAf(push, color->f[2]); PUSH_DATAf(push, color->f[3]); -- if (nouveau_pushbuf_space(push, 32 + sf->depth, 1, 0)) -+ if (nouveau_pushbuf_space(push, 32 + sf->depth, 1, 0)) { +- if (nouveau_pushbuf_space(push, 64 + sf->depth, 1, 0)) ++ if (nouveau_pushbuf_space(push, 64 + sf->depth, 1, 0)) { + pipe_mutex_unlock(nv50->screen->base.push_mutex); return; + } PUSH_REFN(push, bo, mt->base.domain | NOUVEAU_BO_WR); -@@ -353,6 +362,8 @@ nv50_clear_render_target(struct pipe_context *pipe, - BEGIN_NV04(push, NV50_3D(COND_MODE), 1); - PUSH_DATA (push, nv50->cond_condmode); +@@ -358,6 +367,8 @@ + PUSH_DATA (push, nv50->cond_condmode); + } + pipe_mutex_unlock(nv50->screen->base.push_mutex); + nv50->dirty_3d |= NV50_NEW_3D_FRAMEBUFFER | NV50_NEW_3D_SCISSOR; } -@@ -376,6 +387,8 @@ nv50_clear_depth_stencil(struct pipe_context *pipe, +@@ -382,6 +393,8 @@ assert(dst->texture->target != PIPE_BUFFER); assert(nouveau_bo_memtype(bo)); /* ZETA cannot be linear */ @@ -899,28 +876,28 @@ index fbb5129..164ec72 100644 if (clear_flags & PIPE_CLEAR_DEPTH) { BEGIN_NV04(push, NV50_3D(CLEAR_DEPTH), 1); PUSH_DATAf(push, depth); -@@ -388,8 +401,10 @@ nv50_clear_depth_stencil(struct pipe_context *pipe, +@@ -394,8 +407,10 @@ mode |= NV50_3D_CLEAR_BUFFERS_S; } -- if (nouveau_pushbuf_space(push, 32 + sf->depth, 1, 0)) -+ if (nouveau_pushbuf_space(push, 32 + sf->depth, 1, 0)) { +- if (nouveau_pushbuf_space(push, 64 + sf->depth, 1, 0)) ++ if (nouveau_pushbuf_space(push, 64 + sf->depth, 1, 0)) { + pipe_mutex_unlock(nv50->screen->base.push_mutex); return; + } PUSH_REFN(push, bo, mt->base.domain | NOUVEAU_BO_WR); -@@ -436,6 +451,8 @@ nv50_clear_depth_stencil(struct pipe_context *pipe, - BEGIN_NV04(push, NV50_3D(COND_MODE), 1); - PUSH_DATA (push, nv50->cond_condmode); - -+ pipe_mutex_unlock(nv50->screen->base.push_mutex); +@@ -445,6 +460,8 @@ + BEGIN_NV04(push, NV50_3D(COND_MODE), 1); + PUSH_DATA (push, nv50->cond_condmode); + } + ++ pipe_mutex_unlock(nv50->screen->base.push_mutex); + nv50->dirty_3d |= NV50_NEW_3D_FRAMEBUFFER | NV50_NEW_3D_SCISSOR; } - -@@ -524,9 +541,12 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, +@@ -534,9 +551,12 @@ unsigned i, j, k; uint32_t mode = 0; @@ -934,7 +911,7 @@ index fbb5129..164ec72 100644 /* We have to clear ALL of the layers, not up to the min number of layers * of any attachment. */ -@@ -592,6 +612,7 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, +@@ -602,6 +622,7 @@ /* restore the array mode */ BEGIN_NV04(push, NV50_3D(RT_ARRAY_MODE), 1); PUSH_DATA (push, nv50->rt_array_mode); @@ -942,7 +919,7 @@ index fbb5129..164ec72 100644 } static void -@@ -719,14 +740,18 @@ nv50_clear_buffer(struct pipe_context *pipe, +@@ -729,14 +750,18 @@ assert(size % data_size == 0); @@ -962,28 +939,28 @@ index fbb5129..164ec72 100644 } elements = size / data_size; -@@ -742,8 +767,10 @@ nv50_clear_buffer(struct pipe_context *pipe, +@@ -752,8 +777,10 @@ PUSH_DATAf(push, color.f[2]); PUSH_DATAf(push, color.f[3]); -- if (nouveau_pushbuf_space(push, 32, 1, 0)) -+ if (nouveau_pushbuf_space(push, 32, 1, 0)) { +- if (nouveau_pushbuf_space(push, 64, 1, 0)) ++ if (nouveau_pushbuf_space(push, 64, 1, 0)) { + pipe_mutex_unlock(nv50->screen->base.push_mutex); return; + } PUSH_REFN(push, buf->bo, buf->domain | NOUVEAU_BO_WR); -@@ -798,6 +825,8 @@ nv50_clear_buffer(struct pipe_context *pipe, +@@ -807,6 +834,8 @@ + nv50_clear_buffer_push(pipe, res, offset, width * data_size, data, data_size); } - -+ pipe_mutex_unlock(nv50->screen->base.push_mutex); + ++ pipe_mutex_unlock(nv50->screen->base.push_mutex); + nv50->dirty_3d |= NV50_NEW_3D_FRAMEBUFFER | NV50_NEW_3D_SCISSOR; } - -@@ -1714,6 +1743,8 @@ nv50_blit(struct pipe_context *pipe, const struct pipe_blit_info *info) +@@ -1724,6 +1753,8 @@ info->src.box.height != -info->dst.box.height)) eng3d = true; @@ -992,7 +969,7 @@ index fbb5129..164ec72 100644 if (nv50->screen->num_occlusion_queries_active) { BEGIN_NV04(push, NV50_3D(SAMPLECNT_ENABLE), 1); PUSH_DATA (push, 0); -@@ -1728,6 +1759,8 @@ nv50_blit(struct pipe_context *pipe, const struct pipe_blit_info *info) +@@ -1738,6 +1769,8 @@ BEGIN_NV04(push, NV50_3D(SAMPLECNT_ENABLE), 1); PUSH_DATA (push, 1); } @@ -1001,11 +978,9 @@ index fbb5129..164ec72 100644 } static void -diff --git a/src/gallium/drivers/nouveau/nv50/nv50_transfer.c b/src/gallium/drivers/nouveau/nv50/nv50_transfer.c -index 8209f1f..c751ade 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_transfer.c -@@ -304,6 +304,7 @@ nv50_miptree_transfer_map(struct pipe_context *pctx, +@@ -304,6 +304,7 @@ unsigned base = tx->rect[0].base; unsigned z = tx->rect[0].z; unsigned i; @@ -1013,7 +988,7 @@ index 8209f1f..c751ade 100644 for (i = 0; i < box->depth; ++i) { nv50_m2mf_transfer_rect(nv50, &tx->rect[1], &tx->rect[0], tx->nblocksx, tx->nblocksy); -@@ -313,6 +314,9 @@ nv50_miptree_transfer_map(struct pipe_context *pctx, +@@ -313,6 +314,9 @@ tx->rect[0].base += mt->layer_stride; tx->rect[1].base += size; } @@ -1023,7 +998,7 @@ index 8209f1f..c751ade 100644 tx->rect[0].z = z; tx->rect[0].base = base; tx->rect[1].base = 0; -@@ -349,6 +353,7 @@ nv50_miptree_transfer_unmap(struct pipe_context *pctx, +@@ -349,6 +353,7 @@ unsigned i; if (tx->base.usage & PIPE_TRANSFER_WRITE) { @@ -1031,7 +1006,7 @@ index 8209f1f..c751ade 100644 for (i = 0; i < tx->base.box.depth; ++i) { nv50_m2mf_transfer_rect(nv50, &tx->rect[0], &tx->rect[1], tx->nblocksx, tx->nblocksy); -@@ -362,6 +367,7 @@ nv50_miptree_transfer_unmap(struct pipe_context *pctx, +@@ -362,6 +367,7 @@ /* Allow the copies above to finish executing before freeing the source */ nouveau_fence_work(nv50->screen->base.fence.current, nouveau_fence_unref_bo, tx->rect[1].bo); @@ -1039,11 +1014,11 @@ index 8209f1f..c751ade 100644 } else { nouveau_bo_ref(NULL, &tx->rect[1].bo); } -diff --git a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c -index a11cdf8..f73329c 100644 + + --- a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c -@@ -767,6 +767,8 @@ nv50_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) +@@ -767,6 +767,8 @@ bool tex_dirty = false; int s; @@ -1052,7 +1027,7 @@ index a11cdf8..f73329c 100644 /* NOTE: caller must ensure that (min_index + index_bias) is >= 0 */ nv50->vb_elt_first = info->min_index + info->index_bias; nv50->vb_elt_limit = info->max_index - info->min_index; -@@ -827,6 +829,7 @@ nv50_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) +@@ -827,6 +829,7 @@ nv50_push_vbo(nv50, info); push->kick_notify = nv50_default_kick_notify; nouveau_pushbuf_bufctx(push, NULL); @@ -1060,18 +1035,19 @@ index a11cdf8..f73329c 100644 return; } -@@ -886,4 +889,6 @@ nv50_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) +@@ -886,4 +889,6 @@ nv50_release_user_vbufs(nv50); nouveau_pushbuf_bufctx(push, NULL); +-} + + pipe_mutex_unlock(nv50->screen->base.push_mutex); - } -diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c -index 10a4c83..53a0711 100644 ++} + + --- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c -@@ -423,13 +423,17 @@ void +@@ -424,13 +424,17 @@ nvc0_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info) { struct nvc0_context *nvc0 = nvc0_context(pipe); @@ -1089,18 +1065,17 @@ index 10a4c83..53a0711 100644 return; } -@@ -497,4 +501,6 @@ nvc0_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info) +@@ -498,4 +502,6 @@ nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_SUF); nvc0->dirty_cp |= NVC0_NEW_CP_SURFACES; nvc0->images_dirty[5] |= nvc0->images_valid[5]; +-} + + pipe_mutex_unlock(screen->base.push_mutex); - } -diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c -index 1137e6c..28d6fec 100644 ++} --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c -@@ -38,7 +38,9 @@ nvc0_flush(struct pipe_context *pipe, +@@ -38,7 +38,9 @@ if (fence) nouveau_fence_ref(screen->fence.current, (struct nouveau_fence **)fence); @@ -1110,7 +1085,7 @@ index 1137e6c..28d6fec 100644 nouveau_context_update_frame_stats(&nvc0->base); } -@@ -48,8 +50,10 @@ nvc0_texture_barrier(struct pipe_context *pipe) +@@ -48,8 +50,10 @@ { struct nouveau_pushbuf *push = nvc0_context(pipe)->base.pushbuf; @@ -1121,16 +1096,16 @@ index 1137e6c..28d6fec 100644 } static void -@@ -59,6 +63,8 @@ nvc0_memory_barrier(struct pipe_context *pipe, unsigned flags) +@@ -58,6 +62,8 @@ + struct nvc0_context *nvc0 = nvc0_context(pipe); struct nouveau_pushbuf *push = nvc0->base.pushbuf; int i, s; - -+ pipe_mutex_lock(nvc0_context(pipe)->screen->base.push_mutex); + ++ pipe_mutex_lock(nvc0_context(pipe)->screen->base.push_mutex); + if (flags & PIPE_BARRIER_MAPPED_BUFFER) { for (i = 0; i < nvc0->num_vtxbufs; ++i) { - if (!nvc0->vtxbuf[i].buffer) -@@ -108,6 +114,8 @@ nvc0_memory_barrier(struct pipe_context *pipe, unsigned flags) +@@ -108,6 +114,8 @@ nvc0->cb_dirty = true; if (flags & (PIPE_BARRIER_VERTEX_BUFFER | PIPE_BARRIER_INDEX_BUFFER)) nvc0->base.vbo_dirty = true; @@ -1139,7 +1114,7 @@ index 1137e6c..28d6fec 100644 } static void -@@ -124,6 +132,7 @@ nvc0_emit_string_marker(struct pipe_context *pipe, const char *str, int len) +@@ -124,6 +132,7 @@ data_words = string_words; else data_words = string_words + !!(len & 3); @@ -1147,7 +1122,7 @@ index 1137e6c..28d6fec 100644 BEGIN_NIC0(push, SUBC_3D(NV04_GRAPH_NOP), data_words); if (string_words) PUSH_DATAp(push, str, string_words); -@@ -132,6 +141,7 @@ nvc0_emit_string_marker(struct pipe_context *pipe, const char *str, int len) +@@ -132,6 +141,7 @@ memcpy(&data, &str[string_words * 4], len & 3); PUSH_DATA (push, data); } @@ -1155,7 +1130,7 @@ index 1137e6c..28d6fec 100644 } static void -@@ -362,6 +372,8 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) +@@ -365,6 +375,8 @@ return NULL; pipe = &nvc0->base.pipe; @@ -1164,7 +1139,7 @@ index 1137e6c..28d6fec 100644 if (!nvc0_blitctx_create(nvc0)) goto out_err; -@@ -465,9 +477,12 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) +@@ -468,9 +480,12 @@ util_dynarray_init(&nvc0->global_residents); @@ -1177,11 +1152,9 @@ index 1137e6c..28d6fec 100644 if (nvc0) { if (nvc0->bufctx_3d) nouveau_bufctx_del(&nvc0->bufctx_3d); -diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h -index f6d535a..f169b7f 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h -@@ -294,6 +294,11 @@ uint32_t nvc0_program_symbol_offset(const struct nvc0_program *, +@@ -299,6 +299,11 @@ uint32_t label); void nvc0_program_init_tcp_empty(struct nvc0_context *); @@ -1193,11 +1166,9 @@ index f6d535a..f169b7f 100644 /* nvc0_shader_state.c */ void nvc0_vertprog_validate(struct nvc0_context *); void nvc0_tctlprog_validate(struct nvc0_context *); -diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c -index 91fb72f..55d1dc1 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c -@@ -92,7 +92,7 @@ nvc0_get_query_result_resource(struct pipe_context *pipe, +@@ -92,7 +92,7 @@ index, resource, offset); } @@ -1206,7 +1177,7 @@ index 91fb72f..55d1dc1 100644 nvc0_render_condition(struct pipe_context *pipe, struct pipe_query *pq, boolean condition, uint mode) -@@ -161,6 +161,16 @@ nvc0_render_condition(struct pipe_context *pipe, +@@ -161,6 +161,16 @@ PUSH_DATA (push, hq->bo->offset + hq->offset); } @@ -1223,7 +1194,7 @@ index 91fb72f..55d1dc1 100644 int nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen, unsigned id, -@@ -272,6 +282,6 @@ nvc0_init_query_functions(struct nvc0_context *nvc0) +@@ -272,6 +282,6 @@ pipe->get_query_result = nvc0_get_query_result; pipe->get_query_result_resource = nvc0_get_query_result_resource; pipe->set_active_query_state = nvc0_set_active_query_state; @@ -1231,11 +1202,9 @@ index 91fb72f..55d1dc1 100644 + pipe->render_condition = nvc0_render_condition_locked; nvc0->cond_condmode = NVC0_3D_COND_MODE_ALWAYS; } -diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c -index 4c34593..f2584cb 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c -@@ -154,6 +154,7 @@ nvc0_hw_begin_query(struct nvc0_context *nvc0, struct nvc0_query *q) +@@ -154,6 +154,7 @@ } hq->sequence++; @@ -1243,7 +1212,7 @@ index 4c34593..f2584cb 100644 switch (q->type) { case PIPE_QUERY_OCCLUSION_COUNTER: case PIPE_QUERY_OCCLUSION_PREDICATE: -@@ -198,6 +199,7 @@ nvc0_hw_begin_query(struct nvc0_context *nvc0, struct nvc0_query *q) +@@ -198,6 +199,7 @@ default: break; } @@ -1251,7 +1220,7 @@ index 4c34593..f2584cb 100644 hq->state = NVC0_HW_QUERY_STATE_ACTIVE; return ret; } -@@ -221,6 +223,7 @@ nvc0_hw_end_query(struct nvc0_context *nvc0, struct nvc0_query *q) +@@ -221,6 +223,7 @@ } hq->state = NVC0_HW_QUERY_STATE_ENDED; @@ -1259,7 +1228,7 @@ index 4c34593..f2584cb 100644 switch (q->type) { case PIPE_QUERY_OCCLUSION_COUNTER: case PIPE_QUERY_OCCLUSION_PREDICATE: -@@ -276,6 +279,7 @@ nvc0_hw_end_query(struct nvc0_context *nvc0, struct nvc0_query *q) +@@ -276,6 +279,7 @@ default: break; } @@ -1267,7 +1236,7 @@ index 4c34593..f2584cb 100644 if (hq->is64bit) nouveau_fence_ref(nvc0->screen->base.fence.current, &hq->fence); } -@@ -298,16 +302,21 @@ nvc0_hw_get_query_result(struct nvc0_context *nvc0, struct nvc0_query *q, +@@ -298,16 +302,21 @@ nvc0_hw_query_update(nvc0->screen->base.client, q); if (hq->state != NVC0_HW_QUERY_STATE_READY) { @@ -1290,7 +1259,7 @@ index 4c34593..f2584cb 100644 NOUVEAU_DRV_STAT(&nvc0->screen->base, query_sync_count, 1); } hq->state = NVC0_HW_QUERY_STATE_READY; -@@ -374,6 +383,8 @@ nvc0_hw_get_query_result_resource(struct nvc0_context *nvc0, +@@ -374,6 +383,8 @@ assert(!hq->funcs || !hq->funcs->get_query_result); @@ -1299,7 +1268,7 @@ index 4c34593..f2584cb 100644 if (index == -1) { /* TODO: Use a macro to write the availability of the query */ if (hq->state != NVC0_HW_QUERY_STATE_READY) -@@ -382,6 +393,7 @@ nvc0_hw_get_query_result_resource(struct nvc0_context *nvc0, +@@ -382,6 +393,7 @@ nvc0->base.push_cb(&nvc0->base, buf, offset, result_type >= PIPE_QUERY_TYPE_I64 ? 2 : 1, ready); @@ -1307,7 +1276,7 @@ index 4c34593..f2584cb 100644 return; } -@@ -469,6 +481,8 @@ nvc0_hw_get_query_result_resource(struct nvc0_context *nvc0, +@@ -469,6 +481,8 @@ 4 | NVC0_IB_ENTRY_1_NO_PREFETCH); } @@ -1316,11 +1285,9 @@ index 4c34593..f2584cb 100644 if (buf->mm) { nouveau_fence_ref(nvc0->screen->base.fence.current, &buf->fence); nouveau_fence_ref(nvc0->screen->base.fence.current, &buf->fence_wr); -diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c -index 27cbbc4..d416e00 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c -@@ -1662,6 +1662,7 @@ nve4_hw_sm_begin_query(struct nvc0_context *nvc0, struct nvc0_hw_query *hq) +@@ -1662,6 +1662,7 @@ return false; } @@ -1328,7 +1295,7 @@ index 27cbbc4..d416e00 100644 assert(cfg->num_counters <= 4); PUSH_SPACE(push, 4 * 8 * + 6); -@@ -1710,6 +1711,7 @@ nve4_hw_sm_begin_query(struct nvc0_context *nvc0, struct nvc0_hw_query *hq) +@@ -1710,6 +1711,7 @@ BEGIN_NVC0(push, NVE4_CP(MP_PM_SET(c)), 1); PUSH_DATA (push, 0); } @@ -1336,7 +1303,7 @@ index 27cbbc4..d416e00 100644 return true; } -@@ -1733,6 +1735,7 @@ nvc0_hw_sm_begin_query(struct nvc0_context *nvc0, struct nvc0_hw_query *hq) +@@ -1733,6 +1735,7 @@ return false; } @@ -1344,7 +1311,7 @@ index 27cbbc4..d416e00 100644 assert(cfg->num_counters <= 8); PUSH_SPACE(push, 8 * 8 + 2); -@@ -1779,6 +1782,7 @@ nvc0_hw_sm_begin_query(struct nvc0_context *nvc0, struct nvc0_hw_query *hq) +@@ -1779,6 +1782,7 @@ BEGIN_NVC0(push, NVC0_CP(MP_PM_SET(c)), 1); PUSH_DATA (push, 0); } @@ -1352,7 +1319,7 @@ index 27cbbc4..d416e00 100644 return true; } -@@ -1866,6 +1870,7 @@ nvc0_hw_sm_end_query(struct nvc0_context *nvc0, struct nvc0_hw_query *hq) +@@ -1866,6 +1870,7 @@ if (unlikely(!screen->pm.prog)) screen->pm.prog = nvc0_hw_sm_get_program(screen); @@ -1360,7 +1327,7 @@ index 27cbbc4..d416e00 100644 /* disable all counting */ PUSH_SPACE(push, 8); for (c = 0; c < 8; ++c) -@@ -1893,6 +1898,7 @@ nvc0_hw_sm_end_query(struct nvc0_context *nvc0, struct nvc0_hw_query *hq) +@@ -1893,6 +1898,7 @@ /* upload input data for the compute shader which reads MP counters */ nvc0_hw_sm_upload_input(nvc0, hq); @@ -1368,7 +1335,7 @@ index 27cbbc4..d416e00 100644 pipe->bind_compute_state(pipe, screen->pm.prog); for (i = 0; i < 3; i++) { -@@ -1906,6 +1912,7 @@ nvc0_hw_sm_end_query(struct nvc0_context *nvc0, struct nvc0_hw_query *hq) +@@ -1906,6 +1912,7 @@ nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_QUERY); @@ -1376,7 +1343,7 @@ index 27cbbc4..d416e00 100644 /* re-activate other counters */ PUSH_SPACE(push, 16); mask = 0; -@@ -1930,6 +1937,7 @@ nvc0_hw_sm_end_query(struct nvc0_context *nvc0, struct nvc0_hw_query *hq) +@@ -1930,6 +1937,7 @@ PUSH_DATA (push, (cfg->ctr[i].func << 4) | cfg->ctr[i].mode); } } @@ -1384,11 +1351,9 @@ index 27cbbc4..d416e00 100644 } static inline bool -diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c -index e0bfd3b..2a36d42 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c -@@ -494,7 +494,9 @@ nvc0_screen_destroy(struct pipe_screen *pscreen) +@@ -507,7 +507,9 @@ * _current_ one, and remove both. */ nouveau_fence_ref(screen->base.fence.current, ¤t); @@ -1398,11 +1363,9 @@ index e0bfd3b..2a36d42 100644 nouveau_fence_ref(NULL, ¤t); nouveau_fence_ref(NULL, &screen->base.fence.current); } -diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c -index 7556e71..8a965fce 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c -@@ -206,11 +206,14 @@ nvc0_resource_copy_region(struct pipe_context *pipe, +@@ -206,11 +206,14 @@ bool m2mf; unsigned dst_layer = dstz, src_layer = src_box->z; @@ -1417,7 +1380,7 @@ index 7556e71..8a965fce 100644 return; } NOUVEAU_DRV_STAT(&nvc0->screen->base, tex_copy_count, 1); -@@ -251,6 +254,7 @@ nvc0_resource_copy_region(struct pipe_context *pipe, +@@ -251,6 +254,7 @@ else srect.base += src_mt->layer_stride; } @@ -1425,7 +1388,7 @@ index 7556e71..8a965fce 100644 return; } -@@ -273,6 +277,7 @@ nvc0_resource_copy_region(struct pipe_context *pipe, +@@ -273,6 +277,7 @@ break; } nouveau_bufctx_reset(nvc0->bufctx, 0); @@ -1433,7 +1396,7 @@ index 7556e71..8a965fce 100644 } static void -@@ -290,8 +295,12 @@ nvc0_clear_render_target(struct pipe_context *pipe, +@@ -291,8 +296,12 @@ assert(dst->texture->target != PIPE_BUFFER); @@ -1447,8 +1410,8 @@ index 7556e71..8a965fce 100644 PUSH_REFN (push, res->bo, res->domain | NOUVEAU_BO_WR); -@@ -354,6 +363,8 @@ nvc0_clear_render_target(struct pipe_context *pipe, - IMMED_NVC0(push, NVC0_3D(COND_MODE), nvc0->cond_condmode); +@@ -357,6 +366,8 @@ + IMMED_NVC0(push, NVC0_3D(COND_MODE), nvc0->cond_condmode); nvc0->dirty_3d |= NVC0_NEW_3D_FRAMEBUFFER; + @@ -1456,7 +1419,7 @@ index 7556e71..8a965fce 100644 } static void -@@ -539,8 +550,11 @@ nvc0_clear_buffer(struct pipe_context *pipe, +@@ -542,8 +553,11 @@ assert(size % data_size == 0); @@ -1468,7 +1431,7 @@ index 7556e71..8a965fce 100644 return; } -@@ -550,8 +564,10 @@ nvc0_clear_buffer(struct pipe_context *pipe, +@@ -553,8 +567,10 @@ nvc0_clear_buffer_push(pipe, res, offset, fixup_size, data, data_size); offset += fixup_size; size -= fixup_size; @@ -1480,7 +1443,7 @@ index 7556e71..8a965fce 100644 } elements = size / data_size; -@@ -561,8 +577,10 @@ nvc0_clear_buffer(struct pipe_context *pipe, +@@ -564,8 +580,10 @@ width &= ~0xff; assert(width > 0); @@ -1492,7 +1455,7 @@ index 7556e71..8a965fce 100644 PUSH_REFN (push, buf->bo, buf->domain | NOUVEAU_BO_WR); -@@ -610,6 +628,8 @@ nvc0_clear_buffer(struct pipe_context *pipe, +@@ -613,6 +631,8 @@ } nvc0->dirty_3d |= NVC0_NEW_3D_FRAMEBUFFER; @@ -1501,7 +1464,7 @@ index 7556e71..8a965fce 100644 } static void -@@ -631,8 +651,11 @@ nvc0_clear_depth_stencil(struct pipe_context *pipe, +@@ -635,8 +655,11 @@ assert(dst->texture->target != PIPE_BUFFER); @@ -1514,8 +1477,8 @@ index 7556e71..8a965fce 100644 PUSH_REFN (push, mt->base.bo, mt->base.domain | NOUVEAU_BO_WR); -@@ -679,6 +702,8 @@ nvc0_clear_depth_stencil(struct pipe_context *pipe, - IMMED_NVC0(push, NVC0_3D(COND_MODE), nvc0->cond_condmode); +@@ -685,6 +708,8 @@ + IMMED_NVC0(push, NVC0_3D(COND_MODE), nvc0->cond_condmode); nvc0->dirty_3d |= NVC0_NEW_3D_FRAMEBUFFER; + @@ -1523,7 +1486,7 @@ index 7556e71..8a965fce 100644 } void -@@ -692,9 +717,13 @@ nvc0_clear(struct pipe_context *pipe, unsigned buffers, +@@ -698,9 +723,13 @@ unsigned i, j, k; uint32_t mode = 0; @@ -1538,7 +1501,7 @@ index 7556e71..8a965fce 100644 if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) { BEGIN_NVC0(push, NVC0_3D(CLEAR_COLOR(0)), 4); -@@ -753,6 +782,8 @@ nvc0_clear(struct pipe_context *pipe, unsigned buffers, +@@ -759,6 +788,8 @@ (j << NVC0_3D_CLEAR_BUFFERS_LAYER__SHIFT)); } } @@ -1547,7 +1510,7 @@ index 7556e71..8a965fce 100644 } -@@ -1157,8 +1188,8 @@ nvc0_blitctx_post_blit(struct nvc0_blitctx *blit) +@@ -1163,8 +1194,8 @@ nvc0->samplers_dirty[4] |= 3; if (nvc0->cond_query && !blit->render_condition_enable) @@ -1558,7 +1521,7 @@ index 7556e71..8a965fce 100644 nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_VTX_TMP); nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_FB); -@@ -1620,6 +1651,8 @@ nvc0_blit(struct pipe_context *pipe, const struct pipe_blit_info *info) +@@ -1626,6 +1657,8 @@ if (info->num_window_rectangles > 0 || info->window_rectangle_include) eng3d = true; @@ -1567,20 +1530,18 @@ index 7556e71..8a965fce 100644 if (nvc0->screen->num_occlusion_queries_active) IMMED_NVC0(push, NVC0_3D(SAMPLECNT_ENABLE), 0); -@@ -1631,6 +1664,8 @@ nvc0_blit(struct pipe_context *pipe, const struct pipe_blit_info *info) +@@ -1636,6 +1669,8 @@ + if (nvc0->screen->num_occlusion_queries_active) IMMED_NVC0(push, NVC0_3D(SAMPLECNT_ENABLE), 1); - -+ pipe_mutex_unlock(nvc0->screen->base.push_mutex); + ++ pipe_mutex_unlock(nvc0->screen->base.push_mutex); + NOUVEAU_DRV_STAT(&nvc0->screen->base, tex_blit_count, 1); } - -diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c b/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c -index 14fb53c..6cb39a9 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c -@@ -342,16 +342,18 @@ nvc0_mt_sync(struct nvc0_context *nvc0, struct nv50_miptree *mt, unsigned usage) +@@ -342,16 +342,18 @@ return !mt->base.fence_wr || nouveau_fence_wait(mt->base.fence_wr, &nvc0->base.debug); } @@ -1607,7 +1568,7 @@ index 14fb53c..6cb39a9 100644 struct nv50_miptree *mt = nv50_miptree(res); struct nvc0_transfer *tx; uint32_t size; -@@ -465,9 +467,29 @@ nvc0_miptree_transfer_map(struct pipe_context *pctx, +@@ -465,9 +467,29 @@ return tx->rect[1].bo->map; } @@ -1640,7 +1601,7 @@ index 14fb53c..6cb39a9 100644 { struct nvc0_context *nvc0 = nvc0_context(pctx); struct nvc0_transfer *tx = (struct nvc0_transfer *)transfer; -@@ -507,6 +529,18 @@ nvc0_miptree_transfer_unmap(struct pipe_context *pctx, +@@ -507,6 +529,18 @@ FREE(tx); } @@ -1659,11 +1620,11 @@ index 14fb53c..6cb39a9 100644 /* This happens rather often with DTD9/st. */ static void nvc0_cb_push(struct nouveau_context *nv, -diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c -index 4e40ff5..cae621c 100644 + + --- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c -@@ -940,6 +940,8 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) +@@ -940,6 +940,8 @@ struct nvc0_screen *screen = nvc0->screen; int s; @@ -1672,7 +1633,7 @@ index 4e40ff5..cae621c 100644 /* NOTE: caller must ensure that (min_index + index_bias) is >= 0 */ nvc0->vb_elt_first = info->min_index + info->index_bias; nvc0->vb_elt_limit = info->max_index - info->min_index; -@@ -1033,6 +1035,7 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) +@@ -1033,6 +1035,7 @@ nvc0_push_vbo(nvc0, info); push->kick_notify = nvc0_default_kick_notify; nouveau_pushbuf_bufctx(push, NULL); @@ -1680,17 +1641,16 @@ index 4e40ff5..cae621c 100644 return; } -@@ -1085,4 +1088,5 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) +@@ -1085,4 +1088,5 @@ nvc0_release_user_vbufs(nvc0); nouveau_pushbuf_bufctx(push, NULL); +-} + pipe_mutex_unlock(screen->base.push_mutex); - } -diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c -index 27301a1..1c0528c 100644 ++} --- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c +++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c -@@ -530,12 +530,15 @@ void +@@ -604,11 +604,14 @@ nve4_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info) { struct nvc0_context *nvc0 = nvc0_context(pipe); @@ -1700,15 +1660,16 @@ index 27301a1..1c0528c 100644 uint64_t desc_gpuaddr; struct nouveau_bo *desc_bo; int ret; - -+ pipe_mutex_lock(screen->base.push_mutex); + ++ pipe_mutex_lock(screen->base.push_mutex); + desc = nve4_compute_alloc_launch_desc(&nvc0->base, &desc_bo, &desc_gpuaddr); if (!desc) { - ret = -1; -@@ -616,6 +619,7 @@ nve4_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info) +@@ -690,6 +693,7 @@ NOUVEAU_ERR("Failed to launch grid !\n"); nouveau_scratch_done(&nvc0->base); nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_DESC); + pipe_mutex_unlock(screen->base.push_mutex); -} \ No newline at end of file + } + + diff --git a/x11/library/mesa/files/2733e5483e1c2b80e4b0ae21187ec5e3e1579397.diff b/x11/library/mesa/files/N_02-nouveau-more-locking-make-sure-that-fence-work-is-always-done-with-the-push-mutex-acquired.patch similarity index 81% rename from x11/library/mesa/files/2733e5483e1c2b80e4b0ae21187ec5e3e1579397.diff rename to x11/library/mesa/files/N_02-nouveau-more-locking-make-sure-that-fence-work-is-always-done-with-the-push-mutex-acquired.patch index 46ad03d16e..5cc8f148e4 100644 --- a/x11/library/mesa/files/2733e5483e1c2b80e4b0ae21187ec5e3e1579397.diff +++ b/x11/library/mesa/files/N_02-nouveau-more-locking-make-sure-that-fence-work-is-always-done-with-the-push-mutex-acquired.patch @@ -1,5 +1,23 @@ +From: Ilia Mirkin +Date: Mon Jun 6 20:30:48 2016 -0400 +Subject: [PATCH 2/5]nouveau: more locking - make sure that fence work is always done with the push mutex acquired +Patch-mainline: N/A +References: boo#997171 +Signed-off-by: Max Staudt + +Cherry-picked from 2733e5483e1c2b80e4b0ae21187ec5e3e1579397 + at https://github.com/imirkin/mesa.git + +Signed-off-by: Max Staudt +--- + src/gallium/drivers/nouveau/nouveau_buffer.c | 4 ++++ + src/gallium/drivers/nouveau/nv50/nv50_miptree.c | 7 +++++-- + src/gallium/drivers/nouveau/nv50/nv50_query_hw.c | 5 ++++- + src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c | 5 ++++- + 4 files changed, 17 insertions(+), 4 deletions(-) + diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c -index 58fa453..a006e9f 100644 +index b54c19b..a5a06cf 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -80,6 +80,8 @@ release_allocation(struct nouveau_mm_allocation **mm, @@ -12,12 +30,12 @@ index 58fa453..a006e9f 100644 nouveau_fence_work(buf->fence, nouveau_fence_unref_bo, buf->bo); buf->bo = NULL; @@ -89,6 +91,8 @@ nouveau_buffer_release_gpu_storage(struct nv04_resource *buf) - + if (buf->mm) release_allocation(&buf->mm, buf->fence); + if (buf->fence) + pipe_mutex_unlock(buf->fence->screen->push_mutex); - + if (buf->domain == NOUVEAU_BO_VRAM) NOUVEAU_DRV_STAT_RES(buf, buf_obj_current_bytes_vid, -(uint64_t)buf->base.width0); diff --git a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c @@ -27,7 +45,7 @@ index 7450119..38e4faf 100644 @@ -163,10 +163,13 @@ nv50_miptree_destroy(struct pipe_screen *pscreen, struct pipe_resource *pt) { struct nv50_miptree *mt = nv50_miptree(pt); - + - if (mt->base.fence && mt->base.fence->state < NOUVEAU_FENCE_STATE_FLUSHED) + if (mt->base.fence && mt->base.fence->state < NOUVEAU_FENCE_STATE_FLUSHED) { + pipe_mutex_lock(nouveau_screen(pscreen)->push_mutex); @@ -37,7 +55,7 @@ index 7450119..38e4faf 100644 + } else { nouveau_bo_ref(NULL, &mt->base.bo); + } - + nouveau_fence_ref(NULL, &mt->base.fence); nouveau_fence_ref(NULL, &mt->base.fence_wr); diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c b/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c @@ -75,4 +93,4 @@ index f2584cb..4b51a67 100644 + } } } -if (size) { \ No newline at end of file + if (size) { diff --git a/x11/library/mesa/files/940b3a773f264f3f52574160f0d06c48f8e8aeb2.diff b/x11/library/mesa/files/N_03-nv30-locking-fixes.patch similarity index 83% rename from x11/library/mesa/files/940b3a773f264f3f52574160f0d06c48f8e8aeb2.diff rename to x11/library/mesa/files/N_03-nv30-locking-fixes.patch index b4cbcaca36..36dda63bc3 100644 --- a/x11/library/mesa/files/940b3a773f264f3f52574160f0d06c48f8e8aeb2.diff +++ b/x11/library/mesa/files/N_03-nv30-locking-fixes.patch @@ -1,11 +1,27 @@ +From: Ilia Mirkin +Date: Tue Jun 21 22:59:50 2016 -0400 +Subject: [PATCH 3/5]nv30 locking fixes +Patch-mainline: N/A +References: boo#997171 +Signed-off-by: Max Staudt + +Cherry-picked from 940b3a773f264f3f52574160f0d06c48f8e8aeb2 + at https://github.com/imirkin/mesa.git + +Signed-off-by: Max Staudt +--- + src/gallium/drivers/nouveau/nv30/nv30_draw.c | 20 ++++++++++++++++++-- + src/gallium/drivers/nouveau/nv30/nv30_fragprog.c | 4 ++++ + 2 files changed, 22 insertions(+), 2 deletions(-) + diff --git a/src/gallium/drivers/nouveau/nv30/nv30_draw.c b/src/gallium/drivers/nouveau/nv30/nv30_draw.c -index 10c9f56..c5761a3 100644 +index 7b0d074..1c71534 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_draw.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_draw.c @@ -127,6 +127,8 @@ nv30_render_draw_elements(struct vbuf_render *render, struct nouveau_pushbuf *push = nv30->screen->base.pushbuf; unsigned i; - + + pipe_mutex_lock(nv30->screen->base.push_mutex); + BEGIN_NV04(push, NV30_3D(VTXBUF(0)), r->vertex_info.num_attribs); @@ -14,13 +30,13 @@ index 10c9f56..c5761a3 100644 @@ -134,8 +136,10 @@ nv30_render_draw_elements(struct vbuf_render *render, NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, NV30_3D_VTXBUF_DMA1); } - + - if (!nv30_state_validate(nv30, ~0, false)) + if (!nv30_state_validate(nv30, ~0, false)) { + pipe_mutex_unlock(nv30->screen->base.push_mutex); return; + } - + BEGIN_NV04(push, NV30_3D(VERTEX_BEGIN_END), 1); PUSH_DATA (push, r->prim); @@ -160,6 +164,8 @@ nv30_render_draw_elements(struct vbuf_render *render, @@ -30,12 +46,12 @@ index 10c9f56..c5761a3 100644 + + pipe_mutex_unlock(nv30->screen->base.push_mutex); } - + static void @@ -172,6 +178,8 @@ nv30_render_draw_arrays(struct vbuf_render *render, unsigned start, uint nr) unsigned ps = fn + (pn ? 1 : 0); unsigned i; - + + pipe_mutex_lock(nv30->screen->base.push_mutex); + BEGIN_NV04(push, NV30_3D(VTXBUF(0)), r->vertex_info.num_attribs); @@ -44,13 +60,13 @@ index 10c9f56..c5761a3 100644 @@ -179,8 +187,10 @@ nv30_render_draw_arrays(struct vbuf_render *render, unsigned start, uint nr) NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, NV30_3D_VTXBUF_DMA1); } - + - if (!nv30_state_validate(nv30, ~0, false)) + if (!nv30_state_validate(nv30, ~0, false)) { + pipe_mutex_unlock(nv30->screen->base.push_mutex); return; + } - + BEGIN_NV04(push, NV30_3D(VERTEX_BEGIN_END), 1); PUSH_DATA (push, r->prim); @@ -197,6 +207,8 @@ nv30_render_draw_arrays(struct vbuf_render *render, unsigned start, uint nr) @@ -60,21 +76,21 @@ index 10c9f56..c5761a3 100644 + + pipe_mutex_unlock(nv30->screen->base.push_mutex); } - + static void -@@ -386,6 +398,8 @@ nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) - +@@ -383,6 +395,8 @@ nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) + nv30_render_validate(nv30); - + + pipe_mutex_unlock(nv30->screen->base.push_mutex); + if (nv30->draw_dirty & NV30_NEW_VIEWPORT) draw_set_viewport_states(draw, 0, 1, &nv30->viewport); if (nv30->draw_dirty & NV30_NEW_RASTERIZER) -@@ -451,6 +465,8 @@ nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) +@@ -448,6 +462,8 @@ nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) if (transfer[i]) pipe_buffer_unmap(pipe, transfer[i]); - + + pipe_mutex_lock(nv30->screen->base.push_mutex); + nv30->draw_dirty = 0; @@ -87,18 +103,18 @@ index 6de61bc..fd21f99 100644 @@ -38,6 +38,8 @@ nv30_fragprog_upload(struct nv30_context *nv30) struct nv30_fragprog *fp = nv30->fragprog.program; struct pipe_context *pipe = &nv30->base.pipe; - + + pipe_mutex_unlock(nv->screen->push_mutex); + if (unlikely(!fp->buffer)) fp->buffer = pipe_buffer_create(pipe->screen, 0, 0, fp->insn_len * 4); - + @@ -60,6 +62,8 @@ nv30_fragprog_upload(struct nv30_context *nv30) - + if (nv04_resource(fp->buffer)->domain != NOUVEAU_BO_VRAM) nouveau_buffer_migrate(nv, nv04_resource(fp->buffer), NOUVEAU_BO_VRAM); + + pipe_mutex_lock(nv->screen->push_mutex); } - -void \ No newline at end of file + + void diff --git a/x11/library/mesa/files/N_04-nv50-Fix-double-lock-in-nv50_hw_sm_get_query_result.patch b/x11/library/mesa/files/N_04-nv50-Fix-double-lock-in-nv50_hw_sm_get_query_result.patch new file mode 100644 index 0000000000..796f5a9ff8 --- /dev/null +++ b/x11/library/mesa/files/N_04-nv50-Fix-double-lock-in-nv50_hw_sm_get_query_result.patch @@ -0,0 +1,24 @@ +From: Max Staudt +Date: Wed Oct 5 18:49:41 2016 +0200 +Subject: [PATCH 4/5]nv50: Fix double lock in nv50_hw_sm_get_query_result() +Patch-mainline: N/A +References: boo#997171 +Signed-off-by: Max Staudt + +Signed-off-by: Max Staudt +--- + src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c b/src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c +index 31445eb..acc64ac 100644 +--- a/src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c ++++ b/src/gallium/drivers/nouveau/nv50/nv50_query_hw_sm.c +@@ -351,7 +351,7 @@ nv50_hw_sm_get_query_result(struct nv50_context *nv50, struct nv50_hw_query *hq, + + pipe_mutex_lock(nv50->screen->base.push_mutex); + ret = nv50_hw_sm_query_read_data(count, nv50, wait, hq, cfg, mp_count); +- pipe_mutex_lock(nv50->screen->base.push_mutex); ++ pipe_mutex_unlock(nv50->screen->base.push_mutex); + if (!ret) + return false; \ No newline at end of file diff --git a/x11/library/mesa/files/N_05-Use-nv50_render_condition-in-nv50_blitctx_post_blit.patch b/x11/library/mesa/files/N_05-Use-nv50_render_condition-in-nv50_blitctx_post_blit.patch new file mode 100644 index 0000000000..fd9ad2e337 --- /dev/null +++ b/x11/library/mesa/files/N_05-Use-nv50_render_condition-in-nv50_blitctx_post_blit.patch @@ -0,0 +1,29 @@ +From: Max Staudt +Date: Wed Oct 5 18:51:38 2016 +0200 +Subject: [PATCH 5/5]Use nv50_render_condition() in nv50_blitctx_post_blit() +Patch-mainline: N/A +References: boo#997171 +Signed-off-by: Max Staudt + +Analogous to what happens in nvc0_blitctx_post_blit() + +Signed-off-by: Max Staudt +--- + src/gallium/drivers/nouveau/nv50/nv50_surface.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c +index d6b9de0..36cd72b 100644 +--- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c ++++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c +@@ -1328,8 +1328,8 @@ nv50_blitctx_post_blit(struct nv50_blitctx *blit) + nv50->samplers[2][1] = blit->saved.sampler[1]; + + if (nv50->cond_query && !blit->render_condition_enable) +- nv50->base.pipe.render_condition(&nv50->base.pipe, nv50->cond_query, +- nv50->cond_cond, nv50->cond_mode); ++ nv50_render_condition(&nv50->base.pipe, nv50->cond_query, ++ nv50->cond_cond, nv50->cond_mode); + + nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_3D_FB); + nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_3D_TEXTURES); diff --git a/x11/library/mesa/files/n_Define-GLAPIVAR-separate-from-GLAPI.patch b/x11/library/mesa/files/n_Define-GLAPIVAR-separate-from-GLAPI.patch new file mode 100644 index 0000000000..92816bc9cf --- /dev/null +++ b/x11/library/mesa/files/n_Define-GLAPIVAR-separate-from-GLAPI.patch @@ -0,0 +1,40 @@ +From: Egbert Eich +Date: Fri Mar 11 13:29:43 2016 +0100 +Subject: [PATCH]Define GLAPIVAR separate from GLAPI +Patch-mainline: never +Git-commit: 88dda160564c8c23cb533b0eb258404f1687a2e8 + +References: bsc# +Signed-off-by: Egbert Eich + +GLAPI doesn't contain 'extern' in some environments. +This is needed for variables (GLw). + +Signed-off-by: Egbert Eich +--- + Mesa-10.0.3/include/GL/gl.h | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/include/GL/gl.h b/Mesa-10.0.3/include/GL/gl.h +index b484b96..5189008 100644 +--- a/include/GL/gl.h ++++ b/include/GL/gl.h +@@ -59,6 +59,7 @@ + #elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) + # define GLAPI __attribute__((visibility("default"))) + # define GLAPIENTRY ++# define GLAPIVAR extern GLAPI + #endif /* WIN32 && !CYGWIN */ + + /* +@@ -80,6 +81,10 @@ + #define GLAPI extern + #endif + ++#ifndef GLAPIVAR ++#define GLAPIVAR extern ++#endif ++ + #ifndef GLAPIENTRY + #define GLAPIENTRY + #endif diff --git a/x11/library/mesa/files/n_VDPAU-XVMC-libs-Replace-hardlinks-with-copies.patch b/x11/library/mesa/files/n_VDPAU-XVMC-libs-Replace-hardlinks-with-copies.patch new file mode 100644 index 0000000000..ac7c79c9d0 --- /dev/null +++ b/x11/library/mesa/files/n_VDPAU-XVMC-libs-Replace-hardlinks-with-copies.patch @@ -0,0 +1,52 @@ +From a9af1af5f1f9aa9fdea9e73135a92f053478f849 Mon Sep 17 00:00:00 2001 +From: Stefan Dirsch +Date: Wed, 20 Jan 2016 16:10:15 +0100 +Subject: [PATCH] VDPAU/XVMC libs: Replace hardlinks with copies + +Since these are packaged separately in (open)SUSE anyway, one can use +copies as well. This makes debug packages possible again. (bnc #962609) + +Signed-off-by: Stefan Dirsch +--- + src/gallium/targets/vdpau/Makefile.am | 4 ++-- + src/gallium/targets/xvmc/Makefile.am | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/gallium/targets/vdpau/Makefile.am b/src/gallium/targets/vdpau/Makefile.am +index d388f8b..c9cc534 100644 +--- a/src/gallium/targets/vdpau/Makefile.am ++++ b/src/gallium/targets/vdpau/Makefile.am +@@ -86,7 +86,7 @@ all-local: $(vdpau_LTLIBRARIES) + j=libvdpau_gallium.$(LIB_EXT); \ + k=libvdpau_$${i}.$(LIB_EXT); \ + l=$${k}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0; \ +- ln -f .libs/$${j}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0 \ ++ cp -a .libs/$${j}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0 \ + $${link_dir}/$${l}; \ + ln -sf $${l} \ + $${link_dir}/$${k}.$(VDPAU_MAJOR).$(VDPAU_MINOR); \ +@@ -111,7 +111,7 @@ install-data-hook: + j=libvdpau_gallium.$(LIB_EXT); \ + k=libvdpau_$${i}.$(LIB_EXT); \ + l=$${k}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0; \ +- ln -f $${dest_dir}/$${j}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0 \ ++ cp -a $${dest_dir}/$${j}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0 \ + $${dest_dir}/$${l}; \ + ln -sf $${l} \ + $${dest_dir}/$${k}.$(VDPAU_MAJOR).$(VDPAU_MINOR); \ +diff --git a/src/gallium/targets/xvmc/Makefile.am b/src/gallium/targets/xvmc/Makefile.am +index fdc5f4b..93ef230 100644 +--- a/src/gallium/targets/xvmc/Makefile.am ++++ b/src/gallium/targets/xvmc/Makefile.am +@@ -73,7 +73,7 @@ install-data-hook: + j=libXvMCgallium.$(LIB_EXT); \ + k=libXvMC$${i}.$(LIB_EXT); \ + l=$${k}.$(XVMC_MAJOR).$(XVMC_MINOR).0; \ +- ln -f $${dest_dir}/$${j}.$(XVMC_MAJOR).$(XVMC_MINOR).0 \ ++ cp -a $${dest_dir}/$${j}.$(XVMC_MAJOR).$(XVMC_MINOR).0 \ + $${dest_dir}/$${l}; \ + ln -sf $${l} \ + $${dest_dir}/$${k}.$(XVMC_MAJOR).$(XVMC_MINOR); \ +-- +2.6.2 + diff --git a/x11/library/mesa/pspec.xml b/x11/library/mesa/pspec.xml index 793141170f..c1eed0f69d 100644 --- a/x11/library/mesa/pspec.xml +++ b/x11/library/mesa/pspec.xml @@ -40,9 +40,13 @@ libxshmfence-devel - - 2733e5483e1c2b80e4b0ae21187ec5e3e1579397.diff - 940b3a773f264f3f52574160f0d06c48f8e8aeb2.diff + n_VDPAU-XVMC-libs-Replace-hardlinks-with-copies.patch + n_Define-GLAPIVAR-separate-from-GLAPI.patch + N_01-WIP-nouveau-add-locking.patch + N_02-nouveau-more-locking-make-sure-that-fence-work-is-always-done-with-the-push-mutex-acquired.patch + N_03-nv30-locking-fixes.patch + N_04-nv50-Fix-double-lock-in-nv50_hw_sm_get_query_result.patch + N_05-Use-nv50_render_condition-in-nv50_blitctx_post_blit.patch @@ -177,7 +181,7 @@ - 2017-02-12 + 2017-02-15 13.0.4 llvm rebuild Alihan Öztürk