[Mesa-dev] [PATCH] anv: Stall before fast-clear operations
During initial CCS bring-up, I discovered that you have to do a full CS stall prior to doing a CCS resolve as well as afterwards. It appears that the same is needed for fast-clears as well. This fixes rendering corruptions on The Talos Principal on Sky Lake GT4. The issue hasn't been demonstrated on any other hardware however, given that this appears to be a "too many things in the pipe" problem, having it be easier to reproduce on a system with more EUs makes sense. The issues with resolves is demonstrable on a GT3 or GT2 so this is probably also a problem on all GTs. Cc: "13.0 17.0"--- src/intel/vulkan/anv_blorp.c | 25 +++-- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index 049b38d..41966d6 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -1132,6 +1132,25 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer) if (att_state->fast_clear) { surf.clear_color = vk_to_isl_color(att_state->clear_value.color); + /* From the Sky Lake PRM Vol. 7, "Render Target Fast Clear": + * + *"After Render target fast clear, pipe-control with color cache + *write-flush must be issued before sending any DRAW commands on + *that render target." + * + * This comment is a bit cryptic and doesn't really tell you what's + * going or what's really needed. It appears that fast clear ops are + * not properly synchronized with other drawing. This means that we + * cannot have a fast clear operation in the pipe at the same time as + * other regular drawing operations. We need to use a PIPE_CONTROL + * to ensure that the contents of the previous draw hit the render + * target before we resolve and then use a second PIPE_CONTROL after + * the resolve to ensure that it is completed before any additional + * drawing occurs. + */ + cmd_buffer->state.pending_pipe_bits |= +ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT | ANV_PIPE_CS_STALL_BIT; + blorp_fast_clear(, , iview->isl.format, iview->isl.base_level, iview->isl.base_array_layer, fb->layers, @@ -1139,12 +1158,6 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer) render_area.offset.x + render_area.extent.width, render_area.offset.y + render_area.extent.height); - /* From the Sky Lake PRM Vol. 7, "Render Target Fast Clear": - * - *"After Render target fast clear, pipe-control with color cache - *write-flush must be issued before sending any DRAW commands on - *that render target." - */ cmd_buffer->state.pending_pipe_bits |= ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT | ANV_PIPE_CS_STALL_BIT; } else { -- 2.5.0.400.gff86faf ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100073] Shader Disk Cache 32/64 bit detection has a flaw. Missed existence of x32 ABI
https://bugs.freedesktop.org/show_bug.cgi?id=100073 --- Comment #25 from oia...@gmail.com --- (In reply to Emil Velikov from comment #24) > On 10 March 2017 at 18:51, Steven Newburywrote: > > On Fri, 2017-03-10 at 13:27 +, bugzilla-dae...@freedesktop.org > > wrote: > >> Comment # 23 on bug 100073 from Grazvydas Ignotas > >> (In reply to oiaohm from comment #21) > >> > This is why I am so upset. As soon as this comes though I have > >> possible > >> > trouble with miss matched mesa versions crossing with each other in > >> a cache > >> > directory and being hard to debug. > >> That will only happen if you force the same modify timestamp on > >> several > >> variations of mesa that are built for matching pointer size. Do you > >> really > >> think it's likely to happen in practice? > > > > I believe that's exactly what happens with reproducible builds: > > https://reproducible-builds.org/ > > > Take another look - there's nothing which mentions or suggests that > the binaries must have the same timestamps. > The rule of the game is to produce identical binaries, which is true > even when we had the timestamp file. > > And if you're in doubt, do try it on your end - the instructions and > package(s) will help you double-check ;-) > > -Emil https://reproducible-builds.org/docs/timestamps/ I gave this link before you need to read it. SOURCE_DATE_EPOCH is what you are told to use for time stamp values inside source code. That is not complier or arch unique. You will be facing libfaketime or equal methods that freeze the clock at SOURCE_DATE_EPOCH to catch cases of developers who have done the wrong thing. If you look into the existing package on debian that are built multi arch as reproducible builds you will already see many cases where they are the same source the binary files have the exact identical timestamps on them. https://packages.debian.org/stretch/mesa-utils >From here download the amd64 and the arm64 check timestamps on the files and they are absolutely identical. In fact you can pick any arch in the list there and they are all 23 December 2016 at 1:58 I could go right to the second identical. So there is no way to split architecture on timestamp it does not work in the existing real world. I know don't want to depend on build system. I have a nightmare multi arch support means you need something like the GNU triplet. With complier variation like llvm having __ILP32__ for i386 and gcc not and win32 and win64 defined in visual studio at the same time and so on. Cannot use C macros to solve this effectively. Runtime Detection also end up in a huge mountain of code that ends up buggy as all get out due to the C macro issues need to pick between different arch detections. Next part is complete hell where llvm can throw error because it finding never used code. There is no promise that gcc will not add dead code detection. Basically the first lot of code is complier dependant that I complained about as being wrong. To make runtime detection be running the right detections you are back to the build system providing something like a GNU triplet. What is usable is hash the binary that will cost a lot of cpu time or used the GNU triplet from the build system and SOURCE_DATE_EPOCH as 1 value. Last modification time of the source is the SOURCE_DATE_EPOCH or should be. So any patches to source should change that value as long as the party doing it right. Please note due to mesa being MIT license it lack a clause that GPL where modified source must update timestamp. That limits the effectiveness of using SOURCE_DATE_EPOCH. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 99591] Segmentation fault when running vulkaninfo with RADV Radeon Vulkan driver
https://bugs.freedesktop.org/show_bug.cgi?id=99591 --- Comment #7 from Jure Repinc--- (In reply to Mike Lothian from comment #6) > Out of interest was LLVM compiled with LTO? I was seeing segfaults with > vulkaninfo and I found recompiling llvm without LTO fixed things for me I'm afraid I don't know. It is LLVM supplied by openSUSE Tumbleweed. Is there any way to check if it was compiled with LTO? -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100091] Failure to create folder for on-disk shader cache
https://bugs.freedesktop.org/show_bug.cgi?id=100091 --- Comment #21 from John--- (In reply to Emil Velikov from comment #20) > I would really appreciate if one can spend 2 minutes and test the patch in > question. Pretty please ? > > Do move/prune your cache and let me know if you still get the "---disabled" > message(s). I still do get these (and the different folders). -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 12/24] radeonsi: set readnone on reads from read-only memory
On Fri, Mar 10, 2017 at 11:03 PM, Constantine Kharlamovwrote: > > On 26.02.2017 02:58, Marek Olšák wrote: >> From: Marek Olšák >> >> --- >> src/amd/common/ac_llvm_build.c | 11 +-- >> src/amd/common/ac_llvm_build.h | 3 ++- >> src/gallium/drivers/radeonsi/si_shader.c | 20 ++-- >> 3 files changed, 21 insertions(+), 13 deletions(-) >> >> diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c >> index 42965b6..f0ab9cb 100644 >> --- a/src/amd/common/ac_llvm_build.c >> +++ b/src/amd/common/ac_llvm_build.c >> @@ -612,21 +612,22 @@ ac_build_tbuffer_store_dwords(struct ac_llvm_context >> *ctx, >> >> LLVMValueRef >> ac_build_buffer_load(struct ac_llvm_context *ctx, >>LLVMValueRef rsrc, >>int num_channels, >>LLVMValueRef vindex, >>LLVMValueRef voffset, >>LLVMValueRef soffset, >>unsigned inst_offset, >>unsigned glc, >> - unsigned slc) >> + unsigned slc, >> + bool readonly_memory) >> { >> unsigned func = CLAMP(num_channels, 1, 3) - 1; >> >> if (HAVE_LLVM >= 0x309) { >> LLVMValueRef args[] = { >> LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""), >> vindex ? vindex : LLVMConstInt(ctx->i32, 0, 0), >> LLVMConstInt(ctx->i32, inst_offset, 0), >> LLVMConstInt(ctx->i1, glc, 0), >> LLVMConstInt(ctx->i1, slc, 0) >> @@ -644,21 +645,27 @@ ac_build_buffer_load(struct ac_llvm_context *ctx, >> >> if (soffset) { >> args[2] = LLVMBuildAdd(ctx->builder, args[2], soffset, >> ""); >> } >> >> snprintf(name, sizeof(name), "llvm.amdgcn.buffer.load.%s", >>type_names[func]); >> >> return ac_emit_llvm_intrinsic(ctx, name, types[func], args, >> - ARRAY_SIZE(args), >> AC_FUNC_ATTR_READONLY); >> + ARRAY_SIZE(args), >> + /* READNONE means writes can't >> +* affect it, while READONLY >> means >> +* that writes can affect it. */ >> + readonly_memory ? >> + AC_FUNC_ATTR_READNONE : >> + AC_FUNC_ATTR_READONLY); > > You probably swapped the arguments, i.e. when "readonly_memory == true", > you're passing AC_FUNC_ATTR_READNONE instead of AC_FUNC_ATTR_READONLY. I'm sure I didn't. The flag is readonly_*memory*, but the attribute describes the intrinsic, not the memory. By telling LLVM that the intrinsic doesn't read memory, LLVM can assume that memory writes won't affect it. That's exactly what we want for read-only memory. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [libdrm PATCH] intel: Make unsynchronized GTT mappings work on systems with snooping.
On systems without LLC, drm_intel_gem_bo_map_unsynchronized() has had the surprising behavior of doing a synchronized GTT mapping. This is obviously not what the user of the API wanted. Eric left a comment indicating a valid concern: if the CPU and GPU caches are incoherent, we don't keep track of where the user last mapped the buffer, and what caches might contain relevant data. Modern Atom systems still don't have LLC, but they do offer snooping, which effectively makes the caches coherent. The kernel appears to set up the PTE/PPAT to enable snooping for everything where the cache level is not I915_CACHE_NONE. As far as I know, only scanout buffers are marked as uncached. Any buffers used by scanout should be flagged as non-reusable with drm_intel_bo_disable_reuse(), prime export, or flink. So, we can assume that any reusable buffer should be snooped. This patch enables unsynchronized mappings for reusable buffers on all Gen6+ hardware (which have either LLC or snooping). On Broxton, this improves the performance of Unigine Valley 1.0 on Low settings at 1280x720 by about 45%, and Unigine Heaven 4.0 (same settings) by about 53%. Signed-off-by: Kenneth GraunkeCc: Chris Wilson Cc: mesa-dev@lists.freedesktop.org --- intel/intel_bufmgr_gem.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) It looks like Mesa and Beignet are the only callers of this function (SNA and Anvil don't use libdrm, UXA and vaapi don't use this function.) This passed our full barrage of Piglit/dEQP/GLCTS/GLESCTS testing. gnome-shell still works, as does Unigine, and GLBenchmark. I haven't tested any OpenCL workloads. diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index e260f2dc..f53f1fcc 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -1630,9 +1630,7 @@ int drm_intel_gem_bo_map_unsynchronized(drm_intel_bo *bo) { drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; -#ifdef HAVE_VALGRIND drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; -#endif int ret; /* If the CPU cache isn't coherent with the GTT, then use a @@ -1641,8 +1639,12 @@ drm_intel_gem_bo_map_unsynchronized(drm_intel_bo *bo) * terms of drm_intel_bo_map vs drm_intel_gem_bo_map_gtt, so * we would potentially corrupt the buffer even when the user * does reasonable things. +* +* The caches are coherent on LLC platforms or snooping is enabled +* for the BO. The kernel enables snooping for non-scanout (reusable) +* buffers on modern non-LLC systems. */ - if (!bufmgr_gem->has_llc) + if (bufmgr_gem->gen < 6 || !bo_gem->reusable) return drm_intel_gem_bo_map_gtt(bo); pthread_mutex_lock(_gem->lock); -- 2.12.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 99591] Segmentation fault when running vulkaninfo with RADV Radeon Vulkan driver
https://bugs.freedesktop.org/show_bug.cgi?id=99591 Mike Lothianchanged: What|Removed |Added CC||m...@fireburn.co.uk --- Comment #6 from Mike Lothian --- Out of interest was LLVM compiled with LTO? I was seeing segfaults with vulkaninfo and I found recompiling llvm without LTO fixed things for me -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 99987] Mesa 13+ breaks Xvnc (and similar X servers)
https://bugs.freedesktop.org/show_bug.cgi?id=99987 Dennis Schriddechanged: What|Removed |Added CC||devuran...@gmx.net -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 99591] Segmentation fault when running vulkaninfo with RADV Radeon Vulkan driver
https://bugs.freedesktop.org/show_bug.cgi?id=99591 --- Comment #5 from Jure Repinc--- I'm not sure if this helps but here is some steping by instructions in GDB: Temporary breakpoint 6, main () at main.cpp:82 82 HelloTriangleApplication app; (gdb) c Continuing. Breakpoint 3, radv_lookup_entrypoint (name=0x75dcdd00 "vkCreateInstance") at radv_entrypoints.c:933 933if (strcmp(name, strings + e->name) != 0) (gdb) where #0 radv_lookup_entrypoint (name=0x75dcdd00 "vkCreateInstance") at radv_entrypoints.c:933 #1 0x75db3616 in loader_scanned_icd_add (api_version=4194307, filename=0x7fffd590 "/usr/lib64/libvulkan_radeon.so", icd_tramp_list=0x7fffda20, inst=0x0) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/loader/loader.c:1565 #2 loader_icd_scan (inst=inst@entry=0x0, icd_tramp_list=icd_tramp_list@entry=0x7fffda20) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/loader/loader.c:3177 #3 0x75dbc317 in vkEnumerateInstanceExtensionProperties (pLayerName=0x0, pPropertyCount=0x7fffda84, pProperties=0x0) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/loader/trampoline.c:159 #4 0x77bc62cd in _glfwInitVulkan () at /usr/src/debug/glfw-3.2.1/src/vulkan.c:82 #5 0x77bc65ca in _glfwInitVulkan () at /usr/src/debug/glfw-3.2.1/src/vulkan.c:228 #6 glfwGetRequiredInstanceExtensions (count=0x7fffdb2c) at /usr/src/debug/glfw-3.2.1/src/vulkan.c:220 #7 0x004018b2 in HelloTriangleApplication::createInstance (this=0x7fffdc20) at main.cpp:60 #8 0x004017d2 in HelloTriangleApplication::initVulkan (this=0x7fffdc20) at main.cpp:34 #9 0x0040174e in HelloTriangleApplication::run (this=0x7fffdc20) at main.cpp:18 #10 0x00401597 in main () at main.cpp:85 (gdb) dis disable disassemble disconnect display (gdb) dis disable disassemble disconnect display (gdb) disassemble Dump of assembler code for function radv_lookup_entrypoint: 0x73976b60 <+0>: push %rbx 0x73976b61 <+1>: movsbl (%rdi),%edx 0x73976b64 <+4>: test %dl,%dl 0x73976b66 <+6>: je 0x73976bee 0x73976b6c <+12>:mov%rdi,%rcx 0x73976b6f <+15>:xor%eax,%eax 0x73976b71 <+17>:nopl 0x0(%rax) 0x73976b78 <+24>:imul $0x4ca9b7,%eax,%eax 0x73976b7e <+30>:add$0x1,%rcx 0x73976b82 <+34>:add%edx,%eax 0x73976b84 <+36>:movsbl (%rcx),%edx 0x73976b87 <+39>:test %dl,%dl 0x73976b89 <+41>:jne0x73976b78 0x73976b8b <+43>:lea0xce38e(%rip),%rcx# 0x73a44f20 0x73976b92 <+50>:movzbl %al,%edx 0x73976b95 <+53>:movzwl (%rcx,%rdx,2),%ebx 0x73976b99 <+57>:mov%eax,%edx 0x73976b9b <+59>:lea0xce57e(%rip),%rsi# 0x73a45120 0x73976ba2 <+66>:lea0xce377(%rip),%r8# 0x73a44f20 0x73976ba9 <+73>:jmp0x73976bc3 0x73976bab <+75>:nopl 0x0(%rax,%rax,1) 0x73976bb0 <+80>:mov%ebx,%ecx 0x73976bb2 <+82>:add$0x13,%edx 0x73976bb5 <+85>:cmp0x4(%rsi,%rcx,8),%eax 0x73976bb9 <+89>:je 0x73976bd0 0x73976bbb <+91>:movzbl %dl,%ecx 0x73976bbe <+94>:movzwl (%r8,%rcx,2),%ebx 0x73976bc3 <+99>:cmp$0x,%ebx 0x73976bc9 <+105>: jne0x73976bb0 0x73976bcb <+107>: xor%eax,%eax 0x73976bcd <+109>: pop%rbx 0x73976bce <+110>: retq 0x73976bcf <+111>: nop => 0x73976bd0 <+112>: mov(%rsi,%rcx,8),%esi 0x73976bd3 <+115>: lea0xceb26(%rip),%rax# 0x73a45700 0x73976bda <+122>: add%rax,%rsi 0x73976bdd <+125>: callq 0x73974dc0 0x73976be2 <+130>: test %eax,%eax 0x73976be4 <+132>: jne0x73976bcb 0x73976be6 <+134>: mov%ebx,%edi ---Type to continue, or q to quit--- 0x73976be8 <+136>: pop%rbx 0x73976be9 <+137>: jmpq 0x73976b50 0x73976bee <+142>: mov$0x44,%ebx 0x73976bf3 <+147>: xor%eax,%eax 0x73976bf5 <+149>: jmp0x73976b99 End of assembler dump. (gdb) c Continuing. Breakpoint 3, radv_lookup_entrypoint (name=0x75dd0640 "vkEnumerateInstanceExtensionProperties") at radv_entrypoints.c:933 933if (strcmp(name, strings + e->name) != 0) (gdb) disassemble Dump of assembler code for function
[Mesa-dev] [Bug 100091] Failure to create folder for on-disk shader cache
https://bugs.freedesktop.org/show_bug.cgi?id=100091 --- Comment #20 from Emil Velikov--- (In reply to John from comment #18) > (In reply to Emil Velikov from comment #16) > > Some ideas: > > - a non-timestamp better solution might be applicable/in the works > > (guessing here) > > A simple workaround would be to use a combination of the timestamp and the > binary's name (or anything else that identifies the binary, the checksum > wouldn't work as it'd change with each build), and allow more than one base > folder. > > So instead of: > ~/.cache/mesa/1488874151_1488872775 > then overwritten by > ~/.cache/mesa/1488874150_1488872775 > > we'd have: > ~/.cache/mesa/radeonsi_dri_1488874151_1488872775 > and > ~/.cache/mesa/d3dadapter9_1488874150_1488872775 > > or > ~/.cache/mesa/radeonsi_dri/1488874151_1488872775 > and > ~/.cache/mesa/d3dadapter9/1488874150_1488872775 I would really appreciate if one can spend 2 minutes and test the patch in question. Pretty please ? Do move/prune your cache and let me know if you still get the "---disabled" message(s). -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100091] Failure to create folder for on-disk shader cache
https://bugs.freedesktop.org/show_bug.cgi?id=100091 --- Comment #19 from Emil Velikov--- (In reply to Michel Dänzer from comment #17) > Emil, I don't think there's any mystery anymore given comment 13 — the > different cache timestamps are due to *_dri.so and d3dadapter9.so.1.0.0 > having different timestamps. > IMHO the [file] source of the timestamps is not the bigger mystery, but why we end up with "no such file or directory...---disabling". Afaics that should _never_ happen. The only thing that comes to mind is that the "wrong" library/symbol gets picked to get the timestamp from. This may happen due to the dynamic-list we have for the dri module (and the fact that it lacks Bsymbolic). A trivial test is the patch attached. Tl;Dr; "---disabling." should _never_ kick-in. Drop any hacks and give the patch a try, please ? -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Moving i965 driver to genxml commands and structures
Hi! So I've decided to use the version I had typed out after revising your current patches. My version has more functions included and I saw some minor mistakes in the committed files. Of course, there is no guarantee that it is totally error-free, but I did do a couple passes with the documentation. -- Louis-Francis On Fri, 2017-03-03 at 10:37 -0800, Kenneth Graunke wrote: > On Friday, March 3, 2017 10:27:51 AM PST Kenneth Graunke wrote: > > On Friday, March 3, 2017 10:16:57 AM PST Jason Ekstrand wrote: > > > Also, you can find most of the gen4-5 XML here: > > > > > > https://cgit.freedesktop.org/~jekstrand/mesa/log/?h=wip/blorp-gen > > > 4 > > > > > > That should save you some typing. :-) > > > > I typed up Gen4-4.5 XML a few months ago, and Jason fixed a bunch > > of > > things, but we never landed it as we weren't using it for anything > > yet. > > I fixed a few more things beyond the above branch, and pushed what > > we > > have to master. Hopefully it saves you some effort. > > > > Gen5 XML is still missing. The Gen5 docs are in really bad shape, > > so it's probably trickier. > > > > Also, here's the code I started in case it's useful as a reference > > (it definitely won't apply anymore): > > https://cgit.freedesktop.org/~kwg/mesa/log/?h=brwxml > > > > and also the code Lionel started a while back, for reference: > > https://github.com/djdeath/mesa/commits/i965-genxml > > Also...in case the gen4-4.5 XML I pushed *isn't* useful, and you > already had a better version typed up...feel free to throw it out > and replace it with your copy. > > --Ken ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100093] configure: error: Package requirements (zlib >= 1.2.8) were not met:
https://bugs.freedesktop.org/show_bug.cgi?id=100093 Vinson Leechanged: What|Removed |Added Resolution|--- |WONTFIX Status|NEW |RESOLVED -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] intel: Correct the BDW surface state size
On Thu, Mar 09, 2017 at 08:18:25PM -0800, Kenneth Graunke wrote: > On Thursday, March 9, 2017 3:35:15 PM PST Nanley Chery wrote: > > The PRMs state that this packet is 16 DWORDS long. Ensure that the last > > three DWORDS are zeroed as required by the hardware when allocating a > > null surface state. > > > > Cc:> > Signed-off-by: Nanley Chery > > --- > > src/intel/isl/isl.c| 2 +- > > src/mesa/drivers/dri/i965/gen8_surface_state.c | 5 ++--- > > 2 files changed, 3 insertions(+), 4 deletions(-) > > > > diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c > > index 6eb1e93efd..b4bdf2059a 100644 > > --- a/src/intel/isl/isl.c > > +++ b/src/intel/isl/isl.c > > @@ -56,7 +56,7 @@ static const struct { > > [5] = {24, 32, 4}, > > [6] = {24, 32, 4}, > > [7] = {32, 32, 4, 24}, > > - [8] = {52, 64, 32, 40}, > > + [8] = {64, 64, 32, 40}, > > [9] = {64, 64, 32, 40}, > > }; > > > > diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c > > b/src/mesa/drivers/dri/i965/gen8_surface_state.c > > index 501531d4ad..f868293217 100644 > > --- a/src/mesa/drivers/dri/i965/gen8_surface_state.c > > +++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c > > @@ -46,10 +46,9 @@ static uint32_t * > > gen8_allocate_surface_state(struct brw_context *brw, > > uint32_t *out_offset, int index) > > { > > - int dwords = brw->gen >= 9 ? 16 : 13; > > uint32_t *surf = __brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, > > - dwords * 4, 64, index, out_offset); > > - memset(surf, 0, dwords * 4); > > + 64, 64, index, out_offset); > > + memset(surf, 0, 64); > > return surf; > > } > > > > > > Does this actually fix anything, or just use more batch space? > This doesn't fix anything that I know of, but it does make us follow the MBZ requirement for the last three dwords. Sorry for not giving the context of this change. I noticed this bug as I was updating the struct field for a series I'm currently working on. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 12/24] radeonsi: set readnone on reads from read-only memory
On 26.02.2017 02:58, Marek Olšák wrote: > From: Marek Olšák> > --- > src/amd/common/ac_llvm_build.c | 11 +-- > src/amd/common/ac_llvm_build.h | 3 ++- > src/gallium/drivers/radeonsi/si_shader.c | 20 ++-- > 3 files changed, 21 insertions(+), 13 deletions(-) > > diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c > index 42965b6..f0ab9cb 100644 > --- a/src/amd/common/ac_llvm_build.c > +++ b/src/amd/common/ac_llvm_build.c > @@ -612,21 +612,22 @@ ac_build_tbuffer_store_dwords(struct ac_llvm_context > *ctx, > > LLVMValueRef > ac_build_buffer_load(struct ac_llvm_context *ctx, >LLVMValueRef rsrc, >int num_channels, >LLVMValueRef vindex, >LLVMValueRef voffset, >LLVMValueRef soffset, >unsigned inst_offset, >unsigned glc, > - unsigned slc) > + unsigned slc, > + bool readonly_memory) > { > unsigned func = CLAMP(num_channels, 1, 3) - 1; > > if (HAVE_LLVM >= 0x309) { > LLVMValueRef args[] = { > LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""), > vindex ? vindex : LLVMConstInt(ctx->i32, 0, 0), > LLVMConstInt(ctx->i32, inst_offset, 0), > LLVMConstInt(ctx->i1, glc, 0), > LLVMConstInt(ctx->i1, slc, 0) > @@ -644,21 +645,27 @@ ac_build_buffer_load(struct ac_llvm_context *ctx, > > if (soffset) { > args[2] = LLVMBuildAdd(ctx->builder, args[2], soffset, > ""); > } > > snprintf(name, sizeof(name), "llvm.amdgcn.buffer.load.%s", >type_names[func]); > > return ac_emit_llvm_intrinsic(ctx, name, types[func], args, > - ARRAY_SIZE(args), > AC_FUNC_ATTR_READONLY); > + ARRAY_SIZE(args), > + /* READNONE means writes can't > +* affect it, while READONLY means > +* that writes can affect it. */ > + readonly_memory ? > + AC_FUNC_ATTR_READNONE : > + AC_FUNC_ATTR_READONLY); You probably swapped the arguments, i.e. when "readonly_memory == true", you're passing AC_FUNC_ATTR_READNONE instead of AC_FUNC_ATTR_READONLY. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100151] Front buffer drawing mode shows black window with gallium software rasterizers
https://bugs.freedesktop.org/show_bug.cgi?id=100151 --- Comment #4 from Pradeep Yadav--- Not able to clone mesa repository using git clone git://anongit.freedesktop.org/git/mesa/mesa . anongit.freedesktop.org is not responding. $ git clone git://anongit.freedesktop.org/git/mesa/mesa Cloning into 'mesa'... fatal: unable to connect to anongit.freedesktop.org: anongit.freedesktop.org[0: 131.252.210.161]: errno=Connection timed out anongit.freedesktop.org[1: 2610:10:20:722:a800:ff:fe24:61cf]: errno=Network is unreachable -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100151] Front buffer drawing mode shows black window with gallium software rasterizers
https://bugs.freedesktop.org/show_bug.cgi?id=100151 --- Comment #3 from Józef Kucia--- (In reply to Pradeep Yadav from comment #2) > Applied the patch attached with bug 99116 in Mesa 13.0.5 source code but can > still reproduce the problem. FWIW, your OpenGL program seems to work correctly here with llvmpipe in Mesa from git (17.0-branchpoint-1291-gb19caec). -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100151] Front buffer drawing mode shows black window with gallium software rasterizers
https://bugs.freedesktop.org/show_bug.cgi?id=100151 --- Comment #2 from Pradeep Yadav--- Applied the patch attached with bug 99116 in Mesa 13.0.5 source code but can still reproduce the problem. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] configure.ac: require pthread-stubs only where available
On 02/03/2017 19:02, Emil Velikov wrote: From: Emil VelikovThe project is a thing only for BSD platforms. Or in other words - for any other platforms building/installing pthread-stubs results only in a pthread-stub.pc file. And even where it provides a DSO, there's a fundamental design issue with it - see the pthread-stubs mailing list for the specifics. Cc: Jeremy Huddleston Sequoia CC: Gary Wong Cc: Randy Fishel Cc: Niveditha Rau Signed-off-by: Emil Velikov --- Jeremy, others, Afaict pthread-stubs expands to a simple .pc on your platforms, but a confirmation will be greatly appreciated. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a3d1a00bdd..e94e46a0b8 100644 --- a/configure.ac +++ b/configure.ac @@ -799,7 +799,7 @@ fi dnl pthread-stubs is mandatory on targets where it exists This comment could probably do with revising, since that test has almost the opposite meaning now, perhaps something like "don't bother linking with pthread-stubs when it's a no-op" case "$host_os" in -cygwin* ) +linux* | cygwin* | darwin* | solaris* | gnu*) pthread_stubs_possible="no" ;; * ) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] gbm: Introduce modifiers into surface/bo creation
On Thu, Mar 9, 2017 at 6:52 PM, Jason Ekstrandwrote: > On Thu, Mar 9, 2017 at 5:48 PM, Ben Widawsky wrote: > >> The idea behind modifiers like this is that the user of GBM will have >> some mechanism to query what properties the hardware supports for its BO >> or surface. This information is directly passed in (and stored) so that >> the DRI implementation can create an image with the appropriate >> attributes. >> >> A getter() will be added later so that the user GBM will be able to >> query what modifier should be used. >> >> Only in surface creation, the modifiers are stored until the BO is >> actually allocated. In regular buffer allocation, the correct modifier >> can (will be, in future patches be chosen at creation time. >> >> v2: Make sure to check if count is non-zero in addition to testing if >> calloc fails. (Daniel) >> >> v3: Remove "usage" and "flags" from modifier creation. Requested by >> Kristian. >> >> v4: Take advantage of the "INVALID" modifier added by the GET_PLANE2 >> series. >> >> v5: Don't bother with storing modifiers for gbm_bo_create because that's >> a synchronous operation and we can actually select the correct modifier >> at create time (done in a later patch) (Jason) >> >> Cc: Kristian Høgsberg >> Cc: Jason Ekstrand >> References (v4): https://lists.freedesktop.org/ >> archives/intel-gfx/2017-January/116636.html >> Signed-off-by: Ben Widawsky >> Reviewed-by: Eric Engestrom (v1) >> Acked-by: Daniel Stone >> --- >> src/egl/drivers/dri2/platform_drm.c | 19 --- >> src/gbm/backends/dri/gbm_dri.c | 42 >> ++-- >> src/gbm/gbm-symbols-check| 2 ++ >> src/gbm/main/gbm.c | 29 -- >> src/gbm/main/gbm.h | 12 + >> src/gbm/main/gbmint.h| 12 +++-- >> src/mesa/drivers/dri/i965/intel_screen.c | 18 ++ >> 7 files changed, 119 insertions(+), 15 deletions(-) >> >> diff --git a/src/egl/drivers/dri2/platform_drm.c >> b/src/egl/drivers/dri2/platform_drm.c >> index e5e8c60596..cf35ce8a1f 100644 >> --- a/src/egl/drivers/dri2/platform_drm.c >> +++ b/src/egl/drivers/dri2/platform_drm.c >> @@ -230,10 +230,21 @@ get_back_bo(struct dri2_egl_surface *dri2_surf) >> >> if (dri2_surf->back == NULL) >>return -1; >> - if (dri2_surf->back->bo == NULL) >> - dri2_surf->back->bo = gbm_bo_create(_dpy->gbm_dri->base.base, >> - surf->base.width, >> surf->base.height, >> - surf->base.format, >> surf->base.flags); >> + if (dri2_surf->back->bo == NULL) { >> + if (surf->base.modifiers) >> + dri2_surf->back->bo = gbm_bo_create_with_modifiers(& >> dri2_dpy->gbm_dri->base.base, >> + >> surf->base.width, surf->base.height, >> + >> surf->base.format, >> + >> surf->base.modifiers, >> + >> surf->base.count); >> + else >> + dri2_surf->back->bo = gbm_bo_create(_dpy->gbm_d >> ri->base.base, >> + surf->base.width, >> + surf->base.height, >> + surf->base.format, >> + surf->base.flags); >> + >> + } >> if (dri2_surf->back->bo == NULL) >>return -1; >> >> diff --git a/src/gbm/backends/dri/gbm_dri.c >> b/src/gbm/backends/dri/gbm_dri.c >> index 7106dc1229..d45ba94080 100644 >> --- a/src/gbm/backends/dri/gbm_dri.c >> +++ b/src/gbm/backends/dri/gbm_dri.c >> @@ -1023,13 +1023,20 @@ free_bo: >> static struct gbm_bo * >> gbm_dri_bo_create(struct gbm_device *gbm, >>uint32_t width, uint32_t height, >> - uint32_t format, uint32_t usage) >> + uint32_t format, uint32_t usage, >> + const uint64_t *modifiers, >> + const unsigned int count) >> { >> struct gbm_dri_device *dri = gbm_dri_device(gbm); >> struct gbm_dri_bo *bo; >> int dri_format; >> unsigned dri_use = 0; >> >> + /* Callers of this may specify a modifier, or a dri usage, but not >> both. The >> +* newer modifier interface deprecates the older usage flags. >> +*/ >> + assert(!(usage && count)); >> + >> if (usage & GBM_BO_USE_WRITE || dri->image == NULL) >>return create_dumb(gbm, width, height, format, usage); >> >> @@ -1087,11 +1094,21 @@ gbm_dri_bo_create(struct gbm_device *gbm, >> /* Gallium drivers requires shared in order to get the handle/stride >> */ >> dri_use |= __DRI_IMAGE_USE_SHARE; >> >> - bo->image = >> - dri->image->createImage(dri->screen, >> - width, height, >> - dri_format, dri_use, >> - bo); >> +
Re: [Mesa-dev] [PATCH v2 1/2] intel: genxml: add script to generate gzipped genxml
Quoting Lionel Landwerlin (2017-03-10 10:00:12) > v2 (from Dylan): >Add main function >Add missing Copyright >Use print_function > > Signed-off-by: Lionel Landwerlin> --- > src/intel/Makefile.genxml.am| 1 + > src/intel/genxml/gen_zipped_file.py | 29 + > 2 files changed, 30 insertions(+) > create mode 100755 src/intel/genxml/gen_zipped_file.py > > diff --git a/src/intel/Makefile.genxml.am b/src/intel/Makefile.genxml.am > index 20e4b15786..1866d7e2df 100644 > --- a/src/intel/Makefile.genxml.am > +++ b/src/intel/Makefile.genxml.am > @@ -60,4 +60,5 @@ EXTRA_DIST += \ > genxml/genX_pack.h \ > genxml/gen_macros.h \ > genxml/gen_pack_header.py \ > + genxml/gen_zipped_file.py \ > genxml/README > diff --git a/src/intel/genxml/gen_zipped_file.py > b/src/intel/genxml/gen_zipped_file.py > new file mode 100755 > index 00..a6e7b2717f > --- /dev/null > +++ b/src/intel/genxml/gen_zipped_file.py > @@ -0,0 +1,29 @@ > +#!/usr/bin/env python2 > +#encoding=utf-8 > +# > +# Copyright © 2017 Intel Corporation > +# Usually we also add the MIT text > + > +from __future__ import print_function > +import os > +import sys > +import zlib > + > +def main(): > +if len(sys.argv) < 2: > +print("No input xml file specified") > +sys.exit(1) > + > +with open(sys.argv[1]) as f: > +compressed_data = zlib.compress(f.read()) > + > +gen_name = os.path.splitext(os.path.basename(sys.argv[1]))[0] > +print("static const uint8_t %s_xml[] = {" % gen_name) > +print(" ") I think you want end='' on that last print > + > +for i, c in enumerate(compressed_data, start=1): > +print("0x%.2x, " % ord(c), end='\n ' if not i % 12 else '') > +print('\n};') > + > +if __name__ == '__main__': > +main() > -- > 2.11.0 Other than that it looks good, with those changes: Reviewed-by: Dylan Baker signature.asc Description: signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Bug 100073] Shader Disk Cache 32/64 bit detection has a flaw. Missed existence of x32 ABI
On 10 March 2017 at 18:51, Steven Newburywrote: > On Fri, 2017-03-10 at 13:27 +, bugzilla-dae...@freedesktop.org > wrote: >> Comment # 23 on bug 100073 from Grazvydas Ignotas >> (In reply to oiaohm from comment #21) >> > This is why I am so upset. As soon as this comes though I have >> possible >> > trouble with miss matched mesa versions crossing with each other in >> a cache >> > directory and being hard to debug. >> That will only happen if you force the same modify timestamp on >> several >> variations of mesa that are built for matching pointer size. Do you >> really >> think it's likely to happen in practice? > > I believe that's exactly what happens with reproducible builds: > https://reproducible-builds.org/ > Take another look - there's nothing which mentions or suggests that the binaries must have the same timestamps. The rule of the game is to produce identical binaries, which is true even when we had the timestamp file. And if you're in doubt, do try it on your end - the instructions and package(s) will help you double-check ;-) -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100073] Shader Disk Cache 32/64 bit detection has a flaw. Missed existence of x32 ABI
https://bugs.freedesktop.org/show_bug.cgi?id=100073 --- Comment #24 from Emil Velikov--- On 10 March 2017 at 18:51, Steven Newbury wrote: > On Fri, 2017-03-10 at 13:27 +, bugzilla-dae...@freedesktop.org > wrote: >> Comment # 23 on bug 100073 from Grazvydas Ignotas >> (In reply to oiaohm from comment #21) >> > This is why I am so upset. As soon as this comes though I have >> possible >> > trouble with miss matched mesa versions crossing with each other in >> a cache >> > directory and being hard to debug. >> That will only happen if you force the same modify timestamp on >> several >> variations of mesa that are built for matching pointer size. Do you >> really >> think it's likely to happen in practice? > > I believe that's exactly what happens with reproducible builds: > https://reproducible-builds.org/ > Take another look - there's nothing which mentions or suggests that the binaries must have the same timestamps. The rule of the game is to produce identical binaries, which is true even when we had the timestamp file. And if you're in doubt, do try it on your end - the instructions and package(s) will help you double-check ;-) -Emil -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100151] Front buffer drawing mode shows black window with gallium software rasterizers
https://bugs.freedesktop.org/show_bug.cgi?id=100151 Józef Kuciachanged: What|Removed |Added CC||joseph.ku...@gmail.com -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100151] Front buffer drawing mode shows black window with gallium software rasterizers
https://bugs.freedesktop.org/show_bug.cgi?id=100151 --- Comment #1 from Józef Kucia--- (In reply to Pradeep Yadav from comment #0) > When front buffer drawing mode is enabled using glDrawBuffer(GL_FRONT); the > window becomes black after glFlush() call. This is likely a duplicate of bug 99116. Please check if the patch attached to bug 99116 helps. -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100151] Front buffer drawing mode shows black window with gallium software rasterizers
https://bugs.freedesktop.org/show_bug.cgi?id=100151 Pradeep Yadavchanged: What|Removed |Added Summary|Front buffer drawing mode |Front buffer drawing mode |shows black window |shows black window with ||gallium software ||rasterizers -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100151] Front buffer drawing mode shows black window
https://bugs.freedesktop.org/show_bug.cgi?id=100151 Bug ID: 100151 Summary: Front buffer drawing mode shows black window Product: Mesa Version: 13.0 Hardware: x86-64 (AMD64) OS: Linux (All) Status: NEW Severity: major Priority: medium Component: Drivers/Gallium/swr Assignee: mesa-dev@lists.freedesktop.org Reporter: pradeep.ya...@ansys.com QA Contact: mesa-dev@lists.freedesktop.org Created attachment 130157 --> https://bugs.freedesktop.org/attachment.cgi?id=130157=edit Standalone OpenGL program for reproducing this issue When front buffer drawing mode is enabled using glDrawBuffer(GL_FRONT); the window becomes black after glFlush() call. Attached program OpenGLXORApp.cpp demonstrates it. Follow these steps to reproduce: 1. Compile the program using: g++ -I/usr/include -lglut -lGLU -lGL OpenGLXORApp.cpp -o OpenGLXORApp 2. Run the program: ./OpenGLXORApp 3. Using mouse start drawing a rectangle, i.e., click left mouse button anywhere inside the window and drag the mouse while the left mouse button is depressed. Expected Result: A blue triangle on the white background is seen while a green rectangle is being drawn over it. Actual Result: A black window with green rectangle being drawn over it. Tried with: 1. GALLIUM_DRIVER=softpipe <-- Black window on Mesa 10.x.x BUT not on Mesa 11+ releases. But in our complex application where rotation is involved, after front buffer drawing, when we switch to double buffer drawing, the background remains static. The attached program cannot be used to reproduce this last issue because it doesn't have rotation functionality. 2. GALLIUM_DRIVER=llvmpipe <-- Black window on Mesa 10.x.x, 11.2.2 and Mesa 13.0.5 3. Mesa classic software rasterizer <-- NO ISSUES! 4. LIBGL_DEBUG=verbose and MESA_DEBUG=1 didn't print out any errors or warnings, except this warning: Mesa warning: couldn't open libtxc_dxtn.so, software DXTn compression/decompression unavailable. Note: Specific Mesa versions were mentioned above because those are the versions I have built and tested against. -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 0/6] Use drmDevice2 API, take ... final
On 10 March 2017 at 14:25, Mike Lothianwrote: > Works great - tested remotely passing DISPLAY=:0 now only when I pass > DRI_PRIME=1 does the card fire up > Perfect. I'll translate this to "Tested-by..." and, barring any objections, I'll push the series mid next week. -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Bug 100073] Shader Disk Cache 32/64 bit detection has a flaw. Missed existence of x32 ABI
On Fri, 2017-03-10 at 13:27 +, bugzilla-dae...@freedesktop.org wrote: > Comment # 23 on bug 100073 from Grazvydas Ignotas > (In reply to oiaohm from comment #21) > > This is why I am so upset. As soon as this comes though I have > possible > > trouble with miss matched mesa versions crossing with each other in > a cache > > directory and being hard to debug. > That will only happen if you force the same modify timestamp on > several > variations of mesa that are built for matching pointer size. Do you > really > think it's likely to happen in practice? I believe that's exactly what happens with reproducible builds: https://reproducible-builds.org/ signature.asc Description: This is a digitally signed message part ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] configure.ac: require pthread-stubs only where available
On 2 March 2017 at 19:02, Emil Velikovwrote: > From: Emil Velikov > > The project is a thing only for BSD platforms. Or in other words - for > any other platforms building/installing pthread-stubs results only in a > pthread-stub.pc file. > > And even where it provides a DSO, there's a fundamental design issue > with it - see the pthread-stubs mailing list for the specifics. > > Cc: Jeremy Huddleston Sequoia > CC: Gary Wong > Cc: Randy Fishel > Cc: Niveditha Rau > Signed-off-by: Emil Velikov > --- > Jeremy, others, > > Afaict pthread-stubs expands to a simple .pc on your platforms, but a > confirmation will be greatly appreciated. > --- > configure.ac | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/configure.ac b/configure.ac > index a3d1a00bdd..e94e46a0b8 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -799,7 +799,7 @@ fi > > dnl pthread-stubs is mandatory on targets where it exists > case "$host_os" in > -cygwin* ) > +linux* | cygwin* | darwin* | solaris* | gnu*) > pthread_stubs_possible="no" > ;; > * ) > -- Randy, Niveditha, Can you spare a minute to check if there is a pthread-stubs DSO present on Solaris ? Thanks Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH] intel: Correct the BDW surface state size
On Thu, Mar 9, 2017 at 3:35 PM, Nanley Cherywrote: > The PRMs state that this packet is 16 DWORDS long. Ensure that the last > three DWORDS are zeroed as required by the hardware when allocating a > null surface state. > > Cc: > Signed-off-by: Nanley Chery > --- > src/intel/isl/isl.c| 2 +- > src/mesa/drivers/dri/i965/gen8_surface_state.c | 5 ++--- > 2 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c > index 6eb1e93efd..b4bdf2059a 100644 > --- a/src/intel/isl/isl.c > +++ b/src/intel/isl/isl.c > @@ -56,7 +56,7 @@ static const struct { > [5] = {24, 32, 4}, > [6] = {24, 32, 4}, > [7] = {32, 32, 4, 24}, > - [8] = {52, 64, 32, 40}, > + [8] = {64, 64, 32, 40}, > [9] = {64, 64, 32, 40}, > }; > > diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c > b/src/mesa/drivers/dri/i965/gen8_surface_state.c > index 501531d4ad..f868293217 100644 > --- a/src/mesa/drivers/dri/i965/gen8_surface_state.c > +++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c > @@ -46,10 +46,9 @@ static uint32_t * > gen8_allocate_surface_state(struct brw_context *brw, > uint32_t *out_offset, int index) > { > - int dwords = brw->gen >= 9 ? 16 : 13; > uint32_t *surf = __brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, > - dwords * 4, 64, index, out_offset); > - memset(surf, 0, dwords * 4); > + 64, 64, index, out_offset); > + memset(surf, 0, 64); > return surf; > } > > -- > 2.12.0 > > ___ > mesa-stable mailing list > mesa-sta...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-stable Reviewed-by: Anuj Phogat ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 2/2] aubinator/genxml: use gzipped files to store embedded genxml
On 10 March 2017 at 18:00, Lionel Landwerlinwrote: > $(GENXML_GENERATED_FILES): Makefile.am We don't need this one any more - there's no code in the Makefile that would influence (should trigger) the file to be regenerated. -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] intel: genxml: add script to generate gzipped genxml
On 10 March 2017 at 18:01, Emil Velikovwrote: > Hi Lionel, > > I thinking about this just the other day - we have zlib dependency, > yet we store some ~1MiB of XML in the binary. > Not to mention that some distros ship xxd as part of vim ... but that > a distro problem ;-) > > On 10 March 2017 at 16:26, Lionel Landwerlin > wrote: >> Signed-off-by: Lionel Landwerlin >> --- >> src/intel/Makefile.genxml.am| 1 + >> src/intel/genxml/gen_zipped_file.py | 25 + >> 2 files changed, 26 insertions(+) >> create mode 100755 src/intel/genxml/gen_zipped_file.py >> >> diff --git a/src/intel/Makefile.genxml.am b/src/intel/Makefile.genxml.am >> index 20e4b15786..1866d7e2df 100644 >> --- a/src/intel/Makefile.genxml.am >> +++ b/src/intel/Makefile.genxml.am >> @@ -60,4 +60,5 @@ EXTRA_DIST += \ >> genxml/genX_pack.h \ >> genxml/gen_macros.h \ >> genxml/gen_pack_header.py \ >> + genxml/gen_zipped_file.py \ >> genxml/README >> diff --git a/src/intel/genxml/gen_zipped_file.py >> b/src/intel/genxml/gen_zipped_file.py >> new file mode 100755 >> index 00..d5735336c5 >> --- /dev/null >> +++ b/src/intel/genxml/gen_zipped_file.py >> @@ -0,0 +1,25 @@ >> +#!/usr/bin/env python2 > Please drop this line alongside the file execute bit. We explicitly > open these via $PYTHON2 > Forgot to mention: If we get the output filename via an argument we can drop the " || ($(RM) $@; false" 'hack'. Mostly wishful thinking here, but please address the earlier suggestions. -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] intel: genxml: add script to generate gzipped genxml
Hi Lionel, I thinking about this just the other day - we have zlib dependency, yet we store some ~1MiB of XML in the binary. Not to mention that some distros ship xxd as part of vim ... but that a distro problem ;-) On 10 March 2017 at 16:26, Lionel Landwerlinwrote: > Signed-off-by: Lionel Landwerlin > --- > src/intel/Makefile.genxml.am| 1 + > src/intel/genxml/gen_zipped_file.py | 25 + > 2 files changed, 26 insertions(+) > create mode 100755 src/intel/genxml/gen_zipped_file.py > > diff --git a/src/intel/Makefile.genxml.am b/src/intel/Makefile.genxml.am > index 20e4b15786..1866d7e2df 100644 > --- a/src/intel/Makefile.genxml.am > +++ b/src/intel/Makefile.genxml.am > @@ -60,4 +60,5 @@ EXTRA_DIST += \ > genxml/genX_pack.h \ > genxml/gen_macros.h \ > genxml/gen_pack_header.py \ > + genxml/gen_zipped_file.py \ > genxml/README > diff --git a/src/intel/genxml/gen_zipped_file.py > b/src/intel/genxml/gen_zipped_file.py > new file mode 100755 > index 00..d5735336c5 > --- /dev/null > +++ b/src/intel/genxml/gen_zipped_file.py > @@ -0,0 +1,25 @@ > +#!/usr/bin/env python2 Please drop this line alongside the file execute bit. We explicitly open these via $PYTHON2 -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 2/2] aubinator/genxml: use gzipped files to store embedded genxml
This reduces the size of the aubinator binary from ~1.4Mb to ~700Kb. We can now also drop the checks on xxd in configure. v2: Fix incorrect makefile dependency (Lionel) Signed-off-by: Lionel Landwerlin--- configure.ac | 1 - src/intel/Makefile.genxml.am | 10 ++- src/intel/tools/Makefile.am | 4 ++- src/intel/tools/decoder.c| 68 +++- 4 files changed, 66 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index d64ed2d3e8..11bd39bc15 100644 --- a/configure.ac +++ b/configure.ac @@ -126,7 +126,6 @@ LT_PREREQ([2.2]) LT_INIT([disable-static]) AC_CHECK_PROG(RM, rm, [rm -f]) -AC_CHECK_PROG(XXD, xxd, [xxd]) AX_PROG_BISON([], AS_IF([test ! -f "$srcdir/src/compiler/glsl/glcpp/glcpp-parse.c"], diff --git a/src/intel/Makefile.genxml.am b/src/intel/Makefile.genxml.am index 1866d7e2df..99367a11fb 100644 --- a/src/intel/Makefile.genxml.am +++ b/src/intel/Makefile.genxml.am @@ -35,18 +35,12 @@ $(GENXML_GENERATED_FILES): genxml/gen_pack_header.py $(MKDIR_GEN) $(PYTHON_GEN) $(srcdir)/genxml/gen_pack_header.py $< > $@ || ($(RM) $@; false) -# xxd generates variable names based on the path of the input file. We -# prefer to generate our own name here, so it doesn't vary from -# in/out-of-tree builds. - $(GENXML_GENERATED_FILES): Makefile.am +$(GENXML_GENERATED_FILES): genxml/gen_zipped_file.py .xml_xml.h: $(MKDIR_GEN) - $(AM_V_GEN) echo -n "static const uint8_t " > $@; \ - echo "$(@F)_xml[] = {" | sed -e 's,_xml.h,,' >> $@; \ - cat $< | $(XXD) -i >> $@; \ - echo "};" >> $@ + $(AM_V_GEN) $(srcdir)/genxml/gen_zipped_file.py $< > $@ || ($(RM) $@; false) EXTRA_DIST += \ genxml/gen4.xml \ diff --git a/src/intel/tools/Makefile.am b/src/intel/tools/Makefile.am index 5f4d78d6fd..3e2556849a 100644 --- a/src/intel/tools/Makefile.am +++ b/src/intel/tools/Makefile.am @@ -56,10 +56,12 @@ aubinator_SOURCES = \ aubinator_LDADD = \ $(aubinator_DEPS) \ - $(EXPAT_LIBS) + $(EXPAT_LIBS) \ + $(ZLIB_LIBS) aubinator_CFLAGS = \ $(AM_CFLAGS) \ $(EXPAT_CFLAGS) \ + $(ZLIB_CFLAGS) \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src diff --git a/src/intel/tools/decoder.c b/src/intel/tools/decoder.c index defb0873da..72913601c0 100644 --- a/src/intel/tools/decoder.c +++ b/src/intel/tools/decoder.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -508,13 +509,62 @@ devinfo_to_xml_data(const struct gen_device_info *devinfo, return NULL; } +static uint32_t zlib_inflate(const void *compressed_data, + uint32_t compressed_len, + void **out_ptr) +{ + struct z_stream_s zstream; + void *out; + + memset(, 0, sizeof(zstream)); + + zstream.next_in = (unsigned char *)compressed_data; + zstream.avail_in = compressed_len; + + if (inflateInit() != Z_OK) + return 0; + + out = malloc(4096); + zstream.next_out = out; + zstream.avail_out = 4096; + + do { + switch (inflate(, Z_SYNC_FLUSH)) { + case Z_STREAM_END: + goto end; + case Z_OK: + break; + default: + inflateEnd(); + return 0; + } + + if (zstream.avail_out) + break; + + out = realloc(out, 2*zstream.total_out); + if (out == NULL) { + inflateEnd(); + return 0; + } + + zstream.next_out = (unsigned char *)out + zstream.total_out; + zstream.avail_out = zstream.total_out; + } while (1); + end: + inflateEnd(); + *out_ptr = out; + return zstream.total_out; +} + struct gen_spec * gen_spec_load(const struct gen_device_info *devinfo) { struct parser_context ctx; void *buf; - const void *data; - uint32_t data_length = 0; + const void *zlib_data; + void *text_data; + uint32_t zlib_length = 0, text_length; memset(, 0, sizeof ctx); ctx.parser = XML_ParserCreate(NULL); @@ -529,22 +579,26 @@ gen_spec_load(const struct gen_device_info *devinfo) ctx.spec = xzalloc(sizeof(*ctx.spec)); - data = devinfo_to_xml_data(devinfo, _length); - buf = XML_GetBuffer(ctx.parser, data_length); + zlib_data = devinfo_to_xml_data(devinfo, _length); + text_length = zlib_inflate(zlib_data, zlib_length, _data); - memcpy(buf, data, data_length); + buf = XML_GetBuffer(ctx.parser, text_length); + memcpy(buf, text_data, text_length); - if (XML_ParseBuffer(ctx.parser, data_length, true) == 0) { + if (XML_ParseBuffer(ctx.parser, text_length, true) == 0) { fprintf(stderr, - "Error parsing XML at line %ld col %ld: %s\n", + "Error parsing XML at line %ld col %ld byte %ld/%u: %s\n", XML_GetCurrentLineNumber(ctx.parser), XML_GetCurrentColumnNumber(ctx.parser), + XML_GetCurrentByteIndex(ctx.parser), text_length,
[Mesa-dev] [PATCH v2 1/2] intel: genxml: add script to generate gzipped genxml
v2 (from Dylan): Add main function Add missing Copyright Use print_function Signed-off-by: Lionel Landwerlin--- src/intel/Makefile.genxml.am| 1 + src/intel/genxml/gen_zipped_file.py | 29 + 2 files changed, 30 insertions(+) create mode 100755 src/intel/genxml/gen_zipped_file.py diff --git a/src/intel/Makefile.genxml.am b/src/intel/Makefile.genxml.am index 20e4b15786..1866d7e2df 100644 --- a/src/intel/Makefile.genxml.am +++ b/src/intel/Makefile.genxml.am @@ -60,4 +60,5 @@ EXTRA_DIST += \ genxml/genX_pack.h \ genxml/gen_macros.h \ genxml/gen_pack_header.py \ + genxml/gen_zipped_file.py \ genxml/README diff --git a/src/intel/genxml/gen_zipped_file.py b/src/intel/genxml/gen_zipped_file.py new file mode 100755 index 00..a6e7b2717f --- /dev/null +++ b/src/intel/genxml/gen_zipped_file.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python2 +#encoding=utf-8 +# +# Copyright © 2017 Intel Corporation +# + +from __future__ import print_function +import os +import sys +import zlib + +def main(): +if len(sys.argv) < 2: +print("No input xml file specified") +sys.exit(1) + +with open(sys.argv[1]) as f: +compressed_data = zlib.compress(f.read()) + +gen_name = os.path.splitext(os.path.basename(sys.argv[1]))[0] +print("static const uint8_t %s_xml[] = {" % gen_name) +print(" ") + +for i, c in enumerate(compressed_data, start=1): +print("0x%.2x, " % ord(c), end='\n ' if not i % 12 else '') +print('\n};') + +if __name__ == '__main__': +main() -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] intel: genxml: add script to generate gzipped genxml
Quoting Lionel Landwerlin (2017-03-10 08:26:15) > Signed-off-by: Lionel Landwerlin> --- > src/intel/Makefile.genxml.am| 1 + > src/intel/genxml/gen_zipped_file.py | 25 + > 2 files changed, 26 insertions(+) > create mode 100755 src/intel/genxml/gen_zipped_file.py > > diff --git a/src/intel/Makefile.genxml.am b/src/intel/Makefile.genxml.am > index 20e4b15786..1866d7e2df 100644 > --- a/src/intel/Makefile.genxml.am > +++ b/src/intel/Makefile.genxml.am > @@ -60,4 +60,5 @@ EXTRA_DIST += \ > genxml/genX_pack.h \ > genxml/gen_macros.h \ > genxml/gen_pack_header.py \ > + genxml/gen_zipped_file.py \ > genxml/README > diff --git a/src/intel/genxml/gen_zipped_file.py > b/src/intel/genxml/gen_zipped_file.py > new file mode 100755 > index 00..d5735336c5 > --- /dev/null > +++ b/src/intel/genxml/gen_zipped_file.py > @@ -0,0 +1,25 @@ > +#!/usr/bin/env python2 > +#encoding=utf-8 copyright? > + > +import os > +import sys > +import zlib > + could you wrap the rest of this in a main function, and add the "if __name__ == "__main__" idiom to the bottom of the file? > +if len(sys.argv) < 2: > +print("No input xml file specified") > +sys.exit(1) > + > +input_file = open(sys.argv[1]) > +input_data = input_file.read() > +compressed_data = zlib.compress(input_data) with open(sys.argv[1]) as f: compressed_data = zlib.compress(f.read()) This ensures that the fd is closed even if there's an exception, and is more idomatic. > + > +gen_name = os.path.splitext(os.path.basename(sys.argv[1]))[0] > +sys.stdout.write("static const uint8_t %s_xml[] = {\n " % gen_name) You don't want to use sys.stdout.write, you need to manually flush if you do, print would be better. I'm going to suggest that you use print_function here to (and below), since you can control whether that prints the newline at the end (which is what I assume you're trying to avoid using sys.stdout.write. > + > +count = 0 > +for c in compressed_data: > +sys.stdout.write("0x%.2x, " % ord(c)) > +count += 1 > +if count % 12 == 0: > +sys.stdout.write("\n ") > +print("\n};") If you use the print function (from __future__ import print_function), then you can use enumerate to simplify this to: for i, c in enumerate(compressed_data, start=1): print("0x%.2x, " % ord(c), end='\n ' if not i % 12 else '') print('\n};) Start needs to be 1 rather than 0, since i gets incremented at the start of the loop rather than the end in this version. If you want to get really fancy you can use python's str.format instead of the old % syntax (this is just a suggestion, feel no obligation): print("{:0=#4x}, ".format(ord(c))) Which specifies: 0: fill with zeros =: make it equal to the width #: print the 0x (or 0b, or 0o for binary and octal) 4: the wdith (which needs to include the #) x: format hexidecimal Dylan signature.asc Description: signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] radeon_drm_cs_flush: check null return from radeon_cs_create_fence
Follow-up of patch: "radeon_cs_create_fence: check null return from radeon_winsys_bo_create" radeon_drm_cs_flush radeon_cs_create_fence radeon_winsys_bo_create Signed-off-by: Julien Isorce--- src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c index 1545fd8..f59b539 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c @@ -593,18 +593,20 @@ static int radeon_drm_cs_flush(struct radeon_winsys_cs *rcs, fence = radeon_cs_create_fence(rcs); } -if (pfence) -radeon_fence_reference(pfence, fence); - -mtx_lock(>ws->bo_fence_lock); -for (unsigned i = 0; i < cs->csc->num_slab_buffers; ++i) { -struct radeon_bo *bo = cs->csc->slab_buffers[i].bo; -p_atomic_inc(>num_active_ioctls); -radeon_bo_slab_fence(bo, (struct radeon_bo *)fence); -} -mtx_unlock(>ws->bo_fence_lock); +if (fence) { +if (pfence) +radeon_fence_reference(pfence, fence); + +mtx_lock(>ws->bo_fence_lock); +for (unsigned i = 0; i < cs->csc->num_slab_buffers; ++i) { +struct radeon_bo *bo = cs->csc->slab_buffers[i].bo; +p_atomic_inc(>num_active_ioctls); +radeon_bo_slab_fence(bo, (struct radeon_bo *)fence); +} +mtx_unlock(>ws->bo_fence_lock); -radeon_fence_reference(, NULL); +radeon_fence_reference(, NULL); +} } else { radeon_fence_reference(>next_fence, NULL); } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/3] Fixes 1 crash in gallium/hud and 1 crash in gallium/radeon
I encountered these crashes with the radeonsi driver when the VRAM was full. Even if the app should be careful to not upload too much texture for example, it is better not to crash in mesa. Also I found other places in mesa when these checks are done so let's do the same here. I am quite confident with the first patch but unsure with the 2 others for the teardown parts. Julien Isorce (3): radeon_cs_create_fence: check null return from radeon_winsys_bo_create radeon_drm_cs_flush: check null return from radeon_cs_create_fence hud_context: check NULL return from u_upload_alloc src/gallium/auxiliary/hud/hud_context.c | 5 + src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 25 ++--- 2 files changed, 19 insertions(+), 11 deletions(-) -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] radeon_cs_create_fence: check null return from radeon_winsys_bo_create
Fixes the following segmentation fault: radeon_drm_cs_add_buffer (bo=0x0) at radeon_drm_cs.c -> if (!bo->handle) (gdb) bt 0 radeon_drm_cs_add_buffer (bo=0x0) at radeon_drm_cs.c 1 0x7fffe73575de in radeon_cs_create_fence radeon_drm_cs.c 2 0x7fffe7358c48 in radeon_drm_cs_flush radeon_drm_cs.c Signed-off-by: Julien Isorce--- src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c index d431bfc..1545fd8 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c @@ -750,6 +750,9 @@ radeon_cs_create_fence(struct radeon_winsys_cs *rcs) /* Create a fence, which is a dummy BO. */ fence = cs->ws->base.buffer_create(>ws->base, 1, 1, RADEON_DOMAIN_GTT, RADEON_FLAG_HANDLE); +if (!fence) + return NULL; + /* Add the fence as a dummy relocation. */ cs->ws->base.cs_add_buffer(rcs, fence, RADEON_USAGE_READWRITE, RADEON_DOMAIN_GTT, -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] hud_context: check NULL return from u_upload_alloc
Fixes the following segmentation fault: signal SIGSEGV: invalid address (fault address: 0x0) frame #0: 0x7fffe718e117 radeonsi_dri.so hud_draw_background_quad hud_context.c:170 167 168 assert(hud->bg.num_vertices + 4 <= hud->bg.max_num_vertices); 169 -> 170 vertices[num++] = (float) x1; 171 vertices[num++] = (float) y1; 172 173 vertices[num++] = (float) x1; (lldb) bt * frame #0: 0x7fffe718e117 radeonsi_dri.so`hud_draw_background_quad frame #1: 0x7fffe718f458 radeonsi_dri.so`hud_draw frame #2: 0x7fffe712967f radeonsi_dri.so`dri_flush --- src/gallium/auxiliary/hud/hud_context.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index c44f8c0..29ef9ee 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -581,6 +581,10 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex) hud->color_prims.buffer_size, 16, >bg.vbuf.buffer_offset, >bg.vbuf.buffer, (void**)>bg.vertices); + if (!hud->bg.vertices) { + goto out; + } + pipe_resource_reference(>whitelines.vbuf.buffer, hud->bg.vbuf.buffer); pipe_resource_reference(>text.vbuf.buffer, hud->bg.vbuf.buffer); pipe_resource_reference(>color_prims.vbuf.buffer, hud->bg.vbuf.buffer); @@ -690,6 +694,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex) hud_pane_draw_colored_objects(hud, pane); } +out: cso_restore_state(cso); cso_restore_constant_buffer_slot0(cso, PIPE_SHADER_VERTEX); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] radeon_drm_cs_flush: check null return from radeon_cs_create_fence
Follow-up of patch: "radeon_cs_create_fence: check null return from radeon_winsys_bo_create" radeon_drm_cs_flush radeon_cs_create_fence radeon_winsys_bo_create Signed-off-by: Julien Isorce--- src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c index 1545fd8..c854d11 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c @@ -593,18 +593,18 @@ static int radeon_drm_cs_flush(struct radeon_winsys_cs *rcs, fence = radeon_cs_create_fence(rcs); } -if (pfence) -radeon_fence_reference(pfence, fence); - -mtx_lock(>ws->bo_fence_lock); -for (unsigned i = 0; i < cs->csc->num_slab_buffers; ++i) { -struct radeon_bo *bo = cs->csc->slab_buffers[i].bo; -p_atomic_inc(>num_active_ioctls); -radeon_bo_slab_fence(bo, (struct radeon_bo *)fence); +if (fence) { +if (pfence) +radeon_fence_reference(pfence, fence); + +mtx_lock(>ws->bo_fence_lock); +for (unsigned i = 0; i < cs->csc->num_slab_buffers; ++i) { +struct radeon_bo *bo = cs->csc->slab_buffers[i].bo; +p_atomic_inc(>num_active_ioctls); +radeon_bo_slab_fence(bo, (struct radeon_bo *)fence); +} +mtx_unlock(>ws->bo_fence_lock); } -mtx_unlock(>ws->bo_fence_lock); - -radeon_fence_reference(, NULL); } else { radeon_fence_reference(>next_fence, NULL); } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100120] Mesa fails to build with gcc address sanitizer (-fsanitize=address -lasan)
https://bugs.freedesktop.org/show_bug.cgi?id=100120 --- Comment #9 from Jeff Smith--- A few more things I found... Either with or without a fixed libtool, libdl detection is still affected when -fsanitize=address is set. A more precise way to handle this than adding -ldl to LIBS, is to set DLOPEN_LIBS="-ldl" Regarding the problems in d3dadapter9, it seems that there are other things going on: - Linking with "-Wl,--no-undefined" seems to interfere with "-fsanitize=address", making LIBS="-lasan" necessary in this case. - Building with "-fsanitize=address" seems to affect the building of libgallium.a such that when combined with using "-Wl,--no-undefined", "$(top_builddir)/src/compiler/nir/libnir.la" must be added to d3dadapter9_la_LIBADD in the d3dadapter9 Makefile. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] aubinator/genxml: use gzipped files to store embedded genxml
This reduces the size of the aubinator binary from ~1.4Mb to ~700Kb. With can now drop the checks on xxd in configure. Signed-off-by: Lionel Landwerlin--- configure.ac | 1 - src/intel/Makefile.genxml.am | 10 ++- src/intel/tools/Makefile.am | 4 ++- src/intel/tools/decoder.c| 68 +++- 4 files changed, 66 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index d64ed2d3e8..11bd39bc15 100644 --- a/configure.ac +++ b/configure.ac @@ -126,7 +126,6 @@ LT_PREREQ([2.2]) LT_INIT([disable-static]) AC_CHECK_PROG(RM, rm, [rm -f]) -AC_CHECK_PROG(XXD, xxd, [xxd]) AX_PROG_BISON([], AS_IF([test ! -f "$srcdir/src/compiler/glsl/glcpp/glcpp-parse.c"], diff --git a/src/intel/Makefile.genxml.am b/src/intel/Makefile.genxml.am index 1866d7e2df..6ad2b57a51 100644 --- a/src/intel/Makefile.genxml.am +++ b/src/intel/Makefile.genxml.am @@ -35,18 +35,12 @@ $(GENXML_GENERATED_FILES): genxml/gen_pack_header.py $(MKDIR_GEN) $(PYTHON_GEN) $(srcdir)/genxml/gen_pack_header.py $< > $@ || ($(RM) $@; false) -# xxd generates variable names based on the path of the input file. We -# prefer to generate our own name here, so it doesn't vary from -# in/out-of-tree builds. - $(GENXML_GENERATED_FILES): Makefile.am +$(GENXML_GENERATED_FILES): genxml/gen_pack_header.py .xml_xml.h: $(MKDIR_GEN) - $(AM_V_GEN) echo -n "static const uint8_t " > $@; \ - echo "$(@F)_xml[] = {" | sed -e 's,_xml.h,,' >> $@; \ - cat $< | $(XXD) -i >> $@; \ - echo "};" >> $@ + $(AM_V_GEN) $(srcdir)/genxml/gen_zipped_file.py $< > $@ || ($(RM) $@; false) EXTRA_DIST += \ genxml/gen4.xml \ diff --git a/src/intel/tools/Makefile.am b/src/intel/tools/Makefile.am index 5f4d78d6fd..3e2556849a 100644 --- a/src/intel/tools/Makefile.am +++ b/src/intel/tools/Makefile.am @@ -56,10 +56,12 @@ aubinator_SOURCES = \ aubinator_LDADD = \ $(aubinator_DEPS) \ - $(EXPAT_LIBS) + $(EXPAT_LIBS) \ + $(ZLIB_LIBS) aubinator_CFLAGS = \ $(AM_CFLAGS) \ $(EXPAT_CFLAGS) \ + $(ZLIB_CFLAGS) \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src diff --git a/src/intel/tools/decoder.c b/src/intel/tools/decoder.c index defb0873da..72913601c0 100644 --- a/src/intel/tools/decoder.c +++ b/src/intel/tools/decoder.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -508,13 +509,62 @@ devinfo_to_xml_data(const struct gen_device_info *devinfo, return NULL; } +static uint32_t zlib_inflate(const void *compressed_data, + uint32_t compressed_len, + void **out_ptr) +{ + struct z_stream_s zstream; + void *out; + + memset(, 0, sizeof(zstream)); + + zstream.next_in = (unsigned char *)compressed_data; + zstream.avail_in = compressed_len; + + if (inflateInit() != Z_OK) + return 0; + + out = malloc(4096); + zstream.next_out = out; + zstream.avail_out = 4096; + + do { + switch (inflate(, Z_SYNC_FLUSH)) { + case Z_STREAM_END: + goto end; + case Z_OK: + break; + default: + inflateEnd(); + return 0; + } + + if (zstream.avail_out) + break; + + out = realloc(out, 2*zstream.total_out); + if (out == NULL) { + inflateEnd(); + return 0; + } + + zstream.next_out = (unsigned char *)out + zstream.total_out; + zstream.avail_out = zstream.total_out; + } while (1); + end: + inflateEnd(); + *out_ptr = out; + return zstream.total_out; +} + struct gen_spec * gen_spec_load(const struct gen_device_info *devinfo) { struct parser_context ctx; void *buf; - const void *data; - uint32_t data_length = 0; + const void *zlib_data; + void *text_data; + uint32_t zlib_length = 0, text_length; memset(, 0, sizeof ctx); ctx.parser = XML_ParserCreate(NULL); @@ -529,22 +579,26 @@ gen_spec_load(const struct gen_device_info *devinfo) ctx.spec = xzalloc(sizeof(*ctx.spec)); - data = devinfo_to_xml_data(devinfo, _length); - buf = XML_GetBuffer(ctx.parser, data_length); + zlib_data = devinfo_to_xml_data(devinfo, _length); + text_length = zlib_inflate(zlib_data, zlib_length, _data); - memcpy(buf, data, data_length); + buf = XML_GetBuffer(ctx.parser, text_length); + memcpy(buf, text_data, text_length); - if (XML_ParseBuffer(ctx.parser, data_length, true) == 0) { + if (XML_ParseBuffer(ctx.parser, text_length, true) == 0) { fprintf(stderr, - "Error parsing XML at line %ld col %ld: %s\n", + "Error parsing XML at line %ld col %ld byte %ld/%u: %s\n", XML_GetCurrentLineNumber(ctx.parser), XML_GetCurrentColumnNumber(ctx.parser), + XML_GetCurrentByteIndex(ctx.parser), text_length,
[Mesa-dev] [PATCH 0/2] Aubinator: use gzipped genxml files
Hi, Now that zlib has been added as a dependency to Mesa, we can start using gzip to store embedded copies of genxml into aubinator. It reduces the size of the aubinator binary by roughly half. Cheers, Lionel Landwerlin (2): intel: genxml: add script to generate gzipped genxml aubinator/genxml: use gzipped files to store embedded genxml configure.ac| 1 - src/intel/Makefile.genxml.am| 11 ++ src/intel/genxml/gen_zipped_file.py | 25 ++ src/intel/tools/Makefile.am | 4 ++- src/intel/tools/decoder.c | 68 + 5 files changed, 92 insertions(+), 17 deletions(-) create mode 100755 src/intel/genxml/gen_zipped_file.py -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] intel: genxml: add script to generate gzipped genxml
Signed-off-by: Lionel Landwerlin--- src/intel/Makefile.genxml.am| 1 + src/intel/genxml/gen_zipped_file.py | 25 + 2 files changed, 26 insertions(+) create mode 100755 src/intel/genxml/gen_zipped_file.py diff --git a/src/intel/Makefile.genxml.am b/src/intel/Makefile.genxml.am index 20e4b15786..1866d7e2df 100644 --- a/src/intel/Makefile.genxml.am +++ b/src/intel/Makefile.genxml.am @@ -60,4 +60,5 @@ EXTRA_DIST += \ genxml/genX_pack.h \ genxml/gen_macros.h \ genxml/gen_pack_header.py \ + genxml/gen_zipped_file.py \ genxml/README diff --git a/src/intel/genxml/gen_zipped_file.py b/src/intel/genxml/gen_zipped_file.py new file mode 100755 index 00..d5735336c5 --- /dev/null +++ b/src/intel/genxml/gen_zipped_file.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python2 +#encoding=utf-8 + +import os +import sys +import zlib + +if len(sys.argv) < 2: +print("No input xml file specified") +sys.exit(1) + +input_file = open(sys.argv[1]) +input_data = input_file.read() +compressed_data = zlib.compress(input_data) + +gen_name = os.path.splitext(os.path.basename(sys.argv[1]))[0] +sys.stdout.write("static const uint8_t %s_xml[] = {\n " % gen_name) + +count = 0 +for c in compressed_data: +sys.stdout.write("0x%.2x, " % ord(c)) +count += 1 +if count % 12 == 0: +sys.stdout.write("\n ") +print("\n};") -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] util/disk_cache: use LRU eviction rather than random eviction (v3)
Still using fast random selection of two-character subdirectory in which to check cache files rather than scanning entire cache. v2: Factor out double strlen call v3: C99 declaration of variables where used --- Also have a patch to pass the predicate functions sb and len instead which saves calling stat and strlen twice for each entry making LRU slightly cheaper than current random (which calls predicate twice). src/util/disk_cache.c | 77 +++ 1 file changed, 34 insertions(+), 43 deletions(-) diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index facdcecf7c..0037ef2569 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -438,30 +438,29 @@ make_cache_file_directory(struct disk_cache *cache, const cache_key key) free(dir); } -/* Given a directory path and predicate function, count all entries in - * that directory for which the predicate returns true. Then choose a - * random entry from among those counted. +/* Given a directory path and predicate function, find the entry with + * the oldest access time in that directory for which the predicate + * returns true. * * Returns: A malloc'ed string for the path to the chosen file, (or * NULL on any error). The caller should free the string when * finished. */ static char * -choose_random_file_matching(const char *dir_path, -bool (*predicate)(const struct dirent *, - const char *dir_path)) +choose_lru_file_matching(const char *dir_path, + bool (*predicate)(const struct dirent *, + const char *dir_path)) { DIR *dir; struct dirent *entry; - unsigned int count, victim; char *filename; + char *lru_name = NULL; + time_t lru_atime = 0; dir = opendir(dir_path); if (dir == NULL) return NULL; - count = 0; - while (1) { entry = readdir(dir); if (entry == NULL) @@ -469,39 +468,29 @@ choose_random_file_matching(const char *dir_path, if (!predicate(entry, dir_path)) continue; - count++; - } - - if (count == 0) { - closedir(dir); - return NULL; - } - - victim = rand() % count; - - rewinddir(dir); - count = 0; - - while (1) { - entry = readdir(dir); - if (entry == NULL) - break; - if (!predicate(entry, dir_path)) - continue; - if (count == victim) - break; - - count++; + struct stat sb; + if (fstatat(dirfd(dir), entry->d_name, , 0) == 0) { + if (!lru_atime || (sb.st_atime < lru_atime)) { +size_t len = strlen(entry->d_name) + 1; +char *tmp = realloc(lru_name, len); +if (tmp) { + lru_name = tmp; + memcpy(lru_name, entry->d_name, len); + lru_atime = sb.st_atime; +} + } + } } - if (entry == NULL) { + if (lru_name == NULL) { closedir(dir); return NULL; } - if (asprintf(, "%s/%s", dir_path, entry->d_name) < 0) + if (asprintf(, "%s/%s", dir_path, lru_name) < 0) filename = NULL; + free(lru_name); closedir(dir); return filename; @@ -533,12 +522,12 @@ is_regular_non_tmp_file(const struct dirent *entry, const char *path) /* Returns the size of the deleted file, (or 0 on any error). */ static size_t -unlink_random_file_from_directory(const char *path) +unlink_lru_file_from_directory(const char *path) { struct stat sb; char *filename; - filename = choose_random_file_matching(path, is_regular_non_tmp_file); + filename = choose_lru_file_matching(path, is_regular_non_tmp_file); if (filename == NULL) return 0; @@ -581,7 +570,7 @@ is_two_character_sub_directory(const struct dirent *entry, const char *path) } static void -evict_random_item(struct disk_cache *cache) +evict_lru_item(struct disk_cache *cache) { const char hex[] = "0123456789abcde"; char *dir_path; @@ -591,6 +580,7 @@ evict_random_item(struct disk_cache *cache) /* With a reasonably-sized, full cache, (and with keys generated * from a cryptographic hash), we can choose two random hex digits * and reasonably expect the directory to exist with a file in it. +* Provides pseudo-LRU eviction to reduce checking all cache files. */ a = rand() % 16; b = rand() % 16; @@ -598,7 +588,7 @@ evict_random_item(struct disk_cache *cache) if (asprintf(_path, "%s/%c%c", cache->path, hex[a], hex[b]) < 0) return; - size = unlink_random_file_from_directory(dir_path); + size = unlink_lru_file_from_directory(dir_path); free(dir_path); @@ -608,18 +598,19 @@ evict_random_item(struct disk_cache *cache) } /* In the case where the random choice of directory didn't find -* something, we choose randomly from the existing directories. +* something, we choose the least recently accessed from
Re: [Mesa-dev] [PATCH] drm-atomic: Include header file
On 4 March 2017 at 15:01, Fabio Estevamwrote: > Include header file to fix the following build warning: > > CC kmscube-drm.o > drm-atomic.c: In function 'init_drm_atomic': > drm-atomic.c:346:14: warning: implicit declaration of function 'calloc' > [-Wimplicit-function-declaration] > drm.plane = calloc(1, sizeof(*drm.plane)); > ^ > drm-atomic.c:346:14: warning: incompatible implicit declaration of built-in > function 'calloc' > drm-atomic.c:346:14: note: include '' or provide a declaration of > 'calloc' > > Signed-off-by: Fabio Estevam R-b and pushed to master. Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 0/6] Use drmDevice2 API, take ... final
Works great - tested remotely passing DISPLAY=:0 now only when I pass DRI_PRIME=1 does the card fire up Thanks Mike On Fri, 10 Mar 2017 at 13:56 Emil Velikovwrote: > On 10 March 2017 at 13:35, Mike Lothian wrote: > > Does this mean my dGPU will stop being woken up when I play videos or > open > > Chromium? > > > Yes, precisely. Do give it a test and let me know how it behaves on your > end. > > -Emil > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 0/6] Use drmDevice2 API, take ... final
On 10 March 2017 at 13:35, Mike Lothianwrote: > Does this mean my dGPU will stop being woken up when I play videos or open > Chromium? > Yes, precisely. Do give it a test and let me know how it behaves on your end. -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] util/disk_cache: fix zlib linking with LTO build
On Fri, 2017-03-10 at 12:11 +, Emil Velikov wrote: > On 9 March 2017 at 14:39, Steven Newbury> wrote: > > Introduction of zlib compression for the shader cache means > > zlib needs to be explicitly linked to libOSMesa and libstandalone > > otherwise build fails when LTO is used. > > --- > > How exactly are you doing the LTO build ? I build everything LTO, except for a short blacklist where unsupportable. Specifically, on this system my global *FLAGS contain "-flto=8 -fuse-linker-plugin". I have the lto linker plugin symlinked into "/usr/$CHOST/binutils-bin/lib/bfd-plugins/". I also have have the following env vars set to ensure they are called with the LTO plugin: AR="gcc-ar" NM="gcc-nm" RANLIB="gcc-ranlib" Mesa is not blacklisted, and with the patch, and previous to the compressed shader cache built fine, but otherwise there are undefined zlib symbols. > > The only user of ZLIB is libmesautil.la which in itself uses > ZLIB_LIBS. It does, and that seems to satisfy linking of libmesautil.la, but it doesn't result in the archive containing a static zlib since you're using "-lz" (at least with the output of pkg-config --libs zlib here) not explicitly linking to libz.a. (My understanding.) > Hence as-is patch looks wrong/incomplete, although I might be missing > something ? I guess that depends upon your point of view. To me it's the preferred behaviour to use the system provided dynamic zlib to resolve the symbols at load time. signature.asc Description: This is a digitally signed message part ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 0/6] Use drmDevice2 API, take ... final
Does this mean my dGPU will stop being woken up when I play videos or open Chromium? On Fri, 10 Mar 2017 at 12:32 Emil Velikovwrote: > Hi all, > > Here is hopefully the final round of using drmDevice2. > > As a brief reminder - probing devices via drmDevice or directly opening > the device node wakes up the device, even if we're not planning to use > it. > > The wakeup in itself, can be very slow in some cases. > > Note: you _will_ need to update libdrm to 2.4.75 > > -Emil > > Emil Velikov (6): > autoconf/scons: bump libdrm to 2.4.75 > loader: use drmGetDevice[s]2 API > winsys/amdgpu: use drmGetDevice2 API > radv/winsys: use drmGetDevice2 API > radv: do not open random render node(s) > anv: do not open random render node(s) > > configure.ac | 4 +- > scons/gallium.py | 2 +- > src/amd/vulkan/radv_device.c | 48 > +++- > src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c | 4 +- > src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 4 +- > src/intel/vulkan/Makefile.am | 1 + > src/intel/vulkan/anv_device.c | 53 > --- > src/loader/loader.c | 6 +-- > 8 files changed, 85 insertions(+), 37 deletions(-) > > -- > 2.11.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100073] Shader Disk Cache 32/64 bit detection has a flaw. Missed existence of x32 ABI
https://bugs.freedesktop.org/show_bug.cgi?id=100073 --- Comment #23 from Grazvydas Ignotas--- (In reply to oiaohm from comment #21) > This is why I am so upset. As soon as this comes though I have possible > trouble with miss matched mesa versions crossing with each other in a cache > directory and being hard to debug. That will only happen if you force the same modify timestamp on several variations of mesa that are built for matching pointer size. Do you really think it's likely to happen in practice? There is also an option of disabling the cache entirely through environment if it makes you so nervous. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/8] util/disk_cache: make disk_cache_put() compatible with u_queue
On Fri, Mar 10, 2017 at 4:28 AM, Timothy Arceriwrote: > --- > src/compiler/glsl/shader_cache.cpp | 5 - > src/compiler/glsl/tests/cache_test.c| 29 > - > src/gallium/drivers/radeonsi/si_state_shaders.c | 9 ++-- > src/mesa/state_tracker/st_shader_cache.c| 5 - > src/util/disk_cache.c | 27 +-- > src/util/disk_cache.h | 7 ++ > 6 files changed, 55 insertions(+), 27 deletions(-) > > diff --git a/src/compiler/glsl/shader_cache.cpp > b/src/compiler/glsl/shader_cache.cpp > index 6e2c527..1865e96 100644 > --- a/src/compiler/glsl/shader_cache.cpp > +++ b/src/compiler/glsl/shader_cache.cpp > @@ -1269,21 +1269,24 @@ shader_cache_write_program_metadata(struct gl_context > *ctx, > > char sha1_buf[41]; > for (unsigned i = 0; i < prog->NumShaders; i++) { >disk_cache_put_key(cache, prog->Shaders[i]->sha1); >if (ctx->_Shader->Flags & GLSL_CACHE_INFO) { > fprintf(stderr, "marking shader: %s\n", > _mesa_sha1_format(sha1_buf, prog->Shaders[i]->sha1)); >} > } > > - disk_cache_put(cache, prog->data->sha1, metadata->data, metadata->size); > + struct disk_cache_put_job *dc_job = > + disk_cache_create_put_job(cache, prog->data->sha1, metadata->data, > +metadata->size, metadata); > + disk_cache_put(dc_job, 0); I don't think open coding every callsite like this is a good idea, it will make the maintenance of this code hard. I suggest making a new disk_cache_put() (same prototype) that takes care of creating the job itself, and then call the current renamed ..._put() with the job arg by itself (same for util_queue_* stuff added by later patches). Then you don't have to expose struct disk_cache_put_job (and later struct disk_cache itself) in the headers, those things are disk_cache implementation details really. Gražvydas ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 21/24] anv/blorp: make anv_cmd_buffer_alloc_blorp_binding_table() return a VkResult
Instead of asserting inside the function, and then use use that information to return early from its callers upon failure. --- src/intel/vulkan/anv_blorp.c | 35 --- src/intel/vulkan/anv_private.h | 5 +++-- src/intel/vulkan/genX_blorp_exec.c | 8 ++-- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index c871f03..de5b0ec 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -904,31 +904,31 @@ void anv_CmdClearDepthStencilImage( blorp_batch_finish(); } -struct anv_state +VkResult anv_cmd_buffer_alloc_blorp_binding_table(struct anv_cmd_buffer *cmd_buffer, uint32_t num_entries, - uint32_t *state_offset) + uint32_t *state_offset, + struct anv_state *bt_state) { - struct anv_state bt_state = - anv_cmd_buffer_alloc_binding_table(cmd_buffer, num_entries, - state_offset); - if (bt_state.map == NULL) { + *bt_state = anv_cmd_buffer_alloc_binding_table(cmd_buffer, num_entries, + state_offset); + if (bt_state->map == NULL) { /* We ran out of space. Grab a new binding table block. */ - MAYBE_UNUSED VkResult result = - anv_cmd_buffer_new_binding_table_block(cmd_buffer); - assert(result == VK_SUCCESS); + VkResult result = anv_cmd_buffer_new_binding_table_block(cmd_buffer); + if (result != VK_SUCCESS) + return result; /* Re-emit state base addresses so we get the new surface state base * address before we start emitting binding tables etc. */ anv_cmd_buffer_emit_state_base_address(cmd_buffer); - bt_state = anv_cmd_buffer_alloc_binding_table(cmd_buffer, num_entries, -state_offset); - assert(bt_state.map != NULL); + *bt_state = anv_cmd_buffer_alloc_binding_table(cmd_buffer, num_entries, + state_offset); + assert(bt_state->map != NULL); } - return bt_state; + return VK_SUCCESS; } static uint32_t @@ -936,8 +936,13 @@ binding_table_for_surface_state(struct anv_cmd_buffer *cmd_buffer, struct anv_state surface_state) { uint32_t state_offset; - struct anv_state bt_state = - anv_cmd_buffer_alloc_blorp_binding_table(cmd_buffer, 1, _offset); + struct anv_state bt_state; + + VkResult result = + anv_cmd_buffer_alloc_blorp_binding_table(cmd_buffer, 1, _offset, + _state); + if (result != VK_SUCCESS) + return 0; uint32_t *bt_map = bt_state.map; bt_map[0] = surface_state.offset + state_offset; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 7490d0c..adb8ce2 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1463,10 +1463,11 @@ void anv_cmd_buffer_resolve_subpass(struct anv_cmd_buffer *cmd_buffer); const struct anv_image_view * anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer); -struct anv_state +VkResult anv_cmd_buffer_alloc_blorp_binding_table(struct anv_cmd_buffer *cmd_buffer, uint32_t num_entries, - uint32_t *state_offset); + uint32_t *state_offset, + struct anv_state *bt_state); void anv_cmd_buffer_dump(struct anv_cmd_buffer *cmd_buffer); diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c index 90adefe..0649d3b 100644 --- a/src/intel/vulkan/genX_blorp_exec.c +++ b/src/intel/vulkan/genX_blorp_exec.c @@ -89,9 +89,13 @@ blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries, struct anv_cmd_buffer *cmd_buffer = batch->driver_batch; uint32_t state_offset; - struct anv_state bt_state = + struct anv_state bt_state; + + VkResult result = anv_cmd_buffer_alloc_blorp_binding_table(cmd_buffer, num_entries, - _offset); + _offset, _state); + if (result != VK_SUCCESS) + return; uint32_t *bt_map = bt_state.map; *bt_offset = bt_state.offset; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 14/24] anv/cmd_buffer: handle allocation errors during vkCmdBeginRenderPass()
Fixes: dEQP-VK.api.out_of_host_memory.cmd_begin_render_pass --- src/intel/vulkan/genX_cmd_buffer.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index efb271e..539e9ea 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -404,8 +404,9 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer, sizeof(state->attachments[0]), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (state->attachments == NULL) { - /* FIXME: Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer */ - return VK_ERROR_OUT_OF_HOST_MEMORY; + /* Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer */ + return anv_batch_set_error(_buffer->batch, + VK_ERROR_OUT_OF_HOST_MEMORY); } bool need_null_state = false; @@ -2476,7 +2477,14 @@ void genX(CmdBeginRenderPass)( cmd_buffer->state.framebuffer = framebuffer; cmd_buffer->state.pass = pass; cmd_buffer->state.render_area = pRenderPassBegin->renderArea; - genX(cmd_buffer_setup_attachments)(cmd_buffer, pass, pRenderPassBegin); + VkResult result = + genX(cmd_buffer_setup_attachments)(cmd_buffer, pass, pRenderPassBegin); + + /* If we failed to setup the attachments we should not try to go further */ + if (result != VK_SUCCESS) { + assert(anv_batch_has_error(_buffer->batch)); + return; + } genX(flush_pipeline_select_3d)(cmd_buffer); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 17/24] anv/cmd_buffer: skip vkCmdDraw*() on broken command buffers
--- src/intel/vulkan/genX_cmd_buffer.c | 12 1 file changed, 12 insertions(+) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 539e9ea..112239c 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1668,6 +1668,9 @@ void genX(CmdDraw)( struct anv_pipeline *pipeline = cmd_buffer->state.pipeline; const struct brw_vs_prog_data *vs_prog_data = get_vs_prog_data(pipeline); + if (anv_batch_has_error(_buffer->batch)) + return; + genX(cmd_buffer_flush_state)(cmd_buffer); if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstance) @@ -1698,6 +1701,9 @@ void genX(CmdDrawIndexed)( struct anv_pipeline *pipeline = cmd_buffer->state.pipeline; const struct brw_vs_prog_data *vs_prog_data = get_vs_prog_data(pipeline); + if (anv_batch_has_error(_buffer->batch)) + return; + genX(cmd_buffer_flush_state)(cmd_buffer); if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstance) @@ -1738,6 +1744,9 @@ void genX(CmdDrawIndirect)( struct anv_bo *bo = buffer->bo; uint32_t bo_offset = buffer->offset + offset; + if (anv_batch_has_error(_buffer->batch)) + return; + genX(cmd_buffer_flush_state)(cmd_buffer); if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstance) @@ -1772,6 +1781,9 @@ void genX(CmdDrawIndexedIndirect)( struct anv_bo *bo = buffer->bo; uint32_t bo_offset = buffer->offset + offset; + if (anv_batch_has_error(_buffer->batch)) + return; + genX(cmd_buffer_flush_state)(cmd_buffer); /* TODO: We need to stomp base vertex to 0 somehow */ -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 23/24] anv: handle errors in emit_binding_table() and emit_samplers()
These can fail to allocate device memory, however, the driver can recover from this error by allocating a new binding table block and trying again. v2: - Instead of tracking the errors in these functions and making callers reset the batch's status before attempting to allocate a new block for the binding table, simply make callers responsible for setting the error status if they fail to allocate memory during the second attempt. --- src/intel/vulkan/genX_cmd_buffer.c | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 3069297..ae7f5cd 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1360,12 +1360,16 @@ flush_descriptor_sets(struct anv_cmd_buffer *cmd_buffer) dirty |= cmd_buffer->state.pipeline->active_stages; anv_foreach_stage(s, dirty) { result = emit_samplers(cmd_buffer, s, _buffer->state.samplers[s]); - if (result != VK_SUCCESS) + if (result != VK_SUCCESS) { +anv_batch_set_error(_buffer->batch, result); return 0; + } result = emit_binding_table(cmd_buffer, s, _buffer->state.binding_tables[s]); - if (result != VK_SUCCESS) + if (result != VK_SUCCESS) { +anv_batch_set_error(_buffer->batch, result); return 0; + } } } @@ -1831,11 +1835,17 @@ flush_compute_descriptor_set(struct anv_cmd_buffer *cmd_buffer) genX(cmd_buffer_emit_state_base_address)(cmd_buffer); result = emit_binding_table(cmd_buffer, MESA_SHADER_COMPUTE, ); - assert(result == VK_SUCCESS); + if (result != VK_SUCCESS) { + anv_batch_set_error(_buffer->batch, result); + return result; + } } result = emit_samplers(cmd_buffer, MESA_SHADER_COMPUTE, ); - assert(result == VK_SUCCESS); + if (result != VK_SUCCESS) { + anv_batch_set_error(_buffer->batch, result); + return result; + } uint32_t iface_desc_data_dw[GENX(INTERFACE_DESCRIPTOR_DATA_length)]; struct GENX(INTERFACE_DESCRIPTOR_DATA) desc = { @@ -1891,7 +1901,9 @@ genX(cmd_buffer_flush_compute_state)(struct anv_cmd_buffer *cmd_buffer) (cmd_buffer->state.compute_dirty & ANV_CMD_DIRTY_PIPELINE)) { /* FIXME: figure out descriptors for gen7 */ result = flush_compute_descriptor_set(cmd_buffer); - assert(result == VK_SUCCESS); + if (result != VK_SUCCESS) + return; + cmd_buffer->state.descriptors_dirty &= ~VK_SHADER_STAGE_COMPUTE_BIT; } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 11/24] anv/cmd_buffer: report tracked errors in vkEndCommandBuffer()
--- src/intel/vulkan/genX_cmd_buffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 61066b8..9ae9de1 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -618,6 +618,9 @@ genX(EndCommandBuffer)( { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); + if (anv_batch_has_error(_buffer->batch)) + return cmd_buffer->batch.status; + /* We want every command buffer to start with the PMA fix in a known state, * so we disable it at the end of the command buffer. */ -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 19/24] anv/cmd_buffer: skip vkCmdExecuteCommands() on broken command buffers
v2: Assert on secondary commands, applications should've called vkEndCommandBuffer() and received an error for them before. --- src/intel/vulkan/genX_cmd_buffer.c | 4 1 file changed, 4 insertions(+) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index b3f1009..510355e 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -644,6 +644,9 @@ genX(CmdExecuteCommands)( assert(primary->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY); + if (anv_batch_has_error(>batch)) + return; + /* The secondary command buffers will assume that the PMA fix is disabled * when they begin executing. Make sure this is true. */ @@ -653,6 +656,7 @@ genX(CmdExecuteCommands)( ANV_FROM_HANDLE(anv_cmd_buffer, secondary, pCmdBuffers[i]); assert(secondary->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY); + assert(!anv_batch_has_error(>batch)); if (secondary->usage_flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) { -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 15/24] anv/cmd_buffer: handle out of memory during vkCmdPushConstants
Fixes: dEQP-VK.api.out_of_host_memory.cmd_push_constants --- src/intel/vulkan/anv_cmd_buffer.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index 003a28c..3c9efac 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -160,13 +160,17 @@ anv_cmd_buffer_ensure_push_constants_size(struct anv_cmd_buffer *cmd_buffer, if (*ptr == NULL) { *ptr = vk_alloc(_buffer->pool->alloc, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); - if (*ptr == NULL) + if (*ptr == NULL) { + anv_batch_set_error(_buffer->batch, VK_ERROR_OUT_OF_HOST_MEMORY); return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + } } else if ((*ptr)->size < size) { *ptr = vk_realloc(_buffer->pool->alloc, *ptr, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); - if (*ptr == NULL) + if (*ptr == NULL) { + anv_batch_set_error(_buffer->batch, VK_ERROR_OUT_OF_HOST_MEMORY); return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + } } (*ptr)->size = size; @@ -730,7 +734,11 @@ void anv_CmdPushConstants( ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); anv_foreach_stage(stage, stageFlags) { - anv_cmd_buffer_ensure_push_constant_field(cmd_buffer, stage, client_data); + VkResult result = + anv_cmd_buffer_ensure_push_constant_field(cmd_buffer, + stage, client_data); + if (result != VK_SUCCESS) + return; memcpy(cmd_buffer->state.push_constants[stage]->client_data + offset, pValues, size); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 20/24] anv/device: assert that commands submitted to a queue are not bogus
Any errors that may have happened during the command buffer recording are reported by vkEndCommandBuffer() and it is the application's reponsibility to not submit broken commands to a queue. --- src/intel/vulkan/anv_device.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 7a087bd..34e8aa7 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1293,6 +1293,7 @@ VkResult anv_QueueSubmit( ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, pSubmits[i].pCommandBuffers[j]); assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY); + assert(!anv_batch_has_error(_buffer->batch)); result = anv_cmd_buffer_execbuf(device, cmd_buffer); if (result != VK_SUCCESS) -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 09/24] anv: avoid crashes when failing to allocate batches
Most of the time we use macros that handle this situation transparently, but there are some cases were we need to handle this explicitly. This patch makes sure we don't crash, notice that error handling takes place in the function that actually failed the allocation, anv_batch_emit_dwords(), which will set the status field of the batch so it can be used at a later moment to report the error to the user. v2: - Not crashing is not good enough, we need to keep track of the error (Topi, Jason). Iago: now that we track errors in the batch, this is being handled. - Added guards in a few more places that needed it (Iago) --- src/intel/blorp/blorp_genX_exec.h | 25 + src/intel/vulkan/anv_private.h| 22 +- src/intel/vulkan/genX_pipeline.c | 4 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h index f0c4f38..dc1b773 100644 --- a/src/intel/blorp/blorp_genX_exec.h +++ b/src/intel/blorp/blorp_genX_exec.h @@ -110,14 +110,16 @@ _blorp_combine_address(struct blorp_batch *batch, void *location, _blorp_cmd_pack(cmd)(batch, (void *)_dst, ), \ _dst = NULL) -#define blorp_emitn(batch, cmd, n) ({\ - uint32_t *_dw = blorp_emit_dwords(batch, n); \ - struct cmd template = {\ - _blorp_cmd_header(cmd), \ - .DWordLength = n - _blorp_cmd_length_bias(cmd), \ - }; \ - _blorp_cmd_pack(cmd)(batch, _dw, ); \ - _dw + 1; /* Array starts at dw[1] */ \ +#define blorp_emitn(batch, cmd, n) ({ \ + uint32_t *_dw = blorp_emit_dwords(batch, n); \ + if (_dw) {\ + struct cmd template = {\ +_blorp_cmd_header(cmd), \ +.DWordLength = n - _blorp_cmd_length_bias(cmd), \ + }; \ + _blorp_cmd_pack(cmd)(batch, _dw, ); \ + } \ + _dw ? _dw + 1 : NULL; /* Array starts at dw[1] */ \ }) /* 3DSTATE_URB @@ -274,6 +276,8 @@ blorp_emit_vertex_buffers(struct blorp_batch *batch, const unsigned num_dwords = 1 + GENX(VERTEX_BUFFER_STATE_length) * 2; uint32_t *dw = blorp_emitn(batch, GENX(3DSTATE_VERTEX_BUFFERS), num_dwords); + if (!dw) + return; for (unsigned i = 0; i < 2; i++) { GENX(VERTEX_BUFFER_STATE_pack)(batch, dw, [i]); @@ -379,6 +383,8 @@ blorp_emit_vertex_elements(struct blorp_batch *batch, const unsigned num_dwords = 1 + GENX(VERTEX_ELEMENT_STATE_length) * num_elements; uint32_t *dw = blorp_emitn(batch, GENX(3DSTATE_VERTEX_ELEMENTS), num_dwords); + if (!dw) + return; for (unsigned i = 0; i < num_elements; i++) { GENX(VERTEX_ELEMENT_STATE_pack)(batch, dw, [i]); @@ -1019,6 +1025,9 @@ blorp_emit_depth_stencil_state(struct blorp_batch *batch, uint32_t offset = 0; uint32_t *dw = blorp_emit_dwords(batch, GENX(3DSTATE_WM_DEPTH_STENCIL_length)); + if (!dw) + return 0; + GENX(3DSTATE_WM_DEPTH_STENCIL_pack)(NULL, dw, ); #else uint32_t offset; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index d1bb761..7490d0c 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -779,15 +779,17 @@ _anv_combine_address(struct anv_batch *batch, void *location, VG(VALGRIND_CHECK_MEM_IS_DEFINED(dst, __anv_cmd_length(struc) * 4)); \ } while (0) -#define anv_batch_emitn(batch, n, cmd, ...) ({ \ - void *__dst = anv_batch_emit_dwords(batch, n);\ - struct cmd __template = { \ - __anv_cmd_header(cmd), \ -.DWordLength = n - __anv_cmd_length_bias(cmd), \ - __VA_ARGS__\ - };\ - __anv_cmd_pack(cmd)(batch, __dst, &__template); \ - __dst;\ +#define anv_batch_emitn(batch, n, cmd, ...) ({ \ + void *__dst = anv_batch_emit_dwords(batch, n); \ + if (__dst) { \ + struct cmd __template = { \ +__anv_cmd_header(cmd), \ + .DWordLength = n - __anv_cmd_length_bias(cmd), \ +__VA_ARGS__\ + };\ + __anv_cmd_pack(cmd)(batch, __dst, &__template); \ + }\ + __dst;
[Mesa-dev] [PATCH v2 04/24] anv/cmd_buffer: report errors in vkBeginCommandBuffer()
--- src/intel/vulkan/genX_cmd_buffer.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 9fdc08b..f74109e 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -381,7 +381,7 @@ transition_depth_buffer(struct anv_cmd_buffer *cmd_buffer, /** * Setup anv_cmd_state::attachments for vkCmdBeginRenderPass. */ -static void +static VkResult genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer, struct anv_render_pass *pass, const VkRenderPassBeginInfo *begin) @@ -393,7 +393,7 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer, if (pass->attachment_count == 0) { state->attachments = NULL; - return; + return VK_SUCCESS; } state->attachments = vk_alloc(_buffer->pool->alloc, @@ -402,7 +402,7 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (state->attachments == NULL) { /* FIXME: Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer */ - abort(); + return VK_ERROR_OUT_OF_HOST_MEMORY; } bool need_null_state = false; @@ -557,6 +557,8 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer, anv_state_flush(cmd_buffer->device, state->render_pass_states); } + + return VK_SUCCESS; } VkResult @@ -589,6 +591,7 @@ genX(BeginCommandBuffer)( genX(cmd_buffer_emit_state_base_address)(cmd_buffer); + VkResult result = VK_SUCCESS; if (cmd_buffer->usage_flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) { cmd_buffer->state.pass = @@ -597,13 +600,13 @@ genX(BeginCommandBuffer)( _buffer->state.pass->subpasses[pBeginInfo->pInheritanceInfo->subpass]; cmd_buffer->state.framebuffer = NULL; - genX(cmd_buffer_setup_attachments)(cmd_buffer, cmd_buffer->state.pass, - NULL); + result = genX(cmd_buffer_setup_attachments)(cmd_buffer, + cmd_buffer->state.pass, NULL); cmd_buffer->state.dirty |= ANV_CMD_DIRTY_RENDER_TARGETS; } - return VK_SUCCESS; + return result; } VkResult -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 03/24] anv/blorp: return early if we failed to create the shader binary
--- src/intel/vulkan/anv_blorp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index d79c5e0..c871f03 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -72,6 +72,9 @@ upload_blorp_shader(struct blorp_context *blorp, key, key_size, kernel, kernel_size, prog_data, prog_data_size, _map); + if (!bin) + return; + /* The cache already has a reference and it's not going anywhere so there * is no need to hold a second reference. */ -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 16/24] anv: handle memory allocation errors during queue submissions
--- src/intel/vulkan/anv_batch_chain.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index 2add5bd..0dc781c 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -1255,8 +1255,11 @@ anv_cmd_buffer_execbuf(struct anv_device *device, adjust_relocations_from_state_pool(ss_pool, _buffer->surface_relocs, cmd_buffer->last_ss_pool_center); - anv_execbuf_add_bo(, _pool->bo, _buffer->surface_relocs, - _buffer->pool->alloc); + VkResult result = + anv_execbuf_add_bo(, _pool->bo, _buffer->surface_relocs, + _buffer->pool->alloc); + if (result != VK_SUCCESS) + return result; /* First, we walk over all of the bos we've seen and add them and their * relocations to the validate list. @@ -1372,7 +1375,7 @@ anv_cmd_buffer_execbuf(struct anv_device *device, cmd_buffer->surface_relocs.relocs[i].presumed_offset = -1; } - VkResult result = anv_device_execbuf(device, , execbuf.bos); + result = anv_device_execbuf(device, , execbuf.bos); anv_execbuf_finish(, _buffer->pool->alloc); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 12/24] anv/cmd_buffer: skip vkCmdNextSubpass() for broken command buffers
--- src/intel/vulkan/genX_cmd_buffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 9ae9de1..557893b 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2489,6 +2489,9 @@ void genX(CmdNextSubpass)( { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); + if (anv_batch_has_error(_buffer->batch)) + return; + assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY); anv_cmd_buffer_resolve_subpass(cmd_buffer); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 22/24] anv: handle errors while allocating new binding table blocks
Also, we had a couple of instances in flush_descriptor_sets() were we were returning a VkResult directly upon error, but the return value of this function is not a VkResult but a uint32_t dirty mask, so simply return 0 in these cases which reduces the amount of work the driver will do after the error has been raised. --- src/intel/vulkan/anv_batch_chain.c | 8 ++-- src/intel/vulkan/genX_cmd_buffer.c | 11 +++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index 0dc781c..d01d9d7 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -661,8 +661,10 @@ anv_cmd_buffer_new_binding_table_block(struct anv_cmd_buffer *cmd_buffer) _buffer->device->surface_state_block_pool; int32_t *offset = u_vector_add(_buffer->bt_blocks); - if (offset == NULL) + if (offset == NULL) { + anv_batch_set_error(_buffer->batch, VK_ERROR_OUT_OF_HOST_MEMORY); return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + } *offset = anv_block_pool_alloc_back(block_pool); cmd_buffer->bt_next = 0; @@ -715,7 +717,9 @@ anv_cmd_buffer_init_batch_bo_chain(struct anv_cmd_buffer *cmd_buffer) goto fail_bt_blocks; cmd_buffer->last_ss_pool_center = 0; - anv_cmd_buffer_new_binding_table_block(cmd_buffer); + result = anv_cmd_buffer_new_binding_table_block(cmd_buffer); + if (result != VK_SUCCESS) + goto fail_bt_blocks; return VK_SUCCESS; diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 510355e..3069297 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1348,7 +1348,8 @@ flush_descriptor_sets(struct anv_cmd_buffer *cmd_buffer) assert(result == VK_ERROR_OUT_OF_DEVICE_MEMORY); result = anv_cmd_buffer_new_binding_table_block(cmd_buffer); - assert(result == VK_SUCCESS); + if (result != VK_SUCCESS) + return 0; /* Re-emit state base addresses so we get the new surface state base * address before we start emitting binding tables etc. @@ -1360,11 +1361,11 @@ flush_descriptor_sets(struct anv_cmd_buffer *cmd_buffer) anv_foreach_stage(s, dirty) { result = emit_samplers(cmd_buffer, s, _buffer->state.samplers[s]); if (result != VK_SUCCESS) -return result; +return 0; result = emit_binding_table(cmd_buffer, s, _buffer->state.binding_tables[s]); if (result != VK_SUCCESS) -return result; +return 0; } } @@ -1819,8 +1820,10 @@ flush_compute_descriptor_set(struct anv_cmd_buffer *cmd_buffer) result = emit_binding_table(cmd_buffer, MESA_SHADER_COMPUTE, ); if (result != VK_SUCCESS) { assert(result == VK_ERROR_OUT_OF_DEVICE_MEMORY); + result = anv_cmd_buffer_new_binding_table_block(cmd_buffer); - assert(result == VK_SUCCESS); + if (result != VK_SUCCESS) + return result; /* Re-emit state base addresses so we get the new surface state base * address before we start emitting binding tables etc. -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 24/24] anv: improve error reporting when creating pipelines
Specifically, report 'out of memory' errors that might have happened while emitting the pipeline's batch. --- src/intel/vulkan/anv_pipeline.c | 1 + src/intel/vulkan/genX_pipeline.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index dc65e26..97ddd18 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -1207,6 +1207,7 @@ anv_pipeline_init(struct anv_pipeline *pipeline, pipeline->batch.next = pipeline->batch.start = pipeline->batch_data; pipeline->batch.end = pipeline->batch.start + sizeof(pipeline->batch_data); pipeline->batch.relocs = >batch_relocs; + pipeline->batch.status = VK_SUCCESS; copy_non_dynamic_state(pipeline, pCreateInfo); pipeline->depth_clamp_enable = pCreateInfo->pRasterizationState && diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 7b01ee5..8011515 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -1675,7 +1675,7 @@ genX(graphics_pipeline_create)( *pPipeline = anv_pipeline_to_handle(pipeline); - return VK_SUCCESS; + return pipeline->batch.status; } static VkResult @@ -1714,6 +1714,7 @@ compute_pipeline_create( pipeline->batch.next = pipeline->batch.start = pipeline->batch_data; pipeline->batch.end = pipeline->batch.start + sizeof(pipeline->batch_data); pipeline->batch.relocs = >batch_relocs; + pipeline->batch.status = VK_SUCCESS; /* When we free the pipeline, we detect stages based on the NULL status * of various prog_data pointers. Make them NULL by default. @@ -1803,7 +1804,7 @@ compute_pipeline_create( *pPipeline = anv_pipeline_to_handle(pipeline); - return VK_SUCCESS; + return pipeline->batch.status; } VkResult genX(CreateGraphicsPipelines)( -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 10/24] anv: handle failures when growing reloc lists
Growing the reloc list happens through calling anv_reloc_list_add() or anv_reloc_list_append(). Make sure that we call these through helpers that check the result and set the batch error status if needed. v2: - Handling the crashes is not good enough, we need to keep track of the error, for that, keep track of the errors in the batch instead (Jason). - Make reloc list growth go through helpers so we can have a central place where we can do error tracking (Jason). --- src/intel/vulkan/anv_batch_chain.c | 29 - src/intel/vulkan/genX_blorp_exec.c | 7 +-- src/intel/vulkan/genX_cmd_buffer.c | 25 ++--- 3 files changed, 39 insertions(+), 22 deletions(-) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index 3774172..2add5bd 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -151,8 +151,9 @@ anv_reloc_list_add(struct anv_reloc_list *list, const uint32_t domain = target_bo->is_winsys_bo ? I915_GEM_DOMAIN_RENDER : 0; - anv_reloc_list_grow(list, alloc, 1); - /* TODO: Handle failure */ + VkResult result = anv_reloc_list_grow(list, alloc, 1); + if (result != VK_SUCCESS) + return 0; /* XXX: Can we use I915_EXEC_HANDLE_LUT? */ index = list->num_relocs++; @@ -169,13 +170,14 @@ anv_reloc_list_add(struct anv_reloc_list *list, return target_bo->offset + delta; } -static void +static VkResult anv_reloc_list_append(struct anv_reloc_list *list, const VkAllocationCallbacks *alloc, struct anv_reloc_list *other, uint32_t offset) { - anv_reloc_list_grow(list, alloc, other->num_relocs); - /* TODO: Handle failure */ + VkResult result = anv_reloc_list_grow(list, alloc, other->num_relocs); + if (result != VK_SUCCESS) + return result; memcpy(>relocs[list->num_relocs], >relocs[0], other->num_relocs * sizeof(other->relocs[0])); @@ -186,6 +188,7 @@ anv_reloc_list_append(struct anv_reloc_list *list, list->relocs[i + list->num_relocs].offset += offset; list->num_relocs += other->num_relocs; + return VK_SUCCESS; } /*---* @@ -215,8 +218,12 @@ uint64_t anv_batch_emit_reloc(struct anv_batch *batch, void *location, struct anv_bo *bo, uint32_t delta) { - return anv_reloc_list_add(batch->relocs, batch->alloc, - location - batch->start, bo, delta); + uint64_t offset = anv_reloc_list_add(batch->relocs, batch->alloc, +location - batch->start, bo, delta); + if (offset == 0) + anv_batch_set_error(batch, VK_ERROR_OUT_OF_HOST_MEMORY); + + return offset; } void @@ -239,8 +246,12 @@ anv_batch_emit_batch(struct anv_batch *batch, struct anv_batch *other) memcpy(batch->next, other->start, size); offset = batch->next - batch->start; - anv_reloc_list_append(batch->relocs, batch->alloc, - other->relocs, offset); + VkResult result = anv_reloc_list_append(batch->relocs, batch->alloc, + other->relocs, offset); + if (result != VK_SUCCESS) { + anv_batch_set_error(batch, result); + return; + } batch->next += size; } diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c index 7084735..90adefe 100644 --- a/src/intel/vulkan/genX_blorp_exec.c +++ b/src/intel/vulkan/genX_blorp_exec.c @@ -57,8 +57,11 @@ blorp_surface_reloc(struct blorp_batch *batch, uint32_t ss_offset, struct blorp_address address, uint32_t delta) { struct anv_cmd_buffer *cmd_buffer = batch->driver_batch; - anv_reloc_list_add(_buffer->surface_relocs, _buffer->pool->alloc, - ss_offset, address.buffer, address.offset + delta); + uint64_t offset = + anv_reloc_list_add(_buffer->surface_relocs, _buffer->pool->alloc, + ss_offset, address.buffer, address.offset + delta); + if (offset == 0) + anv_batch_set_error(_buffer->batch, VK_ERROR_OUT_OF_HOST_MEMORY); } static void * diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index f74109e..61066b8 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -155,12 +155,19 @@ genX(cmd_buffer_emit_state_base_address)(struct anv_cmd_buffer *cmd_buffer) static void add_surface_state_reloc(struct anv_cmd_buffer *cmd_buffer, struct anv_state state, +bool is_aux, struct anv_bo *bo, uint32_t offset) { const struct isl_device *isl_dev = _buffer->device->isl_dev; - anv_reloc_list_add(_buffer->surface_relocs, _buffer->pool->alloc, - state.offset + isl_dev->ss.addr_offset, bo, offset); + uint32_t total_offset = state.offset + +
[Mesa-dev] [PATCH v2 13/24] anv/cmd_buffer: skip vkCmdEndRenderPass() for broken command buffers
--- src/intel/vulkan/genX_cmd_buffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 557893b..efb271e 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2508,6 +2508,9 @@ void genX(CmdEndRenderPass)( { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); + if (anv_batch_has_error(_buffer->batch)) + return; + anv_cmd_buffer_resolve_subpass(cmd_buffer); /* Perform transitions to the final layout after all writes have occurred. -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 06/24] anv: add anv_batch_set_error() and anv_batch_has_error() helpers
The anv_batch_set_error() helper will track the first error that happened while recording a command buffer. The helper returns the currently tracked error to help the job of internal functions that may generate errors that need to be tracked and return a VkResult to the caller. We will use the anv_batch_has_error() helper to guard parts of the driver that are not safe to execute if an error has been generated while recording a particular command buffer. --- src/intel/vulkan/anv_cmd_buffer.c | 2 +- src/intel/vulkan/anv_private.h| 15 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index 4a41bc0..003a28c 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -221,7 +221,7 @@ static VkResult anv_create_cmd_buffer( return VK_SUCCESS; fail: - cmd_buffer->batch.status = result; + anv_batch_set_error(_buffer->batch, result); vk_free(_buffer->pool->alloc, cmd_buffer); return result; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index f5d7600..d1bb761 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -722,6 +722,21 @@ uint64_t anv_batch_emit_reloc(struct anv_batch *batch, VkResult anv_device_submit_simple_batch(struct anv_device *device, struct anv_batch *batch); +static inline VkResult +anv_batch_set_error(struct anv_batch *batch, VkResult error) +{ + assert(error != VK_SUCCESS); + if (batch->status == VK_SUCCESS) + batch->status = error; + return batch->status; +} + +static inline bool +anv_batch_has_error(struct anv_batch *batch) +{ + return batch->status != VK_SUCCESS; +} + struct anv_address { struct anv_bo *bo; uint32_t offset; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 18/24] anv/cmd_buffer: skip vkCmdDispatch() on broken command buffers
--- src/intel/vulkan/genX_cmd_buffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 112239c..b3f1009 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1933,6 +1933,9 @@ void genX(CmdDispatch)( struct anv_pipeline *pipeline = cmd_buffer->state.compute_pipeline; const struct brw_cs_prog_data *prog_data = get_cs_prog_data(pipeline); + if (anv_batch_has_error(_buffer->batch)) + return; + if (prog_data->uses_num_work_groups) { struct anv_state state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, 12, 4); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 02/24] anv: do not try to ref/unref NULL shaders
This situation can happen if we failed to allocate memory for the shader. v2: - We shouldn't see NULL shaders in anv_shader_bin_ref so we should not check for that (Jason). Make sure that callers don't attempt to call this function with a NULL shader and assert that this never happens (Iago). --- src/intel/vulkan/anv_pipeline_cache.c | 5 - src/intel/vulkan/anv_private.h| 5 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c index a8ea80f..d6c8413 100644 --- a/src/intel/vulkan/anv_pipeline_cache.c +++ b/src/intel/vulkan/anv_pipeline_cache.c @@ -308,7 +308,8 @@ anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache, pthread_mutex_unlock(>mutex); /* We increment refcount before handing it to the caller */ - anv_shader_bin_ref(bin); + if (bin) + anv_shader_bin_ref(bin); return bin; } else { @@ -546,6 +547,8 @@ VkResult anv_MergePipelineCaches( struct hash_entry *entry; hash_table_foreach(src->cache, entry) { struct anv_shader_bin *bin = entry->data; + assert(bin); + if (_mesa_hash_table_search(dst->cache, bin->key)) continue; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 27c1923..aa2b6d7 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1543,13 +1543,16 @@ anv_shader_bin_destroy(struct anv_device *device, struct anv_shader_bin *shader) static inline void anv_shader_bin_ref(struct anv_shader_bin *shader) { - assert(shader->ref_cnt >= 1); + assert(shader && shader->ref_cnt >= 1); __sync_fetch_and_add(>ref_cnt, 1); } static inline void anv_shader_bin_unref(struct anv_device *device, struct anv_shader_bin *shader) { + if (!shader) + return; + assert(shader->ref_cnt >= 1); if (__sync_fetch_and_add(>ref_cnt, -1) == 1) anv_shader_bin_destroy(device, shader); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 07/24] anv: handle allocation failure in anv_batch_emit_batch()
Fixes: dEQP-VK.api.out_of_host_memory.cmd_execute_commands --- src/intel/vulkan/anv_batch_chain.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index 3f6039e..1236001 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -222,8 +222,11 @@ anv_batch_emit_batch(struct anv_batch *batch, struct anv_batch *other) size = other->next - other->start; assert(size % 4 == 0); - if (batch->next + size > batch->end) - batch->extend_cb(batch, batch->user_data); + if (batch->next + size > batch->end) { + VkResult result = batch->extend_cb(batch, batch->user_data); + if (result != VK_SUCCESS) + return; + } assert(batch->next + size <= batch->end); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 05/24] anv/cmd_buffer: add a status field to anv_batch
The vkCmd*() functions do not report errors, instead, any errors should be reported by the time we call vkEndCommandBuffer(). This means that we need to make the driver robust against incosistent and/or imcomplete command buffer states through the command recording process, particularly, avoid crashes due to access to memory that we failed to allocate previously. The strategy used to do this is to track the first error ocurred while recording a command buffer in the batch associated with it. We use the batch to track this information because the command buffer may not be visible to all parts of the driver that can produce errors we need to be aware of (such as allocation failures during batch emissions). Later patches will use this error information to guard parts of the driver that may not be safe to execute. v2: Move the field from the command buffer to the batch so we can track errors from batch emissions (Jason) --- src/intel/vulkan/anv_cmd_buffer.c | 5 + src/intel/vulkan/anv_private.h| 9 + 2 files changed, 14 insertions(+) diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index cab1dd7..4a41bc0 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -117,6 +117,8 @@ anv_cmd_state_reset(struct anv_cmd_buffer *cmd_buffer) { struct anv_cmd_state *state = _buffer->state; + cmd_buffer->batch.status = VK_SUCCESS; + memset(>descriptors, 0, sizeof(state->descriptors)); memset(>push_constants, 0, sizeof(state->push_constants)); memset(state->binding_tables, 0, sizeof(state->binding_tables)); @@ -185,6 +187,8 @@ static VkResult anv_create_cmd_buffer( if (cmd_buffer == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + cmd_buffer->batch.status = VK_SUCCESS; + cmd_buffer->_loader_data.loaderMagic = ICD_LOADER_MAGIC; cmd_buffer->device = device; cmd_buffer->pool = pool; @@ -217,6 +221,7 @@ static VkResult anv_create_cmd_buffer( return VK_SUCCESS; fail: + cmd_buffer->batch.status = result; vk_free(_buffer->pool->alloc, cmd_buffer); return result; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index aa2b6d7..f5d7600 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -704,6 +704,15 @@ struct anv_batch { */ VkResult (*extend_cb)(struct anv_batch *, void *); void * user_data; + + /** +* Current error status of the command buffer. Used to track inconsistent +* or incomplete command buffer states that are the consequence of run-time +* errors such as out of memory scenarios. We want to track this in the +* batch because the command buffer object is not visible to some parts +* of the driver. +*/ + VkResult status; }; void *anv_batch_emit_dwords(struct anv_batch *batch, int num_dwords); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 00/24] anv: Handle out of memory situations better
I think this series addresses all the issues raised for v1, except making similar changes to anv_cmd_buffer_alloc_dynamic_state and anv_cmd_buffer_alloc_blorp_binding_table which Jason suggested we should probably do as well, and that I'd like to cover separately from this. The main change from v1 is that we now track errors in anv_batch, which allows us to track and report errors that occur during batch emissions as well. As discussed during v1, I have dropped the patch "anv: ensure that we don't ever try to adjust relocations more than once", since Jason pointed out that the issue this was trying to address was under discussion in Khronos. I have also pointed that discussion to the test developers so that the tests are updated accordingly when a final decision is made. Besides addressing review feedback, this series incorporates a bunch of additional improvements including better reporting of errors for pipelines (we can do this now because we track out of memory errors in batches) and a few other fixes, mostly crash guards that I had missed before and a few other minor things. I have also changed a bit the order of some patches in the series so related fixes are closer to each other. Iago Toral Quiroga (24): anv: remove unnecessary function prototype. anv: do not try to ref/unref NULL shaders anv/blorp: return early if we failed to create the shader binary anv/cmd_buffer: report errors in vkBeginCommandBuffer() anv/cmd_buffer: add a status field to anv_batch anv: add anv_batch_set_error() and anv_batch_has_error() helpers anv: handle allocation failure in anv_batch_emit_batch() anv: handle allocation failure in anv_batch_emit_dwords() anv: avoid crashes when failing to allocate batches anv: handle failures when growing reloc lists anv/cmd_buffer: report tracked errors in vkEndCommandBuffer() anv/cmd_buffer: skip vkCmdNextSubpass() for broken command buffers anv/cmd_buffer: skip vkCmdEndRenderPass() for broken command buffers anv/cmd_buffer: handle allocation errors during vkCmdBeginRenderPass() anv/cmd_buffer: handle out of memory during vkCmdPushConstants anv: handle memory allocation errors during queue submissions anv/cmd_buffer: skip vkCmdDraw*() on broken command buffers anv/cmd_buffer: skip vkCmdDispatch() on broken command buffers anv/cmd_buffer: skip vkCmdExecuteCommands() on broken command buffers anv/device: assert that commands submitted to a queue are not bogus anv/blorp: make anv_cmd_buffer_alloc_blorp_binding_table() return a VkResult anv: handle errors while allocating new binding table blocks anv: handle errors in emit_binding_table() and emit_samplers() anv: improve error reporting when creating pipelines src/intel/blorp/blorp_genX_exec.h | 25 +--- src/intel/vulkan/anv_batch_chain.c| 62 +-- src/intel/vulkan/anv_blorp.c | 38 +++- src/intel/vulkan/anv_cmd_buffer.c | 19 +- src/intel/vulkan/anv_device.c | 1 + src/intel/vulkan/anv_pipeline.c | 1 + src/intel/vulkan/anv_pipeline_cache.c | 5 +- src/intel/vulkan/anv_private.h| 56 + src/intel/vulkan/genX_blorp_exec.c| 18 +++--- src/intel/vulkan/genX_cmd_buffer.c| 113 +- src/intel/vulkan/genX_pipeline.c | 9 ++- 11 files changed, 253 insertions(+), 94 deletions(-) -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 08/24] anv: handle allocation failure in anv_batch_emit_dwords()
--- src/intel/vulkan/anv_batch_chain.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index 1236001..3774172 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -195,8 +195,13 @@ anv_reloc_list_append(struct anv_reloc_list *list, void * anv_batch_emit_dwords(struct anv_batch *batch, int num_dwords) { - if (batch->next + num_dwords * 4 > batch->end) - batch->extend_cb(batch, batch->user_data); + if (batch->next + num_dwords * 4 > batch->end) { + VkResult result = batch->extend_cb(batch, batch->user_data); + if (result != VK_SUCCESS) { + anv_batch_set_error(batch, result); + return NULL; + } + } void *p = batch->next; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 01/24] anv: remove unnecessary function prototype.
The function is defined right after the prototype declaration. Also, the protoype for it is included in anv_genX.h which is included via anv_private.h. --- src/intel/vulkan/genX_blorp_exec.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c index c1499fb..7084735 100644 --- a/src/intel/vulkan/genX_blorp_exec.c +++ b/src/intel/vulkan/genX_blorp_exec.c @@ -143,9 +143,6 @@ blorp_emit_urb_config(struct blorp_batch *batch, unsigned vs_entry_size) entry_size); } -void genX(blorp_exec)(struct blorp_batch *batch, - const struct blorp_params *params); - void genX(blorp_exec)(struct blorp_batch *batch, const struct blorp_params *params) -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 0/6] Use drmDevice2 API, take ... final
Hi all, Here is hopefully the final round of using drmDevice2. As a brief reminder - probing devices via drmDevice or directly opening the device node wakes up the device, even if we're not planning to use it. The wakeup in itself, can be very slow in some cases. Note: you _will_ need to update libdrm to 2.4.75 -Emil Emil Velikov (6): autoconf/scons: bump libdrm to 2.4.75 loader: use drmGetDevice[s]2 API winsys/amdgpu: use drmGetDevice2 API radv/winsys: use drmGetDevice2 API radv: do not open random render node(s) anv: do not open random render node(s) configure.ac | 4 +- scons/gallium.py | 2 +- src/amd/vulkan/radv_device.c | 48 +++- src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c | 4 +- src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 4 +- src/intel/vulkan/Makefile.am | 1 + src/intel/vulkan/anv_device.c | 53 --- src/loader/loader.c | 6 +-- 8 files changed, 85 insertions(+), 37 deletions(-) -- 2.11.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 3/6] winsys/amdgpu: use drmGetDevice2 API
From: Emil VelikovAnalogous to previous commit Signed-off-by: Emil Velikov Reviewed-by: Michel Dänzer Reviewed-by: Marek Olšák Reviewed-by: Eric Engestrom --- src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index bf7a057399..37e0140311 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -108,9 +108,9 @@ static bool do_winsys_init(struct amdgpu_winsys *ws, int fd) drmDevicePtr devinfo; /* Get PCI info. */ - r = drmGetDevice(fd, ); + r = drmGetDevice2(fd, 0, ); if (r) { - fprintf(stderr, "amdgpu: drmGetDevice failed.\n"); + fprintf(stderr, "amdgpu: drmGetDevice2 failed.\n"); goto fail; } ws->info.pci_domain = devinfo->businfo.pci->domain; -- 2.11.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 6/6] anv: do not open random render node(s)
From: Emil VelikovdrmGetDevices2() provides us with enough flexibility to build heuristics upon. Opening a random node on the other hand will wake up the device, regardless if it's the one we're interested or not. v2: Rebase, explicitly require/check for libdrm v3: Return VK_ERROR_INCOMPATIBLE_DRIVER for no devices (Ilia) Cc: Jason Ekstrand Signed-off-by: Emil Velikov Reviewed-by: Eric Engestrom --- configure.ac | 2 +- src/intel/vulkan/Makefile.am | 1 + src/intel/vulkan/anv_device.c | 53 +++ 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index 420814b517..8be673781a 100644 --- a/configure.ac +++ b/configure.ac @@ -1789,8 +1789,8 @@ if test -n "$with_vulkan_drivers"; then if test "x$HAVE_I965_DRI" != xyes; then AC_MSG_ERROR([Intel Vulkan driver requires the i965 dri driver]) fi +require_libdrm "ANV" HAVE_INTEL_VULKAN=yes - ;; xradeon) PKG_CHECK_MODULES([AMDGPU], [libdrm >= $LIBDRM_AMDGPU_REQUIRED libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED]) diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am index 3cd01e4d02..dcde984719 100644 --- a/src/intel/vulkan/Makefile.am +++ b/src/intel/vulkan/Makefile.am @@ -137,6 +137,7 @@ VULKAN_LIB_DEPS += \ $(top_builddir)/src/intel/isl/libisl.la \ $(top_builddir)/src/intel/blorp/libblorp.la \ $(PER_GEN_LIBS) \ + $(LIBDRM_LIBS) \ $(PTHREAD_LIBS) \ $(DLOPEN_LIBS) \ -lm diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 7a087bd0f0..2888d023a9 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "anv_private.h" #include "util/strtod.h" @@ -384,6 +385,40 @@ void anv_DestroyInstance( vk_free(>alloc, instance); } +static VkResult +anv_enumerate_devices(struct anv_instance *instance) +{ + /* TODO: Check for more devices ? */ + drmDevicePtr devices[8]; + VkResult result = VK_ERROR_INCOMPATIBLE_DRIVER; + int max_devices; + + instance->physicalDeviceCount = 0; + + max_devices = drmGetDevices2(0, devices, sizeof(devices)); + if (max_devices < 1) + return VK_ERROR_INCOMPATIBLE_DRIVER; + + for (unsigned i = 0; i < (unsigned)max_devices; i++) { + if (devices[i]->available_nodes & 1 << DRM_NODE_RENDER && + devices[i]->bustype == DRM_BUS_PCI && + devices[i]->deviceinfo.pci->vendor_id == 0x8086) { + + result = anv_physical_device_init(>physicalDevice, +instance, +devices[i]->nodes[DRM_NODE_RENDER]); + if (result != VK_ERROR_INCOMPATIBLE_DRIVER) +break; + } + } + + if (result == VK_SUCCESS) + instance->physicalDeviceCount = 1; + + return result; +} + + VkResult anv_EnumeratePhysicalDevices( VkInstance _instance, uint32_t* pPhysicalDeviceCount, @@ -393,22 +428,10 @@ VkResult anv_EnumeratePhysicalDevices( VkResult result; if (instance->physicalDeviceCount < 0) { - char path[20]; - for (unsigned i = 0; i < 8; i++) { - snprintf(path, sizeof(path), "/dev/dri/renderD%d", 128 + i); - result = anv_physical_device_init(>physicalDevice, - instance, path); - if (result != VK_ERROR_INCOMPATIBLE_DRIVER) -break; - } - - if (result == VK_ERROR_INCOMPATIBLE_DRIVER) { - instance->physicalDeviceCount = 0; - } else if (result == VK_SUCCESS) { - instance->physicalDeviceCount = 1; - } else { + result = anv_enumerate_devices(instance); + if (result != VK_SUCCESS && + result != VK_ERROR_INCOMPATIBLE_DRIVER) return result; - } } /* pPhysicalDeviceCount is an out parameter if pPhysicalDevices is NULL; -- 2.11.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 5/6] radv: do not open random render node(s)
From: Emil VelikovdrmGetDevices2() provides us with enough flexibility to build heuristics upon. Opening a random node on the other hand will wake up the device, regardless if it's the one we're interested or not. v2: Rebase. v3: Return VK_ERROR_INCOMPATIBLE_DRIVER for no devices (Ilia) Cc: Michel Dänzer Cc: Dave Airlie Signed-off-by: Emil Velikov Reviewed-by: Bas Nieuwenhuizen (v1) Reviewed-by: Eric Engestrom (v1) --- src/amd/vulkan/radv_device.c | 48 +--- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 17529c1f88..d8a903f077 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -379,28 +379,52 @@ void radv_DestroyInstance( vk_free(>alloc, instance); } -VkResult radv_EnumeratePhysicalDevices( - VkInstance _instance, - uint32_t* pPhysicalDeviceCount, - VkPhysicalDevice* pPhysicalDevices) +static VkResult +radv_enumerate_devices(struct radv_instance *instance) { - RADV_FROM_HANDLE(radv_instance, instance, _instance); - VkResult result; + /* TODO: Check for more devices ? */ + drmDevicePtr devices[8]; + VkResult result = VK_ERROR_INCOMPATIBLE_DRIVER; + int max_devices; + + instance->physicalDeviceCount = 0; + + max_devices = drmGetDevices2(0, devices, sizeof(devices)); + if (max_devices < 1) + return VK_ERROR_INCOMPATIBLE_DRIVER; + + for (unsigned i = 0; i < (unsigned)max_devices; i++) { + if (devices[i]->available_nodes & 1 << DRM_NODE_RENDER && + devices[i]->bustype == DRM_BUS_PCI && + devices[i]->deviceinfo.pci->vendor_id == 0x1002) { - if (instance->physicalDeviceCount < 0) { - char path[20]; - instance->physicalDeviceCount = 0; - for (unsigned i = 0; i < RADV_MAX_DRM_DEVICES; i++) { - snprintf(path, sizeof(path), "/dev/dri/renderD%d", 128 + i); result = radv_physical_device_init(instance->physicalDevices + instance->physicalDeviceCount, - instance, path); + instance, + devices[i]->nodes[DRM_NODE_RENDER]); if (result == VK_SUCCESS) ++instance->physicalDeviceCount; else if (result != VK_ERROR_INCOMPATIBLE_DRIVER) return result; } } + return result; +} + +VkResult radv_EnumeratePhysicalDevices( + VkInstance _instance, + uint32_t* pPhysicalDeviceCount, + VkPhysicalDevice* pPhysicalDevices) +{ + RADV_FROM_HANDLE(radv_instance, instance, _instance); + VkResult result; + + if (instance->physicalDeviceCount < 0) { + result = radv_enumerate_devices(instance); + if (result != VK_SUCCESS && + result != VK_ERROR_INCOMPATIBLE_DRIVER) + return result; + } if (!pPhysicalDevices) { *pPhysicalDeviceCount = instance->physicalDeviceCount; -- 2.11.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 4/6] radv/winsys: use drmGetDevice2 API
From: Emil VelikovAnalogous to previous commit Cc: Dave Airlie Signed-off-by: Emil Velikov Reviewed-by: Michel Dänzer Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Eric Engestrom --- src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c index c9f5235991..783567fa5b 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c @@ -124,9 +124,9 @@ do_winsys_init(struct radv_amdgpu_winsys *ws, int fd) int r; int i, j; /* Get PCI info. */ - r = drmGetDevice(fd, ); + r = drmGetDevice2(fd, 0, ); if (r) { - fprintf(stderr, "amdgpu: drmGetDevice failed.\n"); + fprintf(stderr, "amdgpu: drmGetDevice2 failed.\n"); goto fail; } ws->info.pci_domain = devinfo->businfo.pci->domain; -- 2.11.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 2/6] loader: use drmGetDevice[s]2 API
From: Emil VelikovBy this allows us to fetch the device list/info w/o the revision field. At the moment retrieving the latter wakes up the device. Note: kernel patch to resolve that should be in 4.10. Signed-off-by: Emil Velikov Reviewed-by: Michel Dänzer Reviewed-by: Eric Engestrom --- src/loader/loader.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/loader/loader.c b/src/loader/loader.c index 9b4752d313..5541ccc2a7 100644 --- a/src/loader/loader.c +++ b/src/loader/loader.c @@ -145,7 +145,7 @@ static char *drm_get_id_path_tag_for_fd(int fd) drmDevicePtr device; char *tag; - if (drmGetDevice(fd, ) != 0) + if (drmGetDevice2(fd, 0, ) != 0) return NULL; tag = drm_construct_id_path_tag(device); @@ -179,7 +179,7 @@ int loader_get_user_preferred_fd(int default_fd, int *different_device) if (default_tag == NULL) goto err; - num_devices = drmGetDevices(devices, MAX_DRM_DEVICES); + num_devices = drmGetDevices2(0, devices, MAX_DRM_DEVICES); if (num_devices < 0) goto err; @@ -275,7 +275,7 @@ drm_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id) drmDevicePtr device; int ret; - if (drmGetDevice(fd, ) == 0) { + if (drmGetDevice2(fd, 0, ) == 0) { if (device->bustype == DRM_BUS_PCI) { *vendor_id = device->deviceinfo.pci->vendor_id; *chip_id = device->deviceinfo.pci->device_id; -- 2.11.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 1/6] autoconf/scons: bump libdrm to 2.4.75
From: Emil VelikovWe'll be using the drmGetDevice[s]2 API in src/loader with next patch. v2: Rebase. Signed-off-by: Emil Velikov Reviewed-by: Michel Dänzer (v1) Reviewed-by: Eric Engestrom (v1) --- configure.ac | 2 +- scons/gallium.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index d64ed2d3e8..420814b517 100644 --- a/configure.ac +++ b/configure.ac @@ -72,7 +72,7 @@ AC_SUBST([OPENCL_VERSION]) # codifies which drivers need which version of libdrm. Any libdrm # version dependencies in non-driver-specific code should be reflected # in the first entry. -LIBDRM_REQUIRED=2.4.66 +LIBDRM_REQUIRED=2.4.75 LIBDRM_RADEON_REQUIRED=2.4.71 LIBDRM_AMDGPU_REQUIRED=2.4.63 LIBDRM_INTEL_REQUIRED=2.4.75 diff --git a/scons/gallium.py b/scons/gallium.py index 665d66afc7..a411277324 100755 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -648,7 +648,7 @@ def generate(env): env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'glproto >= 1.4.13', 'dri2proto >= 2.8']) env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1', 'xcb-dri2 >= 1.8']) env.PkgCheckModules('XF86VIDMODE', ['xxf86vm']) -env.PkgCheckModules('DRM', ['libdrm >= 2.4.66']) +env.PkgCheckModules('DRM', ['libdrm >= 2.4.75']) if env['x11']: env.Append(CPPPATH = env['X11_CPPPATH']) -- 2.11.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] util/disk_cache: fix zlib linking with LTO build
On 9 March 2017 at 14:39, Steven Newburywrote: > Introduction of zlib compression for the shader cache means > zlib needs to be explicitly linked to libOSMesa and libstandalone > otherwise build fails when LTO is used. > --- How exactly are you doing the LTO build ? The only user of ZLIB is libmesautil.la which in itself uses ZLIB_LIBS. Hence as-is patch looks wrong/incomplete, although I might be missing something ? -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] util/disk_cache: fix zlib linking with LTO build
Acked-by: Marek OlšákMarek On Thu, Mar 9, 2017 at 3:39 PM, Steven Newbury wrote: > Introduction of zlib compression for the shader cache means > zlib needs to be explicitly linked to libOSMesa and libstandalone > otherwise build fails when LTO is used. > --- > src/compiler/Makefile.glsl.am | 1 + > src/gallium/targets/osmesa/Makefile.am | 3 ++- > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/compiler/Makefile.glsl.am > b/src/compiler/Makefile.glsl.am > index 41edb3cf4d..7be607c74c 100644 > --- a/src/compiler/Makefile.glsl.am > +++ b/src/compiler/Makefile.glsl.am > @@ -141,6 +141,7 @@ glsl_libstandalone_la_LIBADD = > \ > glsl/libglsl.la \ > $(top_builddir)/src/libglsl_util.la \ > $(top_builddir)/src/util/libmesautil.la \ > + $(ZLIB_LIBS)\ > $(PTHREAD_LIBS) > > glsl_compiler_SOURCES = \ > diff --git a/src/gallium/targets/osmesa/Makefile.am > b/src/gallium/targets/osmesa/Makefile.am > index 6d340f1d92..b7b9248126 100644 > --- a/src/gallium/targets/osmesa/Makefile.am > +++ b/src/gallium/targets/osmesa/Makefile.am > @@ -66,7 +66,8 @@ lib@OSMESA_LIB@_la_LIBADD = \ > $(top_builddir)/src/mapi/glapi/libglapi.la \ > $(SHARED_GLAPI_LIB) \ > $(OSMESA_LIB_DEPS) \ > - $(CLOCK_LIB) > + $(CLOCK_LIB) \ > + $(ZLIB_LIBS) > > if HAVE_GALLIUM_LLVM > AM_CPPFLAGS += -DGALLIUM_LLVMPIPE > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] RFC Thread queue for shader cache compression/writes (real)
I'm seeing patches I've already reviewed in the previous extended series (e.g. 1/8) and later ones show up multiple times (e.g. there are two patches for 5/8), so I don't know what to review. Can you send the whole thing again. Thanks. Marek On Fri, Mar 10, 2017 at 3:28 AM, Timothy Arceriwrote: > This series was created to attempt to address regressions in compile times > cause by the shader cache when the cache is cold. However my testing has > shown no noticable change either way in start-up times of Deus Ex on my > Intel i5-6400 CPU. > > The reports were for slow compression times on an older AMD cpu so maybe > it will help more there. > > It's also possible this will help in-game but I have no stats for that > currently. > > While working on this I found the major cause of the regression in compile > times and fixed it here [1]. > > For this to apply there are still some patches on the list that need to > be reviewed and land in master [2] [3]. > > [1] https://lists.freedesktop.org/archives/mesa-dev/2017-March/147324.html > [2] https://patchwork.freedesktop.org/series/20872/ > [3] https://patchwork.freedesktop.org/series/20873/ > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] glsl: don't recompile a shader on fallback unless needed
For the series: Acked-by: Marek OlšákDoes this fix the crash when GLSL gets a cache hit and st/mesa gets a cache miss? Marek On Thu, Mar 9, 2017 at 1:42 PM, Timothy Arceri wrote: > On 09/03/17 22:58, Timothy Arceri wrote: >> >> Because we optimistically skip compiling shaders if we have seen them >> before we may need to compile them later at link time if they haven't >> yet been use in a specific combination to create a program. >> >> Rather than always recompiling we take advantage of the >> gl_compile_status enum introduced in the previous patch to only >> compile when we have previously skipped compilation. >> >> This should help with regressions in app start-up times on cold cache >> runs, compared with no cache. > > > Here are the stats: > > Deus Ex: Mankind Divided start-up times: > > cache disabled: ~3m15s > cold cache master:~4m23s > cold cache with this patch: ~3m33s > > >> --- >> src/compiler/glsl/glsl_parser_extras.cpp | 7 +++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp >> b/src/compiler/glsl/glsl_parser_extras.cpp >> index 59114a7..776636c 100644 >> --- a/src/compiler/glsl/glsl_parser_extras.cpp >> +++ b/src/compiler/glsl/glsl_parser_extras.cpp >> @@ -1945,20 +1945,27 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, >> struct gl_shader *shader, >> if (ctx->_Shader->Flags & GLSL_CACHE_INFO) { >> fprintf(stderr, "deferring compile of shader: %s\n", >> _mesa_sha1_format(buf, shader->sha1)); >> } >> shader->CompileStatus = compile_skipped; >> >> free((void *)shader->FallbackSource); >> shader->FallbackSource = NULL; >> return; >>} >> + } else { >> + /* We should only ever end up here if a re-compile has been forced >> by a >> + * shader cache miss. In which case we can skip the compile if its >> + * already be done by a previous fallback or the initial compile >> call. >> + */ >> + if (shader->CompileStatus == compile_success) >> + return; >> } >> >> if (!state->error) { >> _mesa_glsl_lexer_ctor(state, source); >> _mesa_glsl_parse(state); >> _mesa_glsl_lexer_dtor(state); >> do_late_parsing_checks(state); >> } >> >> if (dump_ast) { >> > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] gbm: Export a get modifiers
Hi Ben, Just a minor nitpick below. On 10 March 2017 at 01:49, Ben Widawskywrote: > This patch originally had i965 specific code and was named: > commit 61cd3c52b868cf8cb90b06e53a382a921eb42754 > Author: Ben Widawsky > Date: Thu Oct 20 18:21:24 2016 -0700 > > gbm: Get modifiers from DRI > > To accomplish this, two new query tokens are added to the extension: > __DRI_IMAGE_ATTRIB_MODIFIER_UPPER > __DRI_IMAGE_ATTRIB_MODIFIER_LOWER > > The query extension only supported 32b queries, and modifiers are 64b, > so we needed two of them. > > NOTE: The extension version is still set to 13, so none of this will > actually be called. > > Signed-off-by: Ben Widawsky > --- > src/gbm/backends/dri/gbm_dri.c | 36 > src/gbm/gbm-symbols-check | 1 + > src/gbm/main/gbm.c | 19 +++ > src/gbm/main/gbm.h | 3 +++ > src/gbm/main/gbmint.h | 1 + > 5 files changed, 60 insertions(+) > > diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c > index d45ba94080..2c467127c2 100644 > --- a/src/gbm/backends/dri/gbm_dri.c > +++ b/src/gbm/backends/dri/gbm_dri.c > @@ -39,6 +39,7 @@ > #include > #include > #include > +#include > > #include /* dri_interface needs GL types */ > #include > @@ -53,6 +54,14 @@ > #include "../../../egl/wayland/wayland-drm/wayland-drm.h" > #endif > > +#ifndef DRM_FORMAT_MOD_INVALID > +#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1) > +#endif > + > +#ifndef DRM_FORMAT_MOD_LINEAR > +#define DRM_FORMAT_MOD_LINEAR 0 > +#endif > + > static __DRIimage * > dri_lookup_egl_image(__DRIscreen *screen, void *image, void *data) > { > @@ -735,6 +744,32 @@ gbm_dri_bo_get_offset(struct gbm_bo *_bo, int plane) > return (uint32_t)offset; > } > > +static uint64_t > +gbm_dri_bo_get_modifier(struct gbm_bo *_bo) > +{ > + struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm); > + struct gbm_dri_bo *bo = gbm_dri_bo(_bo); > + > + if (!dri->image || dri->image->base.version < 14) { > + errno = ENOSYS; > + return DRM_FORMAT_MOD_INVALID; > + } > + > + /* Dumb buffers have no modifiers */ > + if (!bo->image) > + return DRM_FORMAT_MOD_LINEAR; > + > + uint64_t ret = 0; > + int mod; > + dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_MODIFIER_UPPER, > ); > + ret = (uint64_t)mod << 32; > + > + dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_MODIFIER_LOWER, > ); > + ret |= mod; > + Queries of newer attributes, like here, can fail. Yes in 99% of the cases those would be driver bugs, but a graceful fail is always better. Seems like the i965 driver does not handle the above queries, which would explain my some of my earlier questions/suggestions. Namely: No new functionality is exposed/available - barring the new GBM entry points [which atm, will attempt to use the old createImage() with incomplete/incorrect usage flags] With some queryImage() error checking above: Reviewed-by: Emil Velikov -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] gbm: Introduce modifiers into surface/bo creation
On 10 March 2017 at 01:48, Ben Widawskywrote: > The idea behind modifiers like this is that the user of GBM will have > some mechanism to query what properties the hardware supports for its BO > or surface. This information is directly passed in (and stored) so that > the DRI implementation can create an image with the appropriate > attributes. > > A getter() will be added later so that the user GBM will be able to > query what modifier should be used. > > Only in surface creation, the modifiers are stored until the BO is > actually allocated. In regular buffer allocation, the correct modifier > can (will be, in future patches be chosen at creation time. > > v2: Make sure to check if count is non-zero in addition to testing if > calloc fails. (Daniel) > > v3: Remove "usage" and "flags" from modifier creation. Requested by > Kristian. > > v4: Take advantage of the "INVALID" modifier added by the GET_PLANE2 > series. > > v5: Don't bother with storing modifiers for gbm_bo_create because that's > a synchronous operation and we can actually select the correct modifier > at create time (done in a later patch) (Jason) > > Cc: Kristian Høgsberg > Cc: Jason Ekstrand > References (v4): > https://lists.freedesktop.org/archives/intel-gfx/2017-January/116636.html > Signed-off-by: Ben Widawsky > Reviewed-by: Eric Engestrom (v1) > Acked-by: Daniel Stone > --- > src/egl/drivers/dri2/platform_drm.c | 19 --- Worth splitting the patches - patch N+1 > src/gbm/backends/dri/gbm_dri.c | 42 > ++-- > src/gbm/gbm-symbols-check| 2 ++ > src/gbm/main/gbm.c | 29 -- > src/gbm/main/gbm.h | 12 + > src/gbm/main/gbmint.h| 12 +++-- Patch N > src/mesa/drivers/dri/i965/intel_screen.c | 18 ++ Patch N+Y > --- a/src/gbm/backends/dri/gbm_dri.c > +++ b/src/gbm/backends/dri/gbm_dri.c > @@ -1023,13 +1023,20 @@ free_bo: > static struct gbm_bo * > gbm_dri_bo_create(struct gbm_device *gbm, >uint32_t width, uint32_t height, > - uint32_t format, uint32_t usage) > + uint32_t format, uint32_t usage, > + const uint64_t *modifiers, > + const unsigned int count) > { > struct gbm_dri_device *dri = gbm_dri_device(gbm); > struct gbm_dri_bo *bo; > int dri_format; > unsigned dri_use = 0; > > + /* Callers of this may specify a modifier, or a dri usage, but not both. > The > +* newer modifier interface deprecates the older usage flags. > +*/ > + assert(!(usage && count)); > + Similar to last patch - XOR ? > if (usage & GBM_BO_USE_WRITE || dri->image == NULL) >return create_dumb(gbm, width, height, format, usage); > > @@ -1087,11 +1094,21 @@ gbm_dri_bo_create(struct gbm_device *gbm, > /* Gallium drivers requires shared in order to get the handle/stride */ > dri_use |= __DRI_IMAGE_USE_SHARE; > > - bo->image = > - dri->image->createImage(dri->screen, > - width, height, > - dri_format, dri_use, > - bo); > + if (!dri->image || dri->image->base.version < 14 || > + !dri->image->createImageWithModifiers) { > + if (modifiers) > + fprintf(stderr, "Modifiers specified, but DRI is too old\n"); > + > + bo->image = dri->image->createImage(dri->screen, width, height, > + dri_format, dri_use, bo); With the "modifiers or use" above how do we get sane value for dri_use in this fall-back ? Seems like things we'll miss/ignore the scanout/curson/linear flags. Perhaps it's worth simply bailing out ? > --- a/src/gbm/gbm-symbols-check > +++ b/src/gbm/gbm-symbols-check > +gbm_bo_create_with_modifiers > +gbm_surface_create_with_modifiers Thank you :-) > +GBM_EXPORT struct gbm_bo * > +gbm_bo_create_with_modifiers(struct gbm_device *gbm, > + uint32_t width, uint32_t height, > + uint32_t format, > + const uint64_t *modifiers, > + const unsigned int count) > +{ > + if (width == 0 || height == 0) { > + errno = EINVAL; > + return NULL; > + } > + Should we validate modifiers and/or count at this level as well ? > +GBM_EXPORT struct gbm_surface * > +gbm_surface_create_with_modifiers(struct gbm_device *gbm, > + uint32_t width, uint32_t height, > + uint32_t format, > + const uint64_t *modifiers, > + const unsigned int count) > +{ Ditto ? What happens if we feed zero width/height ? Worth adding a note, even if things are
Re: [Mesa-dev] [PATCH 7/4] gallium/util: replace pipe_thread_setname() with u_thread_setname()
For 5-7: Reviewed-by: Marek OlšákMarek On Thu, Mar 9, 2017 at 12:09 AM, Timothy Arceri wrote: > They do the same thing we are just moving the function to be > accessible to all of Mesa. > --- > src/gallium/auxiliary/os/os_thread.h | 12 > src/gallium/drivers/llvmpipe/lp_rast.c | 2 +- > src/gallium/state_trackers/nine/nine_state.c | 4 ++-- > 3 files changed, 3 insertions(+), 15 deletions(-) > > diff --git a/src/gallium/auxiliary/os/os_thread.h > b/src/gallium/auxiliary/os/os_thread.h > index ecd8f8a..b6e0698 100644 > --- a/src/gallium/auxiliary/os/os_thread.h > +++ b/src/gallium/auxiliary/os/os_thread.h > @@ -35,32 +35,20 @@ > > #ifndef OS_THREAD_H_ > #define OS_THREAD_H_ > > > #include "pipe/p_compiler.h" > #include "util/u_debug.h" /* for assert */ > #include "util/u_thread.h" > > > -static inline void pipe_thread_setname( const char *name ) > -{ > -#if defined(HAVE_PTHREAD) > -# if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && > defined(__GLIBC_MINOR__) && \ > - (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) > - pthread_setname_np(pthread_self(), name); > -# endif > -#endif > - (void)name; > -} > - > - > static inline int pipe_thread_is_self( thrd_t thread ) > { > #if defined(HAVE_PTHREAD) > # if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && > defined(__GLIBC_MINOR__) && \ >(__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) > return pthread_equal(pthread_self(), thread); > # endif > #endif > return 0; > } > diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c > b/src/gallium/drivers/llvmpipe/lp_rast.c > index d746778..b25ade3 100644 > --- a/src/gallium/drivers/llvmpipe/lp_rast.c > +++ b/src/gallium/drivers/llvmpipe/lp_rast.c > @@ -784,21 +784,21 @@ lp_rast_finish( struct lp_rasterizer *rast ) > static int > thread_function(void *init_data) > { > struct lp_rasterizer_task *task = (struct lp_rasterizer_task *) init_data; > struct lp_rasterizer *rast = task->rast; > boolean debug = false; > char thread_name[16]; > unsigned fpstate; > > util_snprintf(thread_name, sizeof thread_name, "llvmpipe-%u", > task->thread_index); > - pipe_thread_setname(thread_name); > + u_thread_setname(thread_name); > > /* Make sure that denorms are treated like zeros. This is > * the behavior required by D3D10. OpenGL doesn't care. > */ > fpstate = util_fpstate_get(); > util_fpstate_set_denorms_to_zero(fpstate); > > while (1) { >/* wait for work */ >if (debug) > diff --git a/src/gallium/state_trackers/nine/nine_state.c > b/src/gallium/state_trackers/nine/nine_state.c > index ef33942..26c21f2 100644 > --- a/src/gallium/state_trackers/nine/nine_state.c > +++ b/src/gallium/state_trackers/nine/nine_state.c > @@ -88,21 +88,21 @@ nine_csmt_wait_processed(struct csmt_context *ctx) > > /* CSMT worker thread */ > static > int > nine_csmt_worker(void *arg) > { > struct csmt_context *ctx = arg; > struct csmt_instruction *instr; > DBG("CSMT worker spawned\n"); > > -pipe_thread_setname("CSMT-Worker"); > +u_thread_setname("CSMT-Worker"); > > while (1) { > nine_queue_wait_flush(ctx->pool); > mtx_lock(>thread_running); > > /* Get instruction. NULL on empty cmdbuf. */ > while (!p_atomic_read(>terminate) && > (instr = (struct csmt_instruction > *)nine_queue_get(ctx->pool))) { > > /* decode */ > @@ -151,21 +151,21 @@ nine_csmt_create( struct NineDevice9 *This ) > if (!ctx->pool) { > FREE(ctx); > return NULL; > } > cnd_init(>event_processed); > (void) mtx_init(>mutex_processed, mtx_plain); > (void) mtx_init(>thread_running, mtx_plain); > (void) mtx_init(>thread_resume, mtx_plain); > > #if DEBUG > -pipe_thread_setname("Main thread"); > +u_thread_setname("Main thread"); > #endif > > ctx->device = This; > > ctx->worker = u_thread_create(nine_csmt_worker, ctx); > if (!ctx->worker) { > nine_queue_delete(ctx->pool); > FREE(ctx); > return NULL; > } > -- > 2.9.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] gallium/util: move u_queue.{c, h} to src/util
On Fri, Mar 10, 2017 at 12:00 PM, Mike Lothianwrote: > Does that include patches 5, 6 & 7? I replied on the other patches separately. Marek > > On Fri, 10 Mar 2017 at 10:57 Marek Olšák wrote: >> >> For the series: >> >> Reviewed-by: Marek Olšák >> >> Marek >> >> On Wed, Mar 8, 2017 at 5:36 AM, Timothy Arceri >> wrote: >> > This will allow us to use it outside of gallium for things like >> > compressing shader cache entries. >> > --- >> > src/gallium/auxiliary/Makefile.sources | 2 -- >> > src/util/Makefile.sources | 2 ++ >> > src/{gallium/auxiliary => }/util/u_queue.c | 0 >> > src/{gallium/auxiliary => }/util/u_queue.h | 0 >> > 4 files changed, 2 insertions(+), 2 deletions(-) >> > rename src/{gallium/auxiliary => }/util/u_queue.c (100%) >> > rename src/{gallium/auxiliary => }/util/u_queue.h (100%) >> > >> > diff --git a/src/gallium/auxiliary/Makefile.sources >> > b/src/gallium/auxiliary/Makefile.sources >> > index 9063b51..c3a3af9 100644 >> > --- a/src/gallium/auxiliary/Makefile.sources >> > +++ b/src/gallium/auxiliary/Makefile.sources >> > @@ -269,22 +269,20 @@ C_SOURCES := \ >> > util/u_network.c \ >> > util/u_network.h \ >> > util/u_pack_color.h \ >> > util/u_pointer.h \ >> > util/u_prim.h \ >> > util/u_prim_restart.c \ >> > util/u_prim_restart.h \ >> > util/u_pstipple.c \ >> > util/u_pstipple.h \ >> > util/u_pwr8.h \ >> > - util/u_queue.c \ >> > - util/u_queue.h \ >> > util/u_range.h \ >> > util/u_rect.h \ >> > util/u_resource.c \ >> > util/u_resource.h \ >> > util/u_ringbuffer.c \ >> > util/u_ringbuffer.h \ >> > util/u_sampler.c \ >> > util/u_sampler.h \ >> > util/u_simple_shaders.c \ >> > util/u_simple_shaders.h \ >> > diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources >> > index 8b5ee2d..e6c1c76 100644 >> > --- a/src/util/Makefile.sources >> > +++ b/src/util/Makefile.sources >> > @@ -37,19 +37,21 @@ MESA_UTIL_FILES := \ >> > slab.h \ >> > string_to_uint_map.h \ >> > string_to_uint_map.cpp \ >> > strndup.c \ >> > strndup.h \ >> > strtod.c \ >> > strtod.h \ >> > texcompress_rgtc_tmp.h \ >> > u_atomic.h \ >> > u_endian.h \ >> > + u_queue.c \ >> > + u_queue.h \ >> > u_string.h \ >> > u_thread.h \ >> > u_vector.c \ >> > u_vector.h \ >> > vk_alloc.h \ >> > vk_util.h >> > >> > MESA_UTIL_GENERATED_FILES = \ >> > format_srgb.c >> > diff --git a/src/gallium/auxiliary/util/u_queue.c b/src/util/u_queue.c >> > similarity index 100% >> > rename from src/gallium/auxiliary/util/u_queue.c >> > rename to src/util/u_queue.c >> > diff --git a/src/gallium/auxiliary/util/u_queue.h b/src/util/u_queue.h >> > similarity index 100% >> > rename from src/gallium/auxiliary/util/u_queue.h >> > rename to src/util/u_queue.h >> > -- >> > 2.9.3 >> > >> > ___ >> > mesa-dev mailing list >> > mesa-dev@lists.freedesktop.org >> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev >> ___ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH] st/mesa: set result writemask based on ir type
Reviewed-by: Marek OlšákMarek On Sat, Mar 4, 2017 at 7:52 PM, Ilia Mirkin wrote: > This prevents textureQueryLevels, which maps as LODQ, from ending up > with a xyzw writemask, which is illegal. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100061 > Signed-off-by: Ilia Mirkin > Cc: mesa-sta...@lists.freedesktop.org > --- > > Untested beyond making sure that the shader in the above bug ends up with > a .xy writemask. I don't have access to a reasonable testing rig right now, > would be ideal if someone could give it a run through theirs... > > src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp > b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp > index af41bdb..63b681f 100644 > --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp > +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp > @@ -4165,6 +4165,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) > */ > result_src = get_temp(ir->type); > result_dst = st_dst_reg(result_src); > + result_dst.writemask = (1 << ir->type->vector_elements) - 1; > > switch (ir->op) { > case ir_tex: > -- > 2.10.2 > > ___ > mesa-stable mailing list > mesa-sta...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-stable ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] gallium/util: move u_queue.{c, h} to src/util
Does that include patches 5, 6 & 7? On Fri, 10 Mar 2017 at 10:57 Marek Olšákwrote: > For the series: > > Reviewed-by: Marek Olšák > > Marek > > On Wed, Mar 8, 2017 at 5:36 AM, Timothy Arceri > wrote: > > This will allow us to use it outside of gallium for things like > > compressing shader cache entries. > > --- > > src/gallium/auxiliary/Makefile.sources | 2 -- > > src/util/Makefile.sources | 2 ++ > > src/{gallium/auxiliary => }/util/u_queue.c | 0 > > src/{gallium/auxiliary => }/util/u_queue.h | 0 > > 4 files changed, 2 insertions(+), 2 deletions(-) > > rename src/{gallium/auxiliary => }/util/u_queue.c (100%) > > rename src/{gallium/auxiliary => }/util/u_queue.h (100%) > > > > diff --git a/src/gallium/auxiliary/Makefile.sources > b/src/gallium/auxiliary/Makefile.sources > > index 9063b51..c3a3af9 100644 > > --- a/src/gallium/auxiliary/Makefile.sources > > +++ b/src/gallium/auxiliary/Makefile.sources > > @@ -269,22 +269,20 @@ C_SOURCES := \ > > util/u_network.c \ > > util/u_network.h \ > > util/u_pack_color.h \ > > util/u_pointer.h \ > > util/u_prim.h \ > > util/u_prim_restart.c \ > > util/u_prim_restart.h \ > > util/u_pstipple.c \ > > util/u_pstipple.h \ > > util/u_pwr8.h \ > > - util/u_queue.c \ > > - util/u_queue.h \ > > util/u_range.h \ > > util/u_rect.h \ > > util/u_resource.c \ > > util/u_resource.h \ > > util/u_ringbuffer.c \ > > util/u_ringbuffer.h \ > > util/u_sampler.c \ > > util/u_sampler.h \ > > util/u_simple_shaders.c \ > > util/u_simple_shaders.h \ > > diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources > > index 8b5ee2d..e6c1c76 100644 > > --- a/src/util/Makefile.sources > > +++ b/src/util/Makefile.sources > > @@ -37,19 +37,21 @@ MESA_UTIL_FILES := \ > > slab.h \ > > string_to_uint_map.h \ > > string_to_uint_map.cpp \ > > strndup.c \ > > strndup.h \ > > strtod.c \ > > strtod.h \ > > texcompress_rgtc_tmp.h \ > > u_atomic.h \ > > u_endian.h \ > > + u_queue.c \ > > + u_queue.h \ > > u_string.h \ > > u_thread.h \ > > u_vector.c \ > > u_vector.h \ > > vk_alloc.h \ > > vk_util.h > > > > MESA_UTIL_GENERATED_FILES = \ > > format_srgb.c > > diff --git a/src/gallium/auxiliary/util/u_queue.c b/src/util/u_queue.c > > similarity index 100% > > rename from src/gallium/auxiliary/util/u_queue.c > > rename to src/util/u_queue.c > > diff --git a/src/gallium/auxiliary/util/u_queue.h b/src/util/u_queue.h > > similarity index 100% > > rename from src/gallium/auxiliary/util/u_queue.h > > rename to src/util/u_queue.h > > -- > > 2.9.3 > > > > ___ > > mesa-dev mailing list > > mesa-dev@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] gallium/util: move u_queue.{c, h} to src/util
For the series: Reviewed-by: Marek OlšákMarek On Wed, Mar 8, 2017 at 5:36 AM, Timothy Arceri wrote: > This will allow us to use it outside of gallium for things like > compressing shader cache entries. > --- > src/gallium/auxiliary/Makefile.sources | 2 -- > src/util/Makefile.sources | 2 ++ > src/{gallium/auxiliary => }/util/u_queue.c | 0 > src/{gallium/auxiliary => }/util/u_queue.h | 0 > 4 files changed, 2 insertions(+), 2 deletions(-) > rename src/{gallium/auxiliary => }/util/u_queue.c (100%) > rename src/{gallium/auxiliary => }/util/u_queue.h (100%) > > diff --git a/src/gallium/auxiliary/Makefile.sources > b/src/gallium/auxiliary/Makefile.sources > index 9063b51..c3a3af9 100644 > --- a/src/gallium/auxiliary/Makefile.sources > +++ b/src/gallium/auxiliary/Makefile.sources > @@ -269,22 +269,20 @@ C_SOURCES := \ > util/u_network.c \ > util/u_network.h \ > util/u_pack_color.h \ > util/u_pointer.h \ > util/u_prim.h \ > util/u_prim_restart.c \ > util/u_prim_restart.h \ > util/u_pstipple.c \ > util/u_pstipple.h \ > util/u_pwr8.h \ > - util/u_queue.c \ > - util/u_queue.h \ > util/u_range.h \ > util/u_rect.h \ > util/u_resource.c \ > util/u_resource.h \ > util/u_ringbuffer.c \ > util/u_ringbuffer.h \ > util/u_sampler.c \ > util/u_sampler.h \ > util/u_simple_shaders.c \ > util/u_simple_shaders.h \ > diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources > index 8b5ee2d..e6c1c76 100644 > --- a/src/util/Makefile.sources > +++ b/src/util/Makefile.sources > @@ -37,19 +37,21 @@ MESA_UTIL_FILES := \ > slab.h \ > string_to_uint_map.h \ > string_to_uint_map.cpp \ > strndup.c \ > strndup.h \ > strtod.c \ > strtod.h \ > texcompress_rgtc_tmp.h \ > u_atomic.h \ > u_endian.h \ > + u_queue.c \ > + u_queue.h \ > u_string.h \ > u_thread.h \ > u_vector.c \ > u_vector.h \ > vk_alloc.h \ > vk_util.h > > MESA_UTIL_GENERATED_FILES = \ > format_srgb.c > diff --git a/src/gallium/auxiliary/util/u_queue.c b/src/util/u_queue.c > similarity index 100% > rename from src/gallium/auxiliary/util/u_queue.c > rename to src/util/u_queue.c > diff --git a/src/gallium/auxiliary/util/u_queue.h b/src/util/u_queue.h > similarity index 100% > rename from src/gallium/auxiliary/util/u_queue.h > rename to src/util/u_queue.h > -- > 2.9.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] gallium/util: move u_string.h to src/util/u_string.h
For the series: Reviewed-by: Marek OlšákMarek On Wed, Mar 8, 2017 at 4:36 AM, Timothy Arceri wrote: > This will help use move u_queue.c here eventually and also provide > string function wrappers for anyone wishing to port disk_cache.c > to windows. > --- > src/gallium/auxiliary/Makefile.sources | 1 - > src/gallium/auxiliary/util/u_debug_symbol.c | 2 +- > src/gallium/auxiliary/util/u_queue.c| 2 +- > src/util/Makefile.sources | 1 + > src/{gallium/auxiliary => }/util/u_string.h | 0 > 5 files changed, 3 insertions(+), 3 deletions(-) > rename src/{gallium/auxiliary => }/util/u_string.h (100%) > > diff --git a/src/gallium/auxiliary/Makefile.sources > b/src/gallium/auxiliary/Makefile.sources > index 8d3e4a9..9063b51 100644 > --- a/src/gallium/auxiliary/Makefile.sources > +++ b/src/gallium/auxiliary/Makefile.sources > @@ -283,21 +283,20 @@ C_SOURCES := \ > util/u_resource.c \ > util/u_resource.h \ > util/u_ringbuffer.c \ > util/u_ringbuffer.h \ > util/u_sampler.c \ > util/u_sampler.h \ > util/u_simple_shaders.c \ > util/u_simple_shaders.h \ > util/u_split_prim.h \ > util/u_sse.h \ > - util/u_string.h \ > util/u_suballoc.c \ > util/u_suballoc.h \ > util/u_surface.c \ > util/u_surface.h \ > util/u_surfaces.c \ > util/u_surfaces.h \ > util/u_tests.c \ > util/u_tests.h \ > util/u_texture.c \ > util/u_texture.h \ > diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c > b/src/gallium/auxiliary/util/u_debug_symbol.c > index f0b0629..4b55523 100644 > --- a/src/gallium/auxiliary/util/u_debug_symbol.c > +++ b/src/gallium/auxiliary/util/u_debug_symbol.c > @@ -27,21 +27,21 @@ > > /** > * @file > * Symbol lookup. > * > * @author Jose Fonseca > */ > > #include "pipe/p_compiler.h" > #include "os/os_thread.h" > -#include "u_string.h" > +#include "util/u_string.h" > > #include "u_debug.h" > #include "u_debug_symbol.h" > #include "u_hash_table.h" > > > #if defined(PIPE_OS_WINDOWS) > > #include > #include > diff --git a/src/gallium/auxiliary/util/u_queue.c > b/src/gallium/auxiliary/util/u_queue.c > index bb63a6b..05ffc3e 100644 > --- a/src/gallium/auxiliary/util/u_queue.c > +++ b/src/gallium/auxiliary/util/u_queue.c > @@ -19,21 +19,21 @@ > * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE > * USE OR OTHER DEALINGS IN THE SOFTWARE. > * > * The above copyright notice and this permission notice (including the > * next paragraph) shall be included in all copies or substantial portions > * of the Software. > */ > > #include "u_queue.h" > #include "u_memory.h" > -#include "u_string.h" > +#include "util/u_string.h" > > static void util_queue_killall_and_wait(struct util_queue *queue); > > / > * Wait for all queues to assert idle when exit() is called. > * > * Otherwise, C++ static variable destructors can be called while threads > * are using the static variables. > */ > > diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources > index 08ad7be..8b21702 100644 > --- a/src/util/Makefile.sources > +++ b/src/util/Makefile.sources > @@ -37,17 +37,18 @@ MESA_UTIL_FILES := \ > slab.h \ > string_to_uint_map.h \ > string_to_uint_map.cpp \ > strndup.c \ > strndup.h \ > strtod.c \ > strtod.h \ > texcompress_rgtc_tmp.h \ > u_atomic.h \ > u_endian.h \ > + u_string.h \ > u_vector.c \ > u_vector.h \ > vk_alloc.h \ > vk_util.h > > MESA_UTIL_GENERATED_FILES = \ > format_srgb.c > diff --git a/src/gallium/auxiliary/util/u_string.h b/src/util/u_string.h > similarity index 100% > rename from src/gallium/auxiliary/util/u_string.h > rename to src/util/u_string.h > -- > 2.9.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 13/25] mesa: Connect the generated GL command marshalling code to the build.
BTW I don't think that supporting GL compat contexts is worth it. Marek On Tue, Mar 7, 2017 at 7:21 AM, Timothy Arceriwrote: > From: Eric Anholt > > v2: Rebase on the Begin/End changes, and just disable this feature on > non-GL-core. > v3: (Timothy Arceri) enable for non-GL-core contexts. Remove > unrelated safe_mul() hunk. while loop style fix. > --- > src/mesa/Makefile.sources | 2 ++ > src/mesa/main/glthread.c | 15 +++ > 2 files changed, 17 insertions(+) > > diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources > index b2d0783..134d5e9 100644 > --- a/src/mesa/Makefile.sources > +++ b/src/mesa/Makefile.sources > @@ -125,20 +125,22 @@ MAIN_FILES = \ > main/histogram.h \ > main/image.c \ > main/image.h \ > main/imports.c \ > main/imports.h \ > main/light.c \ > main/light.h \ > main/lines.c \ > main/lines.h \ > main/macros.h \ > + main/marshal_generated.c \ > + main/marshal_generated.h \ > main/matrix.c \ > main/matrix.h \ > main/mipmap.c \ > main/mipmap.h \ > main/mm.c \ > main/mm.h \ > main/mtypes.h \ > main/multisample.c \ > main/multisample.h \ > main/objectlabel.c \ > diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c > index 8877a69..c4d1031 100644 > --- a/src/mesa/main/glthread.c > +++ b/src/mesa/main/glthread.c > @@ -47,22 +47,29 @@ glthread_allocate_batch(struct gl_context *ctx) > /* TODO: handle memory allocation failure. */ > glthread->batch = calloc(1, sizeof(*glthread->batch)); > if (!glthread->batch) >return; > glthread->batch->buffer = malloc(MARSHAL_MAX_CMD_SIZE); > } > > static void > glthread_unmarshal_batch(struct gl_context *ctx, struct glthread_batch > *batch) > { > + size_t pos = 0; > + > _glapi_set_dispatch(ctx->CurrentServerDispatch); > > + while (pos < batch->used) > + pos += _mesa_unmarshal_dispatch_cmd(ctx, >buffer[pos]); > + > + assert(pos == batch->used); > + > free(batch->buffer); > free(batch); > } > > static void * > glthread_worker(void *data) > { > struct gl_context *ctx = data; > struct glthread_state *glthread = ctx->GLThread; > > @@ -105,20 +112,28 @@ glthread_worker(void *data) > } > > void > _mesa_glthread_init(struct gl_context *ctx) > { > struct glthread_state *glthread = calloc(1, sizeof(*glthread)); > > if (!glthread) >return; > > + ctx->MarshalExec = _mesa_create_marshal_table(ctx); > + if (!ctx->MarshalExec) { > + free(glthread); > + return; > + } > + > + ctx->CurrentClientDispatch = ctx->MarshalExec; > + > pthread_mutex_init(>mutex, NULL); > pthread_cond_init(>new_work, NULL); > pthread_cond_init(>work_done, NULL); > > glthread->batch_queue_tail = >batch_queue; > ctx->GLThread = glthread; > > glthread_allocate_batch(ctx); > > pthread_create(>thread, NULL, glthread_worker, ctx); > -- > 2.9.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] util/disk_cache: use LRU eviction rather than random eviction (v2)
On Fri, Mar 10, 2017 at 6:23 AM, Timothy Arceriwrote: > On 07/03/17 12:25, Alan Swanson wrote: >> >> Still using random selection of two-character subdirectory in which >> to check cache files rather than scanning entire cache. >> >> v2: Factor out double strlen call >> --- >> src/util/disk_cache.c | 78 >> +++ >> 1 file changed, 35 insertions(+), 43 deletions(-) >> >> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c >> index 31a9336582..2a923be3dc 100644 >> --- a/src/util/disk_cache.c >> +++ b/src/util/disk_cache.c >> @@ -438,70 +438,60 @@ make_cache_file_directory(struct disk_cache *cache, >> const cache_key key) >> free(dir); >> } >> >> -/* Given a directory path and predicate function, count all entries in >> - * that directory for which the predicate returns true. Then choose a >> - * random entry from among those counted. >> +/* Given a directory path and predicate function, find the entry with >> + * the oldest access time in that directory for which the predicate >> + * returns true. >> * >> * Returns: A malloc'ed string for the path to the chosen file, (or >> * NULL on any error). The caller should free the string when >> * finished. >> */ >> static char * >> -choose_random_file_matching(const char *dir_path, >> -bool (*predicate)(const struct dirent *, >> - const char *dir_path)) >> +choose_lru_file_matching(const char *dir_path, >> + bool (*predicate)(const struct dirent *, >> + const char *dir_path)) >> { >> DIR *dir; >> struct dirent *entry; >> - unsigned int count, victim; >> + struct stat sb; >> + char *tmp, *lru_name = NULL; >> + size_t len; >> + time_t lru_atime = 0; > > > Please try to declare variables where they are used. The original version of > this file was written before we could use C99 features in Mesa. > > > >> char *filename; >> >> dir = opendir(dir_path); >> if (dir == NULL) >>return NULL; >> >> - count = 0; >> - >> - while (1) { >> - entry = readdir(dir); >> - if (entry == NULL) >> - break; >> - if (!predicate(entry, dir_path)) >> - continue; >> - >> - count++; >> - } >> - >> - if (count == 0) { >> - closedir(dir); >> - return NULL; >> - } >> - >> - victim = rand() % count; >> - >> - rewinddir(dir); >> - count = 0; >> - >> while (1) { >>entry = readdir(dir); >>if (entry == NULL) >> break; >>if (!predicate(entry, dir_path)) >> continue; >> - if (count == victim) >> - break; >> >> - count++; >> + if (fstatat(dirfd(dir), entry->d_name, , 0) == 0) { >> + if (!lru_atime || (sb.st_atime < lru_atime)) { >> +len = strlen(entry->d_name) + 1; >> +tmp = realloc(lru_name, len); >> +if (tmp) { >> + lru_name = tmp; > > > I don't think we need tmp here. Why not use lru_name directly? It *is* needed, otherwise if realloc fails, you'll leak old memory. Gražvydas ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev