Currently only fully implemented for nvc0. General approach is to make a more stricter use of the *_context object and give each contexts its own pushbuffer, nouveau_client and fence list. This allows us to do some screen operations with the context pushbuf as well (like resizing the text area or bind a cb).
I am still not quite sure about all the things I changed, but it seems to work quite nicely and doesn't change anything for single context applications. And still only uses one hardware context as we did before. Fixes related crashes in: * chromium (general experience is much better, especially when doing webgl stuff) * qtwebengine (distros shipped patches with some env var to force enable with nouveau) * dolphin (async ubershaders, needs code change) * Warsow (needs some flag to force enable it) Things I would like others to test: * video players (using OpenGL _and_ VDPAU) * other applications which randomly crashes related to this Karol Herbst (7): nouveau: include all compile dependencies for nouveau_context.h nouveau: extract nouveau_context functions into a new file nv50,nvc0: simplify screen.fence nouveau: access client and pushbuf from context directly WIP: buffered shader printing nouveau: make fence API independent from nouveau_screen WIP: per context fences/pushbuf src/gallium/drivers/nouveau/Makefile.sources | 1 + src/gallium/drivers/nouveau/codegen/nv50_ir.h | 1 + .../drivers/nouveau/codegen/nv50_ir_print.cpp | 67 ++++++++----- .../drivers/nouveau/codegen/nv50_ir_util.h | 1 + src/gallium/drivers/nouveau/meson.build | 1 + src/gallium/drivers/nouveau/nouveau_buffer.c | 47 ++++----- src/gallium/drivers/nouveau/nouveau_buffer.h | 2 +- src/gallium/drivers/nouveau/nouveau_context.c | 50 ++++++++++ src/gallium/drivers/nouveau/nouveau_context.h | 22 ++--- src/gallium/drivers/nouveau/nouveau_fence.c | 96 +++++++++---------- src/gallium/drivers/nouveau/nouveau_fence.h | 41 ++++++-- src/gallium/drivers/nouveau/nouveau_screen.c | 26 ++--- src/gallium/drivers/nouveau/nouveau_screen.h | 12 +-- .../drivers/nouveau/nv30/nv30_context.c | 8 +- src/gallium/drivers/nouveau/nv30/nv30_draw.c | 4 +- .../drivers/nouveau/nv30/nv30_miptree.c | 2 +- .../drivers/nouveau/nv30/nv30_screen.c | 17 ++-- src/gallium/drivers/nouveau/nv30/nv30_vbo.c | 2 +- .../drivers/nouveau/nv50/nv50_compute.c | 6 +- .../drivers/nouveau/nv50/nv50_context.c | 12 +-- .../drivers/nouveau/nv50/nv50_miptree.c | 2 +- .../drivers/nouveau/nv50/nv50_query_hw.c | 6 +- .../drivers/nouveau/nv50/nv50_screen.c | 24 ++--- .../drivers/nouveau/nv50/nv50_screen.h | 1 - .../drivers/nouveau/nv50/nv50_transfer.c | 4 +- src/gallium/drivers/nouveau/nv50/nv50_vbo.c | 4 +- .../drivers/nouveau/nvc0/nvc0_context.c | 80 +++++++++++----- .../drivers/nouveau/nvc0/nvc0_context.h | 4 + .../drivers/nouveau/nvc0/nvc0_program.c | 2 +- .../drivers/nouveau/nvc0/nvc0_query_hw.c | 18 ++-- .../drivers/nouveau/nvc0/nvc0_screen.c | 43 ++++----- .../drivers/nouveau/nvc0/nvc0_screen.h | 12 ++- .../nouveau/nvc0/nvc0_state_validate.c | 8 +- .../drivers/nouveau/nvc0/nvc0_transfer.c | 8 +- src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c | 6 +- 35 files changed, 377 insertions(+), 263 deletions(-) create mode 100644 src/gallium/drivers/nouveau/nouveau_context.c -- 2.19.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev