Re: [Mesa-dev] [PATCH 3/5] glx/dri3: Request non-vsynced Present for swapinterval zero. (v2)
Hi, On 12/04/2014 11:38 PM, Mario Kleiner wrote: On 12/04/2014 11:20 AM, Axel Davy wrote: On 02/12/2014 20:53, Mario Kleiner wrote : Restores proper immediate tearing swap behaviour for OpenGL bufferswap under DRI3/Present. + if (priv-swap_interval == 0) + options |= XCB_PRESENT_OPTION_ASYNC; + back-busy = 1; Currently under DRI3 glx, you'll get triple buffering behaviour. I agree this should not be the default, and your patches fixes that. Ideally a user option should be added to control triple buffering. The DRI2 implementation had a per-drawable swap_limit and corresponding server api to get and set it. I'm not sure atm. if it was ever exposed via mesa, but i think it wasn't. I agree i would be nice to have some control there. There is one more problem i noticed, of which i'm not yet sure if it is related to mesa's n-buffering and the way it dynamically adapts n, or some driver implementation bug, or some other weirdness, because intel and nouveau behave differently. If a client does multiple swapbuffers calls without any rendering inbetween, then something in the buffer management seems to get confused for the rest of the session, even if the client later behaves properly ie., draw - swap - draw - swap ... Could this be related to / explain also: https://bugs.freedesktop.org/show_bug.cgi?id=81204 ? (Another buffer swap related issue with DRI3 is bug 79715) - Eero Good case: During whole session: draw - swap - draw - swap ... Bad case: At least once: swap - swap For the rest of the session, even if you do regular draw-swap-draw-swap, at least under nouveau, you get proper display for a few frames, followed by some frame displayed which contains pixel trash, like from an uninitialized renderbuffer, then a few good frames - pixel trash and so on. First i thought it's unsynchronized rendering to a swap pending buffer, ie., buffer presented while still rendered to. But now i think it is a trash filled buffer presented every couple of frames. I didn't have time to track this one down, and probably won't have time to look into it atm. I just made sure that my application never does idle swaps, even if it only renders one useless pixel to keep mesa from freaking out. Could be a bug. Could be some assumption that gets broken in a rather confusing way due to the triple/n-buffering. If you add a comment above these lines, saying something like: It is possible to enable triple buffering behaviour by not using XCB_PRESENT_OPTION_ASYNC, but this should not be the default. I'll add it literally, because anything i write in comments tends to become a not very well written essay ;-). Or should i add a ...but this triple buffering should probably not be the default in future implementations but be made configurable by some new api? thanks, -mario You can add my Reviewed-by: Axel Davy axel.d...@ens.fr Axel Davy ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] DRI3/Present fixes for Mesa 10.3+ (v2)
On 12/05/2014 03:41 AM, Eric Anholt wrote: Mario Kleiner mario.kleiner...@gmail.com writes: A slightly updated and extended series of the dri3/present fixes for Mesa i sent last week. Patch 1 and 2 are same as before. Patch 3 now has signed off by Frank Binns and reviewed by Chris Wilson. Patch 4 and 5 are additional fixes. The last one makes INTEL_swap_events behave properly again when swap completion events come in out of order due to skipped present requests. Before the first out of sequence sbc event caused the INTEL_swap_events extension to become completely unuseable for the rest of a session. Sent out review for 3 of them (time for me to head out instead of reviewing more code), and thanks for working on this. 2/5 it's not clear to me from my first read of the spec that you shouldn't expect to get the most recent values from either cause in your return. 5/5 my first thoughts were I hate wraparound logic, I'll review this later. Also, should we even be saving off msc/ust for an out-of-order sbc event? Needs more thought. I'll try to think more about these later, but I wouldn't block on me. Wrt. 2/5: It's a bit ambiguous how to read that bit of the spec, and i agree that one could read it in a way that the current mesa dri3 behaviour is not (completely) violating the spec. When we implemented the DRI2 version, we understood it in the way i want to restore with 2/5. The first reason is because the DRI2 / patch 2/5 interpretation makes the OML_sync_control extension very useful and robust for swap timing, whereas the alternative reading makes the extension borderline useless / its use somewhat fragile due to the race described in the commit. The second reason is backwards compatibility: It would be awesome not to break timing sensitive apps written against DRI2, especially given that users of those apps will certainly not understand why a simple distribution upgrade or graphics stack update pushed by the distro can suddenly cause such regressions. In new app releases one could sort of work around such breakage by use of the INTEL_swap_events extension assuming everything would be nicely bug free. Unfortunately there were quite a few bugs and omissions and limitations in various ddx and kms drivers even until very recently which require funky workarounds, which require funky use of the different bits of the OML_sync_control extension, in ways that would be difficult to do without 2/5 restoring the DRI2 semantic. As an example see https://github.com/kleinerm/Psychtoolbox-3/blob/master/PsychSourceGL/Source/Linux/Screen/PsychWindowGlue.c#L1372 for my own toolkits backend implementation. It's a nice horror-show of all the relevant bugs in DRI2/DRI3 since about 2010 with the collection of workarounds needed to keep stuff working reasonably well on currently shipping distros. Wrt. 5/5: As a little helper, attached a little C test thingy for the wraparound logic, running through a large range of simulated swap events, exercising the logic for both overflow and underflow wraparound, which i used to convince myself that i didn't screw up there with integer overflows etc., apart from testing on the actual server for normal use. In practice i don't think the wraparound logic in its revised form will ever trigger. It takes a lot of time for a running app to accumulate 2^32 bufferswaps. As far as saving mst/ust for out-of-order sbc events: Yes, imho! The Present extension allows to complete swaps in a order different from their submission, e.g., you could submit a present request for target msc 1, then for 9000, then for 8000..., and Present would complete them in order 8000, 9000, 1 - this would cause the completion events to come in in reverse order with decrementing sbc, instead of incrementing. A valid case for dri3/present, and as INTEL_swap_events is not restricted to ascending order, it should be able to handle that case. Another case where one can see smaller inversions of the order is when switching between vsynced and non-vsynced swaps, possibly when the Present extension skips presents. I think a client could get mightily confused if it would try to collect swap events for submitted swaps and they don't show up. However, what would be useful would be to extend INTEL_swap_events with new enums for completion type. Something like GLX_ERROR_INTEL for a present/swap that failed due to some error, e.g., out of memory, gpu wedged, whatever, and then GLX_SKIPPED_INTEL for a skipped present. Currently PresentCompleteModeSkip gets mapped to GLX_COPY_COMPLETE_INTEL, losing that information, which would be valuable for client applications like mine, which really need to know for sure if specific content made it to the actual display unharmed, and in which order. Another thought i had: It would be good if we could expose somewhere if mesa is using DRI2 or DRI3/Present in a given session, e.g., in the GL_RENDERER string or maybe
Re: [Mesa-dev] [PATCH] mesa/st: don't use CMP / I2F for conditional assignments with native integers
Looks good AFAICT. But I think we should probably swap the operands only once, in one place, instead of having two branches for switch_order. Jose On 04/12/14 23:25, srol...@vmware.com wrote: From: Roland Scheidegger srol...@vmware.com The original idea was to optimize away the condition by integrating it directly into the CMP instruction. However, with native integers this requires an extra I2F instruction. It is also fishy because the negation used didn't really honor ieee754 float comparison rules, not to mention the CMP instruction itself (being pretty much a legacy instruction) doesn't really have defined special float value behavior in any case. So, use UCMP and adjust the code trying to optimize the condition away accordingly (I have absolutely no idea if such conditions are actually hit or would be translated away somewhere else already). No piglit regressions on llvmpipe. --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 65 ++ 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 8e91c4b..ad0b05d 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2288,6 +2288,39 @@ glsl_to_tgsi_visitor::process_move_condition(ir_rvalue *ir) bool switch_order = false; ir_expression *const expr = ir-as_expression(); + + if (native_integers) { + if ((expr != NULL) (expr-get_num_operands() == 2)) { + enum glsl_base_type type = expr-operands[0]-type-base_type; + if (type == GLSL_TYPE_INT || type == GLSL_TYPE_UINT || + type == GLSL_TYPE_BOOL) { +if (expr-operation == ir_binop_equal) { + if (expr-operands[0]-is_zero()) { + src_ir = expr-operands[1]; + switch_order = true; + } + else if (expr-operands[1]-is_zero()) { + src_ir = expr-operands[0]; + switch_order = true; + } +} +if (expr-operation == ir_binop_nequal) { + if (expr-operands[0]-is_zero()) { + src_ir = expr-operands[1]; + switch_order = false; + } + else if (expr-operands[1]-is_zero()) { + src_ir = expr-operands[0]; + switch_order = false; + } +} + } + } + + src_ir-accept(this); + return switch_order; + } + if ((expr != NULL) (expr-get_num_operands() == 2)) { bool zero_on_left = false; @@ -2379,7 +2412,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, const struct glsl_type * const struct glsl_type *vec_type; vec_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, -type-vector_elements, 1); + type-vector_elements, 1); for (int i = 0; i type-matrix_columns; i++) { emit_block_mov(ir, vec_type, l, r); @@ -2447,7 +2480,7 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) swizzles[i] = first_enabled_chan; } r.swizzle = MAKE_SWIZZLE4(swizzles[0], swizzles[1], - swizzles[2], swizzles[3]); +swizzles[2], swizzles[3]); } assert(l.file != PROGRAM_UNDEFINED); @@ -2461,23 +2494,21 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) st_src_reg l_src = st_src_reg(l); st_src_reg condition_temp = condition; l_src.swizzle = swizzle_for_size(ir-lhs-type-vector_elements); - + if (native_integers) { -/* This is necessary because TGSI's CMP instruction expects the - * condition to be a float, and we store booleans as integers. - * TODO: really want to avoid i2f path and use UCMP. Requires - * changes to process_move_condition though too. - */ -condition_temp = get_temp(glsl_type::vec4_type); -condition.negate = 0; -emit(ir, TGSI_OPCODE_I2F, st_dst_reg(condition_temp), condition); -condition_temp.swizzle = condition.swizzle; +if (switch_order) { + emit(ir, TGSI_OPCODE_UCMP, l, condition_temp, l_src, r); +} else { + emit(ir, TGSI_OPCODE_UCMP, l, condition_temp, r, l_src); +} } - - if (switch_order) { -emit(ir, TGSI_OPCODE_CMP, l, condition_temp, l_src, r); - } else { -emit(ir, TGSI_OPCODE_CMP, l, condition_temp, r, l_src); + else { +if (switch_order) { + emit(ir, TGSI_OPCODE_CMP, l, condition_temp, l_src, r); +} else { + emit(ir, TGSI_OPCODE_CMP, l, condition_temp, r, l_src); +} + } l.index++;
Re: [Mesa-dev] [PATCH 3/3] util/primconvert: take ib offset into account
On 05/12/14 00:01, Ilia Mirkin wrote: Signed-off-by: Ilia Mirkin imir...@alum.mit.edu Cc: 10.4 10.3 mesa-sta...@lists.freedesktop.org --- src/gallium/auxiliary/indices/u_primconvert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c index 539ca53..4632781 100644 --- a/src/gallium/auxiliary/indices/u_primconvert.c +++ b/src/gallium/auxiliary/indices/u_primconvert.c @@ -137,7 +137,7 @@ util_primconvert_draw_vbo(struct primconvert_context *pc, src = ib-user_buffer; if (!src) { src = pipe_buffer_map(pc-pipe, ib-buffer, - PIPE_TRANSFER_READ, src_transfer); + PIPE_TRANSFER_READ, src_transfer) + ib-offset; } } else { This change made MSVC unhappy due to the void pointer arithmetic, which is trivial to fix, but it made be notice something: shouldn't the ib-offset also be added when src == ib-user_buffer? Jose ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] util/primconvert: take ib offset into account
On Fri, Dec 5, 2014 at 9:10 AM, Jose Fonseca jfons...@vmware.com wrote: On 05/12/14 00:01, Ilia Mirkin wrote: Signed-off-by: Ilia Mirkin imir...@alum.mit.edu Cc: 10.4 10.3 mesa-sta...@lists.freedesktop.org --- src/gallium/auxiliary/indices/u_primconvert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c index 539ca53..4632781 100644 --- a/src/gallium/auxiliary/indices/u_primconvert.c +++ b/src/gallium/auxiliary/indices/u_primconvert.c @@ -137,7 +137,7 @@ util_primconvert_draw_vbo(struct primconvert_context *pc, src = ib-user_buffer; if (!src) { src = pipe_buffer_map(pc-pipe, ib-buffer, - PIPE_TRANSFER_READ, src_transfer); + PIPE_TRANSFER_READ, src_transfer) + ib-offset; } } else { This change made MSVC unhappy due to the void pointer arithmetic, which is trivial to fix, but it made be notice something: shouldn't the ib-offset also be added when src == ib-user_buffer? I grepped around for user_buffer usage and it does not seem like anything else applies ib-offset to it either. Perhaps I missed it though. I'm a little weak on the exact gallium interface meanings, so perhaps it _is_ supposed to be added? Sorry about the MSVC breakage, I even thought about the void ptr arithmetic, but discounted it as well, nobody builds freedreno or vc4 on windows. But of course you still end up building primconvert :) -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] util/primconvert: Avoid point arithmetic; apply offset on all cases.
From: José Fonseca jfons...@vmware.com Matches what u_vbuf_get_minmax_index() does. --- src/gallium/auxiliary/indices/u_primconvert.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c index 4632781..eba1f9e 100644 --- a/src/gallium/auxiliary/indices/u_primconvert.c +++ b/src/gallium/auxiliary/indices/u_primconvert.c @@ -137,8 +137,9 @@ util_primconvert_draw_vbo(struct primconvert_context *pc, src = ib-user_buffer; if (!src) { src = pipe_buffer_map(pc-pipe, ib-buffer, - PIPE_TRANSFER_READ, src_transfer) + ib-offset; + PIPE_TRANSFER_READ, src_transfer); } + src = (const uint8_t *)src + ib-offset; } else { u_index_generator(pc-primtypes_mask, -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] util/primconvert: Avoid point arithmetic; apply offset on all cases.
On Fri, Dec 5, 2014 at 9:16 AM, Jose Fonseca jfons...@vmware.com wrote: From: José Fonseca jfons...@vmware.com Matches what u_vbuf_get_minmax_index() does. Hm, nouveau nv50 (and probably nvc0) does: if (ib-buffer) { nv50-idxbuf.offset = ib-offset; BCTX_REFN(nv50-bufctx_3d, INDEX, nv04_resource(ib-buffer), RD); } else { nv50-idxbuf.user_buffer = ib-user_buffer; } Is the offset really supposed to be applied to the user buffer? I figured the point of the offset was that you couldn't provide an offset into a pipe_resource otherwise, while with a user ptr, you can just add it in yourself... --- src/gallium/auxiliary/indices/u_primconvert.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c index 4632781..eba1f9e 100644 --- a/src/gallium/auxiliary/indices/u_primconvert.c +++ b/src/gallium/auxiliary/indices/u_primconvert.c @@ -137,8 +137,9 @@ util_primconvert_draw_vbo(struct primconvert_context *pc, src = ib-user_buffer; if (!src) { src = pipe_buffer_map(pc-pipe, ib-buffer, - PIPE_TRANSFER_READ, src_transfer) + ib-offset; + PIPE_TRANSFER_READ, src_transfer); } + src = (const uint8_t *)src + ib-offset; } else { u_index_generator(pc-primtypes_mask, -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] util/primconvert: take ib offset into account
On 05/12/14 14:12, Ilia Mirkin wrote: On Fri, Dec 5, 2014 at 9:10 AM, Jose Fonseca jfons...@vmware.com wrote: On 05/12/14 00:01, Ilia Mirkin wrote: Signed-off-by: Ilia Mirkin imir...@alum.mit.edu Cc: 10.4 10.3 mesa-sta...@lists.freedesktop.org --- src/gallium/auxiliary/indices/u_primconvert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c index 539ca53..4632781 100644 --- a/src/gallium/auxiliary/indices/u_primconvert.c +++ b/src/gallium/auxiliary/indices/u_primconvert.c @@ -137,7 +137,7 @@ util_primconvert_draw_vbo(struct primconvert_context *pc, src = ib-user_buffer; if (!src) { src = pipe_buffer_map(pc-pipe, ib-buffer, - PIPE_TRANSFER_READ, src_transfer); + PIPE_TRANSFER_READ, src_transfer) + ib-offset; } } else { This change made MSVC unhappy due to the void pointer arithmetic, which is trivial to fix, but it made be notice something: shouldn't the ib-offset also be added when src == ib-user_buffer? I grepped around for user_buffer usage and it does not seem like anything else applies ib-offset to it either. Perhaps I missed it though. I'm a little weak on the exact gallium interface meanings, so perhaps it _is_ supposed to be added? I'm not sure either. But at least u_vbuf_get_minmax_index() does it so seems safer to do it. Sorry about the MSVC breakage, I even thought about the void ptr arithmetic, but discounted it as well, nobody builds freedreno or vc4 on windows. But of course you still end up building primconvert :) No prob. I should add -Wpointer-arith to the automake build. The only difficulty with that is that (as you mentioned) some code is never meant to be built on MSVC, hence doesn't need such restriction on coding style. Therefore I need a way to add more warnings only on the cross-platform portions of Mesa source tree. Jose ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] util/primconvert: Avoid point arithmetic; apply offset on all cases.
On Fri, Dec 5, 2014 at 9:18 AM, Ilia Mirkin imir...@alum.mit.edu wrote: On Fri, Dec 5, 2014 at 9:16 AM, Jose Fonseca jfons...@vmware.com wrote: From: José Fonseca jfons...@vmware.com Matches what u_vbuf_get_minmax_index() does. Hm, nouveau nv50 (and probably nvc0) does: if (ib-buffer) { nv50-idxbuf.offset = ib-offset; BCTX_REFN(nv50-bufctx_3d, INDEX, nv04_resource(ib-buffer), RD); } else { nv50-idxbuf.user_buffer = ib-user_buffer; } Is the offset really supposed to be applied to the user buffer? I figured the point of the offset was that you couldn't provide an offset into a pipe_resource otherwise, while with a user ptr, you can just add it in yourself... But you're right, u_vbuf seems to add it in. Do a lot of drivers use u_vbuf? The logic for whether it gets used or not does not lend itself to easy checking. --- src/gallium/auxiliary/indices/u_primconvert.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c index 4632781..eba1f9e 100644 --- a/src/gallium/auxiliary/indices/u_primconvert.c +++ b/src/gallium/auxiliary/indices/u_primconvert.c @@ -137,8 +137,9 @@ util_primconvert_draw_vbo(struct primconvert_context *pc, src = ib-user_buffer; if (!src) { src = pipe_buffer_map(pc-pipe, ib-buffer, - PIPE_TRANSFER_READ, src_transfer) + ib-offset; + PIPE_TRANSFER_READ, src_transfer); } + src = (const uint8_t *)src + ib-offset; } else { u_index_generator(pc-primtypes_mask, -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] util/primconvert: Avoid point arithmetic; apply offset on all cases.
On 05/12/14 14:18, Ilia Mirkin wrote: On Fri, Dec 5, 2014 at 9:16 AM, Jose Fonseca jfons...@vmware.com wrote: From: José Fonseca jfons...@vmware.com Matches what u_vbuf_get_minmax_index() does. Hm, nouveau nv50 (and probably nvc0) does: if (ib-buffer) { nv50-idxbuf.offset = ib-offset; BCTX_REFN(nv50-bufctx_3d, INDEX, nv04_resource(ib-buffer), RD); } else { nv50-idxbuf.user_buffer = ib-user_buffer; } Is the offset really supposed to be applied to the user buffer? Nouveau is the odd ball here, as softpipe/llvmpipe apply it: src/gallium/drivers/llvmpipe/lp_draw_arrays.c src/gallium/drivers/softpipe/sp_draw_arrays.c I figured the point of the offset was that you couldn't provide an offset into a pipe_resource otherwise, while with a user ptr, you can just add it in yourself... True. Still it's better to apply these things uniformly, because the user vs buffer pointer is a distinction which rapidly disappears inside a pipe driver. (E.g, the driver can promote the user pointer to a buffer internally, and then the information of whether offset should or not be taken in account gets lost) Jose --- src/gallium/auxiliary/indices/u_primconvert.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c index 4632781..eba1f9e 100644 --- a/src/gallium/auxiliary/indices/u_primconvert.c +++ b/src/gallium/auxiliary/indices/u_primconvert.c @@ -137,8 +137,9 @@ util_primconvert_draw_vbo(struct primconvert_context *pc, src = ib-user_buffer; if (!src) { src = pipe_buffer_map(pc-pipe, ib-buffer, - PIPE_TRANSFER_READ, src_transfer) + ib-offset; + PIPE_TRANSFER_READ, src_transfer); } + src = (const uint8_t *)src + ib-offset; } else { u_index_generator(pc-primtypes_mask, -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] util/primconvert: Avoid point arithmetic; apply offset on all cases.
On Fri, Dec 5, 2014 at 9:29 AM, Jose Fonseca jfons...@vmware.com wrote: On 05/12/14 14:18, Ilia Mirkin wrote: On Fri, Dec 5, 2014 at 9:16 AM, Jose Fonseca jfons...@vmware.com wrote: From: José Fonseca jfons...@vmware.com Matches what u_vbuf_get_minmax_index() does. Hm, nouveau nv50 (and probably nvc0) does: if (ib-buffer) { nv50-idxbuf.offset = ib-offset; BCTX_REFN(nv50-bufctx_3d, INDEX, nv04_resource(ib-buffer), RD); } else { nv50-idxbuf.user_buffer = ib-user_buffer; } Is the offset really supposed to be applied to the user buffer? Nouveau is the odd ball here, as softpipe/llvmpipe apply it: src/gallium/drivers/llvmpipe/lp_draw_arrays.c src/gallium/drivers/softpipe/sp_draw_arrays.c I figured the point of the offset was that you couldn't provide an offset into a pipe_resource otherwise, while with a user ptr, you can just add it in yourself... True. Still it's better to apply these things uniformly, because the user vs buffer pointer is a distinction which rapidly disappears inside a pipe driver. (E.g, the driver can promote the user pointer to a buffer internally, and then the information of whether offset should or not be taken in account gets lost) Definitely agree that it's better to apply things uniformly. Just wasn't sure if uniformly meant fix u_vbuf or fix nouveau :) FWIW, st/mesa does, in setup_index_buffer: if (_mesa_is_bufferobj(bufobj)) { /* indices are in a real VBO */ ibuffer-buffer = st_buffer_object(bufobj)-buffer; ibuffer-offset = pointer_to_offset(ib-ptr); } else { /* indices are in user space memory */ ibuffer-user_buffer = ib-ptr; } But the ibuffer is zero-initialized beforehand. So this discussion is largely academic. I'm happy to decree that ib-offset shall be applied to the user_buffer as well and go around fixing nouveau and anyone else coming in its path. So... this change Reviewed-by: Ilia Mirkin imir...@alum.mit.edu Cheers, -ilia Jose --- src/gallium/auxiliary/indices/u_primconvert.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c index 4632781..eba1f9e 100644 --- a/src/gallium/auxiliary/indices/u_primconvert.c +++ b/src/gallium/auxiliary/indices/u_primconvert.c @@ -137,8 +137,9 @@ util_primconvert_draw_vbo(struct primconvert_context *pc, src = ib-user_buffer; if (!src) { src = pipe_buffer_map(pc-pipe, ib-buffer, - PIPE_TRANSFER_READ, src_transfer) + ib-offset; + PIPE_TRANSFER_READ, src_transfer); } + src = (const uint8_t *)src + ib-offset; } else { u_index_generator(pc-primtypes_mask, -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965/fs: Remove try_replace_with_sel().
On Dec 4, 2014 11:22 PM, Kenneth Graunke kenn...@whitecape.org wrote: On Friday, November 21, 2014 10:23:43 AM Matt Turner wrote: On Tue, Nov 11, 2014 at 9:41 AM, Matt Turner matts...@gmail.com wrote: The rest of our backend optimizations have replaced the need for this since it was written. instructions in affected programs: 30626 - 30564 (-0.20%) Hurts a small number of CSGO shaders by one instruction, but helps even more. Hurts two by a larger number because of something I noticed when I first wrote the SEL peephole: try_replace_with_sel() operates on instructions before we've demoted uniforms to pull constants. So code like var.x = ( -abs(r6.w) = 0.0 ) ? pc[82].x : r9.x; var.y = ( -abs(r6.w) = 0.0 ) ? pc[82].y : r9.y; var.z = ( -abs(r6.w) = 0.0 ) ? pc[82].z : r9.z; var.w = ( -abs(r6.w) = 0.0 ) ? pc[82].w : r9.w; where pc[82] gets demoted to a pull constant, we end up emitting a send(4) instruction to load pc[82] each time, and since they're in different basic blocks because we mishandle the ternary operator in this case we can't combine them. Once we handle this common ternary pattern better the problem will go away. --- Thoughts? I don't know...if I'm reading the above text correctly, this doesn't look compelling. Your argument for deleting this is it's not necessary anymore, but you go on to undermine that by saying that it hurts a few shaders, and even quadrouples the number of pull loads in a few cases... Sure, it'll get fixed if we handle ternary operations better...but we haven't yet...so... First off, how is this different from the sel peephole? Second, at the risk of sounding like a broken record, NIR should fix this for us. That said, I'm a little hesitant to delete whole passes until we know what kind of code it will generate. --Jason I'm pretty confused. Maybe I'm misreading your justification... ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] DRI3/Present fixes for Mesa 10.3+ (v2)
On Fri, 5 Dec 2014, Mario Kleiner wrote: Wrt. 2/5: It's a bit ambiguous how to read that bit of the spec, and i agree that one could read it in a way that the current mesa dri3 behaviour is not (completely) violating the spec. When we implemented the DRI2 version, we understood it in the way i want to restore with 2/5. The first reason is because the DRI2 / patch 2/5 interpretation makes the OML_sync_control extension very useful and robust for swap timing, whereas the alternative reading makes the extension borderline useless / its use somewhat fragile due to the race described in the commit. The second reason is backwards compatibility: It would be awesome not to break timing sensitive apps written against DRI2, especially given that users of those apps will certainly not understand why a simple distribution upgrade or graphics stack update pushed by the distro can suddenly cause such regressions. Another thing about 2/5 is that we don't want that querying the current msc perturbs the next target_msc when calling present_pixmap when swap_interval is not 0. let's say we have. - msc x last presentation succeeds - msc x+1 we query current msc we make new presentation, target msc y. Without patch 2/5, the calculus of y will be done on the basis that last presentation was done at x+1 instead of x. Axel Davy ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Added NULL check in eglCreateContext
I re-submitted the patch according with suggested corrections. Thank you, Valentin Corfu On 29.11.2014 07:53, Matt Turner wrote: On Thu, Nov 27, 2014 at 1:59 AM, Valentin Corfu corfuvalen...@gmail.com wrote: With this check we can avoid segmentation fault when invalid value used during eglCreateContext. Cc: mesa-sta...@lists.freedesktop.org Cc: mesa-dev@lists.freedesktop.org Signed-off-by: Valentin Corfu valentinx.co...@intel.com --- src/egl/drivers/dri2/egl_dri2.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index d795a2f..64eac90 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -808,6 +808,11 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, (void) drv; + if (NULL == conf) { Don't do this. conf == NULL is fine. + _eglError(EGL_BAD_PARAMETER, dri2_create_context); + return NULL; + } + dri2_ctx = malloc(sizeof *dri2_ctx); if (!dri2_ctx) { _eglError(EGL_BAD_ALLOC, eglCreateContext); -- 1.9.1 I don't see any evidence in the spec that eglCreateContext can ever return EGL_BAD_PARAMETER. I do see If config is not a valid EGLConfig, or does not support the requested client API , then an EGL_BAD_CONFIG error is generated And the patch should be prefixed with egl: . ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 86788] (bisected) 32bit UrbanTerror 4.1 timedemo sse4.1 segfault...
https://bugs.freedesktop.org/show_bug.cgi?id=86788 --- Comment #9 from José Fonseca jfons...@vmware.com --- I pushed a quick fix on a1fc6a91e5c6ab098fa8576e63b3a070852aa2a7 . Though I have to say I'm a bit disappointed that pointing out the problem/solution wasn't enough: I had to prepare the fix myself, and that my advice on the proper fix fell on deaf ears. If this is the level of ownership one is to expect from these SSE optimizations, then it would be better to never get them committed in the first place. In fact, if this goes on like this, I'll propose to revert them. As I'm not convinced the meager performance improvements justify this sort of headaches. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa/st: don't use CMP / I2F for conditional assignments with native integers
I am not quite sure what formulation do you suggest? This one seemed about as simple as any other one I could quickly come up with. (though the switch_order = false statements are redundant as they are the default, so if you prefer that they can easily be killed, and the if (expr-operation == ir_binop_nequal) should have been a (else if (expr-operation == ir_binop_nequal) indeed.) Roland Am 05.12.2014 um 13:01 schrieb Jose Fonseca: Looks good AFAICT. But I think we should probably swap the operands only once, in one place, instead of having two branches for switch_order. Jose On 04/12/14 23:25, srol...@vmware.com wrote: From: Roland Scheidegger srol...@vmware.com The original idea was to optimize away the condition by integrating it directly into the CMP instruction. However, with native integers this requires an extra I2F instruction. It is also fishy because the negation used didn't really honor ieee754 float comparison rules, not to mention the CMP instruction itself (being pretty much a legacy instruction) doesn't really have defined special float value behavior in any case. So, use UCMP and adjust the code trying to optimize the condition away accordingly (I have absolutely no idea if such conditions are actually hit or would be translated away somewhere else already). No piglit regressions on llvmpipe. --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 65 ++ 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 8e91c4b..ad0b05d 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2288,6 +2288,39 @@ glsl_to_tgsi_visitor::process_move_condition(ir_rvalue *ir) bool switch_order = false; ir_expression *const expr = ir-as_expression(); + + if (native_integers) { + if ((expr != NULL) (expr-get_num_operands() == 2)) { + enum glsl_base_type type = expr-operands[0]-type-base_type; + if (type == GLSL_TYPE_INT || type == GLSL_TYPE_UINT || + type == GLSL_TYPE_BOOL) { +if (expr-operation == ir_binop_equal) { + if (expr-operands[0]-is_zero()) { + src_ir = expr-operands[1]; + switch_order = true; + } + else if (expr-operands[1]-is_zero()) { + src_ir = expr-operands[0]; + switch_order = true; + } +} +if (expr-operation == ir_binop_nequal) { + if (expr-operands[0]-is_zero()) { + src_ir = expr-operands[1]; + switch_order = false; + } + else if (expr-operands[1]-is_zero()) { + src_ir = expr-operands[0]; + switch_order = false; + } +} + } + } + + src_ir-accept(this); + return switch_order; + } + if ((expr != NULL) (expr-get_num_operands() == 2)) { bool zero_on_left = false; @@ -2379,7 +2412,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, const struct glsl_type * const struct glsl_type *vec_type; vec_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, - type-vector_elements, 1); + type-vector_elements, 1); for (int i = 0; i type-matrix_columns; i++) { emit_block_mov(ir, vec_type, l, r); @@ -2447,7 +2480,7 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) swizzles[i] = first_enabled_chan; } r.swizzle = MAKE_SWIZZLE4(swizzles[0], swizzles[1], -swizzles[2], swizzles[3]); +swizzles[2], swizzles[3]); } assert(l.file != PROGRAM_UNDEFINED); @@ -2461,23 +2494,21 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) st_src_reg l_src = st_src_reg(l); st_src_reg condition_temp = condition; l_src.swizzle = swizzle_for_size(ir-lhs-type-vector_elements); - + if (native_integers) { -/* This is necessary because TGSI's CMP instruction expects the - * condition to be a float, and we store booleans as integers. - * TODO: really want to avoid i2f path and use UCMP. Requires - * changes to process_move_condition though too. - */ -condition_temp = get_temp(glsl_type::vec4_type); -condition.negate = 0; -emit(ir, TGSI_OPCODE_I2F, st_dst_reg(condition_temp), condition); -condition_temp.swizzle = condition.swizzle; +if (switch_order) { + emit(ir, TGSI_OPCODE_UCMP, l, condition_temp, l_src, r); +} else { + emit(ir, TGSI_OPCODE_UCMP, l, condition_temp, r, l_src); +
Re: [Mesa-dev] [PATCH] i965/fs: Remove try_replace_with_sel().
On Thu, Dec 4, 2014 at 11:22 PM, Kenneth Graunke kenn...@whitecape.org wrote: On Friday, November 21, 2014 10:23:43 AM Matt Turner wrote: On Tue, Nov 11, 2014 at 9:41 AM, Matt Turner matts...@gmail.com wrote: The rest of our backend optimizations have replaced the need for this since it was written. instructions in affected programs: 30626 - 30564 (-0.20%) Hurts a small number of CSGO shaders by one instruction, but helps even more. Hurts two by a larger number because of something I noticed when I first wrote the SEL peephole: try_replace_with_sel() operates on instructions before we've demoted uniforms to pull constants. So code like var.x = ( -abs(r6.w) = 0.0 ) ? pc[82].x : r9.x; var.y = ( -abs(r6.w) = 0.0 ) ? pc[82].y : r9.y; var.z = ( -abs(r6.w) = 0.0 ) ? pc[82].z : r9.z; var.w = ( -abs(r6.w) = 0.0 ) ? pc[82].w : r9.w; where pc[82] gets demoted to a pull constant, we end up emitting a send(4) instruction to load pc[82] each time, and since they're in different basic blocks because we mishandle the ternary operator in this case we can't combine them. Once we handle this common ternary pattern better the problem will go away. --- Thoughts? I don't know...if I'm reading the above text correctly, this doesn't look compelling. Your argument for deleting this is it's not necessary anymore, but you go on to undermine that by saying that it hurts a few shaders, and even quadrouples the number of pull loads in a few cases... Sure, it'll get fixed if we handle ternary operations better...but we haven't yet...so... I'm pretty confused. Maybe I'm misreading your justification... 52 shaders are helped by removing it (16 by one instruction), and only 17 are hurt. Of those 17, 15 have one extra instruction. The remaining two are the cases I described that this pass (not by design, I think?) is able to handle because demoting to pull constants hasn't happened yet. My claim is that the optimization is now a net loss. ... and that this pass isn't the place the problem in those two shaders should be optimized. For the record, their results are: HURT: shaders/closed/steam/counter-strike-global-offensive/2433.shader_test SIMD8: 668 - 683 (2.25%) HURT: shaders/closed/steam/counter-strike-global-offensive/2508.shader_test SIMD8: 733 - 756 (3.14%) If you don't think removing the pass is worth it, okay. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965/fs: Remove try_replace_with_sel().
On Fri, Dec 5, 2014 at 7:02 AM, Jason Ekstrand ja...@jlekstrand.net wrote: First off, how is this different from the sel peephole? This happens in the visitor during translation from GLSL IR to FS IR. It only looks for an exact sequence of IF/MOV/ELSE/MOV/ENDIF where the MOVs are to the same destination. The peephole happens in the optimization loop itself. The peephole looks for sequences of MOVs, rather than just a single one. The peephole also emits a MOV if the two sources you're selecting from are identical. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa/st: don't use CMP / I2F for conditional assignments with native integers
What I mean is, instead of if (switch_order) { FOO(l_src, r) } else { FOO(r, l_src,) } ... if (switch_order) { BOO(l_src, r) } else { BOO(r, l_src,) } simply do op1 = l_src, op2 = r; if (switch_order) { op1 = r; op2 = l_src } FOO(op1, op2) ... BOO(op1, op2) Jose On 05/12/14 18:13, Roland Scheidegger wrote: I am not quite sure what formulation do you suggest? This one seemed about as simple as any other one I could quickly come up with. (though the switch_order = false statements are redundant as they are the default, so if you prefer that they can easily be killed, and the if (expr-operation == ir_binop_nequal) should have been a (else if (expr-operation == ir_binop_nequal) indeed.) Roland Am 05.12.2014 um 13:01 schrieb Jose Fonseca: Looks good AFAICT. But I think we should probably swap the operands only once, in one place, instead of having two branches for switch_order. Jose On 04/12/14 23:25, srol...@vmware.com wrote: From: Roland Scheidegger srol...@vmware.com The original idea was to optimize away the condition by integrating it directly into the CMP instruction. However, with native integers this requires an extra I2F instruction. It is also fishy because the negation used didn't really honor ieee754 float comparison rules, not to mention the CMP instruction itself (being pretty much a legacy instruction) doesn't really have defined special float value behavior in any case. So, use UCMP and adjust the code trying to optimize the condition away accordingly (I have absolutely no idea if such conditions are actually hit or would be translated away somewhere else already). No piglit regressions on llvmpipe. --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 65 ++ 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 8e91c4b..ad0b05d 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2288,6 +2288,39 @@ glsl_to_tgsi_visitor::process_move_condition(ir_rvalue *ir) bool switch_order = false; ir_expression *const expr = ir-as_expression(); + + if (native_integers) { + if ((expr != NULL) (expr-get_num_operands() == 2)) { + enum glsl_base_type type = expr-operands[0]-type-base_type; + if (type == GLSL_TYPE_INT || type == GLSL_TYPE_UINT || + type == GLSL_TYPE_BOOL) { +if (expr-operation == ir_binop_equal) { + if (expr-operands[0]-is_zero()) { + src_ir = expr-operands[1]; + switch_order = true; + } + else if (expr-operands[1]-is_zero()) { + src_ir = expr-operands[0]; + switch_order = true; + } +} +if (expr-operation == ir_binop_nequal) { + if (expr-operands[0]-is_zero()) { + src_ir = expr-operands[1]; + switch_order = false; + } + else if (expr-operands[1]-is_zero()) { + src_ir = expr-operands[0]; + switch_order = false; + } +} + } + } + + src_ir-accept(this); + return switch_order; + } + if ((expr != NULL) (expr-get_num_operands() == 2)) { bool zero_on_left = false; @@ -2379,7 +2412,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, const struct glsl_type * const struct glsl_type *vec_type; vec_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, - type-vector_elements, 1); + type-vector_elements, 1); for (int i = 0; i type-matrix_columns; i++) { emit_block_mov(ir, vec_type, l, r); @@ -2447,7 +2480,7 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) swizzles[i] = first_enabled_chan; } r.swizzle = MAKE_SWIZZLE4(swizzles[0], swizzles[1], -swizzles[2], swizzles[3]); +swizzles[2], swizzles[3]); } assert(l.file != PROGRAM_UNDEFINED); @@ -2461,23 +2494,21 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) st_src_reg l_src = st_src_reg(l); st_src_reg condition_temp = condition; l_src.swizzle = swizzle_for_size(ir-lhs-type-vector_elements); - + if (native_integers) { -/* This is necessary because TGSI's CMP instruction expects the - * condition to be a float, and we store booleans as integers. - * TODO: really want to avoid i2f path and use UCMP. Requires - * changes to process_move_condition though too. - */ -condition_temp = get_temp(glsl_type::vec4_type); -condition.negate = 0; -emit(ir, TGSI_OPCODE_I2F,
Re: [Mesa-dev] [PATCH] mesa/st: don't use CMP / I2F for conditional assignments with native integers
Ahh the comment referred to that part of the code... Yes indeed looks better. Roland Am 05.12.2014 um 19:35 schrieb Jose Fonseca: What I mean is, instead of if (switch_order) { FOO(l_src, r) } else { FOO(r, l_src,) } ... if (switch_order) { BOO(l_src, r) } else { BOO(r, l_src,) } simply do op1 = l_src, op2 = r; if (switch_order) { op1 = r; op2 = l_src } FOO(op1, op2) ... BOO(op1, op2) Jose On 05/12/14 18:13, Roland Scheidegger wrote: I am not quite sure what formulation do you suggest? This one seemed about as simple as any other one I could quickly come up with. (though the switch_order = false statements are redundant as they are the default, so if you prefer that they can easily be killed, and the if (expr-operation == ir_binop_nequal) should have been a (else if (expr-operation == ir_binop_nequal) indeed.) Roland Am 05.12.2014 um 13:01 schrieb Jose Fonseca: Looks good AFAICT. But I think we should probably swap the operands only once, in one place, instead of having two branches for switch_order. Jose On 04/12/14 23:25, srol...@vmware.com wrote: From: Roland Scheidegger srol...@vmware.com The original idea was to optimize away the condition by integrating it directly into the CMP instruction. However, with native integers this requires an extra I2F instruction. It is also fishy because the negation used didn't really honor ieee754 float comparison rules, not to mention the CMP instruction itself (being pretty much a legacy instruction) doesn't really have defined special float value behavior in any case. So, use UCMP and adjust the code trying to optimize the condition away accordingly (I have absolutely no idea if such conditions are actually hit or would be translated away somewhere else already). No piglit regressions on llvmpipe. --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 65 ++ 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 8e91c4b..ad0b05d 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2288,6 +2288,39 @@ glsl_to_tgsi_visitor::process_move_condition(ir_rvalue *ir) bool switch_order = false; ir_expression *const expr = ir-as_expression(); + + if (native_integers) { + if ((expr != NULL) (expr-get_num_operands() == 2)) { + enum glsl_base_type type = expr-operands[0]-type-base_type; + if (type == GLSL_TYPE_INT || type == GLSL_TYPE_UINT || + type == GLSL_TYPE_BOOL) { +if (expr-operation == ir_binop_equal) { + if (expr-operands[0]-is_zero()) { + src_ir = expr-operands[1]; + switch_order = true; + } + else if (expr-operands[1]-is_zero()) { + src_ir = expr-operands[0]; + switch_order = true; + } +} +if (expr-operation == ir_binop_nequal) { + if (expr-operands[0]-is_zero()) { + src_ir = expr-operands[1]; + switch_order = false; + } + else if (expr-operands[1]-is_zero()) { + src_ir = expr-operands[0]; + switch_order = false; + } +} + } + } + + src_ir-accept(this); + return switch_order; + } + if ((expr != NULL) (expr-get_num_operands() == 2)) { bool zero_on_left = false; @@ -2379,7 +2412,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, const struct glsl_type * const struct glsl_type *vec_type; vec_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, - type-vector_elements, 1); + type-vector_elements, 1); for (int i = 0; i type-matrix_columns; i++) { emit_block_mov(ir, vec_type, l, r); @@ -2447,7 +2480,7 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) swizzles[i] = first_enabled_chan; } r.swizzle = MAKE_SWIZZLE4(swizzles[0], swizzles[1], -swizzles[2], swizzles[3]); +swizzles[2], swizzles[3]); } assert(l.file != PROGRAM_UNDEFINED); @@ -2461,23 +2494,21 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) st_src_reg l_src = st_src_reg(l); st_src_reg condition_temp = condition; l_src.swizzle = swizzle_for_size(ir-lhs-type-vector_elements); - + if (native_integers) { -/* This is necessary because TGSI's CMP instruction expects the - * condition to be a float, and we store booleans as integers. - * TODO:
Re: [Mesa-dev] [PATCH] i965/fs: Remove try_replace_with_sel().
On Fri, Dec 5, 2014 at 10:24 AM, Matt Turner matts...@gmail.com wrote: On Fri, Dec 5, 2014 at 7:02 AM, Jason Ekstrand ja...@jlekstrand.net wrote: First off, how is this different from the sel peephole? This happens in the visitor during translation from GLSL IR to FS IR. It only looks for an exact sequence of IF/MOV/ELSE/MOV/ENDIF where the MOVs are to the same destination. The peephole happens in the optimization loop itself. The peephole looks for sequences of MOVs, rather than just a single one. The peephole also emits a MOV if the two sources you're selecting from are identical. So why isn't the peephole picking up on what the other one is? I'm confused as to why we have any shaderdb change at all. Any insight on that? ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 01/12] i965: Don't copy propagate constants from sources with saturate
On Thu, Dec 4, 2014 at 10:02 PM, Kristian Høgsberg k...@bitplanet.net wrote: We don't propagate the saturate bit and some instructions can't saturate at all. If the source has saturate set, just skip propagation. I think the commit message could use some help. The real point is that copy propagation propagates into sources but sat is a destination modier. The only way you can propagate a mov.sat is into another mov by making it a mov.sat. Signed-off-by: Kristian Høgsberg k...@bitplanet.net --- src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp index e1989cb..611cff1 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp @@ -425,6 +425,8 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry) if (entry-src.file != IMM) return false; + if (entry-saturate) + return false; for (int i = inst-sources - 1; i = 0; i--) { if (inst-src[i].file != GRF) -- 2.2.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] util: Make unreachable at least be an assert
Previously, if __builtin_unreachable() was unavailable, the unreachable macro was defined to do nothing. We do better here, by at least still making it an assert. --- src/util/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/macros.h b/src/util/macros.h index 5fc6729..eec8b93 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -82,7 +82,7 @@ do {\ #endif #ifndef unreachable -#define unreachable(str) +#define unreachable(str) assert(!str) #endif /** -- 2.1.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] glsl: Prefer unreachable(condition) over assert(!condition)
The unreachable macro has the advantage (for modern compilers) of hinting to the compiler that this code is actually unreachable, which can help reduce spurious warnings, etc. Also, this version is a bit easier to type correctly and understand when reading without that seemingly out-of-place logical negation. These were all found with the following: git grep 'assert(! *' -- src/glsl and then replaced automatically. --- I did this only for for the glsl directory for now. There are still many more of these throughout mesa's source tree, but it felt like it would be far too invasive to make a change like this globally. So most of the changes here are in the glsl_types.cpp file where I was already working, and then there are just small numbers in many of the files in the same directory. src/glsl/ast_function.cpp| 4 +-- src/glsl/ast_to_hir.cpp | 8 ++--- src/glsl/glcpp/glcpp-parse.y | 2 +- src/glsl/glsl_parser_extras.cpp | 4 +-- src/glsl/glsl_symbol_table.cpp | 4 +-- src/glsl/glsl_types.cpp | 14 - src/glsl/ir.cpp | 38 src/glsl/ir.h| 2 +- src/glsl/ir_clone.cpp| 2 +- src/glsl/ir_constant_expression.cpp | 8 ++--- src/glsl/ir_equals.cpp | 2 +- src/glsl/ir_set_program_inouts.cpp | 2 +- src/glsl/ir_validate.cpp | 2 +- src/glsl/ir_visitor.h| 2 +- src/glsl/link_interface_blocks.cpp | 2 +- src/glsl/link_uniform_block_active_visitor.cpp | 2 +- src/glsl/link_uniform_blocks.cpp | 2 +- src/glsl/link_uniform_initializers.cpp | 4 +-- src/glsl/link_uniforms.cpp | 2 +- src/glsl/link_varyings.cpp | 4 +-- src/glsl/loop_analysis.cpp | 2 +- src/glsl/loop_controls.cpp | 2 +- src/glsl/lower_packed_varyings.cpp | 4 +-- src/glsl/lower_packing_builtins.cpp | 2 +- src/glsl/lower_ubo_reference.cpp | 6 ++-- src/glsl/lower_variable_index_to_cond_assign.cpp | 2 +- src/glsl/lower_vector.cpp| 2 +- src/glsl/opt_constant_propagation.cpp| 4 +-- src/glsl/opt_minmax.cpp | 2 +- 29 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index cbff9d8..60a5414 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -661,7 +661,7 @@ dereference_component(ir_rvalue *src, unsigned component) return dereference_component(col, r); } - assert(!Should not get here.); + unreachable(Should not get here.); return NULL; } @@ -1016,7 +1016,7 @@ emit_inline_vector_constructor(const glsl_type *type, data.b[i + base_component] = c-get_bool_component(i); break; default: - assert(!Should not get here.); + unreachable(Should not get here.); break; } } diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 811a955..ae68142 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1193,7 +1193,7 @@ ast_expression::do_hir(exec_list *instructions, switch (this-oper) { case ast_aggregate: - assert(!ast_aggregate: Should never get here.); + unreachable(ast_aggregate: Should never get here.); break; case ast_assign: { @@ -2314,7 +2314,7 @@ validate_explicit_location(const struct ast_type_qualifier *qual, : (qual-location + VARYING_SLOT_VAR0); break; case MESA_SHADER_COMPUTE: -assert(!Unexpected shader type); +unreachable(Unexpected shader type); break; } } else { @@ -5412,7 +5412,7 @@ ast_interface_block::hir(exec_list *instructions, } else { var_mode = ir_var_auto; iface_type_name = UNKNOWN; - assert(!interface block layout qualifier not found!); + unreachable(interface block layout qualifier not found!); } enum glsl_matrix_layout matrix_layout = GLSL_MATRIX_LAYOUT_INHERITED; @@ -6008,7 +6008,7 @@ remove_per_vertex_blocks(exec_list *instructions, } break; default: - assert(!Unexpected mode); + unreachable(Unexpected mode); break; } diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index f1119eb..f1c006e 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -1169,7 +1169,7 @@ _token_print (char **out, size_t *len, token_t *token) /* Nothing to print. */ break; default: -
Re: [Mesa-dev] [PATCH 1/2] mesa: Add a source parameter to _mesa_gl_debug.
Series is Reviewed-by: Ian Romanick ian.d.roman...@intel.com I like Eric's suggestions for patch 2, but I think those could be a follow-on patch. On 12/03/2014 10:24 AM, Matt Turner wrote: --- src/mesa/drivers/dri/i915/intel_context.h | 2 ++ src/mesa/drivers/dri/i915/intel_fbo.c | 1 + src/mesa/drivers/dri/i965/intel_debug.h | 2 ++ src/mesa/drivers/dri/i965/intel_fbo.c | 1 + src/mesa/main/errors.c| 3 ++- src/mesa/main/errors.h| 4 +++- src/mesa/main/fbobject.c | 1 + 7 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h index c314594..f0773c8 100644 --- a/src/mesa/drivers/dri/i915/intel_context.h +++ b/src/mesa/drivers/dri/i915/intel_context.h @@ -367,6 +367,7 @@ extern int INTEL_DEBUG; dbg_printf(__VA_ARGS__); \ if (intel-perf_debug) \ _mesa_gl_debug(intel-ctx, msg_id, \ + MESA_DEBUG_SOURCE_API, \ MESA_DEBUG_TYPE_PERFORMANCE, \ MESA_DEBUG_SEVERITY_MEDIUM,\ __VA_ARGS__); \ @@ -382,6 +383,7 @@ extern int INTEL_DEBUG; _warned = true;\ \ _mesa_gl_debug(ctx, msg_id, \ +MESA_DEBUG_SOURCE_API, \ MESA_DEBUG_TYPE_OTHER, \ MESA_DEBUG_SEVERITY_HIGH, fmt); \ } \ diff --git a/src/mesa/drivers/dri/i915/intel_fbo.c b/src/mesa/drivers/dri/i915/intel_fbo.c index b260d16..e138b85 100644 --- a/src/mesa/drivers/dri/i915/intel_fbo.c +++ b/src/mesa/drivers/dri/i915/intel_fbo.c @@ -546,6 +546,7 @@ intel_finish_render_texture(struct gl_context * ctx, struct gl_renderbuffer *rb) static GLuint msg_id = 0; \ if (unlikely(ctx-Const.ContextFlags GL_CONTEXT_FLAG_DEBUG_BIT)) { \ _mesa_gl_debug(ctx, msg_id, \ +MESA_DEBUG_SOURCE_API, \ MESA_DEBUG_TYPE_OTHER, \ MESA_DEBUG_SEVERITY_MEDIUM, \ __VA_ARGS__); \ diff --git a/src/mesa/drivers/dri/i965/intel_debug.h b/src/mesa/drivers/dri/i965/intel_debug.h index e859be1..e693e9c 100644 --- a/src/mesa/drivers/dri/i965/intel_debug.h +++ b/src/mesa/drivers/dri/i965/intel_debug.h @@ -86,6 +86,7 @@ extern uint64_t INTEL_DEBUG; dbg_printf(__VA_ARGS__); \ if (brw-perf_debug) \ _mesa_gl_debug(brw-ctx, msg_id,\ + MESA_DEBUG_SOURCE_API, \ MESA_DEBUG_TYPE_PERFORMANCE, \ MESA_DEBUG_SEVERITY_MEDIUM,\ __VA_ARGS__); \ @@ -101,6 +102,7 @@ extern uint64_t INTEL_DEBUG; _warned = true;\ \ _mesa_gl_debug(ctx, msg_id, \ +MESA_DEBUG_SOURCE_API, \ MESA_DEBUG_TYPE_OTHER, \ MESA_DEBUG_SEVERITY_HIGH, fmt); \ } \ diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c index 4a03b57..d56fc5b 100644 --- a/src/mesa/drivers/dri/i965/intel_fbo.c +++ b/src/mesa/drivers/dri/i965/intel_fbo.c @@ -638,6 +638,7 @@ intel_render_texture(struct gl_context * ctx, static GLuint msg_id = 0; \ if (unlikely(ctx-Const.ContextFlags GL_CONTEXT_FLAG_DEBUG_BIT)) { \ _mesa_gl_debug(ctx, msg_id, \ +MESA_DEBUG_SOURCE_API, \ MESA_DEBUG_TYPE_OTHER, \ MESA_DEBUG_SEVERITY_MEDIUM, \ __VA_ARGS__); \ diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index
Re: [Mesa-dev] [PATCH 1/2] util: Make unreachable at least be an assert
On 12/05/2014 01:17 PM, Carl Worth wrote: Previously, if __builtin_unreachable() was unavailable, the unreachable macro was defined to do nothing. We do better here, by at least still making it an assert. --- src/util/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/macros.h b/src/util/macros.h index 5fc6729..eec8b93 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -82,7 +82,7 @@ do {\ #endif #ifndef unreachable -#define unreachable(str) +#define unreachable(str) assert(!str) I'd make this ASSERT. In Mesa, ASSERT only exists if DEBUG is defined. It seems that many distros build without -DDEBUG and without -DNDEBUG. I'd rather have no code for these cases in all release builds. With that changed, this patch is Reviewed-by: Ian Romanick ian.d.roman...@intel.com #endif /** ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 03/12] i965: Set shader name for generator from call site
On Thu, Dec 04, 2014 at 10:02:24PM -0800, Kristian Høgsberg wrote: fs_generator no longer knows what stage it's generating code for, so we have to set the debug name of the shader from the call site. Signed-off-by: Kristian Høgsberg k...@bitplanet.net --- src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp | 4 +++- src/mesa/drivers/dri/i965/brw_fs.cpp| 17 -- src/mesa/drivers/dri/i965/brw_fs.h | 7 +++--- src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 31 +++-- 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp index 86ed953..f6d0b68 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp @@ -31,8 +31,10 @@ brw_blorp_eu_emitter::brw_blorp_eu_emitter(struct brw_context *brw, : mem_ctx(ralloc_context(NULL)), generator(brw, mem_ctx, (void *) rzalloc(mem_ctx, struct brw_wm_prog_key), (struct brw_stage_prog_data *) rzalloc(mem_ctx, struct brw_wm_prog_data), - NULL, NULL, false, debug_flag) + NULL, NULL, false) { + if (debug_flag) + generator.enable_debug(blorp); } brw_blorp_eu_emitter::~brw_blorp_eu_emitter() diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 6cc508e..8501f72 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -3717,8 +3717,21 @@ brw_wm_fs_emit(struct brw_context *brw, prog_data-no_8 = false; } - fs_generator g(brw, mem_ctx, (void *) key, prog_data-base, prog, fp-Base, - v.runtime_check_aads_emit, INTEL_DEBUG DEBUG_WM); + fs_generator g(brw, mem_ctx, (void *) key, prog_data-base, prog, + fp-Base, v.runtime_check_aads_emit); + + if (unlikely(INTEL_DEBUG DEBUG_WM)) { + char *name; + if (prog) + name = ralloc_asprintf(mem_ctx, %s fragment shader %d, +prog-Label ? prog-Label : unnamed, +prog-Name); + else + name = ralloc_asprintf(mem_ctx, fragment program %d, fp-Base.Id); + + g.enable_debug(name); + } + if (simd8_cfg) g.generate_code(simd8_cfg, 8); if (simd16_cfg) diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index bba7f96..20c6059 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -684,10 +684,10 @@ public: struct brw_stage_prog_data *prog_data, struct gl_shader_program *shader_prog, struct gl_program *fp, -bool runtime_check_aads_emit, -bool debug_flag); +bool runtime_check_aads_emit); ~fs_generator(); + void enable_debug(const char *shader_name); int generate_code(const cfg_t *cfg, int dispatch_width); const unsigned *get_assembly(unsigned int *assembly_size); @@ -795,7 +795,8 @@ private: exec_list discard_halt_patches; bool runtime_check_aads_emit; - const bool debug_flag; + bool debug_flag; + const char *shader_name; void *mem_ctx; }; diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index 9d20f40..602595a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -42,13 +42,12 @@ fs_generator::fs_generator(struct brw_context *brw, struct brw_stage_prog_data *prog_data, struct gl_shader_program *shader_prog, struct gl_program *prog, - bool runtime_check_aads_emit, - bool debug_flag) + bool runtime_check_aads_emit) : brw(brw), key(key), prog_data(prog_data), shader_prog(shader_prog), prog(prog), runtime_check_aads_emit(runtime_check_aads_emit), - debug_flag(debug_flag), mem_ctx(mem_ctx) + debug_flag(false), mem_ctx(mem_ctx) { ctx = brw-ctx; @@ -1512,6 +1511,13 @@ fs_generator::generate_untyped_surface_read(fs_inst *inst, struct brw_reg dst, brw_mark_surface_used(prog_data, surf_index.dw1.ud); } +void +fs_generator::enable_debug(const char *shader_name) +{ + debug_flag = true; + this-shader_name = shader_name; +} + int fs_generator::generate_code(const cfg_t *cfg, int dispatch_width) { @@ -2011,21 +2017,10 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width) int after_size = p-next_insn_offset - start_offset; if (unlikely(debug_flag)) { - if (shader_prog) { - fprintf(stderr, - Native code for %s fragment shader %d
Re: [Mesa-dev] [PATCH v3 03/12] i965: Set shader name for generator from call site
On Fri, Dec 5, 2014 at 1:34 PM, Ben Widawsky b...@bwidawsk.net wrote: I do wonder the original motivation for the debug_flag member. Seems totally superfluous. Because brw_fs_generator is used by the fs and by blorp, and you want different debug flags for them. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] glsl: Prefer unreachable(condition) over assert(!condition)
On 12/05/2014 01:17 PM, Carl Worth wrote: The unreachable macro has the advantage (for modern compilers) of hinting to the compiler that this code is actually unreachable, which can help reduce spurious warnings, etc. Also, this version is a bit easier to type correctly and understand when reading without that seemingly out-of-place logical negation. These were all found with the following: git grep 'assert(! *' -- src/glsl and then replaced automatically. There are a bunch of remove this ... comments below. I also think the Should not get here comments should get replace with something more reasonable. Most distros build without -DNDEBUG, so I tried to use the same string over and over to keep the bloat down. If the strings only exist in debug builds, there's no reason to be stingy. There are also a couple spots that I think should remain asserts. I've commented on those below. --- I did this only for for the glsl directory for now. There are still many more of these throughout mesa's source tree, but it felt like it would be far too invasive to make a change like this globally. So most of the changes here are in the glsl_types.cpp file where I was already working, and then there are just small numbers in many of the files in the same directory. src/glsl/ast_function.cpp| 4 +-- src/glsl/ast_to_hir.cpp | 8 ++--- src/glsl/glcpp/glcpp-parse.y | 2 +- src/glsl/glsl_parser_extras.cpp | 4 +-- src/glsl/glsl_symbol_table.cpp | 4 +-- src/glsl/glsl_types.cpp | 14 - src/glsl/ir.cpp | 38 src/glsl/ir.h| 2 +- src/glsl/ir_clone.cpp| 2 +- src/glsl/ir_constant_expression.cpp | 8 ++--- src/glsl/ir_equals.cpp | 2 +- src/glsl/ir_set_program_inouts.cpp | 2 +- src/glsl/ir_validate.cpp | 2 +- src/glsl/ir_visitor.h| 2 +- src/glsl/link_interface_blocks.cpp | 2 +- src/glsl/link_uniform_block_active_visitor.cpp | 2 +- src/glsl/link_uniform_blocks.cpp | 2 +- src/glsl/link_uniform_initializers.cpp | 4 +-- src/glsl/link_uniforms.cpp | 2 +- src/glsl/link_varyings.cpp | 4 +-- src/glsl/loop_analysis.cpp | 2 +- src/glsl/loop_controls.cpp | 2 +- src/glsl/lower_packed_varyings.cpp | 4 +-- src/glsl/lower_packing_builtins.cpp | 2 +- src/glsl/lower_ubo_reference.cpp | 6 ++-- src/glsl/lower_variable_index_to_cond_assign.cpp | 2 +- src/glsl/lower_vector.cpp| 2 +- src/glsl/opt_constant_propagation.cpp| 4 +-- src/glsl/opt_minmax.cpp | 2 +- 29 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index cbff9d8..60a5414 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -661,7 +661,7 @@ dereference_component(ir_rvalue *src, unsigned component) return dereference_component(col, r); } - assert(!Should not get here.); + unreachable(Should not get here.); return NULL; Remove this return. } @@ -1016,7 +1016,7 @@ emit_inline_vector_constructor(const glsl_type *type, data.b[i + base_component] = c-get_bool_component(i); break; default: - assert(!Should not get here.); + unreachable(Should not get here.); break; } } diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 811a955..ae68142 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1193,7 +1193,7 @@ ast_expression::do_hir(exec_list *instructions, switch (this-oper) { case ast_aggregate: - assert(!ast_aggregate: Should never get here.); + unreachable(ast_aggregate: Should never get here.); break; case ast_assign: { @@ -2314,7 +2314,7 @@ validate_explicit_location(const struct ast_type_qualifier *qual, : (qual-location + VARYING_SLOT_VAR0); break; case MESA_SHADER_COMPUTE: -assert(!Unexpected shader type); +unreachable(Unexpected shader type); break; } } else { @@ -5412,7 +5412,7 @@ ast_interface_block::hir(exec_list *instructions, } else { var_mode = ir_var_auto; iface_type_name = UNKNOWN; - assert(!interface block layout qualifier not found!); + unreachable(interface block layout qualifier not found!); } enum
Re: [Mesa-dev] [PATCH v3 03/12] i965: Set shader name for generator from call site
On Fri, Dec 05, 2014 at 01:36:52PM -0800, Matt Turner wrote: On Fri, Dec 5, 2014 at 1:34 PM, Ben Widawsky b...@bwidawsk.net wrote: I do wonder the original motivation for the debug_flag member. Seems totally superfluous. Because brw_fs_generator is used by the fs and by blorp, and you want different debug flags for them. Beforehand though we had the program type, so you could just as easily read the debug flag in at that time. I suppose what's there now might look a bit nicer if you had tons of different consumers of the fs_generator. Thanks for explaining though. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] util: Make unreachable at least be an assert
On Fri, Dec 5, 2014 at 1:25 PM, Ian Romanick i...@freedesktop.org wrote: On 12/05/2014 01:17 PM, Carl Worth wrote: Previously, if __builtin_unreachable() was unavailable, the unreachable macro was defined to do nothing. We do better here, by at least still making it an assert. --- src/util/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/macros.h b/src/util/macros.h index 5fc6729..eec8b93 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -82,7 +82,7 @@ do {\ #endif #ifndef unreachable -#define unreachable(str) +#define unreachable(str) assert(!str) I'd make this ASSERT. In Mesa, ASSERT only exists if DEBUG is defined. It seems that many distros build without -DDEBUG and without -DNDEBUG. I'd rather have no code for these cases in all release builds. I'm surprised by that. I see that we add -DDEBUG with --enable-debug, but from experience assert() does nothing in my regular release build (without --enable-debug). Where is NDEBUG coming from in that case? I don't see it in the macros gcc automatically defines (gcc -g -dM -E - /dev/null). ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] util: Make unreachable at least be an assert
On 12/05/2014 01:42 PM, Matt Turner wrote: On Fri, Dec 5, 2014 at 1:25 PM, Ian Romanick i...@freedesktop.org wrote: On 12/05/2014 01:17 PM, Carl Worth wrote: Previously, if __builtin_unreachable() was unavailable, the unreachable macro was defined to do nothing. We do better here, by at least still making it an assert. --- src/util/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/macros.h b/src/util/macros.h index 5fc6729..eec8b93 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -82,7 +82,7 @@ do {\ #endif #ifndef unreachable -#define unreachable(str) +#define unreachable(str) assert(!str) I'd make this ASSERT. In Mesa, ASSERT only exists if DEBUG is defined. It seems that many distros build without -DDEBUG and without -DNDEBUG. I'd rather have no code for these cases in all release builds. I'm surprised by that. I see that we add -DDEBUG with --enable-debug, but from experience assert() does nothing in my regular release build (without --enable-debug). Where is NDEBUG coming from in that case? I don't see it in the macros gcc automatically defines (gcc -g -dM -E - /dev/null). Right... and you need NDEBUG to no-op assert. It has to be added by hand, and it seems that the distros don't. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] util: Make unreachable at least be an assert
On Fri, Dec 5, 2014 at 1:48 PM, Ian Romanick i...@freedesktop.org wrote: On 12/05/2014 01:42 PM, Matt Turner wrote: On Fri, Dec 5, 2014 at 1:25 PM, Ian Romanick i...@freedesktop.org wrote: On 12/05/2014 01:17 PM, Carl Worth wrote: Previously, if __builtin_unreachable() was unavailable, the unreachable macro was defined to do nothing. We do better here, by at least still making it an assert. --- src/util/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/macros.h b/src/util/macros.h index 5fc6729..eec8b93 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -82,7 +82,7 @@ do {\ #endif #ifndef unreachable -#define unreachable(str) +#define unreachable(str) assert(!str) I'd make this ASSERT. In Mesa, ASSERT only exists if DEBUG is defined. It seems that many distros build without -DDEBUG and without -DNDEBUG. I'd rather have no code for these cases in all release builds. I'm surprised by that. I see that we add -DDEBUG with --enable-debug, but from experience assert() does nothing in my regular release build (without --enable-debug). Where is NDEBUG coming from in that case? I don't see it in the macros gcc automatically defines (gcc -g -dM -E - /dev/null). Right... and you need NDEBUG to no-op assert. It has to be added by hand, and it seems that the distros don't. But I don't get assert()s in release builds, and I'm not adding NDEBUG anywhere. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] util: Make unreachable at least be an assert
On 12/05/2014 01:50 PM, Matt Turner wrote: On Fri, Dec 5, 2014 at 1:48 PM, Ian Romanick i...@freedesktop.org wrote: On 12/05/2014 01:42 PM, Matt Turner wrote: On Fri, Dec 5, 2014 at 1:25 PM, Ian Romanick i...@freedesktop.org wrote: On 12/05/2014 01:17 PM, Carl Worth wrote: Previously, if __builtin_unreachable() was unavailable, the unreachable macro was defined to do nothing. We do better here, by at least still making it an assert. --- src/util/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/macros.h b/src/util/macros.h index 5fc6729..eec8b93 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -82,7 +82,7 @@ do {\ #endif #ifndef unreachable -#define unreachable(str) +#define unreachable(str) assert(!str) I'd make this ASSERT. In Mesa, ASSERT only exists if DEBUG is defined. It seems that many distros build without -DDEBUG and without -DNDEBUG. I'd rather have no code for these cases in all release builds. I'm surprised by that. I see that we add -DDEBUG with --enable-debug, but from experience assert() does nothing in my regular release build (without --enable-debug). Where is NDEBUG coming from in that case? I don't see it in the macros gcc automatically defines (gcc -g -dM -E - /dev/null). Right... and you need NDEBUG to no-op assert. It has to be added by hand, and it seems that the distros don't. But I don't get assert()s in release builds, and I'm not adding NDEBUG anywhere. That's weird... I just (today) had a case where an assert() was in a release build, but the same ASSERT() was not. Maybe something weird is just happening on my end... let me double check my stuff. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/1] clover: Use switch
THis way we get a warning if an enum value is not handled v2: codestyle Signed-off-by: Jan Vesely jan.ves...@rutgers.edu Reviewed-by: Francisco Jerez curroje...@riseup.net --- src/gallium/state_trackers/clover/core/kernel.cpp | 44 ++- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp index e07d14d..06f1610 100644 --- a/src/gallium/state_trackers/clover/core/kernel.cpp +++ b/src/gallium/state_trackers/clover/core/kernel.cpp @@ -293,38 +293,32 @@ namespace { std::unique_ptrkernel::argument kernel::argument::create(const module::argument marg) { - if (marg.type == module::argument::scalar) - return std::unique_ptrkernel::argument( -new scalar_argument(marg.size)); + switch (marg.type) { + case module::argument::scalar: + return std::unique_ptrkernel::argument(new scalar_argument(marg.size)); - else if (marg.type == module::argument::global) - return std::unique_ptrkernel::argument( -new global_argument); + case module::argument::global: + return std::unique_ptrkernel::argument(new global_argument); - else if (marg.type == module::argument::local) - return std::unique_ptrkernel::argument( -new local_argument); + case module::argument::local: + return std::unique_ptrkernel::argument(new local_argument); - else if (marg.type == module::argument::constant) - return std::unique_ptrkernel::argument( -new constant_argument); + case module::argument::constant: + return std::unique_ptrkernel::argument(new constant_argument); - else if (marg.type == module::argument::image2d_rd || - marg.type == module::argument::image3d_rd) - return std::unique_ptrkernel::argument( -new image_rd_argument); + case module::argument::image2d_rd: + case module::argument::image3d_rd: + return std::unique_ptrkernel::argument(new image_rd_argument); - else if (marg.type == module::argument::image2d_wr || - marg.type == module::argument::image3d_wr) - return std::unique_ptrkernel::argument( -new image_wr_argument); + case module::argument::image2d_wr: + case module::argument::image3d_wr: + return std::unique_ptrkernel::argument(new image_wr_argument); - else if (marg.type == module::argument::sampler) - return std::unique_ptrkernel::argument( -new sampler_argument); + case module::argument::sampler: + return std::unique_ptrkernel::argument(new sampler_argument); - else - throw error(CL_INVALID_KERNEL_DEFINITION); + } + throw error(CL_INVALID_KERNEL_DEFINITION); } kernel::argument::argument() : _set(false) { -- 1.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] util: Make unreachable at least be an assert
On 12/05/2014 01:54 PM, Ian Romanick wrote: On 12/05/2014 01:50 PM, Matt Turner wrote: On Fri, Dec 5, 2014 at 1:48 PM, Ian Romanick i...@freedesktop.org wrote: On 12/05/2014 01:42 PM, Matt Turner wrote: On Fri, Dec 5, 2014 at 1:25 PM, Ian Romanick i...@freedesktop.org wrote: On 12/05/2014 01:17 PM, Carl Worth wrote: Previously, if __builtin_unreachable() was unavailable, the unreachable macro was defined to do nothing. We do better here, by at least still making it an assert. --- src/util/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/macros.h b/src/util/macros.h index 5fc6729..eec8b93 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -82,7 +82,7 @@ do {\ #endif #ifndef unreachable -#define unreachable(str) +#define unreachable(str) assert(!str) I'd make this ASSERT. In Mesa, ASSERT only exists if DEBUG is defined. It seems that many distros build without -DDEBUG and without -DNDEBUG. I'd rather have no code for these cases in all release builds. I'm surprised by that. I see that we add -DDEBUG with --enable-debug, but from experience assert() does nothing in my regular release build (without --enable-debug). Where is NDEBUG coming from in that case? I don't see it in the macros gcc automatically defines (gcc -g -dM -E - /dev/null). Right... and you need NDEBUG to no-op assert. It has to be added by hand, and it seems that the distros don't. But I don't get assert()s in release builds, and I'm not adding NDEBUG anywhere. That's weird... I just (today) had a case where an assert() was in a release build, but the same ASSERT() was not. Maybe something weird is just happening on my end... let me double check my stuff. Never mind. PEBKAC. Patch, as is, is Reviewed-by: Ian Romanick ian.d.roman...@intel.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] radeonsi/compute: Clamp COMPUTE_TMPRING_SIZE.WAVES to: num_cu * 32
This is the maximum value allowed for this field. --- src/gallium/drivers/radeonsi/si_compute.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index 6ddb478..bf935dc 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -371,6 +371,9 @@ static void si_launch_grid( | S_00B85C_SH1_CU_EN(0x /* Default value */)) ; + num_waves_for_scratch = + MIN2(num_waves_for_scratch, +32 * sctx-screen-b.info.max_compute_units); si_pm4_set_reg(pm4, R_00B860_COMPUTE_TMPRING_SIZE, /* The maximum value for WAVES is 32 * num CU. * If you program this value incorrectly, the GPU will hang if -- 2.0.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965: Replace 'noann' debug flag with 'ann'.
--- Eric was against making this the default when I first suggested a flag. Have opinions changed since then? I rarely use the annotations, and they do make the assembly harder to read, when the assembly is what you're interested in. src/mesa/drivers/dri/i965/intel_asm_annotation.c | 2 +- src/mesa/drivers/dri/i965/intel_debug.c | 2 +- src/mesa/drivers/dri/i965/intel_debug.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c b/src/mesa/drivers/dri/i965/intel_asm_annotation.c index 37ad090..ac12655 100644 --- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c +++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c @@ -109,7 +109,7 @@ void annotate(struct brw_context *brw, struct annotation *ann = annotation-ann[annotation-ann_count++]; ann-offset = offset; - if ((INTEL_DEBUG DEBUG_NO_ANNOTATION) == 0) { + if ((INTEL_DEBUG DEBUG_ANNOTATION) != 0) { ann-ir = inst-ir; ann-annotation = inst-annotation; } diff --git a/src/mesa/drivers/dri/i965/intel_debug.c b/src/mesa/drivers/dri/i965/intel_debug.c index 6391cf7..1dd2b1d 100644 --- a/src/mesa/drivers/dri/i965/intel_debug.c +++ b/src/mesa/drivers/dri/i965/intel_debug.c @@ -66,7 +66,7 @@ static const struct dri_debug_control debug_control[] = { { blorp, DEBUG_BLORP }, { nodualobj, DEBUG_NO_DUAL_OBJECT_GS }, { optimizer, DEBUG_OPTIMIZER }, - { noann, DEBUG_NO_ANNOTATION }, + { ann, DEBUG_ANNOTATION }, { no8, DEBUG_NO8 }, { NULL,0 } }; diff --git a/src/mesa/drivers/dri/i965/intel_debug.h b/src/mesa/drivers/dri/i965/intel_debug.h index e859be1..a01de21 100644 --- a/src/mesa/drivers/dri/i965/intel_debug.h +++ b/src/mesa/drivers/dri/i965/intel_debug.h @@ -61,7 +61,7 @@ extern uint64_t INTEL_DEBUG; #define DEBUG_VUE (1 25) #define DEBUG_NO_DUAL_OBJECT_GS (1 26) #define DEBUG_OPTIMIZER (1 27) -#define DEBUG_NO_ANNOTATION (1 28) +#define DEBUG_ANNOTATION (1 28) #define DEBUG_NO8 (1 29) #ifdef HAVE_ANDROID_PLATFORM -- 2.0.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] winsys/radeon: Always report at least 1 compute unit
All uses of this require that the value be at least one, so it's easier to report at least one than having to wrap all uses in MAX2(max_compute_units, 1). --- src/gallium/drivers/radeon/r600_pipe_common.c | 2 +- src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 8aad178..cb17e54 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -607,7 +607,7 @@ static int r600_get_compute_param(struct pipe_screen *screen, case PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS: if (ret) { uint32_t *max_compute_units = ret; - *max_compute_units = MAX2(rscreen-info.max_compute_units, 1); + *max_compute_units = rscreen-info.max_compute_units; } return sizeof(uint32_t); diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index c207a85..f6349a0 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -384,6 +384,8 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws) radeon_get_drm_value(ws-fd, RADEON_INFO_MAX_PIPES, NULL, ws-info.r600_max_pipes); +/* All GPUs have at least one compute unit */ +ws-info.max_compute_units = 1; radeon_get_drm_value(ws-fd, RADEON_INFO_ACTIVE_CU_COUNT, NULL, ws-info.max_compute_units); -- 2.0.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Replace 'noann' debug flag with 'ann'.
On Fri, Dec 05, 2014 at 05:08:40PM -0800, Matt Turner wrote: --- Eric was against making this the default when I first suggested a flag. Have opinions changed since then? I rarely use the annotations, and they do make the assembly harder to read, when the assembly is what you're interested in. src/mesa/drivers/dri/i965/intel_asm_annotation.c | 2 +- src/mesa/drivers/dri/i965/intel_debug.c | 2 +- src/mesa/drivers/dri/i965/intel_debug.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c b/src/mesa/drivers/dri/i965/intel_asm_annotation.c index 37ad090..ac12655 100644 --- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c +++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c @@ -109,7 +109,7 @@ void annotate(struct brw_context *brw, struct annotation *ann = annotation-ann[annotation-ann_count++]; ann-offset = offset; - if ((INTEL_DEBUG DEBUG_NO_ANNOTATION) == 0) { + if ((INTEL_DEBUG DEBUG_ANNOTATION) != 0) { if (INTEL_DEBUG DEBUG_ANNOTATION) ann-ir = inst-ir; ann-annotation = inst-annotation; } diff --git a/src/mesa/drivers/dri/i965/intel_debug.c b/src/mesa/drivers/dri/i965/intel_debug.c index 6391cf7..1dd2b1d 100644 --- a/src/mesa/drivers/dri/i965/intel_debug.c +++ b/src/mesa/drivers/dri/i965/intel_debug.c @@ -66,7 +66,7 @@ static const struct dri_debug_control debug_control[] = { { blorp, DEBUG_BLORP }, { nodualobj, DEBUG_NO_DUAL_OBJECT_GS }, { optimizer, DEBUG_OPTIMIZER }, - { noann, DEBUG_NO_ANNOTATION }, + { ann, DEBUG_ANNOTATION }, { no8, DEBUG_NO8 }, { NULL,0 } }; diff --git a/src/mesa/drivers/dri/i965/intel_debug.h b/src/mesa/drivers/dri/i965/intel_debug.h index e859be1..a01de21 100644 --- a/src/mesa/drivers/dri/i965/intel_debug.h +++ b/src/mesa/drivers/dri/i965/intel_debug.h @@ -61,7 +61,7 @@ extern uint64_t INTEL_DEBUG; #define DEBUG_VUE (1 25) #define DEBUG_NO_DUAL_OBJECT_GS (1 26) #define DEBUG_OPTIMIZER (1 27) -#define DEBUG_NO_ANNOTATION (1 28) +#define DEBUG_ANNOTATION (1 28) #define DEBUG_NO8 (1 29) #ifdef HAVE_ANDROID_PLATFORM I never had an opinion, but I completely agree. With or without my suggestion above: Reviewed-by: Ben Widawsky b...@bwidawsk.net ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/4] i965/fs: Try to emit LINE instructions on Gen = 5.
On Thu, Dec 4, 2014 at 7:07 PM, Ian Romanick i...@freedesktop.org wrote: On 12/04/2014 04:37 PM, Matt Turner wrote: The LINE instruction performs a multiply-add instruction (a * b + c) where b and c are scalar arguments. It reads b and c from offsets in src0 such that you can load them (it they're representable) as a vector-float immediate with a single instruction. Hurts some programs, but that'll all get better once we CSE the vector-float MOVs in the next patch. Why only on Gen = 5? It looks like the instruction still exists at least on Gen6. On Gen 6 and up, we probably prefer to use a MAD instruction (pre-Gen6 there's no MAD instruction). Removing the brw-gen = 5 check though does have some merit: (Note, the order in which we try to emit line/mad doesn't change the results) total instructions in shared programs: 5807536 - 5768438 (-0.67%) instructions in affected programs: 2317584 - 2278486 (-1.69%) GAINED:1 LOST: 18 Unfortunately there's a bunch of lost SIMD16 programs, for likely the same reason as enabling MAD when you have constant arguments hurts -- because you're increasing register pressure to hold the constant arguments. I suspect we should be tracking number of registers used for Gen = 5 in shader-db. This series may have increased register pressure, which would reduce parallelism. :( Better information needed. And some improvements to scheduling. And to finish my constants combining pass... ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 04/12] i965: Remove shader program argument and member from fs_generator
On Thu, Dec 04, 2014 at 10:02:25PM -0800, Kristian Høgsberg wrote: Now that the caller passes in the shader debug name, we don't need this anymore. Signed-off-by: Kristian Høgsberg k...@bitplanet.net Up through here all looks fine to me. I do like Jason's suggestion for patch 1. (I also don't really see the need to have 2-4 as separate patches, but as you like). 1-4: Reviewed-by: Ben Widawsky b...@bwidawsk.net --- src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp | 2 +- src/mesa/drivers/dri/i965/brw_fs.cpp| 2 +- src/mesa/drivers/dri/i965/brw_fs.h | 2 -- src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 3 +-- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp index f6d0b68..83fccc2 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp @@ -31,7 +31,7 @@ brw_blorp_eu_emitter::brw_blorp_eu_emitter(struct brw_context *brw, : mem_ctx(ralloc_context(NULL)), generator(brw, mem_ctx, (void *) rzalloc(mem_ctx, struct brw_wm_prog_key), (struct brw_stage_prog_data *) rzalloc(mem_ctx, struct brw_wm_prog_data), - NULL, NULL, false) + NULL, false) { if (debug_flag) generator.enable_debug(blorp); diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 8501f72..fe09630 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -3717,7 +3717,7 @@ brw_wm_fs_emit(struct brw_context *brw, prog_data-no_8 = false; } - fs_generator g(brw, mem_ctx, (void *) key, prog_data-base, prog, + fs_generator g(brw, mem_ctx, (void *) key, prog_data-base, fp-Base, v.runtime_check_aads_emit); if (unlikely(INTEL_DEBUG DEBUG_WM)) { diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 20c6059..5360b1c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -682,7 +682,6 @@ public: void *mem_ctx, const void *key, struct brw_stage_prog_data *prog_data, -struct gl_shader_program *shader_prog, struct gl_program *fp, bool runtime_check_aads_emit); ~fs_generator(); @@ -788,7 +787,6 @@ private: const void * const key; struct brw_stage_prog_data * const prog_data; - struct gl_shader_program * const shader_prog; const struct gl_program *prog; unsigned dispatch_width; /** 8 or 16 */ diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index 602595a..c2d83bf 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -40,12 +40,11 @@ fs_generator::fs_generator(struct brw_context *brw, void *mem_ctx, const void *key, struct brw_stage_prog_data *prog_data, - struct gl_shader_program *shader_prog, struct gl_program *prog, bool runtime_check_aads_emit) : brw(brw), key(key), - prog_data(prog_data), shader_prog(shader_prog), + prog_data(prog_data), prog(prog), runtime_check_aads_emit(runtime_check_aads_emit), debug_flag(false), mem_ctx(mem_ctx) { -- 2.2.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965: Fix union usage for GCC = 4.6.
This patch fixes this build error with GCC = 4.6. CXXtest_vf_float_conversions.o test_vf_float_conversions.cpp: In function ‘unsigned int f2u(float)’: test_vf_float_conversions.cpp:63:20: error: expected primary-expression before ‘.’ token Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86939 Signed-off-by: Vinson Lee v...@freedesktop.org --- .../drivers/dri/i965/test_vf_float_conversions.cpp |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp b/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp index 2ea36fd..6a8bcea 100644 --- a/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp +++ b/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp @@ -60,7 +60,8 @@ union fu { static unsigned f2u(float f) { - union fu fu = { .f = f }; + union fu fu; + fu.f = f; return fu.u; } -- 1.7.9.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Fix union usage for GCC = 4.6.
On Fri, Dec 5, 2014 at 6:18 PM, Vinson Lee v...@freedesktop.org wrote: This patch fixes this build error with GCC = 4.6. CXXtest_vf_float_conversions.o test_vf_float_conversions.cpp: In function ‘unsigned int f2u(float)’: test_vf_float_conversions.cpp:63:20: error: expected primary-expression before ‘.’ token Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86939 Signed-off-by: Vinson Lee v...@freedesktop.org --- .../drivers/dri/i965/test_vf_float_conversions.cpp |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp b/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp index 2ea36fd..6a8bcea 100644 --- a/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp +++ b/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp @@ -60,7 +60,8 @@ union fu { static unsigned f2u(float f) { - union fu fu = { .f = f }; + union fu fu; + fu.f = f; return fu.u; } I'm surprised that this is necessary. Can someone point me to some documentation that says that designated initializers for unions only were added with gcc-4.7? Jonathan, can you confirm that this is required? I suppose you didn't notice because you didn't build with 'make check'? ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Fix union usage for GCC = 4.6.
On Fri, Dec 05, 2014 at 06:56:27PM -0800, Matt Turner wrote: On Fri, Dec 5, 2014 at 6:18 PM, Vinson Lee v...@freedesktop.org wrote: This patch fixes this build error with GCC = 4.6. CXXtest_vf_float_conversions.o test_vf_float_conversions.cpp: In function ‘unsigned int f2u(float)’: test_vf_float_conversions.cpp:63:20: error: expected primary-expression before ‘.’ token Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86939 Signed-off-by: Vinson Lee v...@freedesktop.org --- .../drivers/dri/i965/test_vf_float_conversions.cpp |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp b/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp index 2ea36fd..6a8bcea 100644 --- a/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp +++ b/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp @@ -60,7 +60,8 @@ union fu { static unsigned f2u(float f) { - union fu fu = { .f = f }; + union fu fu; + fu.f = f; return fu.u; } I'm surprised that this is necessary. Can someone point me to some documentation that says that designated initializers for unions only were added with gcc-4.7? Jonathan, can you confirm that this is required? I suppose you didn't notice because you didn't build with 'make check'? I believe Vinson means G++. G++ allowing declared initializers is pretty new. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] opengl fill modes
Hi, this might be a stupid question, but if you use opengl fill mode line / point are the shared edges/vertices in strip (or fan) primitives drawn multiple times? My pedantic reading of the spec would seem to say yes (because it essentially says tri strips form individual triangles for rasterization, and only there are they converted to points/lines), and this is what we actually do in the draw module, but I have some doubts that it's actually true or at least that modern hw operates like that? Oh and a followup question if it's wrong, what would be the primitive ids associated with such lines / points when resulting from such decomposed tri strips? Roland ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Fix union usage for GCC = 4.6.
On Fri, Dec 05, 2014 at 06:56:27PM -0800, Matt Turner wrote: On Fri, Dec 5, 2014 at 6:18 PM, Vinson Lee v...@freedesktop.org wrote: This patch fixes this build error with GCC = 4.6. CXXtest_vf_float_conversions.o test_vf_float_conversions.cpp: In function ???unsigned int f2u(float)???: test_vf_float_conversions.cpp:63:20: error: expected primary-expression before ???.??? token Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86939 Signed-off-by: Vinson Lee v...@freedesktop.org --- .../drivers/dri/i965/test_vf_float_conversions.cpp |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp b/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp index 2ea36fd..6a8bcea 100644 --- a/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp +++ b/src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp @@ -60,7 +60,8 @@ union fu { static unsigned f2u(float f) { - union fu fu = { .f = f }; + union fu fu; + fu.f = f; return fu.u; } I'm surprised that this is necessary. Can someone point me to some documentation that says that designated initializers for unions only were added with gcc-4.7? Jonathan, can you confirm that this is required? I suppose you didn't notice because you didn't build with 'make check'? No I don't normally run make check, it seems it errors out before then as it assumes /bin/bash is present /bin/sh: ./es1api/ABI-check: No such file or directory FAIL: es1api/ABI-check /bin/sh: ./es2api/ABI-check: No such file or directory FAIL: es2api/ABI-check glsl_test does not link due to missing pthread symbols And there looks to be a large amount of other scripts that want bash, ugh. Running gmake check from src/mesa/drivers/dri instead of the top level gives: test_vf_float_conversions.cpp: In function 'unsigned int f2u(float)': test_vf_float_conversions.cpp:63: error: expected primary-expression before 'union' test_vf_float_conversions.cpp:63: error: expected `)' before 'union' Makefile:1013: recipe for target 'test_vf_float_conversions.o' failed With the below diff from the top level I get as far as == Testing optimization passes == Testing ./lower_jumps/lower_returns_main_true.opt_test...FAIL Traceback (most recent call last): File /usr/users/jsg/src/mesa/src/glsl/tests/compare_ir, line 43, in module ir2 = sort_decls(parse_sexp(f.read())) File /usr/users/jsg/src/mesa/src/glsl/tests/sexps.py, line 66, in parse_sexp raise Exception('Multiple sexps') Exception: Multiple sexps Testing ./lower_jumps/lower_returns_main_false.opt_test...FAIL Traceback (most recent call last): File /usr/users/jsg/src/mesa/src/glsl/tests/compare_ir, line 43, in module ir2 = sort_decls(parse_sexp(f.read())) File /usr/users/jsg/src/mesa/src/glsl/tests/sexps.py, line 66, in parse_sexp raise Exception('Multiple sexps') Exception: Multiple sexps (and a bunch more of these) Along with the ABI-check scripts it seems at the very least all occurances of #!/bin/bash should be changed to #!/usr/bin/env bash if they are actually bash specific. In other words these: bin/bugzilla_mesa.sh:#!/bin/bash bin/shortlog_mesa.sh:#!/bin/bash src/egl/wayland/wayland-egl/wayland-egl-symbols-check:#!/bin/bash src/gallium/targets/gbm/gallium-gbm-symbols-check:#!/bin/bash src/gallium/tools/addr2line.sh:#!/bin/bash src/gallium/tools/trace/tracediff.sh:#!/bin/bash src/gbm/gbm-symbols-check:#!/bin/basH diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am index 0ccc81d..66986eb 100644 --- a/src/glsl/Makefile.am +++ b/src/glsl/Makefile.am @@ -137,7 +137,8 @@ glsl_test_SOURCES = \ test.cpp \ test_optpass.cpp -glsl_test_LDADD = libglsl.la +glsl_test_LDADD = libglsl.la \ + $(PTHREAD_LIBS) # We write our own rules for yacc and lex below. We'd rather use automake, # but automake makes it especially difficult for a number of reasons: diff --git a/src/glsl/tests/optimization-test b/src/glsl/tests/optimization-test index 26a51be..19e3ce5 100755 --- a/src/glsl/tests/optimization-test +++ b/src/glsl/tests/optimization-test @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh if [ ! -z $srcdir ]; then compare_ir=`pwd`/tests/compare_ir diff --git a/src/mapi/es1api/ABI-check b/src/mapi/es1api/ABI-check index 44654cd..223658b 100755 --- a/src/mapi/es1api/ABI-check +++ b/src/mapi/es1api/ABI-check @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Print defined gl.* functions not in GL ES 1.1 or in # (FIXME, none of these should be part of the ABI) diff --git a/src/mapi/es2api/ABI-check b/src/mapi/es2api/ABI-check index abbb55c..5c9e826 100755 --- a/src/mapi/es2api/ABI-check +++ b/src/mapi/es2api/ABI-check @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Print defined gl.* functions not in GL ES 3.0 or in # (FIXME, none of these should be part of the ABI) ___ mesa-dev mailing
Re: [Mesa-dev] r600/sb loop issue
On 12/04/2014 01:43 AM, Dave Airlie wrote: Hi Vadim, I've been looking with Glenn's help into a bug in sb for a couple of weeks now triggered by a change in how GLSL generates switch statements. I understand you probably aren't too interested in r600g but I believe I'm hitting a design level problem and I would like some advice. So it appears that GLSL can create loops that don't repeat for switch statements, and it appears SB wasn't ready to handle such a thing. Hi, Dave, I suspect we should rather get rid of such loops somehow, i.e. convert to something else, the loop that never repeats is not really a loop anyway. AFAICS continue is not supported in switch statements according to GLSL specs, so the loops generated for switch will never be repeated. Am I missing something? Even if repeating is possible somehow, at least we can get rid of the loops that are not repeated. I think loops are less efficient than other control flow instructions on r600g hw (at least because they increase stack usage), and possibly on other hw too. In fact it seems sb basically gets rid of it already in IR, it just doesn't know how to translate resulting control flow to ISA, because so far it only supports specific control flow structure for if-then-else that was previously preserved during optimizations. I think it may be not very hard to implement support for that in finalizer, I'll look into it. sb has the -is_loop() and it just checks !repeats.empty(), so this meant in the finalizer code we'd fall into the if statement which would then assert. I hacked/fixed (more hacked), this in 7b0067d23a6f64cf83c42e7f11b2cd4100c569fe which attempts to detect single pass loops and handle things that way. However this lead to stack depth calculations being incorrectly done, so I moved the single loop detect into the is_loop check, (see attached patch). This fixes the rendering in some places, but lead to a regression in tests/shaders/glsl-vs-continue-in-switch-in-do-while.shader_test error at : PHI t76||FP@R3.x, t128||FP@R3.x, t115||FP@R3.x, t102||FP@R3.x, t89||FP@R3.x : expected operand value t115||FP@R3.x, gpr contains t17||FP@R3.x error at : PHI t76||FP@R3.x, t128||FP@R3.x, t115||FP@R3.x, t102||FP@R3.x, t89||FP@R3.x : expected operand value t102||FP@R3.x, gpr contains t17||FP@R3.x Now Glenn suspected this was due to the is_loop check in sb_shader.cpp:create_bbs, and changing that check to only detect repeating loops removes that issue, but introduces stack sizing issues again, resulting in lockups/random rendering. So I just want to ask had you considered single loops with an always break in sb design, I didn't see such loops with any test cases, so I didn't even think about it. and perhaps some idea where things are going so wrong with the register alloc above. Not sure, but as long as the only repeat node is optimized away in bc_parser because it's useless due to unconditional break, I suspect it may be not easy to make all other code think that it's still a loop. I've tried a quick fix to not optimize the repeat away for such loops, but it results in other issues, probably it will require handling this as a special case in other places, so it doesn't look like a good idea either. I'll try to implement the solution that I described above, that is, translate resulting control flow back to ISA. If it won't be too much work, it's probably the best way and it won't use loop instructions in the end. I suspect I'll keep digging into this, but its getting to the edges of the brain space/time I can find! Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] r600/sb loop issue
On Fri, Dec 5, 2014 at 8:13 PM, Vadim Girlin vadimgir...@gmail.com wrote: I suspect we should rather get rid of such loops somehow, i.e. convert to something else, the loop that never repeats is not really a loop anyway. AFAICS continue is not supported in switch statements according to GLSL specs, so the loops generated for switch will never be repeated. Am I missing something? Even if repeating is possible somehow, at least we can get rid of the loops that are not repeated. I don't think that's true. I don't see anything in the spec that would lead me to believe continue cannot occur in a switch statement. In fact, we have some relatively complicated shaders that have a continue in a switch. See tests/shaders/glsl-fs-continue-in-switch-in-do-while.shader_test ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] r600/sb loop issue
On 12/06/2014 07:50 AM, Matt Turner wrote: On Fri, Dec 5, 2014 at 8:13 PM, Vadim Girlin vadimgir...@gmail.com wrote: I suspect we should rather get rid of such loops somehow, i.e. convert to something else, the loop that never repeats is not really a loop anyway. AFAICS continue is not supported in switch statements according to GLSL specs, so the loops generated for switch will never be repeated. Am I missing something? Even if repeating is possible somehow, at least we can get rid of the loops that are not repeated. I don't think that's true. I don't see anything in the spec that would lead me to believe continue cannot occur in a switch statement. I've double-checked some versions of GLSL spec (1.30, 1.50, 3.30, 4.40) and all of them say the same (section 6.4 Jumps): The continue jump is used only in loops. In fact, we have some relatively complicated shaders that have a continue in a switch. See tests/shaders/glsl-fs-continue-in-switch-in-do-while.shader_test ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Replace 'noann' debug flag with 'ann'.
On 12/05/2014 05:23 PM, Ben Widawsky wrote: On Fri, Dec 05, 2014 at 05:08:40PM -0800, Matt Turner wrote: --- Eric was against making this the default when I first suggested a flag. Have opinions changed since then? I rarely use the annotations, and they do make the assembly harder to read, when the assembly is what you're interested in. src/mesa/drivers/dri/i965/intel_asm_annotation.c | 2 +- src/mesa/drivers/dri/i965/intel_debug.c | 2 +- src/mesa/drivers/dri/i965/intel_debug.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c b/src/mesa/drivers/dri/i965/intel_asm_annotation.c index 37ad090..ac12655 100644 --- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c +++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c @@ -109,7 +109,7 @@ void annotate(struct brw_context *brw, struct annotation *ann = annotation-ann[annotation-ann_count++]; ann-offset = offset; - if ((INTEL_DEBUG DEBUG_NO_ANNOTATION) == 0) { + if ((INTEL_DEBUG DEBUG_ANNOTATION) != 0) { if (INTEL_DEBUG DEBUG_ANNOTATION) Doesn't this result in a GCC warning? ann-ir = inst-ir; ann-annotation = inst-annotation; } diff --git a/src/mesa/drivers/dri/i965/intel_debug.c b/src/mesa/drivers/dri/i965/intel_debug.c index 6391cf7..1dd2b1d 100644 --- a/src/mesa/drivers/dri/i965/intel_debug.c +++ b/src/mesa/drivers/dri/i965/intel_debug.c @@ -66,7 +66,7 @@ static const struct dri_debug_control debug_control[] = { { blorp, DEBUG_BLORP }, { nodualobj, DEBUG_NO_DUAL_OBJECT_GS }, { optimizer, DEBUG_OPTIMIZER }, - { noann, DEBUG_NO_ANNOTATION }, + { ann, DEBUG_ANNOTATION }, { no8, DEBUG_NO8 }, { NULL,0 } }; diff --git a/src/mesa/drivers/dri/i965/intel_debug.h b/src/mesa/drivers/dri/i965/intel_debug.h index e859be1..a01de21 100644 --- a/src/mesa/drivers/dri/i965/intel_debug.h +++ b/src/mesa/drivers/dri/i965/intel_debug.h @@ -61,7 +61,7 @@ extern uint64_t INTEL_DEBUG; #define DEBUG_VUE (1 25) #define DEBUG_NO_DUAL_OBJECT_GS (1 26) #define DEBUG_OPTIMIZER (1 27) -#define DEBUG_NO_ANNOTATION (1 28) +#define DEBUG_ANNOTATION (1 28) #define DEBUG_NO8 (1 29) #ifdef HAVE_ANDROID_PLATFORM I never had an opinion, but I completely agree. With or without my suggestion above: Reviewed-by: Ben Widawsky b...@bwidawsk.net ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] r600/sb loop issue
On Fri, Dec 5, 2014 at 8:56 PM, Vadim Girlin vadimgir...@gmail.com wrote: On 12/06/2014 07:50 AM, Matt Turner wrote: On Fri, Dec 5, 2014 at 8:13 PM, Vadim Girlin vadimgir...@gmail.com wrote: I suspect we should rather get rid of such loops somehow, i.e. convert to something else, the loop that never repeats is not really a loop anyway. AFAICS continue is not supported in switch statements according to GLSL specs, so the loops generated for switch will never be repeated. Am I missing something? Even if repeating is possible somehow, at least we can get rid of the loops that are not repeated. I don't think that's true. I don't see anything in the spec that would lead me to believe continue cannot occur in a switch statement. I've double-checked some versions of GLSL spec (1.30, 1.50, 3.30, 4.40) and all of them say the same (section 6.4 Jumps): The continue jump is used only in loops. Sure, but isn't the continue below in a loop? do { switch (...) { case ...: continue; } } while (...); The grammar is pretty unambiguous. jump_statement: CONTINUE SEMICOLON BREAK SEMICOLON RETURN SEMICOLON RETURN expression SEMICOLON DISCARD SEMICOLON // Fragment shader only. If continue can't be in a switch, neither can break. :) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Replace 'noann' debug flag with 'ann'.
On Fri, Dec 05, 2014 at 08:57:27PM -0800, Ian Romanick wrote: On 12/05/2014 05:23 PM, Ben Widawsky wrote: On Fri, Dec 05, 2014 at 05:08:40PM -0800, Matt Turner wrote: --- Eric was against making this the default when I first suggested a flag. Have opinions changed since then? I rarely use the annotations, and they do make the assembly harder to read, when the assembly is what you're interested in. src/mesa/drivers/dri/i965/intel_asm_annotation.c | 2 +- src/mesa/drivers/dri/i965/intel_debug.c | 2 +- src/mesa/drivers/dri/i965/intel_debug.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c b/src/mesa/drivers/dri/i965/intel_asm_annotation.c index 37ad090..ac12655 100644 --- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c +++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c @@ -109,7 +109,7 @@ void annotate(struct brw_context *brw, struct annotation *ann = annotation-ann[annotation-ann_count++]; ann-offset = offset; - if ((INTEL_DEBUG DEBUG_NO_ANNOTATION) == 0) { + if ((INTEL_DEBUG DEBUG_ANNOTATION) != 0) { if (INTEL_DEBUG DEBUG_ANNOTATION) Doesn't this result in a GCC warning? Perhaps I am missing something. Do you mean because there is no, '{'? It should be fine, I think. [snip] ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Replace 'noann' debug flag with 'ann'.
On 12/05/2014 09:34 PM, Ben Widawsky wrote: On Fri, Dec 05, 2014 at 08:57:27PM -0800, Ian Romanick wrote: On 12/05/2014 05:23 PM, Ben Widawsky wrote: On Fri, Dec 05, 2014 at 05:08:40PM -0800, Matt Turner wrote: --- Eric was against making this the default when I first suggested a flag. Have opinions changed since then? I rarely use the annotations, and they do make the assembly harder to read, when the assembly is what you're interested in. src/mesa/drivers/dri/i965/intel_asm_annotation.c | 2 +- src/mesa/drivers/dri/i965/intel_debug.c | 2 +- src/mesa/drivers/dri/i965/intel_debug.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c b/src/mesa/drivers/dri/i965/intel_asm_annotation.c index 37ad090..ac12655 100644 --- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c +++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c @@ -109,7 +109,7 @@ void annotate(struct brw_context *brw, struct annotation *ann = annotation-ann[annotation-ann_count++]; ann-offset = offset; - if ((INTEL_DEBUG DEBUG_NO_ANNOTATION) == 0) { + if ((INTEL_DEBUG DEBUG_ANNOTATION) != 0) { if (INTEL_DEBUG DEBUG_ANNOTATION) Doesn't this result in a GCC warning? Perhaps I am missing something. Do you mean because there is no, '{'? It should be fine, I think. It seems like there are some cases where using in an if-condition causes a warning... and it suggests putting parenthesis around it. That seems to be cases like if (x y != 0) foo.c:3:2: warning: suggest parentheses around comparison in operand of ‘’ [-Wparentheses] The thing you suggest doesn't generate that warning, so never mind. :) [snip] ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] r600/sb loop issue
On 12/06/2014 08:01 AM, Matt Turner wrote: On Fri, Dec 5, 2014 at 8:56 PM, Vadim Girlin vadimgir...@gmail.com wrote: On 12/06/2014 07:50 AM, Matt Turner wrote: On Fri, Dec 5, 2014 at 8:13 PM, Vadim Girlin vadimgir...@gmail.com wrote: I suspect we should rather get rid of such loops somehow, i.e. convert to something else, the loop that never repeats is not really a loop anyway. AFAICS continue is not supported in switch statements according to GLSL specs, so the loops generated for switch will never be repeated. Am I missing something? Even if repeating is possible somehow, at least we can get rid of the loops that are not repeated. I don't think that's true. I don't see anything in the spec that would lead me to believe continue cannot occur in a switch statement. I've double-checked some versions of GLSL spec (1.30, 1.50, 3.30, 4.40) and all of them say the same (section 6.4 Jumps): The continue jump is used only in loops. Sure, but isn't the continue below in a loop? do { switch (...) { case ...: continue; } } while (...); Ah, now I see, you're right. I just was mostly thinking about that loop that is created for a switch in IR, not about source, and somehow confused these things. Thanks for pointing that out. Hopefully such cases won't complicate the problem in sb even more, need to check those tests. The grammar is pretty unambiguous. jump_statement: CONTINUE SEMICOLON BREAK SEMICOLON RETURN SEMICOLON RETURN expression SEMICOLON DISCARD SEMICOLON // Fragment shader only. If continue can't be in a switch, neither can break. :) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Replace 'noann' debug flag with 'ann'.
On Fri, Dec 5, 2014 at 5:23 PM, Ben Widawsky b...@bwidawsk.net wrote: On Fri, Dec 05, 2014 at 05:08:40PM -0800, Matt Turner wrote: diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c b/src/mesa/drivers/dri/i965/intel_asm_annotation.c index 37ad090..ac12655 100644 --- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c +++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c @@ -109,7 +109,7 @@ void annotate(struct brw_context *brw, struct annotation *ann = annotation-ann[annotation-ann_count++]; ann-offset = offset; - if ((INTEL_DEBUG DEBUG_NO_ANNOTATION) == 0) { + if ((INTEL_DEBUG DEBUG_ANNOTATION) != 0) { if (INTEL_DEBUG DEBUG_ANNOTATION) I really don't like the implicit int - bool conversion (and I hate the explicit conversion with !! even more). ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 86944] glsl_parser_extras.cpp, line 1455: Error: Badly formed expression.
https://bugs.freedesktop.org/show_bug.cgi?id=86944 --- Comment #3 from Vinson Lee v...@freedesktop.org --- (In reply to Matt Turner from comment #2) Oh, I bet there's something wrong with the macro. I'd try removing the typeof(*v) cast in src/util/u_atomic.h around line 173. If that fixes it, we should remove those casts from p_atomic_inc_return and p_atomic_dec_return as well. I removed the typeof(*v) cast in u_atomic.h:173. The build gets further and hits a different build error. diff --git a/src/util/u_atomic.h b/src/util/u_atomic.h index 56c5740..afe1b90 100644 --- a/src/util/u_atomic.h +++ b/src/util/u_atomic.h @@ -170,7 +170,7 @@ sizeof(*v) == sizeof(uint64_t) ? atomic_dec_64_nv((uint64_t *)(v)) : \ (assert(!should not get here), 0)) -#define p_atomic_cmpxchg(v, old, _new) ((typeof(*v)) \ +#define p_atomic_cmpxchg(v, old, _new) ( \ sizeof(*v) == sizeof(uint8_t) ? atomic_cas_8 ((uint8_t *)(v), (uint8_t )(old), (uint8_t )(_new)) : \ sizeof(*v) == sizeof(uint16_t) ? atomic_cas_16((uint16_t *)(v), (uint16_t)(old), (uint16_t)(_new)) : \ sizeof(*v) == sizeof(uint32_t) ? atomic_cas_32((uint32_t *)(v), (uint32_t)(old), (uint32_t)(_new)) : \ ../../src/gallium/include/pipe/p_compiler.h, line 73: warning: typedef redeclared: uint ../../src/gallium/include/pipe/p_compiler.h, line 75: warning: typedef redeclared: ushort ../../src/gallium/auxiliary/util/u_inlines.h, line 83: operands have incompatible types: void : int -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev