[Mesa-dev] [PATCH] glsl: enable early_fragment_tests implicitly with post_depth_coverage
From: Iago Toral Quiroga From ARB_post_depth_coverage: "This extension allows the fragment shader to control whether values in gl_SampleMaskIn[] reflect the coverage after application of the early depth and stencil tests. This feature can be enabled with the following layout qualifier in the fragment shader: layout(post_depth_coverage) in; Use of this feature implicitly enables early fragment tests." And a bit later it also adds: "early_fragment_tests" requests that fragment tests be performed before fragment shader execution, as described in section 15.2.4 "Early Fragment Tests" of the OpenGL Specification. If neither this nor post_depth_coverage are declared, per-fragment tests will be performed after fragment shader execution." Fixes: GL45-CTS.post_depth_coverage_tests.PostDepthSampleMask --- src/compiler/glsl/linker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index b6f8bc4..7343e4e 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1881,7 +1881,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, } linked_shader->Program->info.fs.early_fragment_tests |= - shader->EarlyFragmentTests; + shader->EarlyFragmentTests || shader->PostDepthCoverage; linked_shader->Program->info.fs.inner_coverage |= shader->InnerCoverage; linked_shader->Program->info.fs.post_depth_coverage |= shader->PostDepthCoverage; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] vl: u_upload_alloc might fail to allocate buffer in bicubic filter
Signed-off-by: Nayan Deshmukh --- src/gallium/auxiliary/vl/vl_bicubic_filter.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c b/src/gallium/auxiliary/vl/vl_bicubic_filter.c index 570f153..275dd2a 100644 --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c @@ -416,14 +416,16 @@ vl_bicubic_filter_render(struct vl_bicubic_filter *filter, viewport.scale[2] = 1; struct pipe_constant_buffer cb = {}; - float *ptr; + float *ptr = NULL; u_upload_alloc(filter->pipe->const_uploader, 0, 2 * sizeof(float), 256, &cb.buffer_offset, &cb.buffer, (void**)&ptr); cb.buffer_size = 2 * sizeof(float); - ptr[0] = 0.5f/viewport.scale[0]; - ptr[1] = 0.5f/viewport.scale[1]; + if (ptr) { + ptr[0] = 0.5f/viewport.scale[0]; + ptr[1] = 0.5f/viewport.scale[1]; + } u_upload_unmap(filter->pipe->const_uploader); memset(&fb_state, 0, sizeof(fb_state)); -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] radv: fetch sample index via fmask for image coord as well.
On Wed, Feb 22, 2017 at 5:31 AM, Dave Airlie wrote: > From: Dave Airlie > > This follows the txf_ms code, I can't figure out why amdgpu-pro > doesn't do this in their shaders, they must know someone we don't. > > This fixes: > dEQP-VK.pipeline.multisample_shader_builtin.sample_id.* > > Signed-off-by: Dave Airlie > --- > src/amd/common/ac_nir_to_llvm.c | 180 > > 1 file changed, 126 insertions(+), 54 deletions(-) > > diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c > index d02531b..1e6c979 100644 > --- a/src/amd/common/ac_nir_to_llvm.c > +++ b/src/amd/common/ac_nir_to_llvm.c > @@ -2367,60 +2367,6 @@ static int image_type_to_components_count(enum > glsl_sampler_dim dim, bool array) > return 0; > } > > -static LLVMValueRef get_image_coords(struct nir_to_llvm_context *ctx, > -nir_intrinsic_instr *instr) > -{ > - const struct glsl_type *type = instr->variables[0]->var->type; > - if(instr->variables[0]->deref.child) > - type = instr->variables[0]->deref.child->type; > - > - LLVMValueRef src0 = get_src(ctx, instr->src[0]); > - LLVMValueRef coords[4]; > - LLVMValueRef masks[] = { > - LLVMConstInt(ctx->i32, 0, false), LLVMConstInt(ctx->i32, 1, > false), > - LLVMConstInt(ctx->i32, 2, false), LLVMConstInt(ctx->i32, 3, > false), > - }; > - LLVMValueRef res; > - int count; > - enum glsl_sampler_dim dim = glsl_get_sampler_dim(type); > - bool add_frag_pos = (dim == GLSL_SAMPLER_DIM_SUBPASS || > -dim == GLSL_SAMPLER_DIM_SUBPASS_MS); > - bool is_ms = (dim == GLSL_SAMPLER_DIM_MS || > - dim == GLSL_SAMPLER_DIM_SUBPASS_MS); > - > - count = image_type_to_components_count(dim, > - > glsl_sampler_type_is_array(type)); > - > - if (count == 1) { > - if (instr->src[0].ssa->num_components) > - res = LLVMBuildExtractElement(ctx->builder, src0, > masks[0], ""); > - else > - res = src0; > - } else { > - int chan; > - if (is_ms) > - count--; > - for (chan = 0; chan < count; ++chan) { > - coords[chan] = LLVMBuildExtractElement(ctx->builder, > src0, masks[chan], ""); > - } > - > - if (add_frag_pos) { > - for (chan = 0; chan < count; ++chan) > - coords[chan] = LLVMBuildAdd(ctx->builder, > coords[chan], LLVMBuildFPToUI(ctx->builder, ctx->frag_pos[chan], ctx->i32, > ""), ""); > - } > - if (is_ms) { > - coords[count] = llvm_extract_elem(ctx, get_src(ctx, > instr->src[1]), 0); > - count++; > - } > - > - if (count == 3) { > - coords[3] = LLVMGetUndef(ctx->i32); > - count = 4; > - } > - res = ac_build_gather_values(&ctx->ac, coords, count); > - } > - return res; > -} > > static void build_type_name_for_intr( > LLVMTypeRef type, > @@ -2483,6 +2429,132 @@ static void get_image_intr_name(const char *base_name, > } > } > > +static LLVMValueRef get_image_coords(struct nir_to_llvm_context *ctx, > +nir_intrinsic_instr *instr) > +{ > + const struct glsl_type *type = instr->variables[0]->var->type; > + if(instr->variables[0]->deref.child) > + type = instr->variables[0]->deref.child->type; > + > + LLVMValueRef src0 = get_src(ctx, instr->src[0]); > + LLVMValueRef coords[4]; > + LLVMValueRef masks[] = { > + LLVMConstInt(ctx->i32, 0, false), LLVMConstInt(ctx->i32, 1, > false), > + LLVMConstInt(ctx->i32, 2, false), LLVMConstInt(ctx->i32, 3, > false), > + }; > + LLVMValueRef res; > + LLVMValueRef sample_index = llvm_extract_elem(ctx, get_src(ctx, > instr->src[1]), 0); > + > + int count; > + enum glsl_sampler_dim dim = glsl_get_sampler_dim(type); > + bool add_frag_pos = (dim == GLSL_SAMPLER_DIM_SUBPASS || > +dim == GLSL_SAMPLER_DIM_SUBPASS_MS); > + bool is_ms = (dim == GLSL_SAMPLER_DIM_MS || > + dim == GLSL_SAMPLER_DIM_SUBPASS_MS); > + > + count = image_type_to_components_count(dim, > + > glsl_sampler_type_is_array(type)); > + > + if (is_ms) { > + LLVMValueRef fmask_load_address[4]; > + LLVMValueRef params[7]; > + LLVMValueRef glc = LLVMConstInt(ctx->i1, 0, false); > + LLVMValueRef slc = LLVMConstInt(ctx->i1, 0, false); > + LLVMValueRef da = ctx->i32zero; > +
Re: [Mesa-dev] [PATCH 0/8] gallium: A number of video code fixes
Am 21.02.2017 um 21:52 schrieb Thomas Hellstrom: A couple of fixes / improvements for things I've encountered while looking through and testing the video code in preparation for a virtual hardware video driver. Reviewed-by: Christian König for the whole set. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/8] gallium: A number of video code fixes
On 02/22/2017 09:56 AM, Christian König wrote: > Am 21.02.2017 um 21:52 schrieb Thomas Hellstrom: >> A couple of fixes / improvements for things I've encountered while >> looking >> through and testing the video code in preparation for a virtual >> hardware video >> driver. > > Reviewed-by: Christian König for the whole > set. Thanks for the review, Christian. /Thomas > >> >> ___ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=DwIDaQ&c=uilaK90D4TOVoH58JNXRgQ&r=wnSlgOCqfpNS4d02vP68_E9q2BNMCwfD2OZ_6dCFVQQ&m=9Bp0jormPCx4wB_f8c8lmZnYcCTy9PWS69Zsk78KQ80&s=mVPwf5JzzaZ1PEE6SE-4pcDZe0FZgXEq42dcklzYpW4&e= > > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/4] gallium/hud: prevent an infinite loop
On 21.02.2017 22:09, Marek Olšák wrote: From: Marek Olšák v2: use UINT64_MAX / 11 Reviewed-by: Nicolai Hähnle --- src/gallium/auxiliary/hud/hud_context.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index aaa52d5..c44f8c0 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -724,23 +724,24 @@ hud_pane_set_max_value(struct hud_pane *pane, uint64_t value) uint64_t exp10; int i; /* The following code determines the max_value in the graph as well as * how many describing lines are drawn. The max_value is rounded up, * so that all drawn numbers are rounded for readability. * We want to print multiples of a simple number instead of multiples of * hard-to-read numbers like 1.753. */ - /* Find the left-most digit. */ + /* Find the left-most digit. Make sure exp10 * 10 and fixup_bytes doesn't +* overflow. (11 is safe) */ exp10 = 1; - for (i = 0; value > 9 * exp10; i++) { + for (i = 0; exp10 <= UINT64_MAX / 11 && exp10 * 9 < value; i++) { exp10 *= 10; fixup_bytes(pane->type, i + 1, &exp10); } leftmost_digit = DIV_ROUND_UP(value, exp10); /* Round 9 to 10. */ if (leftmost_digit == 9) { leftmost_digit = 1; exp10 *= 10; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/4] gallium/u_queue: fix random crashes when the app calls exit()
Reviewed-by: Nicolai Hähnle On 21.02.2017 22:05, Marek Olšák wrote: From: Marek Olšák This fixes: vdpauinfo: ../lib/CodeGen/TargetPassConfig.cpp:579: virtual void llvm::TargetPassConfig::addMachinePasses(): Assertion `TPI && IPI && "Pass ID not registered!"' failed. v2: use list_head, switch the call order in destroy Cc: 13.0 17.0 --- src/gallium/auxiliary/util/u_queue.c | 76 +++- src/gallium/auxiliary/util/u_queue.h | 4 ++ 2 files changed, 78 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_queue.c b/src/gallium/auxiliary/util/u_queue.c index 4da5d8e..52cfc0a 100644 --- a/src/gallium/auxiliary/util/u_queue.c +++ b/src/gallium/auxiliary/util/u_queue.c @@ -22,20 +22,82 @@ * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. */ #include "u_queue.h" #include "u_memory.h" #include "u_string.h" #include "os/os_time.h" +static void util_queue_killall_and_wait(struct util_queue *queue); + +/ + * Wait for all queues to assert idle when exit() is called. + * + * Otherwise, C++ static variable destructors can be called while threads + * are using the static variables. + */ + +static once_flag atexit_once_flag = ONCE_FLAG_INIT; +static struct list_head queue_list; +pipe_static_mutex(exit_mutex); + +static void +atexit_handler(void) +{ + struct util_queue *iter; + + pipe_mutex_lock(exit_mutex); + /* Wait for all queues to assert idle. */ + LIST_FOR_EACH_ENTRY(iter, &queue_list, head) { + util_queue_killall_and_wait(iter); + } + pipe_mutex_unlock(exit_mutex); +} + +static void +global_init(void) +{ + LIST_INITHEAD(&queue_list); + atexit(atexit_handler); +} + +static void +add_to_atexit_list(struct util_queue *queue) +{ + call_once(&atexit_once_flag, global_init); + + pipe_mutex_lock(exit_mutex); + LIST_ADD(&queue->head, &queue_list); + pipe_mutex_unlock(exit_mutex); +} + +static void +remove_from_atexit_list(struct util_queue *queue) +{ + struct util_queue *iter, *tmp; + + pipe_mutex_lock(exit_mutex); + LIST_FOR_EACH_ENTRY_SAFE(iter, tmp, &queue_list, head) { + if (iter == queue) { + LIST_DEL(&iter->head); + break; + } + } + pipe_mutex_unlock(exit_mutex); +} + +/ + * util_queue implementation + */ + static void util_queue_fence_signal(struct util_queue_fence *fence) { pipe_mutex_lock(fence->mutex); fence->signalled = true; pipe_condvar_broadcast(fence->cond); pipe_mutex_unlock(fence->mutex); } void @@ -97,20 +159,21 @@ static PIPE_THREAD_ROUTINE(util_queue_thread_func, input) } /* signal remaining jobs before terminating */ pipe_mutex_lock(queue->lock); while (queue->jobs[queue->read_idx].job) { util_queue_fence_signal(queue->jobs[queue->read_idx].fence); queue->jobs[queue->read_idx].job = NULL; queue->read_idx = (queue->read_idx + 1) % queue->max_jobs; } + queue->num_queued = 0; /* reset this when exiting the thread */ pipe_mutex_unlock(queue->lock); return 0; } bool util_queue_init(struct util_queue *queue, const char *name, unsigned max_jobs, unsigned num_threads) { @@ -150,49 +213,58 @@ util_queue_init(struct util_queue *queue, if (i == 0) { /* no threads created, fail */ goto fail; } else { /* at least one thread created, so use it */ queue->num_threads = i+1; break; } } } + + add_to_atexit_list(queue); return true; fail: FREE(queue->threads); if (queue->jobs) { pipe_condvar_destroy(queue->has_space_cond); pipe_condvar_destroy(queue->has_queued_cond); pipe_mutex_destroy(queue->lock); FREE(queue->jobs); } /* also util_queue_is_initialized can be used to check for success */ memset(queue, 0, sizeof(*queue)); return false; } -void -util_queue_destroy(struct util_queue *queue) +static void +util_queue_killall_and_wait(struct util_queue *queue) { unsigned i; /* Signal all threads to terminate. */ pipe_mutex_lock(queue->lock); queue->kill_threads = 1; pipe_condvar_broadcast(queue->has_queued_cond); pipe_mutex_unlock(queue->lock); for (i = 0; i < queue->num_threads; i++) pipe_thread_wait(queue->threads[i]); +} + +void +util_queue_destroy(struct util_queue *queue) +{ + util_queue_killall_and_wait(queue); + remove_from_atexit_list(queue); pipe_condvar_destroy(queue->has_space_cond); pipe_condvar_destroy(queue->has_queued_cond); pipe_mutex_destroy(queue->lock); FREE(queue->jobs); FREE(queue->threads); } void util_queue_fence_init(struct util_queue_
Re: [Mesa-dev] [PATCH 1/8] util/disk_cache: fix bug with deleting old cache dirs
On Wed, Feb 22, 2017 at 5:45 AM, Timothy Arceri wrote: > If there was more than a single directory in the .cache/mesa dir > then it would only remove one (or none) of the directories. > > Apparently Valgrind was also reporting: > Conditional jump or move depends on uninitialised value uninitialised -> uninitialized Could you also fix the other problems along the way, like checking stat() return, freeing full_path and adding missing closedir(dir)? Gražvydas > --- > src/util/disk_cache.c | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c > index 2f138da..b172b8b 100644 > --- a/src/util/disk_cache.c > +++ b/src/util/disk_cache.c > @@ -152,14 +152,15 @@ remove_old_cache_directories(void *mem_ctx, char *path, > const char *timestamp) > struct dirent* d_entry; > while((d_entry = readdir(dir)) != NULL) > { > + char *full_path = > + ralloc_asprintf(mem_ctx, "%s/%s", path, d_entry->d_name); > + >struct stat sb; > - stat(d_entry->d_name, &sb); > + stat(full_path, &sb); >if (S_ISDIR(sb.st_mode) && >strcmp(d_entry->d_name, timestamp) != 0 && >strcmp(d_entry->d_name, "..") != 0 && >strcmp(d_entry->d_name, ".") != 0) { > - char *full_path = > -ralloc_asprintf(mem_ctx, "%s/%s", path, d_entry->d_name); > nftw(full_path, remove_dir, 20, FTW_DEPTH); >} > } > -- > 2.9.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 5/8] gallium: add get_disk_shader_cache() callback
On 22.02.2017 07:23, Michel Dänzer wrote: On 22/02/17 12:45 PM, Timothy Arceri wrote: +get_disk_shader_cache +^ + +Returns a pointer to driver-specific on-disk shader cache. If the driver +failed to create the cache or does not support an on-disk shader cache NULL is +returned. [...] + /** +* Returns a pointer to driver-specific on-disk shader cache. If the driver +* failed to create the cache or does not support an on-disk shader cache +* NULL is returned. +*/ + struct disk_cache *(*get_disk_shader_cache)(struct pipe_screen *screen); }; Drivers which don't support an on-disk shader cache don't set this callback in the first place, right? :) (Just a suggestion for improvement before landing this patch, not a blocker, no need to resend) Yeah, but creating the shader cache might have failed, or it might be disabled. Perhaps a driver that doesn't do its own caching might want to initialize the cache lazily. I think the interface is more flexible this way. Nicolai ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/8] st/mesa: implement a tgsi on-disk shader cache
On 22.02.2017 04:45, Timothy Arceri wrote: Implements a tgsi cache for the OpenGL state tracker. V2: add support for compute shaders --- src/mesa/Makefile.sources | 2 + src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 + src/mesa/state_tracker/st_program.c| 27 +- src/mesa/state_tracker/st_shader_cache.c | 406 + src/mesa/state_tracker/st_shader_cache.h | 46 5 files changed, 481 insertions(+), 6 deletions(-) create mode 100644 src/mesa/state_tracker/st_shader_cache.c create mode 100644 src/mesa/state_tracker/st_shader_cache.h diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index ee737b0..9262967 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -514,6 +514,8 @@ STATETRACKER_FILES = \ state_tracker/st_sampler_view.h \ state_tracker/st_scissor.c \ state_tracker/st_scissor.h \ + state_tracker/st_shader_cache.c \ + state_tracker/st_shader_cache.h \ state_tracker/st_texture.c \ state_tracker/st_texture.h \ state_tracker/st_tgsi_lower_yuv.c \ diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 476d185..d43d821 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -54,6 +54,7 @@ #include "st_format.h" #include "st_glsl_types.h" #include "st_nir.h" +#include "st_shader_cache.h" #include @@ -6870,6 +6871,11 @@ extern "C" { GLboolean st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) { + /* Return early if we are loading the shader from on-disk cache */ + if (st_load_tgsi_from_disk_cache(ctx, prog)) { + return GL_TRUE; + } + struct pipe_screen *pscreen = ctx->st->pipe->screen; assert(prog->data->LinkStatus); diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 3795f25..4d9250b 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -58,6 +58,7 @@ #include "st_mesa_to_tgsi.h" #include "st_atifs_to_tgsi.h" #include "st_nir.h" +#include "st_shader_cache.h" #include "cso_cache/cso_context.h" @@ -364,7 +365,6 @@ st_release_cp_variants(struct st_context *st, struct st_compute_program *stcp) } } - /** * Translate a vertex program. */ @@ -583,7 +583,6 @@ st_translate_vertex_program(struct st_context *st, &stvp->tgsi.stream_output); free_glsl_to_tgsi_visitor(stvp->glsl_to_tgsi); - stvp->glsl_to_tgsi = NULL; } else error = st_translate_mesa_program(st->ctx, PIPE_SHADER_VERTEX, @@ -608,8 +607,15 @@ st_translate_vertex_program(struct st_context *st, return false; } - stvp->tgsi.tokens = ureg_get_tokens(ureg, NULL); + unsigned num_tokens; + stvp->tgsi.tokens = ureg_get_tokens(ureg, &num_tokens); ureg_destroy(ureg); + + if (stvp->glsl_to_tgsi) { + stvp->glsl_to_tgsi = NULL; + st_store_tgsi_in_disk_cache(st, &stvp->Base, NULL, num_tokens); + } + return stvp->tgsi.tokens != NULL; } @@ -1031,7 +1037,6 @@ st_translate_fragment_program(struct st_context *st, fs_output_semantic_index); free_glsl_to_tgsi_visitor(stfp->glsl_to_tgsi); - stfp->glsl_to_tgsi = NULL; } else if (stfp->ati_fs) st_translate_atifs_program(ureg, stfp->ati_fs, @@ -1064,8 +1069,15 @@ st_translate_fragment_program(struct st_context *st, fs_output_semantic_name, fs_output_semantic_index); - stfp->tgsi.tokens = ureg_get_tokens(ureg, NULL); + unsigned num_tokens; + stfp->tgsi.tokens = ureg_get_tokens(ureg, &num_tokens); ureg_destroy(ureg); + + if (stfp->glsl_to_tgsi) { + stfp->glsl_to_tgsi = NULL; + st_store_tgsi_in_disk_cache(st, &stfp->Base, NULL, num_tokens); + } + return stfp->tgsi.tokens != NULL; } @@ -1600,13 +1612,16 @@ st_translate_program_common(struct st_context *st, output_semantic_name, output_semantic_index); - out_state->tokens = ureg_get_tokens(ureg, NULL); + unsigned num_tokens; + out_state->tokens = ureg_get_tokens(ureg, &num_tokens); ureg_destroy(ureg); st_translate_stream_output_info(glsl_to_tgsi, outputMapping, &out_state->stream_output); + st_store_tgsi_in_disk_cache(st, prog, out_state, num_tokens); + if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) { _mesa_print_program(prog); debug_printf("\n"); diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c new file mode 100644 index 000..84ad94e --- /dev/null +++ b/src/mesa/state_tracker/st_shader_cache.c @@ -0,0 +1,406 @@ +/* + * Copyright © 20
Re: [Mesa-dev] [PATCH 6/8] ddebug/rbug/trace: add get_disk_shader_cache() to pass-throughs
On 22.02.2017 04:45, Timothy Arceri wrote: --- src/gallium/drivers/ddebug/dd_screen.c | 9 + src/gallium/drivers/rbug/rbug_screen.c | 9 + src/gallium/drivers/trace/tr_screen.c | 21 + 3 files changed, 39 insertions(+) diff --git a/src/gallium/drivers/ddebug/dd_screen.c b/src/gallium/drivers/ddebug/dd_screen.c index 58e496a..996ff85 100644 --- a/src/gallium/drivers/ddebug/dd_screen.c +++ b/src/gallium/drivers/ddebug/dd_screen.c @@ -55,6 +55,14 @@ dd_screen_get_device_vendor(struct pipe_screen *_screen) return screen->get_device_vendor(screen); } +static struct disk_cache * +dd_screen_get_disk_shader_cache(struct pipe_screen *_screen) +{ + struct pipe_screen *screen = dd_screen(_screen)->screen; + + return screen->get_disk_shader_cache(screen); +} + static int dd_screen_get_param(struct pipe_screen *_screen, enum pipe_cap param) @@ -378,6 +386,7 @@ ddebug_screen_create(struct pipe_screen *screen) dscreen->base.get_name = dd_screen_get_name; dscreen->base.get_vendor = dd_screen_get_vendor; dscreen->base.get_device_vendor = dd_screen_get_device_vendor; + dscreen->base.get_disk_shader_cache = dd_screen_get_disk_shader_cache; This should use SCR_INIT since the function pointer might be NULL. The same applies to rbug and trace. Cheers, Nicolai dscreen->base.get_param = dd_screen_get_param; dscreen->base.get_paramf = dd_screen_get_paramf; dscreen->base.get_compute_param = dd_screen_get_compute_param; diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c index 8fbbe73..0ea5139 100644 --- a/src/gallium/drivers/rbug/rbug_screen.c +++ b/src/gallium/drivers/rbug/rbug_screen.c @@ -77,6 +77,14 @@ rbug_screen_get_device_vendor(struct pipe_screen *_screen) return screen->get_device_vendor(screen); } +static struct disk_cache * +rbug_screen_get_disk_shader_cache(struct pipe_screen *_screen) +{ + struct pipe_screen *screen = rbug_screen(_screen)->screen; + + return screen->get_disk_shader_cache(screen); +} + static int rbug_screen_get_param(struct pipe_screen *_screen, enum pipe_cap param) @@ -283,6 +291,7 @@ rbug_screen_create(struct pipe_screen *screen) rb_screen->base.destroy = rbug_screen_destroy; rb_screen->base.get_name = rbug_screen_get_name; rb_screen->base.get_vendor = rbug_screen_get_vendor; + rb_screen->base.get_disk_shader_cache = rbug_screen_get_disk_shader_cache; rb_screen->base.get_device_vendor = rbug_screen_get_device_vendor; rb_screen->base.get_param = rbug_screen_get_param; rb_screen->base.get_shader_param = rbug_screen_get_shader_param; diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index aaf2e26..4256855 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -103,6 +103,26 @@ trace_screen_get_device_vendor(struct pipe_screen *_screen) } +static struct disk_cache * +trace_screen_get_disk_shader_cache(struct pipe_screen *_screen) +{ + struct trace_screen *tr_scr = trace_screen(_screen); + struct pipe_screen *screen = tr_scr->screen; + + trace_dump_call_begin("pipe_screen", "get_disk_shader_cache"); + + trace_dump_arg(ptr, screen); + + struct disk_cache *result = screen->get_disk_shader_cache(screen); + + trace_dump_ret(ptr, result); + + trace_dump_call_end(); + + return result; +} + + static int trace_screen_get_param(struct pipe_screen *_screen, enum pipe_cap param) @@ -525,6 +545,7 @@ trace_screen_create(struct pipe_screen *screen) tr_scr->base.get_name = trace_screen_get_name; tr_scr->base.get_vendor = trace_screen_get_vendor; tr_scr->base.get_device_vendor = trace_screen_get_device_vendor; + tr_scr->base.get_disk_shader_cache = trace_screen_get_disk_shader_cache; tr_scr->base.get_param = trace_screen_get_param; tr_scr->base.get_shader_param = trace_screen_get_shader_param; tr_scr->base.get_paramf = trace_screen_get_paramf; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] r600/radeonsi: enable glsl/tgsi on-disk cache
On 22.02.2017 04:45, Timothy Arceri wrote: For gpu generations that use LLVM we create a timestamp string containing both the LLVM and Mesa build times, otherwise we just use the Mesa build time. Reviewed-by: Marek Olšák Reviewed-by: Edward O'Callaghan --- src/gallium/drivers/radeon/r600_pipe_common.c | 43 +++ src/gallium/drivers/radeon/r600_pipe_common.h | 3 ++ 2 files changed, 46 insertions(+) diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 1781584..bae6d6f 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -43,6 +43,10 @@ #define HAVE_LLVM 0 #endif +#if HAVE_LLVM +#include +#endif + #ifndef MESA_LLVM_VERSION_PATCH #define MESA_LLVM_VERSION_PATCH 0 #endif @@ -779,6 +783,41 @@ static const char* r600_get_chip_name(struct r600_common_screen *rscreen) } } +static void r600_disk_cache_create(struct r600_common_screen *rscreen) +{ + uint32_t mesa_timestamp; + if (disk_cache_get_function_timestamp(r600_disk_cache_create, + &mesa_timestamp)) { + char *timestamp_str; + int res = -1; + if (rscreen->chip_class < SI) { + res = asprintf(×tamp_str, "%u",mesa_timestamp); Missing space after , Cheers, Nicolai + } +#if HAVE_LLVM + else { + uint32_t llvm_timestamp; + if (disk_cache_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, + &llvm_timestamp)) { + res = asprintf(×tamp_str, "%u_%u", + mesa_timestamp, llvm_timestamp); + } + } +#endif + if (res != -1) { + rscreen->disk_shader_cache = + disk_cache_create(r600_get_chip_name(rscreen), + timestamp_str); + free(timestamp_str); + } + } +} + +static struct disk_cache *r600_get_disk_shader_cache(struct pipe_screen *pscreen) +{ + struct r600_common_screen *rscreen = (struct r600_common_screen*)pscreen; + return rscreen->disk_shader_cache; +} + static const char* r600_get_name(struct pipe_screen* pscreen) { struct r600_common_screen *rscreen = (struct r600_common_screen*)pscreen; @@ -1234,6 +1273,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, rscreen->b.get_name = r600_get_name; rscreen->b.get_vendor = r600_get_vendor; rscreen->b.get_device_vendor = r600_get_device_vendor; + rscreen->b.get_disk_shader_cache = r600_get_disk_shader_cache; rscreen->b.get_compute_param = r600_get_compute_param; rscreen->b.get_paramf = r600_get_paramf; rscreen->b.get_timestamp = r600_get_timestamp; @@ -1259,6 +1299,8 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, rscreen->chip_class = rscreen->info.chip_class; rscreen->debug_flags = debug_get_flags_option("R600_DEBUG", common_debug_options, 0); + r600_disk_cache_create(rscreen); + slab_create_parent(&rscreen->pool_transfers, sizeof(struct r600_transfer), 64); rscreen->force_aniso = MIN2(16, debug_get_num_option("R600_TEX_ANISO", -1)); @@ -1324,6 +1366,7 @@ void r600_destroy_common_screen(struct r600_common_screen *rscreen) slab_destroy_parent(&rscreen->pool_transfers); + disk_cache_destroy(rscreen->disk_shader_cache); rscreen->ws->destroy(rscreen->ws); FREE(rscreen); } diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index a977dc1..94cf0fc 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -36,6 +36,7 @@ #include "radeon/radeon_winsys.h" +#include "util/disk_cache.h" #include "util/u_blitter.h" #include "util/list.h" #include "util/u_range.h" @@ -405,6 +406,8 @@ struct r600_common_screen { boolhas_cp_dma; boolhas_streamout; + struct disk_cache *disk_shader_cache; + struct slab_parent_pool pool_transfers; /* Texture filter settings. */ ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] V4 TGSI on-disk shader cache
On 22.02.2017 04:45, Timothy Arceri wrote: Changes in V4: - split tgsi cache code into its own file - add missing fallback for tgsi cache miss - share the sha1 generated by the load function with the store function like in the glsl ir cache. - add get_disk_shader_cache() to the pass-throughs - add get_disk_shader_cache() description to screen.rst - bug fis for old cache dir deletion Thanks a lot for cleaning up the st/mesa code! I have minor comments (mostly nitpicks, really) on patches 4, 6, and 8. With my remarks fixed, patches 2-8 are Reviewed-by: Nicolai Hähnle ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa v2] glx: add GLXdispatchIndex sort check
Signed-off-by: Eric Engestrom --- v2: make sure the list is in the order C's strcmp uses (Ilia) Ilia: I used LC_ALL instead of LANG, as it takes precedence (ie. LANG=C in this script would be overridden by LC_ALL=en_US in the environment). --- src/glx/tests/Makefile.am | 2 +- src/glx/tests/dispatch-index-check | 24 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 src/glx/tests/dispatch-index-check diff --git a/src/glx/tests/Makefile.am b/src/glx/tests/Makefile.am index bdc78c0d5a..8874c20b01 100644 --- a/src/glx/tests/Makefile.am +++ b/src/glx/tests/Makefile.am @@ -12,7 +12,7 @@ AM_CPPFLAGS = \ $(LIBDRM_CFLAGS) \ $(X11_INCLUDES) -TESTS = glx-test +TESTS = glx-test dispatch-index-check check_PROGRAMS = glx-test glx_test_SOURCES = \ diff --git a/src/glx/tests/dispatch-index-check b/src/glx/tests/dispatch-index-check new file mode 100755 index 00..78464b8305 --- /dev/null +++ b/src/glx/tests/dispatch-index-check @@ -0,0 +1,24 @@ +#!/bin/sh + +# extract enum definition +dispatch_list=$(sed '/__GLXdispatchIndex/,/__GLXdispatchIndex/!d' \ + "$srcdir"/../g_glxglvnddispatchindices.h) + +# extract values inside of enum +dispatch_list=$(sed '1d;$d' <<< "$dispatch_list") + +# remove indentation +dispatch_list=$(sed 's/^\s\+//' <<< "$dispatch_list") + +# extract function names +dispatch_list=$(sed 's/DI_//;s/,//' <<< "$dispatch_list") + +# same for commented functions, we want to keep them sorted too +dispatch_list=$(sed 's#// ##;s/ implemented by [a-z]\+//' <<< "$dispatch_list") + +# remove LAST_INDEX, as it will not be in alphabetical order +dispatch_list=$(sed '/LAST_INDEX/d' <<< "$dispatch_list") + +sorted=$(LC_ALL=C sort <<< "$dispatch_list") + +test "$dispatch_list" = "$sorted" -- Cheers, Eric ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] isl/state: fix assert on raw buffer surface state minimum size
From IVB PRM, SURFACE_STATE::Height: "For typed buffer and structured buffer surfaces, the number of entries in the buffer ranges from 1 to 2^27 . For raw buffer surfaces, the number of entries in the buffer is the number of bytes which can range from 1 to 2^30." The minimum value is 1, according to the spec. The spec quote was already added into the code by 028f6d8317f00. Fixes crashing tests under: dEQP-VK.robustness.buffer_access.* Signed-off-by: Samuel Iglesias Gonsálvez Cc: ja...@jlekstrand.net --- src/intel/isl/isl_surface_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c index 29ec289a5d..853bb11846 100644 --- a/src/intel/isl/isl_surface_state.c +++ b/src/intel/isl/isl_surface_state.c @@ -671,7 +671,7 @@ isl_genX(buffer_fill_state_s)(void *state, */ if (info->format == ISL_FORMAT_RAW) { assert(num_elements <= (1ull << 30)); - assert((num_elements & 3) == 0); + assert(num_elements > 0); } else { assert(num_elements <= (1ull << 27)); } -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/8] util/disk_cache: fix bug with deleting old cache dirs
On 22/02/17 21:43, Grazvydas Ignotas wrote: On Wed, Feb 22, 2017 at 5:45 AM, Timothy Arceri wrote: If there was more than a single directory in the .cache/mesa dir then it would only remove one (or none) of the directories. Apparently Valgrind was also reporting: Conditional jump or move depends on uninitialised value uninitialised -> uninitialized That is the US spelling, Mesa doesn't enforce US spelling. Could you also fix the other problems along the way, like checking stat() return, freeing full_path and adding missing closedir(dir)? full path is freed when the memory context is freed. Will fix stat and add closedir(). Thanks. Gražvydas --- src/util/disk_cache.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index 2f138da..b172b8b 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -152,14 +152,15 @@ remove_old_cache_directories(void *mem_ctx, char *path, const char *timestamp) struct dirent* d_entry; while((d_entry = readdir(dir)) != NULL) { + char *full_path = + ralloc_asprintf(mem_ctx, "%s/%s", path, d_entry->d_name); + struct stat sb; - stat(d_entry->d_name, &sb); + stat(full_path, &sb); if (S_ISDIR(sb.st_mode) && strcmp(d_entry->d_name, timestamp) != 0 && strcmp(d_entry->d_name, "..") != 0 && strcmp(d_entry->d_name, ".") != 0) { - char *full_path = -ralloc_asprintf(mem_ctx, "%s/%s", path, d_entry->d_name); nftw(full_path, remove_dir, 20, FTW_DEPTH); } } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/3] anv/blorp/i965: pipe control blumping
Hi, While looking at blorp, I noticed we weren't looking at blorp's pipe controls instructions in the i965 driver. As far as I can tell this isn't a problem with regards to workarounds at the moment, but it feels like we should have them centralized just in case something changes. We can also centralize pipe controls in anv and implement one of the workaround we need on IVB/BYT. Cheers, Lionel Landwerlin (3): anv/blorp/i965: blump blorp's pipe controls back into the embedding driver anv: centralize PIPE_CONTROLs anv: implement WaCsStallAtEveryFourthPipecontrol for gen7 src/intel/blorp/blorp_genX_exec.h | 18 -- src/intel/vulkan/anv_batch_chain.c | 5 +++ src/intel/vulkan/anv_genX.h | 26 +++ src/intel/vulkan/anv_pipeline.c | 2 ++ src/intel/vulkan/anv_private.h | 12 +++ src/intel/vulkan/genX_blorp_exec.c | 10 ++ src/intel/vulkan/genX_cmd_buffer.c | 52 + src/intel/vulkan/genX_pipeline.c| 2 +- src/intel/vulkan/genX_query.c | 10 +++--- src/mesa/drivers/dri/i965/genX_blorp_exec.c | 19 +++ 10 files changed, 135 insertions(+), 21 deletions(-) -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] anv/blorp/i965: blump blorp's pipe controls back into the embedding driver
At the moment, we don't seem to miss any workaround from having blorp's pipe controls not tracked by the embedding driver, but this should make things more robust if something new comes up. Signed-off-by: Lionel Landwerlin --- src/intel/blorp/blorp_genX_exec.h | 18 -- src/intel/vulkan/genX_blorp_exec.c | 10 ++ src/mesa/drivers/dri/i965/genX_blorp_exec.c | 19 +++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h index f0c4f38578..a1f796b6e6 100644 --- a/src/intel/blorp/blorp_genX_exec.h +++ b/src/intel/blorp/blorp_genX_exec.h @@ -120,6 +120,20 @@ _blorp_combine_address(struct blorp_batch *batch, void *location, _dw + 1; /* Array starts at dw[1] */ \ }) +#define blorp_emit_pipe_control(batch, name)\ + for ( struct GENX(PIPE_CONTROL) name = \ +{ GENX(PIPE_CONTROL_header) }, \ +*__continue = &name;\ + __continue != NULL;\ + ({ genX(blorp_emit_pipe_control(batch, &name));\ +__continue = NULL; \ + })) + +#if GEN_GEN >= 8 +static void genX(blorp_emit_pipe_control)(struct blorp_batch *batch, + const struct GENX(PIPE_CONTROL) *pc); +#endif + /* 3DSTATE_URB * 3DSTATE_URB_VS * 3DSTATE_URB_HS @@ -1317,7 +1331,7 @@ blorp_emit_gen8_hiz_op(struct blorp_batch *batch, /* PIPE_CONTROL w/ all bits clear except for “Post-Sync Operation” must set * to “Write Immediate Data” enabled. */ - blorp_emit(batch, GENX(PIPE_CONTROL), pc) { + blorp_emit_pipe_control(batch, pc) { pc.PostSyncOperation = WriteImmediateData; } @@ -1325,7 +1339,7 @@ blorp_emit_gen8_hiz_op(struct blorp_batch *batch, /* Perform depth clear specific flushing */ if (params->hiz_op == BLORP_HIZ_OP_DEPTH_CLEAR && params->depth.enabled) { - blorp_emit(batch, GENX(PIPE_CONTROL), pc) { + blorp_emit_pipe_control(batch, pc) { pc.DepthStallEnable = true; pc.DepthCacheFlushEnable = true; } diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c index c1499fbb72..e2ed7e6d1c 100644 --- a/src/intel/vulkan/genX_blorp_exec.c +++ b/src/intel/vulkan/genX_blorp_exec.c @@ -34,6 +34,16 @@ #include "common/gen_sample_positions.h" #include "blorp/blorp_genX_exec.h" +#if GEN_GEN >= 8 +static void +genX(blorp_emit_pipe_control)(struct blorp_batch *batch, + const struct GENX(PIPE_CONTROL) *pc) +{ + void *batch_pc = blorp_emit_dwords(batch, GENX(PIPE_CONTROL_length)); + GENX(PIPE_CONTROL_pack)(batch, batch_pc, pc); +} +#endif + static void * blorp_emit_dwords(struct blorp_batch *batch, unsigned n) { diff --git a/src/mesa/drivers/dri/i965/genX_blorp_exec.c b/src/mesa/drivers/dri/i965/genX_blorp_exec.c index 8e011e98ce..944145aee6 100644 --- a/src/mesa/drivers/dri/i965/genX_blorp_exec.c +++ b/src/mesa/drivers/dri/i965/genX_blorp_exec.c @@ -34,6 +34,25 @@ #include "brw_blorp.h" +#if GEN_GEN >= 8 +static void +genX(blorp_emit_pipe_control)(struct blorp_batch *batch, + const struct GENX(PIPE_CONTROL) *pc) +{ + uint32_t dw[GENX(PIPE_CONTROL_length)]; + + GENX(PIPE_CONTROL_pack)(batch, dw, pc); + + if (pc->ImmediateData || pc->Address.buffer) { + brw_emit_pipe_control_write(batch->driver_batch, dw[1], + pc->Address.buffer, pc->Address.offset, + dw[4], dw[5]); + + } else + brw_emit_pipe_control_flush(batch->driver_batch, dw[1]); +} +#endif + static void * blorp_emit_dwords(struct blorp_batch *batch, unsigned n) { -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] anv: centralize PIPE_CONTROLs
This allows us to monitor pipe controls and apply workarounds in a single location if needed. Signed-off-by: Lionel Landwerlin --- src/intel/vulkan/anv_genX.h| 26 ++ src/intel/vulkan/anv_private.h | 8 src/intel/vulkan/genX_blorp_exec.c | 4 ++-- src/intel/vulkan/genX_cmd_buffer.c | 35 ++- src/intel/vulkan/genX_pipeline.c | 2 +- src/intel/vulkan/genX_query.c | 10 +- 6 files changed, 64 insertions(+), 21 deletions(-) diff --git a/src/intel/vulkan/anv_genX.h b/src/intel/vulkan/anv_genX.h index 67147b0e92..2e7303405c 100644 --- a/src/intel/vulkan/anv_genX.h +++ b/src/intel/vulkan/anv_genX.h @@ -36,6 +36,27 @@ #error This file is included by means other than anv_private.h #endif +struct GENX(PIPE_CONTROL); + +#define anv_cmd_buffer_pipe_control(cmd_buffer, name) \ + for ( struct GENX(PIPE_CONTROL) name = \ +{ GENX(PIPE_CONTROL_header) }, \ +*__continue = &name;\ + __continue != NULL;\ + ({ genX(emit_pipe_control((cmd_buffer)->device,\ + &(cmd_buffer)->batch, &name)); \ +__continue = NULL; \ + })) + +#define anv_batch_pipe_control(device, batch, name) \ + for ( struct GENX(PIPE_CONTROL) name = \ +{ GENX(PIPE_CONTROL_header) }, \ +*__continue = &name;\ + __continue != NULL;\ + ({ genX(emit_pipe_control(device, batch, &name)); \ +__continue = NULL; \ + })) + VkResult genX(init_device_state)(struct anv_device *device); void genX(cmd_buffer_emit_state_base_address)(struct anv_cmd_buffer *cmd_buffer); @@ -64,6 +85,11 @@ genX(emit_urb_setup)(struct anv_device *device, struct anv_batch *batch, VkShaderStageFlags active_stages, const unsigned entry_size[4]); +void +genX(emit_pipe_control)(struct anv_device *device, +struct anv_batch *batch, +const struct GENX(PIPE_CONTROL) *pc); + void genX(cmd_buffer_gpu_memcpy)(struct anv_cmd_buffer *cmd_buffer, struct anv_bo *dst, uint32_t dst_offset, struct anv_bo *src, uint32_t src_offset, diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 2527c2cc5a..ac121c833e 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1954,17 +1954,25 @@ ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_shader_module, VkShaderModule) # include "anv_genX.h" #else # define genX(x) gen7_##x +# define GENX(x) GEN7_##x # include "anv_genX.h" # undef genX +# undef GENX # define genX(x) gen75_##x +# define GENX(x) GEN75_##x # include "anv_genX.h" # undef genX +# undef GENX # define genX(x) gen8_##x +# define GENX(x) GEN8_##x # include "anv_genX.h" # undef genX +# undef GENX # define genX(x) gen9_##x +# define GENX(x) GEN9_##x # include "anv_genX.h" # undef genX +# undef GENX #endif #endif /* ANV_PRIVATE_H */ diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c index e2ed7e6d1c..ec63910c39 100644 --- a/src/intel/vulkan/genX_blorp_exec.c +++ b/src/intel/vulkan/genX_blorp_exec.c @@ -39,8 +39,8 @@ static void genX(blorp_emit_pipe_control)(struct blorp_batch *batch, const struct GENX(PIPE_CONTROL) *pc) { - void *batch_pc = blorp_emit_dwords(batch, GENX(PIPE_CONTROL_length)); - GENX(PIPE_CONTROL_pack)(batch, batch_pc, pc); + struct anv_cmd_buffer *cmd_buffer = batch->driver_batch; + genX(emit_pipe_control)(cmd_buffer->device, &cmd_buffer->batch, pc); } #endif diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 7af2b31679..856b58412a 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -31,6 +31,15 @@ #include "genxml/gen_macros.h" #include "genxml/genX_pack.h" +void +genX(emit_pipe_control)(struct anv_device *device, +struct anv_batch *batch, +const struct GENX(PIPE_CONTROL) *pc) +{ + void *batch_pc = anv_batch_emit_dwords(batch, GENX(PIPE_CONTROL_length)); + GENX(PIPE_CONTROL_pack)(batch, batch_pc, pc); +} + static void emit_lrm(struct anv_batch *batch, uint32_t reg, struct anv_bo *bo, uint32_t offset) @@ -62,7 +71,7 @@ genX(cmd_buffer_emit_state_base_address)(struct anv_cmd_buffer *cmd_buffer) * this, we get GPU hangs when using multi-leve
[Mesa-dev] [PATCH 3/3] anv: implement WaCsStallAtEveryFourthPipecontrol for gen7
Signed-off-by: Lionel Landwerlin --- src/intel/vulkan/anv_batch_chain.c | 5 + src/intel/vulkan/anv_pipeline.c| 2 ++ src/intel/vulkan/anv_private.h | 4 src/intel/vulkan/genX_cmd_buffer.c | 21 +++-- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index 3f6039e816..07921d1d12 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -235,6 +235,9 @@ anv_batch_emit_batch(struct anv_batch *batch, struct anv_batch *other) other->relocs, offset); batch->next += size; + + batch->gen7.pipe_controls_since_last_cs_stall += + other->gen7.pipe_controls_since_last_cs_stall; } /*---* @@ -657,6 +660,8 @@ anv_cmd_buffer_init_batch_bo_chain(struct anv_cmd_buffer *cmd_buffer) struct anv_batch_bo *batch_bo; VkResult result; + memset(&cmd_buffer->batch, 0, sizeof(cmd_buffer->batch)); + list_inithead(&cmd_buffer->batch_bos); result = anv_batch_bo_create(cmd_buffer, &batch_bo); diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 4410103835..5dee943fe9 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -1187,6 +1187,8 @@ anv_pipeline_init(struct anv_pipeline *pipeline, if (result != VK_SUCCESS) return result; + memset(&pipeline->batch, 0, sizeof(pipeline->batch)); + pipeline->batch.alloc = alloc; pipeline->batch.next = pipeline->batch.start = pipeline->batch_data; pipeline->batch.end = pipeline->batch.start + sizeof(pipeline->batch_data); diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index ac121c833e..167a486d83 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -707,6 +707,10 @@ struct anv_batch { */ VkResult (*extend_cb)(struct anv_batch *, void *); void * user_data; + + struct { + uint32_t pipe_controls_since_last_cs_stall; + } gen7; }; void *anv_batch_emit_dwords(struct anv_batch *batch, int num_dwords); diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 856b58412a..14998251bb 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -34,10 +34,27 @@ void genX(emit_pipe_control)(struct anv_device *device, struct anv_batch *batch, -const struct GENX(PIPE_CONTROL) *pc) +const struct GENX(PIPE_CONTROL) *_pc) { + struct GENX(PIPE_CONTROL) pc = *_pc; + + /* Implement the WaCsStallAtEveryFourthPipecontrol workaround on IVB, BYT: +* +* "Every 4th PIPE_CONTROL command, not counting the PIPE_CONTROL with +* only read-cache-invalidate bit(s) set, must have a CS_STALL bit set." +* +* Note that the kernel does CS stalls between batches, so we only need +* to count them within a batch. +*/ + if (device->info.gen == 7 && !device->info.is_haswell) { + if (pc.CommandStreamerStallEnable) + batch->gen7.pipe_controls_since_last_cs_stall = 0; + else if (batch->gen7.pipe_controls_since_last_cs_stall > 4) + pc.CommandStreamerStallEnable = true; + } + void *batch_pc = anv_batch_emit_dwords(batch, GENX(PIPE_CONTROL_length)); - GENX(PIPE_CONTROL_pack)(batch, batch_pc, pc); + GENX(PIPE_CONTROL_pack)(batch, batch_pc, &pc); } static void -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 99604] kwin_x11 disabling compositing with mesa 17
https://bugs.freedesktop.org/show_bug.cgi?id=99604 --- Comment #1 from Fabio Coatti --- same issue with mesa 17.0.0 -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] r600/radeonsi: enable glsl/tgsi on-disk cache
Am Mittwoch, 22. Februar 2017, 04:45:46 CET schrieb Timothy Arceri: > For gpu generations that use LLVM we create a timestamp string > containing both the LLVM and Mesa build times, otherwise we just > use the Mesa build time. > > Reviewed-by: Marek Olšák > Reviewed-by: Edward O'Callaghan > --- > src/gallium/drivers/radeon/r600_pipe_common.c | 43 > +++ src/gallium/drivers/radeon/r600_pipe_common.h | > 3 ++ > 2 files changed, 46 insertions(+) > > diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c > b/src/gallium/drivers/radeon/r600_pipe_common.c index 1781584..bae6d6f > 100644 > --- a/src/gallium/drivers/radeon/r600_pipe_common.c > +++ b/src/gallium/drivers/radeon/r600_pipe_common.c > @@ -43,6 +43,10 @@ > #define HAVE_LLVM 0 > #endif > > +#if HAVE_LLVM > +#include > +#endif > + > #ifndef MESA_LLVM_VERSION_PATCH > #define MESA_LLVM_VERSION_PATCH 0 > #endif > @@ -779,6 +783,41 @@ static const char* r600_get_chip_name(struct > r600_common_screen *rscreen) } > } > > +static void r600_disk_cache_create(struct r600_common_screen *rscreen) > +{ > + uint32_t mesa_timestamp; > + if (disk_cache_get_function_timestamp(r600_disk_cache_create, > + &mesa_timestamp)) { > + char *timestamp_str; > + int res = -1; > + if (rscreen->chip_class < SI) { > + res = asprintf(×tamp_str, "%u",mesa_timestamp); > + } > +#if HAVE_LLVM > + else { > + uint32_t llvm_timestamp; > + if > (disk_cache_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, > + &llvm_timestamp)) > { > + res = asprintf(×tamp_str, "%u_%u", > +mesa_timestamp, llvm_timestamp); > + } > + } > +#endif maybe this fails to link later in omx with r600 only compile. make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ wird betreten CXXLDlibomx_mesa.la ../../../../src/gallium/drivers/radeon/.libs/libradeon.a(r600_pipe_common.o): In function `r600_disk_cache_create': r600_pipe_common.c:(.text+0x2000): undefined reference to `LLVMInitializeAMDGPUTargetInfo' collect2: error: ld returned 1 exit status make[4]: *** [Makefile:791: libomx_mesa.la] Fehler 1 make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ wird verlassen Marc signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] st/vdpau: Don't reallocate video surfaces on putBitsYCbCr format mismatch
mplayer likes putting YV12 data, and if there is a buffer format mismatch, the vdpau state tracker would try to reallocate the video surface as an YV12 surface. A virtual driver doesn't like reallocating and doesn't like YV12 surfaces, so before trying the reallocation, check whether we can instead do an YV12 to NV12 format conversion. Also advertize that we actually can do the getBits and putBits conversion. Signed-off-by: Thomas Hellstrom Reviewed-by: Sinclair Yeh --- src/gallium/auxiliary/util/u_video.h | 42 + src/gallium/state_trackers/vdpau/query.c | 13 src/gallium/state_trackers/vdpau/surface.c | 50 +- 3 files changed, 98 insertions(+), 7 deletions(-) diff --git a/src/gallium/auxiliary/util/u_video.h b/src/gallium/auxiliary/util/u_video.h index 99a8fd6..7cd6268 100644 --- a/src/gallium/auxiliary/util/u_video.h +++ b/src/gallium/auxiliary/util/u_video.h @@ -107,6 +107,48 @@ u_copy_nv12_to_yv12(void *const *destination_data, } } +/** + * \brief Copy YV12 chroma data while converting it NV12 + * + * Given a set of YV12 source pointers and -pitches, copy the data to a + * layout typical for NV12 video buffers. + * + * \param source data[in] The plane data pointers. Array of 3. + * \param source_pitches[in] The plane pitches. Array of 3. + * \param dst_plane[in] The destination plane to copy to. For NV12 always 1. + * \param dst_field[in] The destination field if interlaced. + * \param dst_stride[in] The destination stride for this plane. + * \param num_fields[in] The number of fields in the video buffer. + * \param dst[in] The destination plane pointer. + * \param width[in] The source plane width. + * \param height[in] The source plane height. + */ +static inline void +u_copy_nv12_from_yv12(const void *const *source_data, + uint32_t const *source_pitches, + int dst_plane, int dst_field, + int dst_stride, int num_fields, + uint8_t *dst, + int width, int height) +{ + int x, y; + unsigned u_stride = source_pitches[2] * num_fields; + unsigned v_stride = source_pitches[1] * num_fields; + uint8_t *u_src = (uint8_t *)source_data[2] + source_pitches[2] * dst_field; + uint8_t *v_src = (uint8_t *)source_data[1] + source_pitches[1] * dst_field; + + /* TODO: SIMD */ + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + dst[2*x] = u_src[x]; + dst[2*x+1] = v_src[x]; + } + u_src += u_stride; + v_src += v_stride; + dst += dst_stride; + } +} + static inline void u_copy_yv12_to_nv12(void *const *destination_data, uint32_t const *destination_pitches, diff --git a/src/gallium/state_trackers/vdpau/query.c b/src/gallium/state_trackers/vdpau/query.c index e69c9b1..435cafd 100644 --- a/src/gallium/state_trackers/vdpau/query.c +++ b/src/gallium/state_trackers/vdpau/query.c @@ -123,8 +123,21 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp switch(bits_ycbcr_format) { case VDP_YCBCR_FORMAT_NV12: + *is_supported = surface_chroma_type == VDP_CHROMA_TYPE_420; + break; + case VDP_YCBCR_FORMAT_YV12: *is_supported = surface_chroma_type == VDP_CHROMA_TYPE_420; + + /* We can convert YV12 to NV12 on the fly! */ + if (*is_supported && + pscreen->is_video_format_supported(pscreen, + PIPE_FORMAT_NV12, + PIPE_VIDEO_PROFILE_UNKNOWN, + PIPE_VIDEO_ENTRYPOINT_BITSTREAM)) { + pipe_mutex_unlock(dev->mutex); + return VDP_STATUS_OK; + } break; case VDP_YCBCR_FORMAT_UYVY: diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index 9a80605..927fbcb 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -304,9 +304,11 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, uint32_t const *source_pitches) { enum pipe_format pformat = FormatYCBCRToPipe(source_ycbcr_format); + enum getbits_conversion conversion = CONVERSION_NONE; struct pipe_context *pipe; struct pipe_sampler_view **sampler_views; unsigned i, j; + unsigned usage = PIPE_TRANSFER_WRITE; vlVdpSurface *p_surf = vlGetDataHTAB(surface); if (!p_surf) @@ -320,7 +322,16 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, return VDP_STATUS_INVALID_POINTER; pipe_mutex_lock(p_surf->device->mutex); - if (p_surf->video_buffer == NULL || pformat != p_surf->video_buffer->buffer_format) { + + if (pformat != p_surf->video_buffer->buffer_format) { + if (pformat == PIPE_FORMAT_YV12 && + p_surf->video_buffer->buffer_format == PIPE_FORMAT_NV12) + conversion = CONVERS
[Mesa-dev] [PATCH 2/2] st/va: Fix up YV12 to NV12 putImage conversion
Use the utility u_copy_nv12_from_yv12 to implement this similarly to how it's been done in the VPAU state tracker. The old code mixed up planes and fields and didn't correctly handle video surfaces in interlaced format. Signed-off-by: Thomas Hellstrom --- src/gallium/auxiliary/util/u_video.h | 37 --- src/gallium/state_trackers/va/image.c | 48 --- 2 files changed, 28 insertions(+), 57 deletions(-) diff --git a/src/gallium/auxiliary/util/u_video.h b/src/gallium/auxiliary/util/u_video.h index 7cd6268..251e144 100644 --- a/src/gallium/auxiliary/util/u_video.h +++ b/src/gallium/auxiliary/util/u_video.h @@ -173,43 +173,6 @@ u_copy_yv12_to_nv12(void *const *destination_data, } static inline void -u_copy_yv12_img_to_nv12_surf(ubyte *const *src, - ubyte *dst, - unsigned width, - unsigned height, - unsigned src_stride, - unsigned dst_stride, - int field) -{ - if (field == 0) { - ubyte *src_0 = src[field]; - for (int i = 0; i < height ; i++) { - memcpy(dst, src_0, width); - dst += dst_stride; - src_0 += src_stride; - } - } else if (field == 1) { - const ubyte *src_1 = src[field]; - const ubyte *src_2 = src[field+1]; - bool odd = true; - for (unsigned i = 0; i < height ; i++) { - for (unsigned j = 0; j < width*2 ; j++) { -if (odd == false) { - dst[j] = src_1[j/2]; - odd = true; -} else { - dst[j] = src_2[j/2]; - odd = false; -} - } - dst += dst_stride; - src_1 += src_stride; - src_2 += src_stride; - } - } -} - -static inline void u_copy_swap422_packed(void *const *destination_data, uint32_t const *destination_pitches, int src_plane, int src_field, diff --git a/src/gallium/state_trackers/va/image.c b/src/gallium/state_trackers/va/image.c index bd60d3e..47d31de 100644 --- a/src/gallium/state_trackers/va/image.c +++ b/src/gallium/state_trackers/va/image.c @@ -513,28 +513,36 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID surface, VAImageID image, for (i = 0; i < vaimage->num_planes; ++i) { unsigned width, height; + struct pipe_resource *tex; + if (!views[i]) continue; - vlVaVideoSurfaceSize(surf, i, &width, &height); - if (((format == PIPE_FORMAT_YV12) || (format == PIPE_FORMAT_IYUV)) && -(surf->buffer->buffer_format == PIPE_FORMAT_NV12)) { - struct pipe_transfer *transfer = NULL; - uint8_t *map = NULL; - struct pipe_box dst_box_1 = {0, 0, 0, width, height, 1}; - map = drv->pipe->transfer_map(drv->pipe, - views[i]->texture, - 0, - PIPE_TRANSFER_DISCARD_RANGE, - &dst_box_1, &transfer); - if (map == NULL) -return VA_STATUS_ERROR_OPERATION_FAILED; + tex = views[i]->texture; - u_copy_yv12_img_to_nv12_surf ((ubyte * const*)data, map, width, height, - pitches[i], transfer->stride, i); - pipe_transfer_unmap(drv->pipe, transfer); - } else { - for (j = 0; j < views[i]->texture->array_size; ++j) { -struct pipe_box dst_box = {0, 0, j, width, height, 1}; -drv->pipe->texture_subdata(drv->pipe, views[i]->texture, 0, + vlVaVideoSurfaceSize(surf, i, &width, &height); + for (j = 0; j < tex->array_size; ++j) { + struct pipe_box dst_box = {0, 0, j, width, height, 1}; + + if (((format == PIPE_FORMAT_YV12) || (format == PIPE_FORMAT_IYUV)) + && (surf->buffer->buffer_format == PIPE_FORMAT_NV12) + && i == 1) { +struct pipe_transfer *transfer = NULL; +uint8_t *map = NULL; + +map = drv->pipe->transfer_map(drv->pipe, + tex, + 0, + PIPE_TRANSFER_WRITE | + PIPE_TRANSFER_DISCARD_RANGE, + &dst_box, &transfer); +if (map == NULL) + return VA_STATUS_ERROR_OPERATION_FAILED; + +u_copy_nv12_from_yv12((const void * const*) data, pitches, i, j, + transfer->stride, tex->array_size, + map, dst_box.width, dst_box.height); +pipe_transfer_unmap(drv->pipe, transfer); + } else { +drv->pipe->texture_subdata(drv->pipe, tex, 0, PIPE_TRANSFER_WRITE, &dst_box,
Re: [Mesa-dev] [PATCH 1/2] st/vdpau: Don't reallocate video surfaces on putBitsYCbCr format mismatch
Am 22.02.2017 um 14:42 schrieb Thomas Hellstrom: mplayer likes putting YV12 data, and if there is a buffer format mismatch, the vdpau state tracker would try to reallocate the video surface as an YV12 surface. A virtual driver doesn't like reallocating and doesn't like YV12 surfaces, so before trying the reallocation, check whether we can instead do an YV12 to NV12 format conversion. Also advertize that we actually can do the getBits and putBits conversion. Signed-off-by: Thomas Hellstrom Reviewed-by: Sinclair Yeh NAK, the internal format of the surfaces should follow what the application has put into it as much as possible. That has quite some performance advantages. You should only do the conversation if the backend driver can't handle the desired format. Regards, Christian. --- src/gallium/auxiliary/util/u_video.h | 42 + src/gallium/state_trackers/vdpau/query.c | 13 src/gallium/state_trackers/vdpau/surface.c | 50 +- 3 files changed, 98 insertions(+), 7 deletions(-) diff --git a/src/gallium/auxiliary/util/u_video.h b/src/gallium/auxiliary/util/u_video.h index 99a8fd6..7cd6268 100644 --- a/src/gallium/auxiliary/util/u_video.h +++ b/src/gallium/auxiliary/util/u_video.h @@ -107,6 +107,48 @@ u_copy_nv12_to_yv12(void *const *destination_data, } } +/** + * \brief Copy YV12 chroma data while converting it NV12 + * + * Given a set of YV12 source pointers and -pitches, copy the data to a + * layout typical for NV12 video buffers. + * + * \param source data[in] The plane data pointers. Array of 3. + * \param source_pitches[in] The plane pitches. Array of 3. + * \param dst_plane[in] The destination plane to copy to. For NV12 always 1. + * \param dst_field[in] The destination field if interlaced. + * \param dst_stride[in] The destination stride for this plane. + * \param num_fields[in] The number of fields in the video buffer. + * \param dst[in] The destination plane pointer. + * \param width[in] The source plane width. + * \param height[in] The source plane height. + */ +static inline void +u_copy_nv12_from_yv12(const void *const *source_data, + uint32_t const *source_pitches, + int dst_plane, int dst_field, + int dst_stride, int num_fields, + uint8_t *dst, + int width, int height) +{ + int x, y; + unsigned u_stride = source_pitches[2] * num_fields; + unsigned v_stride = source_pitches[1] * num_fields; + uint8_t *u_src = (uint8_t *)source_data[2] + source_pitches[2] * dst_field; + uint8_t *v_src = (uint8_t *)source_data[1] + source_pitches[1] * dst_field; + + /* TODO: SIMD */ + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + dst[2*x] = u_src[x]; + dst[2*x+1] = v_src[x]; + } + u_src += u_stride; + v_src += v_stride; + dst += dst_stride; + } +} + static inline void u_copy_yv12_to_nv12(void *const *destination_data, uint32_t const *destination_pitches, diff --git a/src/gallium/state_trackers/vdpau/query.c b/src/gallium/state_trackers/vdpau/query.c index e69c9b1..435cafd 100644 --- a/src/gallium/state_trackers/vdpau/query.c +++ b/src/gallium/state_trackers/vdpau/query.c @@ -123,8 +123,21 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp switch(bits_ycbcr_format) { case VDP_YCBCR_FORMAT_NV12: + *is_supported = surface_chroma_type == VDP_CHROMA_TYPE_420; + break; + case VDP_YCBCR_FORMAT_YV12: *is_supported = surface_chroma_type == VDP_CHROMA_TYPE_420; + + /* We can convert YV12 to NV12 on the fly! */ + if (*is_supported && + pscreen->is_video_format_supported(pscreen, + PIPE_FORMAT_NV12, + PIPE_VIDEO_PROFILE_UNKNOWN, + PIPE_VIDEO_ENTRYPOINT_BITSTREAM)) { + pipe_mutex_unlock(dev->mutex); + return VDP_STATUS_OK; + } break; case VDP_YCBCR_FORMAT_UYVY: diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index 9a80605..927fbcb 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -304,9 +304,11 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, uint32_t const *source_pitches) { enum pipe_format pformat = FormatYCBCRToPipe(source_ycbcr_format); + enum getbits_conversion conversion = CONVERSION_NONE; struct pipe_context *pipe; struct pipe_sampler_view **sampler_views; unsigned i, j; + unsigned usage = PIPE_TRANSFER_WRITE; vlVdpSurface *p_surf = vlGetDataHTAB(surface); if (!p_surf) @@ -320,7 +322,16 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, return VDP
Re: [Mesa-dev] [PATCH 1/2] st/vdpau: Don't reallocate video surfaces on putBitsYCbCr format mismatch
On 02/22/2017 03:00 PM, Christian König wrote: > Am 22.02.2017 um 14:42 schrieb Thomas Hellstrom: >> mplayer likes putting YV12 data, and if there is a buffer format >> mismatch, >> the vdpau state tracker would try to reallocate the video surface as an >> YV12 surface. A virtual driver doesn't like reallocating and doesn't >> like YV12 >> surfaces, so before trying the reallocation, check whether we can >> instead do >> an YV12 to NV12 format conversion. >> >> Also advertize that we actually can do the getBits and putBits >> conversion. >> >> Signed-off-by: Thomas Hellstrom >> Reviewed-by: Sinclair Yeh > > NAK, the internal format of the surfaces should follow what the > application has put into it as much as possible. That has quite some > performance advantages. > > You should only do the conversation if the backend driver can't handle > the desired format. > > Regards, > Christian. OK. I'll respin. /Thomas ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] anv: ensure that we do not emit negative Depth in 3DSTATE_DEPTH_BUFFER
This fixes a number of new CTS tests that would crash otherwise: dEQP-VK.pipeline.render_to_image.* --- src/intel/vulkan/genX_cmd_buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 40a72f4..cdd4501 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2270,7 +2270,8 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer) assert(image->depth_surface.isl.dim != ISL_SURF_DIM_3D); db.Depth = db.RenderTargetViewExtent = -iview->isl.array_len - iview->isl.base_array_layer - 1; +iview->isl.array_len <= iview->isl.base_array_layer + ? 0 : iview->isl.array_len - iview->isl.base_array_layer - 1; #if GEN_GEN >= 8 db.SurfaceQPitch = -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] r600/radeonsi: enable glsl/tgsi on-disk cache
On 22 February 2017 at 13:31, Marc Dietrich wrote: > Am Mittwoch, 22. Februar 2017, 04:45:46 CET schrieb Timothy Arceri: >> For gpu generations that use LLVM we create a timestamp string >> containing both the LLVM and Mesa build times, otherwise we just >> use the Mesa build time. >> >> Reviewed-by: Marek Olšák >> Reviewed-by: Edward O'Callaghan >> --- >> src/gallium/drivers/radeon/r600_pipe_common.c | 43 >> +++ src/gallium/drivers/radeon/r600_pipe_common.h | >> 3 ++ >> 2 files changed, 46 insertions(+) >> >> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c >> b/src/gallium/drivers/radeon/r600_pipe_common.c index 1781584..bae6d6f >> 100644 >> --- a/src/gallium/drivers/radeon/r600_pipe_common.c >> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c >> @@ -43,6 +43,10 @@ >> #define HAVE_LLVM 0 >> #endif >> >> +#if HAVE_LLVM >> +#include >> +#endif >> + >> #ifndef MESA_LLVM_VERSION_PATCH >> #define MESA_LLVM_VERSION_PATCH 0 >> #endif >> @@ -779,6 +783,41 @@ static const char* r600_get_chip_name(struct >> r600_common_screen *rscreen) } >> } >> >> +static void r600_disk_cache_create(struct r600_common_screen *rscreen) >> +{ >> + uint32_t mesa_timestamp; >> + if (disk_cache_get_function_timestamp(r600_disk_cache_create, >> + &mesa_timestamp)) { >> + char *timestamp_str; >> + int res = -1; >> + if (rscreen->chip_class < SI) { >> + res = asprintf(×tamp_str, "%u",mesa_timestamp); >> + } >> +#if HAVE_LLVM >> + else { >> + uint32_t llvm_timestamp; >> + if >> (disk_cache_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, >> + >> &llvm_timestamp)) { >> + res = asprintf(×tamp_str, "%u_%u", >> +mesa_timestamp, llvm_timestamp); >> + } >> + } >> +#endif > > > maybe this fails to link later in omx with r600 only compile. > > make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ wird > betreten > CXXLDlibomx_mesa.la > ../../../../src/gallium/drivers/radeon/.libs/libradeon.a(r600_pipe_common.o): > In function `r600_disk_cache_create': > r600_pipe_common.c:(.text+0x2000): undefined reference to > `LLVMInitializeAMDGPUTargetInfo' > collect2: error: ld returned 1 exit status > make[4]: *** [Makefile:791: libomx_mesa.la] Fehler 1 > make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ wird > verlassen > That should not happen since - Compile guard HAVE_LLVM is defined when --enable-llvm is set (explicitly or not) - Makefile/link guard HAVE_GALLIUM_LLVM is set when the --enable-llvm is Please make clean/git clean and report the output of make V=1 if the final link still fails. Thanks Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 99604] kwin_x11 disabling compositing with mesa 17
https://bugs.freedesktop.org/show_bug.cgi?id=99604 Emil Velikov changed: What|Removed |Added QA Contact|mesa-dev@lists.freedesktop. |intel-3d-bugs@lists.freedes |org |ktop.org Assignee|mesa-dev@lists.freedesktop. |intel-3d-bugs@lists.freedes |org |ktop.org Component|Other |Drivers/DRI/i965 --- Comment #2 from Emil Velikov --- Afaict i5-3427U is a Ivy Bridge - the i965 driver. Fabio can you track down what's kwin is doing just before things fail (the error message is printed) ? -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] r600/radeonsi: enable glsl/tgsi on-disk cache
Am Mittwoch, 22. Februar 2017, 15:48:18 CET schrieb Emil Velikov: > On 22 February 2017 at 13:31, Marc Dietrich wrote: > > Am Mittwoch, 22. Februar 2017, 04:45:46 CET schrieb Timothy Arceri: > >> For gpu generations that use LLVM we create a timestamp string > >> containing both the LLVM and Mesa build times, otherwise we just > >> use the Mesa build time. > >> > >> Reviewed-by: Marek Olšák > >> Reviewed-by: Edward O'Callaghan > >> --- > >> > >> src/gallium/drivers/radeon/r600_pipe_common.c | 43 > >> > >> +++ src/gallium/drivers/radeon/r600_pipe_common.h > >> | > >> > >> 3 ++ > >> 2 files changed, 46 insertions(+) > >> > >> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c > >> b/src/gallium/drivers/radeon/r600_pipe_common.c index 1781584..bae6d6f > >> 100644 > >> --- a/src/gallium/drivers/radeon/r600_pipe_common.c > >> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c > >> @@ -43,6 +43,10 @@ > >> > >> #define HAVE_LLVM 0 > >> #endif > >> > >> +#if HAVE_LLVM > >> +#include > >> +#endif > >> + > >> > >> #ifndef MESA_LLVM_VERSION_PATCH > >> #define MESA_LLVM_VERSION_PATCH 0 > >> #endif > >> > >> @@ -779,6 +783,41 @@ static const char* r600_get_chip_name(struct > >> r600_common_screen *rscreen) } > >> > >> } > >> > >> +static void r600_disk_cache_create(struct r600_common_screen *rscreen) > >> +{ > >> + uint32_t mesa_timestamp; > >> + if (disk_cache_get_function_timestamp(r600_disk_cache_create, > >> + &mesa_timestamp)) { > >> + char *timestamp_str; > >> + int res = -1; > >> + if (rscreen->chip_class < SI) { > >> + res = asprintf(×tamp_str, > >> "%u",mesa_timestamp); > >> + } > >> +#if HAVE_LLVM > >> + else { > >> + uint32_t llvm_timestamp; > >> + if > >> (disk_cache_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, + > >> &llvm_timestamp)) > >> { + res = asprintf(×tamp_str, "%u_%u", > >> +mesa_timestamp, > >> llvm_timestamp); + } > >> + } > >> +#endif > > > > maybe this fails to link later in omx with r600 only compile. > > > > make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ > > wird betreten > > > > CXXLDlibomx_mesa.la > > > > ../../../../src/gallium/drivers/radeon/.libs/libradeon.a(r600_pipe_common. > > o): In function `r600_disk_cache_create': > > r600_pipe_common.c:(.text+0x2000): undefined reference to > > `LLVMInitializeAMDGPUTargetInfo' > > collect2: error: ld returned 1 exit status > > make[4]: *** [Makefile:791: libomx_mesa.la] Fehler 1 > > make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ > > wird verlassen > > That should not happen since > - Compile guard HAVE_LLVM is defined when --enable-llvm is set > (explicitly or not) > - Makefile/link guard HAVE_GALLIUM_LLVM is set when the --enable-llvm is > > Please make clean/git clean and report the output of make V=1 if the > final link still fails. still same. I added -lLLVMAMDGPUInfo to LLVM_{LDFLAGS|LIBS}. Now it compiles, but GL apps crash during context creation. I also tested the initial version posted and this worked just fine. I have llvm enabled. make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ wird betreten /bin/sh ../../../../libtool --tag=CXX --mode=link g++ -Wall -fno-math- errno -fno-trapping-math -shared -module -no-undefined -avoid-version -Wl,-- gc-sections -Wl,--no-undefined -Wl,--version-script=../../../../src/gallium/ targets/omx/omx.sym -L/usr/lib64 -o libomx_mesa.la -rpath /usr/lib64/ bellagio libomx_mesa_la-target.lo ../../../../src/gallium/state_trackers/omx/ libomxtracker.la ../../../../src/gallium/auxiliary/libgalliumvlwinsys.la ../../../../src/gallium/auxiliary/libgalliumvl.la ../../../../src/gallium/ auxiliary/libgallium.la ../../../../src/util/libmesautil.la -lomxil-bellagio - lxcb-dri3 -lxcb-present -lxcb-sync -lxshmfence -lxcb-xfixes -lX11-xcb -lX11 - lxcb -lxcb-dri2 -ldrm -lm -lpthread -ldl -ldrm ../../../../src/gallium/ auxiliary/pipe-loader/libpipe_loader_static.la ../../../../src/gallium/winsys/ sw/null/libws_null.la ../../../../src/gallium/winsys/sw/wrapper/libwsw.la ../../../../src/gallium/winsys/sw/dri/libswdri.la ../../../../src/gallium/ winsys/sw/kms-dri/libswkmsdri.la -ldrm ../../../../src/gallium/drivers/r600/ libr600.la -ldrm -ldrm_radeon -ldrm ../../../../src/gallium/winsys/radeon/ drm/libradeonwinsys.la ../../../../src/gallium/drivers/radeon/libradeon.la - lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG - lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMCodeGen -lLLVMScalarOpts - lLLVMInstCombine -lLLVMInstrumentation -lLLVMTransformUtils -lLLVMX86Desc - lLLVMMCDisassembler -lLLVMX86Info -lL
Re: [Mesa-dev] [PATCH 0/8] gallium: A number of video code fixes
On 22 February 2017 at 09:30, Thomas Hellstrom wrote: > On 02/22/2017 09:56 AM, Christian König wrote: >> Am 21.02.2017 um 21:52 schrieb Thomas Hellstrom: >>> A couple of fixes / improvements for things I've encountered while >>> looking >>> through and testing the video code in preparation for a virtual >>> hardware video >>> driver. >> >> Reviewed-by: Christian König for the whole >> set. > > Thanks for the review, Christian. Worth getting the lot to -stable ? Adding either "cc: mesa-stable..." or "Fixes: $sha1 ("$commit summary")" will do. Haven't looked at the series, so not sure how much of the work is safe/applicable. Thanks Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] anv/Makefile: Gather all the genX files into one place
On 22 February 2017 at 03:38, Jason Ekstrand wrote: > While we're here, we also fix the alphabetization of the list of > genx_* files. Reviewed-by: Emil Velikov Thanks Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] anv: ensure that we do not emit negative Depth in 3DSTATE_DEPTH_BUFFER
I can't reproduce on the vulkan-cts-next-dev (I just pull -r, so I shouldn't miss anything right?). On 22/02/17 14:45, Iago Toral Quiroga wrote: This fixes a number of new CTS tests that would crash otherwise: dEQP-VK.pipeline.render_to_image.* --- src/intel/vulkan/genX_cmd_buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 40a72f4..cdd4501 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2270,7 +2270,8 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer) assert(image->depth_surface.isl.dim != ISL_SURF_DIM_3D); db.Depth = db.RenderTargetViewExtent = -iview->isl.array_len - iview->isl.base_array_layer - 1; +iview->isl.array_len <= iview->isl.base_array_layer + ? 0 : iview->isl.array_len - iview->isl.base_array_layer - 1; #if GEN_GEN >= 8 db.SurfaceQPitch = ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 5/8] gallium: add get_disk_shader_cache() callback
On 22/02/17 07:58 PM, Nicolai Hähnle wrote: > On 22.02.2017 07:23, Michel Dänzer wrote: >> On 22/02/17 12:45 PM, Timothy Arceri wrote: >>> >>> +get_disk_shader_cache >>> +^ >>> + >>> +Returns a pointer to driver-specific on-disk shader cache. If the >>> driver >>> +failed to create the cache or does not support an on-disk shader >>> cache NULL is >>> +returned. >> >> [...] >> >>> + /** >>> +* Returns a pointer to driver-specific on-disk shader cache. If >>> the driver >>> +* failed to create the cache or does not support an on-disk >>> shader cache >>> +* NULL is returned. >>> +*/ >>> + struct disk_cache *(*get_disk_shader_cache)(struct pipe_screen >>> *screen); >>> }; >> >> Drivers which don't support an on-disk shader cache don't set this >> callback in the first place, right? :) (Just a suggestion for >> improvement before landing this patch, not a blocker, no need to resend) > > Yeah, but creating the shader cache might have failed, or it might be > disabled. Perhaps a driver that doesn't do its own caching might want to > initialize the cache lazily. I think the interface is more flexible this > way. Sure. Maybe I was being too cryptic, sorry. What I mean is that the "or does not support an on-disk shader cache" language in the callback documentation is slightly misleading, since such drivers should simply not set the callback in the first place. That's all. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] st/vdpau: Provide YV12 to NV12 putBits conversion v2
mplayer likes putting YV12 data, and if there is a buffer format mismatch, the vdpau state tracker would try to reallocate the video surface as an YV12 surface. A virtual driver doesn't like reallocating and doesn't like YV12 surfaces, so if we can't support YV12, try an YV12 to NV12 conversion instead. Also advertize that we actually can do the getBits and putBits conversion. v2: A previous version of this patch prioritized conversion before reallocating. This has been changed to prioritize reallocating in this version. Cc: Christian König Signed-off-by: Thomas Hellstrom --- src/gallium/auxiliary/util/u_video.h | 42 + src/gallium/state_trackers/vdpau/query.c | 13 + src/gallium/state_trackers/vdpau/surface.c | 94 -- 3 files changed, 130 insertions(+), 19 deletions(-) diff --git a/src/gallium/auxiliary/util/u_video.h b/src/gallium/auxiliary/util/u_video.h index 99a8fd6..7cd6268 100644 --- a/src/gallium/auxiliary/util/u_video.h +++ b/src/gallium/auxiliary/util/u_video.h @@ -107,6 +107,48 @@ u_copy_nv12_to_yv12(void *const *destination_data, } } +/** + * \brief Copy YV12 chroma data while converting it NV12 + * + * Given a set of YV12 source pointers and -pitches, copy the data to a + * layout typical for NV12 video buffers. + * + * \param source data[in] The plane data pointers. Array of 3. + * \param source_pitches[in] The plane pitches. Array of 3. + * \param dst_plane[in] The destination plane to copy to. For NV12 always 1. + * \param dst_field[in] The destination field if interlaced. + * \param dst_stride[in] The destination stride for this plane. + * \param num_fields[in] The number of fields in the video buffer. + * \param dst[in] The destination plane pointer. + * \param width[in] The source plane width. + * \param height[in] The source plane height. + */ +static inline void +u_copy_nv12_from_yv12(const void *const *source_data, + uint32_t const *source_pitches, + int dst_plane, int dst_field, + int dst_stride, int num_fields, + uint8_t *dst, + int width, int height) +{ + int x, y; + unsigned u_stride = source_pitches[2] * num_fields; + unsigned v_stride = source_pitches[1] * num_fields; + uint8_t *u_src = (uint8_t *)source_data[2] + source_pitches[2] * dst_field; + uint8_t *v_src = (uint8_t *)source_data[1] + source_pitches[1] * dst_field; + + /* TODO: SIMD */ + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + dst[2*x] = u_src[x]; + dst[2*x+1] = v_src[x]; + } + u_src += u_stride; + v_src += v_stride; + dst += dst_stride; + } +} + static inline void u_copy_yv12_to_nv12(void *const *destination_data, uint32_t const *destination_pitches, diff --git a/src/gallium/state_trackers/vdpau/query.c b/src/gallium/state_trackers/vdpau/query.c index e69c9b1..435cafd 100644 --- a/src/gallium/state_trackers/vdpau/query.c +++ b/src/gallium/state_trackers/vdpau/query.c @@ -123,8 +123,21 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp switch(bits_ycbcr_format) { case VDP_YCBCR_FORMAT_NV12: + *is_supported = surface_chroma_type == VDP_CHROMA_TYPE_420; + break; + case VDP_YCBCR_FORMAT_YV12: *is_supported = surface_chroma_type == VDP_CHROMA_TYPE_420; + + /* We can convert YV12 to NV12 on the fly! */ + if (*is_supported && + pscreen->is_video_format_supported(pscreen, + PIPE_FORMAT_NV12, + PIPE_VIDEO_PROFILE_UNKNOWN, + PIPE_VIDEO_ENTRYPOINT_BITSTREAM)) { + pipe_mutex_unlock(dev->mutex); + return VDP_STATUS_OK; + } break; case VDP_YCBCR_FORMAT_UYVY: diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index 9a80605..e0dff4e 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -304,9 +304,11 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, uint32_t const *source_pitches) { enum pipe_format pformat = FormatYCBCRToPipe(source_ycbcr_format); + enum getbits_conversion conversion = CONVERSION_NONE; struct pipe_context *pipe; struct pipe_sampler_view **sampler_views; unsigned i, j; + unsigned usage = PIPE_TRANSFER_WRITE; vlVdpSurface *p_surf = vlGetDataHTAB(surface); if (!p_surf) @@ -320,24 +322,53 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, return VDP_STATUS_INVALID_POINTER; pipe_mutex_lock(p_surf->device->mutex); - if (p_surf->video_buffer == NULL || pformat != p_surf->video_buffer->buffer_format) { - /* destroy the old one */ - if (p_surf->video_buffer) - p_surf->video_buffer->des
Re: [Mesa-dev] [PATCH 0/8] gallium: A number of video code fixes
On 02/22/2017 04:00 PM, Emil Velikov wrote: > On 22 February 2017 at 09:30, Thomas Hellstrom wrote: >> On 02/22/2017 09:56 AM, Christian König wrote: >>> Am 21.02.2017 um 21:52 schrieb Thomas Hellstrom: A couple of fixes / improvements for things I've encountered while looking through and testing the video code in preparation for a virtual hardware video driver. >>> Reviewed-by: Christian König for the whole >>> set. >> Thanks for the review, Christian. > Worth getting the lot to -stable ? Adding either "cc: mesa-stable..." > or "Fixes: $sha1 ("$commit summary")" will do. > > Haven't looked at the series, so not sure how much of the work is > safe/applicable. > > Thanks > Emil Hi, Emil, There is only one significant bugfix in that series, (the vdpau multithreading fix), but I'm not sure how and if it affects the current drivers. I hit this problem with mpv --vo vdpau --hwdec vdpau . In any case it should probably sit in master for a while before we decide to crossport. /Thomas ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/8] gallium: A number of video code fixes
Am 22.02.2017 um 16:31 schrieb Thomas Hellstrom: On 02/22/2017 04:00 PM, Emil Velikov wrote: On 22 February 2017 at 09:30, Thomas Hellstrom wrote: On 02/22/2017 09:56 AM, Christian König wrote: Am 21.02.2017 um 21:52 schrieb Thomas Hellstrom: A couple of fixes / improvements for things I've encountered while looking through and testing the video code in preparation for a virtual hardware video driver. Reviewed-by: Christian König for the whole set. Thanks for the review, Christian. Worth getting the lot to -stable ? Adding either "cc: mesa-stable..." or "Fixes: $sha1 ("$commit summary")" will do. Haven't looked at the series, so not sure how much of the work is safe/applicable. Thanks Emil Hi, Emil, There is only one significant bugfix in that series, (the vdpau multithreading fix), but I'm not sure how and if it affects the current drivers. Actually thinking more about it that change might be incorrect after all. The pipe a decoder is created from can be accessed concurrently together with the decoder. E.g. you can hammer on the pipe from thread A and on the decoder from thread B at the same time and that is fine. Otherwise you run into a bunch of stalling problems with Kodi for example. Your solution of creating a separate pipe object might work as well, but I think that could cause problems with the cached sampler views later on. Regards, Christian. I hit this problem with mpv --vo vdpau --hwdec vdpau . In any case it should probably sit in master for a while before we decide to crossport. /Thomas ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/1] clover: Dump linked module to a different file
This allows to pass the generated files directly to llc or bugpoint. Note that if program links multiple binaries they will still be in the same file, the module name is "link". Signed-off-by: Jan Vesely --- src/gallium/state_trackers/clover/llvm/invocation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp index f63ff3d..7eecdca 100644 --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp @@ -282,7 +282,7 @@ clover::llvm::link_program(const std::vector &modules, optimize(*mod, c->getCodeGenOpts().OptimizationLevel, !create_library); if (has_flag(debug::llvm)) - debug::log(".ll", print_module_bitcode(*mod)); + debug::log("." + mod->getModuleIdentifier() + ".ll", print_module_bitcode(*mod)); if (create_library) { return build_module_library(*mod, module::section::text_library); @@ -292,7 +292,7 @@ clover::llvm::link_program(const std::vector &modules, } else if (ir == PIPE_SHADER_IR_NATIVE) { if (has_flag(debug::native)) - debug::log(".asm", print_module_native(*mod, target)); + debug::log("." + mod->getModuleIdentifier() + ".asm", print_module_native(*mod, target)); return build_module_native(*mod, target, *c, r_log); -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4] docs: update features.txt for GL_ARB_clear_texture with llvmpipe and softpipe
Signed-off-by: Lars Hamre --- CC: Roland Scheidegger NOTE: someone with access will need to commit this post review process docs/features.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/features.txt b/docs/features.txt index 01315a0..d7828b1 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -192,7 +192,7 @@ GL 4.4, GLSL 4.40 -- all DONE: i965/gen8+, nvc0, radeonsi GL_MAX_VERTEX_ATTRIB_STRIDE DONE (all drivers) GL_ARB_buffer_storage DONE (i965, nv50, r600) - GL_ARB_clear_texture DONE (i965, nv50, r600) + GL_ARB_clear_texture DONE (i965, nv50, r600, llvmpipe, softpipe) GL_ARB_enhanced_layouts DONE (i965, nv50, llvmpipe, softpipe) - compile-time constant expressions DONE - explicit byte offsets for blocksDONE -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4] llvmpipe: enable clear_texture with util_clear_texture
Passes all corresponding piglit tests. Signed-off-by: Lars Hamre --- CC: Roland Scheidegger NOTE: someone with access will need to commit this post review process src/gallium/drivers/llvmpipe/lp_screen.c | 3 ++- src/gallium/drivers/llvmpipe/lp_surface.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 76a30a6..2633b0c 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -307,6 +307,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 1; case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS: return 1; + case PIPE_CAP_CLEAR_TEXTURE: + return 1; case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: @@ -315,7 +317,6 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TGSI_TXQS: case PIPE_CAP_FORCE_PERSAMPLE_INTERP: case PIPE_CAP_SHAREABLE_SHADERS: - case PIPE_CAP_CLEAR_TEXTURE: case PIPE_CAP_DRAW_PARAMETERS: case PIPE_CAP_TGSI_PACK_HALF_FLOAT: case PIPE_CAP_MULTI_DRAW_INDIRECT: diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c index 784db7f..953b26e 100644 --- a/src/gallium/drivers/llvmpipe/lp_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_surface.c @@ -231,7 +231,8 @@ llvmpipe_init_surface_functions(struct llvmpipe_context *lp) lp->pipe.clear_depth_stencil = llvmpipe_clear_depth_stencil; lp->pipe.create_surface = llvmpipe_create_surface; lp->pipe.surface_destroy = llvmpipe_surface_destroy; - /* These two are not actually functions dealing with surfaces */ + /* These are not actually functions dealing with surfaces */ + lp->pipe.clear_texture = util_clear_texture; lp->pipe.resource_copy_region = lp_resource_copy; lp->pipe.blit = lp_blit; lp->pipe.flush_resource = lp_flush_resource; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4 v3] gallium: implement util_clear_texture
v3: have util_clear_texture mirror the pipe function (Roland Scheidegger) v2: rework util clear functions such that they operate on a resource instead of a surface (Roland Scheidegger) Creates a util_clear_texture function for implementing the GL_ARB_clear_texture in softpipe and llvmpipe. Signed-off-by: Lars Hamre --- CC: Roland Scheidegger NOTE: someone with access will need to commit this post review process src/gallium/auxiliary/util/u_surface.c | 386 - src/gallium/auxiliary/util/u_surface.h | 7 + 2 files changed, 248 insertions(+), 145 deletions(-) diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index a9ed006..f2a471d 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -388,6 +388,66 @@ no_src_map: ; } +static void +util_clear_color_texture_helper(struct pipe_transfer *dst_trans, +ubyte *dst_map, +enum pipe_format format, +const union pipe_color_union *color, +unsigned width, unsigned height, unsigned depth) +{ + union util_color uc; + + assert(dst_trans->stride > 0); + + if (util_format_is_pure_integer(format)) { + /* + * We expect int/uint clear values here, though some APIs + * might disagree (but in any case util_pack_color() + * couldn't handle it)... + */ + if (util_format_is_pure_sint(format)) { + util_format_write_4i(format, color->i, 0, &uc, 0, 0, 0, 1, 1); + } else { + assert(util_format_is_pure_uint(format)); + util_format_write_4ui(format, color->ui, 0, &uc, 0, 0, 0, 1, 1); + } + } else { + util_pack_color(color->f, format, &uc); + } + + util_fill_box(dst_map, format, + dst_trans->stride, dst_trans->layer_stride, + 0, 0, 0, width, height, depth, &uc); +} + +static void +util_clear_color_texture(struct pipe_context *pipe, + struct pipe_resource *texture, + const union pipe_color_union *color, + unsigned level, + unsigned dstx, unsigned dsty, unsigned dstz, + unsigned width, unsigned height, unsigned depth) +{ + struct pipe_transfer *dst_trans; + ubyte *dst_map; + enum pipe_format format = texture->format; + + dst_map = pipe_transfer_map_3d(pipe, + texture, + level, + PIPE_TRANSFER_WRITE, + dstx, dsty, dstz, + width, height, depth, + &dst_trans); + if (!dst_map) + return; + + if (dst_trans->stride > 0) { + util_clear_color_texture_helper(dst_trans, dst_map, format, color, + width, height, depth); + } + pipe->transfer_unmap(pipe, dst_trans); +} #define UBYTE_TO_USHORT(B) ((B) | ((B) << 8)) @@ -410,8 +470,6 @@ util_clear_render_target(struct pipe_context *pipe, { struct pipe_transfer *dst_trans; ubyte *dst_map; - union util_color uc; - unsigned max_layer; assert(dst->texture); if (!dst->texture) @@ -426,56 +484,202 @@ util_clear_render_target(struct pipe_context *pipe, unsigned pixstride = util_format_get_blocksize(dst->format); dx = (dst->u.buf.first_element + dstx) * pixstride; w = width * pixstride; - max_layer = 0; dst_map = pipe_transfer_map(pipe, dst->texture, 0, 0, PIPE_TRANSFER_WRITE, dx, 0, w, 1, &dst_trans); + if (dst_map) { + util_clear_color_texture_helper(dst_trans, dst_map, dst->format, color, + width, height, 1); + pipe->transfer_unmap(pipe, dst_trans); + } } else { - max_layer = dst->u.tex.last_layer - dst->u.tex.first_layer; - dst_map = pipe_transfer_map_3d(pipe, - dst->texture, - dst->u.tex.level, - PIPE_TRANSFER_WRITE, - dstx, dsty, dst->u.tex.first_layer, - width, height, max_layer + 1, &dst_trans); + unsigned depth = dst->u.tex.last_layer - dst->u.tex.first_layer + 1; + util_clear_color_texture(pipe, dst->texture, color, dst->u.tex.level, + dstx, dsty, dst->u.tex.first_layer, + width, height, depth); } +} +static void +util_clear_depth_stencil_texture(struct pipe_context *pipe, + struct pipe_resource *textu
[Mesa-dev] [PATCH 3/4] softpipe: enable clear_texture with util_clear_texture
Passes all corresponding piglit tests. Signed-off-by: Lars Hamre --- CC: Roland Scheidegger NOTE: someone with access will need to commit this post review process src/gallium/drivers/softpipe/sp_screen.c | 3 ++- src/gallium/drivers/softpipe/sp_texture.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 02eff91..aa061d7 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -260,6 +260,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS: case PIPE_CAP_TGSI_ARRAY_COMPONENTS: return 1; + case PIPE_CAP_CLEAR_TEXTURE: + return 1; case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: @@ -268,7 +270,6 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TGSI_TXQS: case PIPE_CAP_FORCE_PERSAMPLE_INTERP: case PIPE_CAP_SHAREABLE_SHADERS: - case PIPE_CAP_CLEAR_TEXTURE: case PIPE_CAP_DRAW_PARAMETERS: case PIPE_CAP_TGSI_PACK_HALF_FLOAT: case PIPE_CAP_MULTI_DRAW_INDIRECT: diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 8dca158..ea5e2c6 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -37,6 +37,7 @@ #include "util/u_math.h" #include "util/u_memory.h" #include "util/u_transfer.h" +#include "util/u_surface.h" #include "sp_context.h" #include "sp_flush.h" @@ -520,6 +521,7 @@ softpipe_init_texture_funcs(struct pipe_context *pipe) pipe->create_surface = softpipe_create_surface; pipe->surface_destroy = softpipe_surface_destroy; + pipe->clear_texture = util_clear_texture; } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/8] gallium: A number of video code fixes
On 02/22/2017 04:46 PM, Christian König wrote: > Am 22.02.2017 um 16:31 schrieb Thomas Hellstrom: >> On 02/22/2017 04:00 PM, Emil Velikov wrote: >>> On 22 February 2017 at 09:30, Thomas Hellstrom >>> wrote: On 02/22/2017 09:56 AM, Christian König wrote: > Am 21.02.2017 um 21:52 schrieb Thomas Hellstrom: >> A couple of fixes / improvements for things I've encountered while >> looking >> through and testing the video code in preparation for a virtual >> hardware video >> driver. > Reviewed-by: Christian König for the whole > set. Thanks for the review, Christian. >>> Worth getting the lot to -stable ? Adding either "cc: mesa-stable..." >>> or "Fixes: $sha1 ("$commit summary")" will do. >>> >>> Haven't looked at the series, so not sure how much of the work is >>> safe/applicable. >>> >>> Thanks >>> Emil >> Hi, Emil, >> >> There is only one significant bugfix in that series, (the vdpau >> multithreading fix), but I'm not sure how and if it affects the current >> drivers. > > Actually thinking more about it that change might be incorrect after all. > > The pipe a decoder is created from can be accessed concurrently > together with the decoder. The problem is the gallium pipe contexts, like GL's are not allowed to be used from separate threads without synchronization. At least no other state trackers I'm aware of are doing that, and if we were allowing it it would cause a lot of additional costly locking. What was happening in our case was that the postprocessing thread and the decoding thread were submitting commands simultaneously wreaking havoc in the pipe context's relocation lists and command buffers. > > E.g. you can hammer on the pipe from thread A and on the decoder from > thread B at the same time and that is fine. Unless the decoder tries to manipulate the pipe's state and command queue. > > > Otherwise you run into a bunch of stalling problems with Kodi for > example. > > Your solution of creating a separate pipe object might work as well, > but I think that could cause problems with the cached sampler views > later on. Agreed. If the decoder is using the cached views for rendering purposes we're in trouble. Another solution would be to holding a single lock while rendering using a context and if we take care to release the locks without waiting for GPU I think the latency incurred would not be too large. IMO the proper solution would be to do something with the get_sampler_views* / get_surfaces* interface. In its simplest form they could take an additional pipe argument. /Thomas > > Regards, > Christian. > >> I hit this problem with mpv --vo vdpau --hwdec vdpau . >> >> In any case it should probably sit in master for a while before we >> decide to crossport. >> >> /Thomas >> >> > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] isl/state: fix assert on raw buffer surface state minimum size
Seems reasonable Are you sure this isn't somehow required on old hardware? Reviewed-by: Jason Ekstrand On Wed, Feb 22, 2017 at 3:39 AM, Samuel Iglesias Gonsálvez < sigles...@igalia.com> wrote: > From IVB PRM, SURFACE_STATE::Height: > > "For typed buffer and structured buffer surfaces, the number of > entries in the buffer ranges from 1 to 2^27 . For raw buffer > surfaces, the number of entries in the buffer is the number of bytes > which can range from 1 to 2^30." > > The minimum value is 1, according to the spec. The spec quote > was already added into the code by 028f6d8317f00. > > Fixes crashing tests under: > > dEQP-VK.robustness.buffer_access.* > > Signed-off-by: Samuel Iglesias Gonsálvez > Cc: ja...@jlekstrand.net > --- > src/intel/isl/isl_surface_state.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/intel/isl/isl_surface_state.c > b/src/intel/isl/isl_surface_state.c > index 29ec289a5d..853bb11846 100644 > --- a/src/intel/isl/isl_surface_state.c > +++ b/src/intel/isl/isl_surface_state.c > @@ -671,7 +671,7 @@ isl_genX(buffer_fill_state_s)(void *state, > */ >if (info->format == ISL_FORMAT_RAW) { > assert(num_elements <= (1ull << 30)); > - assert((num_elements & 3) == 0); > + assert(num_elements > 0); >} else { > assert(num_elements <= (1ull << 27)); >} > -- > 2.11.0 > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/8] gallium: A number of video code fixes
Am 22.02.2017 um 17:23 schrieb Thomas Hellstrom: On 02/22/2017 04:46 PM, Christian König wrote: Am 22.02.2017 um 16:31 schrieb Thomas Hellstrom: On 02/22/2017 04:00 PM, Emil Velikov wrote: On 22 February 2017 at 09:30, Thomas Hellstrom wrote: On 02/22/2017 09:56 AM, Christian König wrote: Am 21.02.2017 um 21:52 schrieb Thomas Hellstrom: A couple of fixes / improvements for things I've encountered while looking through and testing the video code in preparation for a virtual hardware video driver. Reviewed-by: Christian König for the whole set. Thanks for the review, Christian. Worth getting the lot to -stable ? Adding either "cc: mesa-stable..." or "Fixes: $sha1 ("$commit summary")" will do. Haven't looked at the series, so not sure how much of the work is safe/applicable. Thanks Emil Hi, Emil, There is only one significant bugfix in that series, (the vdpau multithreading fix), but I'm not sure how and if it affects the current drivers. Actually thinking more about it that change might be incorrect after all. The pipe a decoder is created from can be accessed concurrently together with the decoder. The problem is the gallium pipe contexts, like GL's are not allowed to be used from separate threads without synchronization. At least no other state trackers I'm aware of are doing that, and if we were allowing it it would cause a lot of additional costly locking. What was happening in our case was that the postprocessing thread and the decoding thread were submitting commands simultaneously wreaking havoc in the pipe context's relocation lists and command buffers. E.g. you can hammer on the pipe from thread A and on the decoder from thread B at the same time and that is fine. Unless the decoder tries to manipulate the pipe's state and command queue. Which is forbidden. See the shader based MPEG2 implementation for an example how to properly handle that. Actually the decoder should be created from the screen object, not from the pipe object. That it uses the pipe object has only historical reasons and should be fixed sooner or later, but as you noted below as well we would need to fix the video buffer interface for this. Otherwise you run into a bunch of stalling problems with Kodi for example. Your solution of creating a separate pipe object might work as well, but I think that could cause problems with the cached sampler views later on. Agreed. If the decoder is using the cached views for rendering purposes we're in trouble. Another solution would be to holding a single lock while rendering using a context and if we take care to release the locks without waiting for GPU I think the latency incurred would not be too large. We tried this approach before and it is not an option. Hardware decoders sooner or later need to block for internal resources, resulting in stalls in the output pipeline if the same locks are taken on both paths. IMO the proper solution would be to do something with the get_sampler_views* / get_surfaces* interface. In its simplest form they could take an additional pipe argument. Yes, agree completely. Christian. /Thomas Regards, Christian. I hit this problem with mpv --vo vdpau --hwdec vdpau . In any case it should probably sit in master for a while before we decide to crossport. /Thomas ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/8] gallium: A number of video code fixes
On 02/22/2017 05:54 PM, Christian König wrote: > Am 22.02.2017 um 17:23 schrieb Thomas Hellstrom: >> On 02/22/2017 04:46 PM, Christian König wrote: >>> Am 22.02.2017 um 16:31 schrieb Thomas Hellstrom: On 02/22/2017 04:00 PM, Emil Velikov wrote: > On 22 February 2017 at 09:30, Thomas Hellstrom > wrote: >> On 02/22/2017 09:56 AM, Christian König wrote: >>> Am 21.02.2017 um 21:52 schrieb Thomas Hellstrom: A couple of fixes / improvements for things I've encountered while looking through and testing the video code in preparation for a virtual hardware video driver. >>> Reviewed-by: Christian König for the >>> whole >>> set. >> Thanks for the review, Christian. > Worth getting the lot to -stable ? Adding either "cc: mesa-stable..." > or "Fixes: $sha1 ("$commit summary")" will do. > > Haven't looked at the series, so not sure how much of the work is > safe/applicable. > > Thanks > Emil Hi, Emil, There is only one significant bugfix in that series, (the vdpau multithreading fix), but I'm not sure how and if it affects the current drivers. >>> Actually thinking more about it that change might be incorrect after >>> all. >>> >>> The pipe a decoder is created from can be accessed concurrently >>> together with the decoder. >> The problem is the gallium pipe contexts, like GL's are not allowed to >> be used from separate threads without synchronization. At least no other >> state trackers I'm aware of are doing that, and if we were allowing it >> it would cause a lot of additional costly locking. What was happening in >> our case was that the postprocessing thread and the decoding thread were >> submitting commands simultaneously wreaking havoc in the pipe context's >> relocation lists and command buffers. >> >>> E.g. you can hammer on the pipe from thread A and on the decoder from >>> thread B at the same time and that is fine. >> Unless the decoder tries to manipulate the pipe's state and command >> queue. > > Which is forbidden. See the shader based MPEG2 implementation for an > example how to properly handle that. > > Actually the decoder should be created from the screen object, not > from the pipe object. > > That it uses the pipe object has only historical reasons and should be > fixed sooner or later, but as you noted below as well we would need to > fix the video buffer interface for this. OK. Then I feel confident reverting this change and instead create a new pipe object from within the driver decoder. Does that sound OK with you? /Thomas ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] anv: ensure that we do not emit negative Depth in 3DSTATE_DEPTH_BUFFER
On Wed, Feb 22, 2017 at 6:45 AM, Iago Toral Quiroga wrote: > This fixes a number of new CTS tests that would crash otherwise: > dEQP-VK.pipeline.render_to_image.* > --- > src/intel/vulkan/genX_cmd_buffer.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/intel/vulkan/genX_cmd_buffer.c > b/src/intel/vulkan/genX_cmd_buffer.c > index 40a72f4..cdd4501 100644 > --- a/src/intel/vulkan/genX_cmd_buffer.c > +++ b/src/intel/vulkan/genX_cmd_buffer.c > @@ -2270,7 +2270,8 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer > *cmd_buffer) > assert(image->depth_surface.isl.dim != ISL_SURF_DIM_3D); > db.Depth = > db.RenderTargetViewExtent = > -iview->isl.array_len - iview->isl.base_array_layer - 1; > +iview->isl.array_len <= iview->isl.base_array_layer > + ? 0 : iview->isl.array_len - iview->isl.base_array_layer - > 1; > I think both the old code and the new code is broken. :( I believe what we actually want here is just array_len; we don't want to subtract base_array_layer. Does using just iview->isl.array_len fix the issue? > > #if GEN_GEN >= 8 > db.SurfaceQPitch = > -- > 2.7.4 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] r600/radeonsi: enable glsl/tgsi on-disk cache
On 22 February 2017 at 14:57, Marc Dietrich wrote: > Am Mittwoch, 22. Februar 2017, 15:48:18 CET schrieb Emil Velikov: >> On 22 February 2017 at 13:31, Marc Dietrich wrote: >> > Am Mittwoch, 22. Februar 2017, 04:45:46 CET schrieb Timothy Arceri: >> >> For gpu generations that use LLVM we create a timestamp string >> >> containing both the LLVM and Mesa build times, otherwise we just >> >> use the Mesa build time. >> >> >> >> Reviewed-by: Marek Olšák >> >> Reviewed-by: Edward O'Callaghan >> >> --- >> >> >> >> src/gallium/drivers/radeon/r600_pipe_common.c | 43 >> >> >> >> +++ src/gallium/drivers/radeon/r600_pipe_common.h >> >> | >> >> >> >> 3 ++ >> >> 2 files changed, 46 insertions(+) >> >> >> >> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c >> >> b/src/gallium/drivers/radeon/r600_pipe_common.c index 1781584..bae6d6f >> >> 100644 >> >> --- a/src/gallium/drivers/radeon/r600_pipe_common.c >> >> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c >> >> @@ -43,6 +43,10 @@ >> >> >> >> #define HAVE_LLVM 0 >> >> #endif >> >> >> >> +#if HAVE_LLVM >> >> +#include >> >> +#endif >> >> + >> >> >> >> #ifndef MESA_LLVM_VERSION_PATCH >> >> #define MESA_LLVM_VERSION_PATCH 0 >> >> #endif >> >> >> >> @@ -779,6 +783,41 @@ static const char* r600_get_chip_name(struct >> >> r600_common_screen *rscreen) } >> >> >> >> } >> >> >> >> +static void r600_disk_cache_create(struct r600_common_screen *rscreen) >> >> +{ >> >> + uint32_t mesa_timestamp; >> >> + if (disk_cache_get_function_timestamp(r600_disk_cache_create, >> >> + &mesa_timestamp)) { >> >> + char *timestamp_str; >> >> + int res = -1; >> >> + if (rscreen->chip_class < SI) { >> >> + res = asprintf(×tamp_str, >> >> "%u",mesa_timestamp); >> >> + } >> >> +#if HAVE_LLVM >> >> + else { >> >> + uint32_t llvm_timestamp; >> >> + if >> >> (disk_cache_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, + >> >> &llvm_timestamp)) >> >> { + res = asprintf(×tamp_str, "%u_%u", >> >> +mesa_timestamp, >> >> llvm_timestamp); + } >> >> + } >> >> +#endif >> > >> > maybe this fails to link later in omx with r600 only compile. >> > >> > make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ >> > wird betreten >> > >> > CXXLDlibomx_mesa.la >> > >> > ../../../../src/gallium/drivers/radeon/.libs/libradeon.a(r600_pipe_common. >> > o): In function `r600_disk_cache_create': >> > r600_pipe_common.c:(.text+0x2000): undefined reference to >> > `LLVMInitializeAMDGPUTargetInfo' >> > collect2: error: ld returned 1 exit status >> > make[4]: *** [Makefile:791: libomx_mesa.la] Fehler 1 >> > make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ >> > wird verlassen >> >> That should not happen since >> - Compile guard HAVE_LLVM is defined when --enable-llvm is set >> (explicitly or not) >> - Makefile/link guard HAVE_GALLIUM_LLVM is set when the --enable-llvm is >> >> Please make clean/git clean and report the output of make V=1 if the >> final link still fails. > > still same. I added -lLLVMAMDGPUInfo to LLVM_{LDFLAGS|LIBS}. Now it compiles, > but GL apps crash during context creation. I also tested the initial version > posted and this worked just fine. I have llvm enabled. > Afaict there is no functional change that would trigger this issue - either things were broken before (but went unnoticed) or something is going bonkers here. First things first: - is this issue with multiple static LLVM libraries or multiple shared LLVM libraries ? - can you reproduce with simple shared LLVM library Note that multiple shared LLVM libraries is not supported on our end :-\ As a follow-up: - can you analyse the output of libvulkan_radeon.so linking vs libomx.so - missing -lLLVMfoo, strange order etc. - check if correct the component is not added to the LLVM_COMPONENT list (in configure.ac) - send us a patch that fixes the problem on your end, please ;-) Thanks Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/8] gallium: A number of video code fixes
Am 22.02.2017 um 18:05 schrieb Thomas Hellstrom: On 02/22/2017 05:54 PM, Christian König wrote: Am 22.02.2017 um 17:23 schrieb Thomas Hellstrom: On 02/22/2017 04:46 PM, Christian König wrote: Am 22.02.2017 um 16:31 schrieb Thomas Hellstrom: On 02/22/2017 04:00 PM, Emil Velikov wrote: On 22 February 2017 at 09:30, Thomas Hellstrom wrote: On 02/22/2017 09:56 AM, Christian König wrote: Am 21.02.2017 um 21:52 schrieb Thomas Hellstrom: A couple of fixes / improvements for things I've encountered while looking through and testing the video code in preparation for a virtual hardware video driver. Reviewed-by: Christian König for the whole set. Thanks for the review, Christian. Worth getting the lot to -stable ? Adding either "cc: mesa-stable..." or "Fixes: $sha1 ("$commit summary")" will do. Haven't looked at the series, so not sure how much of the work is safe/applicable. Thanks Emil Hi, Emil, There is only one significant bugfix in that series, (the vdpau multithreading fix), but I'm not sure how and if it affects the current drivers. Actually thinking more about it that change might be incorrect after all. The pipe a decoder is created from can be accessed concurrently together with the decoder. The problem is the gallium pipe contexts, like GL's are not allowed to be used from separate threads without synchronization. At least no other state trackers I'm aware of are doing that, and if we were allowing it it would cause a lot of additional costly locking. What was happening in our case was that the postprocessing thread and the decoding thread were submitting commands simultaneously wreaking havoc in the pipe context's relocation lists and command buffers. E.g. you can hammer on the pipe from thread A and on the decoder from thread B at the same time and that is fine. Unless the decoder tries to manipulate the pipe's state and command queue. Which is forbidden. See the shader based MPEG2 implementation for an example how to properly handle that. Actually the decoder should be created from the screen object, not from the pipe object. That it uses the pipe object has only historical reasons and should be fixed sooner or later, but as you noted below as well we would need to fix the video buffer interface for this. OK. Then I feel confident reverting this change and instead create a new pipe object from within the driver decoder. Does that sound OK with you? Yes, sounds perfectly fine with me. Thanks, Christian. /Thomas ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] Model INTEL perf query backend after query object BE
On Wed, Feb 22, 2017 at 1:24 AM, Kenneth Graunke wrote: > On Wednesday, February 15, 2017 1:37:36 PM PST Robert Bragg wrote: >> Instead of using the same backend interface as AMD_performance_monitor >> this defines a dedicated INTEL_performance_query interface that is >> modelled more on the ARB_query_buffer_object interface (considering the >> similarity of the extensions) with the addition of vfuncs for >> initializing and enumerating query and counter info. > > Patches 1 and 2's commit titles should start with "mesa: ". Ah, yup okey. > >> Compared to the previous backend, some notable differences are: >> >> - The backend is free to represent counters using whatever data >> structures are optimal/convenient since queries and counters are >> enumerated via an iterator api instead of declaring them using >> structures directly shared with the frontend. >> >> This is also done to help us support the full range of data and >> semantic types available with INTEL_performance_query which is awkward >> while using a structure shared with the AMD_performance_monitor >> backend since neither extension's types are a subset of the other. >> >> - The backend must support waiting for a query instead of the frontend >> simply using glFinish(). >> >> - Objects go through 'Active' and 'Ready' states consistent with the >> query object backend (hopefully making them more familiar). There is >> no 'Ended' state (which used to show that a query has ended at least >> once for a given object). There is a new 'Used' state similar to the >> 'EverBound' state of query objects, set when a query is first begun >> which implies that we are expecting to get results back for the object >> at some point. > > That's a little different from EverBound, which is used to answer stupid > glIsFoo() queries - where glGenFoo() doesn't actually "create" a Foo, > but glBindFoo() does. An awkward concept. Ok, makes sense now. I've updated the comment to note there's no equivalent to EverBound needed here. > >> The INTEL_performance_query and AMD_performance_monitor extensions are >> now completely orthogonal within Mesa main (though a driver could >> optionally choose to implement both extensions within a unified backend >> if that were convenient for the sake of sharing state/code). >> >> v2: (Samuel Pitoiset) >> - init PerfQuery.NumQueries in frontend >> - s/return_string/output_clipped_string/ >> - s/backed/backend/ typo >> - remove redundant *bytesWritten = 0 >> v3: >> - Add InitPerfQueryInfo for lazy probing of available queries >> >> Signed-off-by: Robert Bragg >> --- >> src/mesa/main/dd.h| 41 +++ >> src/mesa/main/mtypes.h| 24 +- >> src/mesa/main/performance_query.c | 625 >> ++ >> src/mesa/main/performance_query.h | 6 +- >> 4 files changed, 295 insertions(+), 401 deletions(-) >> >> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h >> index 7ebd084ca3..e77df31cf2 100644 >> --- a/src/mesa/main/dd.h >> +++ b/src/mesa/main/dd.h >> @@ -780,6 +780,47 @@ struct dd_function_table { >> /*@}*/ >> >> /** >> +* \name Performance Query objects >> +*/ >> + /*@{*/ >> + GLuint (*InitPerfQueryInfo)(struct gl_context *ctx); >> + void (*GetPerfQueryInfo)(struct gl_context *ctx, >> +int queryIndex, >> +const char **name, >> +GLuint *dataSize, >> +GLuint *numCounters, >> +GLuint *numActive); >> + void (*GetPerfCounterInfo)(struct gl_context *ctx, >> + int queryIndex, >> + int counterIndex, >> + const char **name, >> + const char **desc, >> + GLuint *offset, >> + GLuint *data_size, >> + GLuint *type_enum, >> + GLuint *data_type_enum, >> + GLuint64 *raw_max); >> + struct gl_perf_query_object * (*NewPerfQueryObject)(struct gl_context >> *ctx, >> + int queryIndex); >> + void (*DeletePerfQuery)(struct gl_context *ctx, >> + struct gl_perf_query_object *obj); >> + GLboolean (*BeginPerfQuery)(struct gl_context *ctx, >> + struct gl_perf_query_object *obj); >> + void (*EndPerfQuery)(struct gl_context *ctx, >> +struct gl_perf_query_object *obj); >> + void (*WaitPerfQuery)(struct gl_context *ctx, >> + struct gl_perf_query_object *obj); >> + GLboolean (*IsPerfQueryReady)(struct gl_context *ctx, >> + struct gl_perf_query_object *obj); >> + void (*GetPerfQueryData)(struct gl_context *ctx, >> +struct gl_perf_query_object
Re: [Mesa-dev] [PATCH v2] i965: Implement INTEL_performance_query backend
On Wed, Feb 22, 2017 at 1:26 AM, Kenneth Graunke wrote: > On Thursday, February 16, 2017 5:20:37 AM PST Robert Bragg wrote: > [snip] >> + switch(obj->query->kind) { > > Space after "switch" please. Oh, oops, repeated that in a few places. > > Patch 3 is: > Reviewed-by: Kenneth Graunke Thanks ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 5/8] gallium: add get_disk_shader_cache() callback
On 22.02.2017 16:19, Michel Dänzer wrote: On 22/02/17 07:58 PM, Nicolai Hähnle wrote: On 22.02.2017 07:23, Michel Dänzer wrote: On 22/02/17 12:45 PM, Timothy Arceri wrote: +get_disk_shader_cache +^ + +Returns a pointer to driver-specific on-disk shader cache. If the driver +failed to create the cache or does not support an on-disk shader cache NULL is +returned. [...] + /** +* Returns a pointer to driver-specific on-disk shader cache. If the driver +* failed to create the cache or does not support an on-disk shader cache +* NULL is returned. +*/ + struct disk_cache *(*get_disk_shader_cache)(struct pipe_screen *screen); }; Drivers which don't support an on-disk shader cache don't set this callback in the first place, right? :) (Just a suggestion for improvement before landing this patch, not a blocker, no need to resend) Yeah, but creating the shader cache might have failed, or it might be disabled. Perhaps a driver that doesn't do its own caching might want to initialize the cache lazily. I think the interface is more flexible this way. Sure. Maybe I was being too cryptic, sorry. What I mean is that the "or does not support an on-disk shader cache" language in the callback documentation is slightly misleading, since such drivers should simply not set the callback in the first place. That's all. Ah, yes, that makes sense. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] Model INTEL perf query backend after query object BE
On Wednesday, February 22, 2017 10:35:24 AM PST Robert Bragg wrote: > On Wed, Feb 22, 2017 at 1:24 AM, Kenneth Graunke > wrote: > > On Wednesday, February 15, 2017 1:37:36 PM PST Robert Bragg wrote: [snip] > >> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h > >> index f3a24df589..e6cf1f4af6 100644 > >> --- a/src/mesa/main/mtypes.h > >> +++ b/src/mesa/main/mtypes.h > >> @@ -1860,6 +1860,23 @@ struct gl_perf_monitor_group > >> > >> > >> /** > >> + * A query object instance as described in INTEL_performance_query. > >> + * > >> + * NB: We want to keep this and the corresponding backend structure > >> + * relatively lean considering that applications may expect to > >> + * allocate enough objects to be able to query around all draw calls > >> + * in a frame. > >> + */ > >> +struct gl_perf_query_object > >> +{ > >> + GLuint Id;/**< hash table ID/name */ > >> + GLuint Used:1;/**< has been used for 1 or more queries */ > >> + GLuint Active:1; /**< inside Begin/EndPerfQuery */ > >> + GLuint Ready:1; /**< result is ready? */ > > > > Please use "unsigned Id" and "bool Used:1" - we're trying to get away > > from GL type aliases when not directly API-facing. > > Ah right I was generally aware of that but doing a skimming everything > with this in mind I found a few other little bits to clean up though I > ended having some second thoughts about these particular members: > > This Id is a record of the GLuint ID given to the application, just > used for debugging currently. The value is returned by > _mesa_HashFindFreeKeyBlock() which is currently implemented in terms > of the GLuint type. One other place where we access the same ID for > debugging is via _mesa_HashWalk() which takes a callback expecting a > GLuint argument. I can still change, but when I thought about this it > felt like it was indeed a directly api facing value. > > For the bitfields I started over thinking what it means to have a bool > bitfield since I doubted whether it could be assumed to be unsigned > and then wondered about the potential for a bug with some code trying > to compare a bitfield value == 1, or indexing an array. Does Mesa > require a c99 compiler, otherwise I don't think it's unheard of for > bool to end up as a signed int typedef. Anyway, besides the > overly-pedantic thought, I guessed you wouldn't really mind me using > "unsigned Used:1;" for the sake of avoiding GLuint. I don't think it > would make a practical difference since the struct will be naturally > padded to 8 bytes in all likelyhood either way. I'll prod you on IRC > to check if you really have a strong opinion here before I push. We assume bool types become 0 or 1 when cast to integers, as guaranteed by C99. There are existing examples of bool:1 in NIR, i965, and vc4. I think it should be OK in Mesa core. But, feel free to use unsigned. Or GLuint when you have a rationale for doing so, as above. A lot of people just use GL types everywhere for no particular reason, but it makes some sense here. --Ken signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/mesa: inform the driver of framebuffer changes before compute dispatches
From: Nicolai Hähnle Even though compute shaders cannot access the framebuffer, there is a synchronization issue when a compute dispatch accesses a texture that was previously bound and drawn to as a framebuffer. Section 9.3 (Feedback Loops Between Textures and the Framebuffer) of the OpenGL 4.5 spec rather implicitly clarifies that undefined behavior results if the texture is still attached to the currently bound framebuffer. However, the feedback loop is broken when the application changes the framebuffer binding before a compute dispatch, and the state tracker needs to let the driver known about this. Fixes GL45-CTS.compute_shader.pipeline-post-fs on SI family Radeons. Cc: mesa-sta...@lists.freedesktop.org --- src/mesa/state_tracker/st_atom.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index 65ac517..9e1137e 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -181,21 +181,29 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline ) struct gl_program *new_cp = ctx->ComputeProgram._Current; if (new_cp != &old_cp->Base) { if (old_cp) st->dirty |= old_cp->affected_states; assert(new_cp); st->dirty |= st_compute_program(new_cp)->affected_states; } st->compute_shader_may_be_dirty = false; - pipeline_mask = ST_PIPELINE_COMPUTE_STATE_MASK; + + /* + * We add the ST_NEW_FB_STATE bit here as well, because glBindFramebuffer + * acts as a barrier that breaks feedback loops between the framebuffer + * and textures bound to the framebuffer, even when those textures are + * accessed by compute shaders; so we must inform the driver of new + * framebuffer state. + */ + pipeline_mask = ST_PIPELINE_COMPUTE_STATE_MASK | ST_NEW_FB_STATE; break; } default: unreachable("Invalid pipeline specified"); } dirty = st->dirty & pipeline_mask; if (!dirty) return; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/4] Various memory error fixes
Hi, this is a bunch of patches for random problems that were all found by running with -fsanitize=address. Please review! Thanks, Nicolai -- src/compiler/glsl/ast_to_hir.cpp | 55 +++- src/mesa/main/api_loopback.c | 3 +- src/mesa/main/api_validate.c | 41 ++- src/mesa/main/api_validate.h | 2 +- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 11 +++- 5 files changed, 81 insertions(+), 31 deletions(-) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4] mesa: Avoid out-of-bounds stack read via _mesa_Materiali
From: Nicolai Hähnle MATERIALFV may end up reading up to 4 floats from the passed parameter. This should really set a GL_INVALID_ENUM error in the cases where it matters, but does anybody really care? Found by ASAN in piglit gl-1.0-beginend-coverage. --- src/mesa/main/api_loopback.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c index 8b63d9c..1db6ce1 100644 --- a/src/mesa/main/api_loopback.c +++ b/src/mesa/main/api_loopback.c @@ -858,21 +858,22 @@ void GLAPIENTRY _mesa_Materialf( GLenum face, GLenum pname, GLfloat param ) { GLfloat fparam[4]; fparam[0] = param; MATERIALFV( face, pname, fparam ); } void GLAPIENTRY _mesa_Materiali(GLenum face, GLenum pname, GLint param ) { - GLfloat p = (GLfloat) param; + GLfloat p[4]; + p[0] = (GLfloat) param; MATERIALFV(face, pname, &p); } void GLAPIENTRY _mesa_Materialiv(GLenum face, GLenum pname, const GLint *params ) { GLfloat fparam[4]; switch (pname) { case GL_AMBIENT: case GL_DIFFUSE: -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4] glsl: fix use-after-free when processing array re-declarations
From: Nicolai Hähnle When determining whether the array is implicitly sized, we must avoid accessing var->data.mode (around line 5270), because var may have been deleted. Instead of adding yet another ternary condition based on earlier == NULL, refactor get_variable_being_redeclared so that we do not keep dangling pointers around. Found by ASAN in GL45-CTS.gtf21.GL.build.array10_frag. Cc: mesa-sta...@lists.freedesktop.org --- src/compiler/glsl/ast_to_hir.cpp | 55 ++-- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index b90ad97..57a9db9 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -3942,44 +3942,50 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, "the shared storage qualifiers can only be used with " "compute shaders"); } apply_image_qualifier_to_variable(qual, var, state, loc); } /** * Get the variable that is being redeclared by this declaration * + * \p pvar is changed to point to an existing variable in the current scope if + * the declaration that it initially points to is a redeclaration. + * + * The declaration originally pointed to by \p pvar may be deleted. + * * Semantic checks to verify the validity of the redeclaration are also * performed. If semantic checks fail, compilation error will be emitted via - * \c _mesa_glsl_error, but a non-\c NULL pointer will still be returned. + * \c _mesa_glsl_error, but a non-\c NULL pointer will still be provided. * * \returns - * A pointer to an existing variable in the current scope if the declaration - * is a redeclaration, \c NULL otherwise. + * Whether the declaration is a redeclaration. */ -static ir_variable * -get_variable_being_redeclared(ir_variable *var, YYLTYPE loc, +static bool +get_variable_being_redeclared(ir_variable **pvar, YYLTYPE loc, struct _mesa_glsl_parse_state *state, bool allow_all_redeclarations) { + ir_variable *var = *pvar; + /* Check if this declaration is actually a re-declaration, either to * resize an array or add qualifiers to an existing variable. * * This is allowed for variables in the current scope, or when at * global scope (for built-ins in the implicit outer scope). */ ir_variable *earlier = state->symbols->get_variable(var->name); if (earlier == NULL || (state->current_function != NULL && !state->symbols->name_declared_this_scope(var->name))) { - return NULL; + return false; } /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec, * * "It is legal to declare an array without a size and then * later re-declare the same name as an array of the same * type and specify a size." */ if (earlier->type->is_unsized_array() && var->type->is_array() @@ -4082,21 +4088,22 @@ get_variable_being_redeclared(ir_variable *var, YYLTYPE loc, var->name); } else if (earlier->type != var->type) { _mesa_glsl_error(&loc, state, "redeclaration of `%s' has incorrect type", var->name); } } else { _mesa_glsl_error(&loc, state, "`%s' redeclared", var->name); } - return earlier; + *pvar = earlier; + return true; } /** * Generate the IR for an initializer in a variable declaration */ ir_rvalue * process_initializer(ir_variable *var, ast_declaration *decl, ast_fully_specified_type *type, exec_list *initializer_instructions, struct _mesa_glsl_parse_state *state) @@ -5196,56 +5203,54 @@ ast_declarator_list::hir(exec_list *instructions, * list. This list will be added to the instruction stream (below) after * the declaration is added. This is done because in some cases (such as * redeclarations) the declaration may not actually be added to the * instruction stream. */ exec_list initializer_instructions; /* Examine var name here since var may get deleted in the next call */ bool var_is_gl_id = is_gl_identifier(var->name); - ir_variable *earlier = - get_variable_being_redeclared(var, decl->get_location(), state, + bool is_redeclaration = + get_variable_being_redeclared(&var, decl->get_location(), state, false /* allow_all_redeclarations */); - if (earlier != NULL) { + if (is_redeclaration) { if (var_is_gl_id && - earlier->data.how_declared == ir_var_declared_in_block) { + var->data.how_declared == ir_var_declared_in_block) { _mesa_glsl_error(&loc, state, "`%s' has already been redeclared using " -
[Mesa-dev] [PATCH 3/4] st/glsl_to_tgsi: avoid iterating past the head of the instruction list
From: Nicolai Hähnle exec_node::get_prev() does not guard against going past the beginning of the list, so we need to add explicit checks here. Found by ASAN in piglit arb_shader_storage_buffer_object-rendering. Cc: mesa-sta...@lists.freedesktop.org --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 630f5af..fac41b8 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3603,24 +3603,31 @@ glsl_to_tgsi_visitor::visit_ssbo_intrinsic(ir_call *ir) } /* The emit_asm() might have actually split the op into pieces, e.g. for * double stores. We have to go back and fix up all the generated ops. */ unsigned op = inst->op; do { inst->resource = buffer; if (access) inst->buffer_access = access->value.u[0]; + + if (inst == this->instructions.get_head_raw()) + break; inst = (glsl_to_tgsi_instruction *)inst->get_prev(); - if (inst->op == TGSI_OPCODE_UADD) + + if (inst->op == TGSI_OPCODE_UADD) { + if (inst == this->instructions.get_head_raw()) +break; inst = (glsl_to_tgsi_instruction *)inst->get_prev(); - } while (inst && inst->op == op && inst->resource.file == PROGRAM_UNDEFINED); + } + } while (inst->op == op && inst->resource.file == PROGRAM_UNDEFINED); } void glsl_to_tgsi_visitor::visit_membar_intrinsic(ir_call *ir) { switch (ir->callee->intrinsic_id) { case ir_intrinsic_memory_barrier: emit_asm(ir, TGSI_OPCODE_MEMBAR, undef_dst, st_src_reg_for_int(TGSI_MEMBAR_SHADER_BUFFER | TGSI_MEMBAR_ATOMIC_BUFFER | -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] mesa/main: fix MultiDrawElements[BaseVertex] validation of primcount
From: Nicolai Hähnle primcount must be a GLsizei as in the signature for MultiDrawElements or bad things can happen. Furthermore, an error should be flagged when primcount is negative (plus there is an argument about whether it should be flagged when primcount is 0, but let's worry about that separately). Curiously, this code used to work somewhat correctly even when primcount was negative, because the loop that checks count[i] would iterate out of bounds and almost certainly hit a negative value at some point. Found by an ASAN error in GL45-CTS.gtf32.GL3Tests.draw_elements_base_vertex.draw_elements_base_vertex_primcount Note that the OpenGL spec seems to have s/primcount/drawcount/ at some point, and the code still reflects the old language. Cc: mesa-sta...@lists.freedesktop.org --- src/mesa/main/api_validate.c | 41 +++-- src/mesa/main/api_validate.h | 2 +- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 1e8a714..5b05301 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -716,26 +716,63 @@ _mesa_validate_DrawElements(struct gl_context *ctx, /** * Error checking for glMultiDrawElements(). Includes parameter checking * and VBO bounds checking. * \return GL_TRUE if OK to render, GL_FALSE if error found */ GLboolean _mesa_validate_MultiDrawElements(struct gl_context *ctx, GLenum mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, - GLuint primcount) + GLsizei primcount) { - unsigned i; + GLsizei i; FLUSH_CURRENT(ctx, 0); + /* +* Section 10.4 (Drawing Commands Using Vertex Arrays) of the OpenGL 4.5 +* (Compatibility Profile) spec defines MultiDrawElements as equivalent to: +* +*if (mode, drawcount, or type is invalid) +* generate appropriate error +*else { +* for (int i = 0; i < drawcount; i++) +* DrawElementsOneInstance(mode, count[i], type, +* indices[i], 0, 0, 0); +*} +* +* However, it does not say when drawcount is invalid or what the +* appropriate error would be. +* +* The same section does define the error condition for the similar +* MultiDrawElementsIndirect: +* +*"An INVALID_VALUE error is generated if drawcount is not positive." +* +* It would make sense to apply the same condition here, but +* +* (1) this language was only introduced together with the *Indirect() draw +* calls and is quite far removed textually, and +* +* (2) GL45-CTS.gtf32.GL3Tests.draw_elements_base_vertex.draw_elements_base_vertex_primcount +* expects to get an error iff the value is negative. +* +* This looks like a gap in the spec, but until that is resolved, let's just +* follow what the CTS expects. +*/ + if (primcount < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glMultiDrawElements(primcount=%d)", primcount); + return GL_FALSE; + } + for (i = 0; i < primcount; i++) { if (count[i] < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glMultiDrawElements(count)" ); return GL_FALSE; } } if (!_mesa_valid_prim_mode(ctx, mode, "glMultiDrawElements")) { return GL_FALSE; diff --git a/src/mesa/main/api_validate.h b/src/mesa/main/api_validate.h index e94f02e..de520c9 100644 --- a/src/mesa/main/api_validate.h +++ b/src/mesa/main/api_validate.h @@ -50,21 +50,21 @@ _mesa_validate_DrawArrays(struct gl_context *ctx, GLenum mode, GLsizei count); extern GLboolean _mesa_validate_DrawElements(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); extern GLboolean _mesa_validate_MultiDrawElements(struct gl_context *ctx, GLenum mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, - GLuint primcount); + GLsizei primcount); extern GLboolean _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); extern GLboolean _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint first, -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] anv: Enable MSAA compression
On Mon 20 Feb 2017, Jason Ekstrand wrote: > This just enables basic MSAA compression (no fast clears) for all > multisampled surfaces. This improves the framerate of the Sascha > "multisampling" demo by 76% on my Sky Lake laptop. Running Talos on > medium settings with 8x MSAA, this improves the framerate in the > benchmark by 80%. > --- > src/intel/vulkan/TODO | 2 +- > src/intel/vulkan/anv_blorp.c | 3 ++- > src/intel/vulkan/anv_image.c | 9 + > src/intel/vulkan/anv_pipeline.c| 19 +++ > src/intel/vulkan/genX_cmd_buffer.c | 5 + > 5 files changed, 36 insertions(+), 2 deletions(-) > diff --git a/src/intel/vulkan/genX_cmd_buffer.c > b/src/intel/vulkan/genX_cmd_buffer.c > index 40a72f4..5d8c3ea 100644 > --- a/src/intel/vulkan/genX_cmd_buffer.c > +++ b/src/intel/vulkan/genX_cmd_buffer.c > @@ -222,6 +222,11 @@ color_attachment_compute_aux_usage(struct anv_device > *device, >att_state->input_aux_usage = ISL_AUX_USAGE_NONE; >att_state->fast_clear = false; >return; > + } else if (iview->image->aux_usage == ISL_AUX_USAGE_MCS) { > + att_state->aux_usage = ISL_AUX_USAGE_MCS; > + att_state->input_aux_usage = ISL_AUX_USAGE_MCS; > + att_state->fast_clear = false; > + return; > } Small nit. It feels awkward that this function, above the hunk, checks iview->image->aux_surface.isl.size == 0, then the next branch checks iview->image->aux_usage. It seems more natural to check aux_usage in both branches. Anyway, that nit fixup belongs in a different commit anyway, for bisection's sake. Reviewed-by: Chad Versace ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] anv: Enable MSAA compression
On Wed, Feb 22, 2017 at 11:09 AM, Chad Versace wrote: > On Mon 20 Feb 2017, Jason Ekstrand wrote: > > This just enables basic MSAA compression (no fast clears) for all > > multisampled surfaces. This improves the framerate of the Sascha > > "multisampling" demo by 76% on my Sky Lake laptop. Running Talos on > > medium settings with 8x MSAA, this improves the framerate in the > > benchmark by 80%. > > --- > > src/intel/vulkan/TODO | 2 +- > > src/intel/vulkan/anv_blorp.c | 3 ++- > > src/intel/vulkan/anv_image.c | 9 + > > src/intel/vulkan/anv_pipeline.c| 19 +++ > > src/intel/vulkan/genX_cmd_buffer.c | 5 + > > 5 files changed, 36 insertions(+), 2 deletions(-) > > > > diff --git a/src/intel/vulkan/genX_cmd_buffer.c > b/src/intel/vulkan/genX_cmd_buffer.c > > index 40a72f4..5d8c3ea 100644 > > --- a/src/intel/vulkan/genX_cmd_buffer.c > > +++ b/src/intel/vulkan/genX_cmd_buffer.c > > @@ -222,6 +222,11 @@ color_attachment_compute_aux_usage(struct > anv_device *device, > >att_state->input_aux_usage = ISL_AUX_USAGE_NONE; > >att_state->fast_clear = false; > >return; > > + } else if (iview->image->aux_usage == ISL_AUX_USAGE_MCS) { > > + att_state->aux_usage = ISL_AUX_USAGE_MCS; > > + att_state->input_aux_usage = ISL_AUX_USAGE_MCS; > > + att_state->fast_clear = false; > > + return; > > } > > Small nit. It feels awkward that this function, above the hunk, checks > iview->image->aux_surface.isl.size == 0, then the next branch checks > iview->image->aux_usage. It seems more natural to check aux_usage in > both branches. > Not so much... aux_surface.isl.size == 0 implies aux_usage == NONE but not the other way around. For gen7 fast clears, for instance, you get NONE in aux_usage because that's the way we use it for texturing. --Jason > Anyway, that nit fixup belongs in a different commit anyway, for > bisection's sake. > > Reviewed-by: Chad Versace > There's also an anv blorp patch that's needed to prevent regressions. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glx/glvnd: Fix GLXdispatchIndex sorting
On 02/20/2017 01:32 AM, Hans de Goede wrote: Hi Emil, On 16-02-17 16:38, Emil Velikov wrote: Hi Hans, On 6 February 2017 at 13:09, Hans de Goede wrote: Commit 8bca8d89ef3b ("glx/glvnd: Fix dispatch function names and indices") fixed the sorting of the array initializers in g_glxglvnddispatchfuncs.c because FindGLXFunction's binary search needs these to be sorted alphabetically. That commit also mostly fixed the sorting of the DI_foo defines in g_glxglvnddispatchindices.h, which is what actually matters as the arrays are initialized using "[DI_foo] = glXfoo," but a small error crept in which at least causes glXGetVisualFromFBConfigSGIX to not resolve, breaking games such as "The Binding of Isaac: Rebirth" and "Crypt of the NecroDancer" from Steam not working and possible causes other problems too. This commit fixes the last of the sorting errors, fixing these mentioned games not working. Fixes: 8bca8d89ef3b ("glx/glvnd: Fix dispatch function names and indices") Cc: "13.0" Cc: "17.0" Cc: Adam Jackson Signed-off-by: Hans de Goede --- A while back as Adam did a similar thing, it was suggested that we get an actual test so that things don't break. I was stupid^Wkind enough to opt for "we can have such patch as follow-up", only that it never came. As you can imagine not cool... Sorry, but for me this was sort of a drive by patch and I don't really have time to work on a test for this. But it looks like ajax owes you a test-case for this, ajax ? Also Kyle Brenneman (added to the CC) who helped me pinpoint the issue to the sorting problem mentioned that he was working on a patch to autogenerate the files in question to avoid breakage like this, Kyle what is the status of that ? Regards, Hans I've got the generation patch almost done. I'm hoping to have it ready by this afternoon. -Kyle ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/6] Removal of PIPE_CAP_USER_INDEX_BUFFERS (take 3)
Hi, This version is hopefully final. I moved the helper code into a separate commit and fixed a pipe_resource leak there. (thanks Brian for the clue) The rest didn't really change. Please review, Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/6] gallium: remove PIPE_CAP_USER_INDEX_BUFFERS
From: Marek Olšák all drivers support it Reviewed-by: Nicolai Hähnle --- src/gallium/docs/source/screen.rst | 4 src/gallium/drivers/etnaviv/etnaviv_screen.c | 1 - src/gallium/drivers/freedreno/freedreno_screen.c | 1 - src/gallium/drivers/i915/i915_screen.c | 1 - src/gallium/drivers/llvmpipe/lp_screen.c | 1 - src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 - src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 - src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 - src/gallium/drivers/r300/r300_screen.c | 1 - src/gallium/drivers/r600/r600_pipe.c | 1 - src/gallium/drivers/radeonsi/si_pipe.c | 1 - src/gallium/drivers/softpipe/sp_screen.c | 1 - src/gallium/drivers/svga/svga_screen.c | 1 - src/gallium/drivers/swr/swr_screen.cpp | 1 - src/gallium/drivers/vc4/vc4_screen.c | 1 - src/gallium/drivers/virgl/virgl_screen.c | 1 - src/gallium/include/pipe/p_defines.h | 1 - 17 files changed, 20 deletions(-) diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 74c8cec..b08c3ce 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -108,24 +108,20 @@ The integer capabilities: limitation. If true, pipe_vertex_buffer::buffer_offset must always be aligned to 4. If false, there are no restrictions on the offset. * ``PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY``: This CAP describes a hw limitation. If true, pipe_vertex_buffer::stride must always be aligned to 4. If false, there are no restrictions on the stride. * ``PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY``: This CAP describes a hw limitation. If true, pipe_vertex_element::src_offset must always be aligned to 4. If false, there are no restrictions on src_offset. * ``PIPE_CAP_COMPUTE``: Whether the implementation supports the compute entry points defined in pipe_context and pipe_screen. -* ``PIPE_CAP_USER_INDEX_BUFFERS``: Whether user index buffers are supported. - If not, the state tracker must upload all indices which are not in hw - resources. If user-space buffers are supported, the driver must also still - accept HW resource buffers. * ``PIPE_CAP_USER_CONSTANT_BUFFERS``: Whether user-space constant buffers are supported. If not, the state tracker must put constants into HW resources/buffers. If user-space constant buffers are supported, the driver must still accept HW constant buffers also. * ``PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT``: Describes the required alignment of pipe_constant_buffer::buffer_offset. * ``PIPE_CAP_START_INSTANCE``: Whether the driver supports pipe_draw_info::start_instance. * ``PIPE_CAP_QUERY_TIMESTAMP``: Whether PIPE_QUERY_TIMESTAMP and the pipe_screen::get_timestamp hook are implemented. diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index d00f5d0..ab436b9 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -129,21 +129,20 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: case PIPE_CAP_SM3: case PIPE_CAP_TEXTURE_BARRIER: case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION: case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_USER_CONSTANT_BUFFERS: case PIPE_CAP_TGSI_TEXCOORD: case PIPE_CAP_VERTEX_COLOR_UNCLAMPED: - case PIPE_CAP_USER_INDEX_BUFFERS: return 1; /* Memory */ case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: return 256; case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 4; /* XXX could easily be supported */ case PIPE_CAP_GLSL_FEATURE_LEVEL: return 120; diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index e1b95a6..e667187 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -172,21 +172,20 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: case PIPE_CAP_SEAMLESS_CUBE_MAP: case PIPE_CAP_VERTEX_COLOR_UNCLAMPED: case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION: case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT: case PIPE_CAP_STRING_MARKER: case PIPE_CAP_MIXED_COLOR_DEPTH_BITS: - case PIPE_CAP_USER_INDEX_BUFFERS: return 1; case PIPE_CAP_VE
[Mesa-dev] [PATCH 2/6] etnaviv: add support for user index buffers
From: Marek Olšák --- src/gallium/drivers/etnaviv/etnaviv_context.c | 12 src/gallium/drivers/etnaviv/etnaviv_screen.c | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c index 5566e0e..dfd9e1f 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_context.c +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c @@ -40,20 +40,21 @@ #include "etnaviv_state.h" #include "etnaviv_surface.h" #include "etnaviv_texture.h" #include "etnaviv_transfer.h" #include "etnaviv_translate.h" #include "etnaviv_zsa.h" #include "pipe/p_context.h" #include "pipe/p_state.h" #include "util/u_blitter.h" +#include "util/u_helpers.h" #include "util/u_memory.h" #include "util/u_prim.h" #include "util/u_upload_mgr.h" #include "hw/common.xml.h" static void etna_context_destroy(struct pipe_context *pctx) { struct etna_context *ctx = etna_context(pctx); @@ -130,20 +131,29 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) DBG("Invalid draw primitive mode=%i or no primitives to be drawn", info->mode); return; } draw_mode = translate_draw_mode(info->mode); if (draw_mode == ETNA_NO_MATCH) { BUG("Unsupported draw mode"); return; } + /* Upload a user index buffer. */ + struct pipe_index_buffer ibuffer_saved = {}; + if (info->indexed && ctx->index_buffer.ib.user_buffer && + !util_save_and_upload_index_buffer(pctx, info, &ctx->index_buffer.ib, + &ibuffer_saved)) { + BUG("Index buffer upload failed."); + return; + } + if (info->indexed && !ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.bo) { BUG("Unsupported or no index buffer"); return; } /* Update any derived state */ if (!etna_state_update(ctx)) return; /* @@ -204,20 +214,22 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) etna_stall(ctx->stream, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); } if (DBG_ENABLED(ETNA_DBG_FLUSH_ALL)) pctx->flush(pctx, NULL, 0); if (ctx->framebuffer.cbuf) etna_resource(ctx->framebuffer.cbuf->texture)->seqno++; if (ctx->framebuffer.zsbuf) etna_resource(ctx->framebuffer.zsbuf->texture)->seqno++; + if (info->indexed && ibuffer_saved.user_buffer) + pctx->set_index_buffer(pctx, &ibuffer_saved); } static void etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence, enum pipe_flush_flags flags) { struct etna_context *ctx = etna_context(pctx); etna_cmd_stream_flush(ctx->stream); diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index ccfa0d8..d00f5d0 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -129,20 +129,21 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: case PIPE_CAP_SM3: case PIPE_CAP_TEXTURE_BARRIER: case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION: case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_USER_CONSTANT_BUFFERS: case PIPE_CAP_TGSI_TEXCOORD: case PIPE_CAP_VERTEX_COLOR_UNCLAMPED: + case PIPE_CAP_USER_INDEX_BUFFERS: return 1; /* Memory */ case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: return 256; case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 4; /* XXX could easily be supported */ case PIPE_CAP_GLSL_FEATURE_LEVEL: return 120; @@ -173,21 +174,20 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_INDEP_BLEND_ENABLE: case PIPE_CAP_INDEP_BLEND_FUNC: case PIPE_CAP_DEPTH_CLIP_DISABLE: case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE: case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS: /* Don't skip strict max uniform limit check */ case PIPE_CAP_FRAGMENT_COLOR_CLAMPED: case PIPE_CAP_VERTEX_COLOR_CLAMPED: case PIPE_CAP_USER_VERTEX_BUFFERS: - case PIPE_CAP_USER_INDEX_BUFFERS: case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT: case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY: case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES: /* TODO: test me out with piglit */ case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT: case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS: case PIPE_CAP_TEXTURE_GATHER_SM5: case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT: case PIPE_CAP_FAKE_SW_MSAA: case PIPE_CAP_TEXTURE_QUERY_LOD: -- 2.7.4 ___ mesa-dev mailing list mesa-dev@list
[Mesa-dev] [PATCH 5/6] st/mesa: assume all drivers support user index buffers
From: Marek Olšák Reviewed-by: Nicolai Hähnle --- src/mesa/state_tracker/st_context.c | 2 -- src/mesa/state_tracker/st_context.h | 1 - src/mesa/state_tracker/st_draw.c| 50 ++--- 3 files changed, 13 insertions(+), 40 deletions(-) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index f4ad6d8..4cc4dab 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -331,22 +331,20 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, st->pipe = pipe; /* XXX: this is one-off, per-screen init: */ st_debug_init(); /* state tracker needs the VBO module */ _vbo_CreateContext(ctx); st->dirty = ST_ALL_STATES_MASK; - st->has_user_indexbuf = - screen->get_param(screen, PIPE_CAP_USER_INDEX_BUFFERS); st->has_user_constbuf = screen->get_param(screen, PIPE_CAP_USER_CONSTANT_BUFFERS); /* Drivers still have to upload zero-stride vertex attribs manually * with the GL core profile, but they don't have to deal with any complex * user vertex buffer uploads. */ unsigned vbuf_flags = ctx->API == API_OPENGL_CORE ? U_VBUF_FLAG_NO_USER_VBOS : 0; st->cso_context = cso_create_context(pipe, vbuf_flags); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 942fdd7..bb00384 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -78,21 +78,20 @@ struct st_context boolean has_time_elapsed; boolean has_shader_model3; boolean has_etc1; boolean has_etc2; boolean prefer_blit_based_texture_transfer; boolean force_persample_in_shader; boolean has_shareable_shaders; boolean has_half_float_packing; boolean has_multi_draw_indirect; boolean has_user_constbuf; - boolean has_user_indexbuf; /** * If a shader can be created when we get its source. * This means it has only 1 variant, not counting glBitmap and * glDrawPixels. */ boolean shader_has_one_variant[MESA_SHADER_STAGES]; boolean needs_texcoord_semantic; boolean apply_texture_swizzle_to_border_color; diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 8d54732..f04b6c2 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -81,55 +81,45 @@ all_varyings_in_vbos(const struct gl_vertex_array *arrays[]) !_mesa_is_bufferobj(arrays[i]->BufferObj)) return GL_FALSE; return GL_TRUE; } /** * Basically, translate Mesa's index buffer information into * a pipe_index_buffer object. - * \return TRUE or FALSE for success/failure */ -static boolean +static void setup_index_buffer(struct st_context *st, - const struct _mesa_index_buffer *ib, - struct pipe_index_buffer *ibuffer) + const struct _mesa_index_buffer *ib) { + struct pipe_index_buffer ibuffer; struct gl_buffer_object *bufobj = ib->obj; - ibuffer->index_size = vbo_sizeof_ib_type(ib->type); + ibuffer.index_size = vbo_sizeof_ib_type(ib->type); /* get/create the index buffer object */ 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 if (!st->has_user_indexbuf) { - /* upload indexes from user memory into a real buffer */ - u_upload_data(st->pipe->stream_uploader, 0, -ib->count * ibuffer->index_size, 4, ib->ptr, -&ibuffer->offset, &ibuffer->buffer); - if (!ibuffer->buffer) { - /* out of memory */ - return FALSE; - } - u_upload_unmap(st->pipe->stream_uploader); + ibuffer.buffer = st_buffer_object(bufobj)->buffer; + ibuffer.offset = pointer_to_offset(ib->ptr); + ibuffer.user_buffer = NULL; } else { /* indices are in user space memory */ - ibuffer->user_buffer = ib->ptr; + ibuffer.buffer = NULL; + ibuffer.offset = 0; + ibuffer.user_buffer = ib->ptr; } - cso_set_index_buffer(st->cso_context, ibuffer); - return TRUE; + cso_set_index_buffer(st->cso_context, &ibuffer); } /** * Set the restart index. */ static void setup_primitive_restart(struct gl_context *ctx, const struct _mesa_index_buffer *ib, struct pipe_draw_info *info) @@ -178,21 +168,20 @@ st_draw_vbo(struct gl_context *ctx, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, GLuint min_index, GLuint max_index, struct gl_transform_feedback_object *tfb_vertcount, unsigned stream, struct gl_buffer_object *indirect) { struct st_context *st = st_context(ctx); - s
[Mesa-dev] [PATCH 4/6] svga: implement user index buffers
From: Marek Olšák --- src/gallium/drivers/svga/svga_pipe_draw.c | 13 - src/gallium/drivers/svga/svga_screen.c| 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c index c51c0b2..bbd4430 100644 --- a/src/gallium/drivers/svga/svga_pipe_draw.c +++ b/src/gallium/drivers/svga/svga_pipe_draw.c @@ -18,20 +18,21 @@ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * **/ #include "util/u_format.h" +#include "util/u_helpers.h" #include "util/u_inlines.h" #include "util/u_prim.h" #include "util/u_prim_restart.h" #include "util/u_time.h" #include "util/u_upload_mgr.h" #include "indices/u_indices.h" #include "svga_hw_reg.h" #include "svga_cmd.h" #include "svga_context.h" @@ -187,20 +188,28 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) boolean needed_swtnl; SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_DRAWVBO); svga->hud.num_draw_calls++; /* for SVGA_QUERY_NUM_DRAW_CALLS */ if (u_reduced_prim(info->mode) == PIPE_PRIM_TRIANGLES && svga->curr.rast->templ.cull_face == PIPE_FACE_FRONT_AND_BACK) goto done; + /* Upload a user index buffer. */ + struct pipe_index_buffer ibuffer_saved = {}; + if (info->indexed && svga->curr.ib.user_buffer && + !util_save_and_upload_index_buffer(pipe, info, &svga->curr.ib, + &ibuffer_saved)) { + return; + } + /* * Mark currently bound target surfaces as dirty * doesn't really matter if it is done before drawing. * * TODO If we ever normaly return something other then * true we should not mark it as dirty then. */ svga_mark_surfaces_dirty(svga_context(pipe)); if (svga->curr.reduced_prim != reduced_prim) { @@ -270,19 +279,21 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) /* XXX: Silence warnings, do something sensible here? */ (void)ret; if (SVGA_DEBUG & DEBUG_FLUSH) { svga_hwtnl_flush_retry( svga ); svga_context_flush(svga, NULL); } done: + if (info->indexed && ibuffer_saved.user_buffer) + pipe->set_index_buffer(pipe, &ibuffer_saved); + SVGA_STATS_TIME_POP(svga_sws(svga)); -; } void svga_init_draw_functions( struct svga_context *svga ) { svga->pipe.draw_vbo = svga_draw_vbo; } diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index f9dfcd2..8af66b7 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -175,20 +175,21 @@ static int svga_get_param(struct pipe_screen *screen, enum pipe_cap param) { struct svga_screen *svgascreen = svga_screen(screen); struct svga_winsys_screen *sws = svgascreen->sws; SVGA3dDevCapResult result; switch (param) { case PIPE_CAP_NPOT_TEXTURES: case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES: case PIPE_CAP_MIXED_COLOR_DEPTH_BITS: + case PIPE_CAP_USER_INDEX_BUFFERS: return 1; case PIPE_CAP_TWO_SIDED_STENCIL: return 1; case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: /* * "In virtually every OpenGL implementation and hardware, * GL_MAX_DUAL_SOURCE_DRAW_BUFFERS is 1" * http://www.opengl.org/wiki/Blending */ return sws->have_vgpu10 ? 1 : 0; @@ -206,21 +207,20 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param) return 0; case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: return sws->have_vgpu10; case PIPE_CAP_TEXTURE_SHADOW_MAP: return 1; case PIPE_CAP_TEXTURE_SWIZZLE: return 1; case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK: return 0; case PIPE_CAP_USER_VERTEX_BUFFERS: - case PIPE_CAP_USER_INDEX_BUFFERS: return 0; case PIPE_CAP_USER_CONSTANT_BUFFERS: return 1; case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: return 256; case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: { unsigned levels = SVGA_MAX_TEXTURE_LEVELS; if (sws->get_cap(sws, SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH, &result)) -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/6] gallium/util: add new helpers for user index buffer uploading
From: Marek Olšák v3: split from the etnaviv patch; fix new_ib.buffer leak --- src/gallium/auxiliary/util/u_helpers.c | 30 ++ src/gallium/auxiliary/util/u_helpers.h | 5 + 2 files changed, 35 insertions(+) diff --git a/src/gallium/auxiliary/util/u_helpers.c b/src/gallium/auxiliary/util/u_helpers.c index 09020b0..35cca82 100644 --- a/src/gallium/auxiliary/util/u_helpers.c +++ b/src/gallium/auxiliary/util/u_helpers.c @@ -20,20 +20,21 @@ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS AND/OR THEIR SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * **/ #include "util/u_helpers.h" #include "util/u_inlines.h" +#include "util/u_upload_mgr.h" /** * This function is used to copy an array of pipe_vertex_buffer structures, * while properly referencing the pipe_vertex_buffer::buffer member. * * enabled_buffers is updated such that the bits corresponding to the indices * of disabled buffers are set to 0 and the enabled ones are set to 1. * * \sa util_copy_framebuffer_state */ @@ -102,10 +103,39 @@ util_set_index_buffer(struct pipe_index_buffer *dst, { if (src) { pipe_resource_reference(&dst->buffer, src->buffer); memcpy(dst, src, sizeof(*dst)); } else { pipe_resource_reference(&dst->buffer, NULL); memset(dst, 0, sizeof(*dst)); } } + +/** + * Given a user index buffer, save the structure to "saved", and upload it. + */ +bool +util_save_and_upload_index_buffer(struct pipe_context *pipe, + const struct pipe_draw_info *info, + const struct pipe_index_buffer *ib, + struct pipe_index_buffer *out_saved) +{ + struct pipe_index_buffer new_ib = {0}; + unsigned start_offset = info->start * ib->index_size; + + u_upload_data(pipe->stream_uploader, start_offset, + info->count * ib->index_size, 4, + (char*)ib->user_buffer + start_offset, + &new_ib.offset, &new_ib.buffer); + if (!new_ib.buffer) + return false; + u_upload_unmap(pipe->stream_uploader); + + new_ib.offset -= start_offset; + new_ib.index_size = ib->index_size; + + util_set_index_buffer(out_saved, ib); + pipe->set_index_buffer(pipe, &new_ib); + pipe_resource_reference(&new_ib.buffer, NULL); + return true; +} diff --git a/src/gallium/auxiliary/util/u_helpers.h b/src/gallium/auxiliary/util/u_helpers.h index a9a53e4..7de960b 100644 --- a/src/gallium/auxiliary/util/u_helpers.h +++ b/src/gallium/auxiliary/util/u_helpers.h @@ -40,15 +40,20 @@ void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst, unsigned start_slot, unsigned count); void util_set_vertex_buffers_count(struct pipe_vertex_buffer *dst, unsigned *dst_count, const struct pipe_vertex_buffer *src, unsigned start_slot, unsigned count); void util_set_index_buffer(struct pipe_index_buffer *dst, const struct pipe_index_buffer *src); +bool util_save_and_upload_index_buffer(struct pipe_context *pipe, + const struct pipe_draw_info *info, + const struct pipe_index_buffer *ib, + struct pipe_index_buffer *out_saved); + #ifdef __cplusplus } #endif #endif -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/6] freedreno: add support for user index buffers
From: Marek Olšák --- src/gallium/drivers/freedreno/freedreno_draw.c | 12 src/gallium/drivers/freedreno/freedreno_screen.c | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index cfe13cd..5d5b7c1 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -24,20 +24,21 @@ * * Authors: *Rob Clark */ #include "pipe/p_state.h" #include "util/u_string.h" #include "util/u_memory.h" #include "util/u_prim.h" #include "util/u_format.h" +#include "util/u_helpers.h" #include "freedreno_draw.h" #include "freedreno_context.h" #include "freedreno_state.h" #include "freedreno_resource.h" #include "freedreno_query_hw.h" #include "freedreno_util.h" static void resource_read(struct fd_batch *batch, struct pipe_resource *prsc) @@ -77,20 +78,28 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) /* emulate unsupported primitives: */ if (!fd_supported_prim(ctx, info->mode)) { if (ctx->streamout.num_targets > 0) debug_error("stream-out with emulated prims"); util_primconvert_save_index_buffer(ctx->primconvert, &ctx->indexbuf); util_primconvert_save_rasterizer_state(ctx->primconvert, ctx->rasterizer); util_primconvert_draw_vbo(ctx->primconvert, info); return; } + /* Upload a user index buffer. */ + struct pipe_index_buffer ibuffer_saved = {}; + if (info->indexed && ctx->indexbuf.user_buffer && + !util_save_and_upload_index_buffer(pctx, info, &ctx->indexbuf, + &ibuffer_saved)) { + return; + } + if (ctx->in_blit) { fd_batch_reset(batch); ctx->dirty = ~0; } batch->blit = ctx->in_blit; batch->back_blit = ctx->in_shadow; /* NOTE: needs to be before resource_written(batch->query_buf), otherwise * query_buf may not be created yet. @@ -194,20 +203,23 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) if (ctx->draw_vbo(ctx, info)) batch->needs_flush = true; for (i = 0; i < ctx->streamout.num_targets; i++) ctx->streamout.offsets[i] += info->count; if (fd_mesa_debug & FD_DBG_DDRAW) ctx->dirty = 0x; fd_batch_check_size(batch); + + if (info->indexed && ibuffer_saved.user_buffer) + pctx->set_index_buffer(pctx, &ibuffer_saved); } /* Generic clear implementation (partially) using u_blitter: */ static void fd_blitter_clear(struct pipe_context *pctx, unsigned buffers, const union pipe_color_union *color, double depth, unsigned stencil) { struct fd_context *ctx = fd_context(pctx); struct pipe_framebuffer_state *pfb = &ctx->batch->framebuffer; struct blitter_context *blitter = ctx->blitter; diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 1122e29..e1b95a6 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -172,20 +172,21 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: case PIPE_CAP_SEAMLESS_CUBE_MAP: case PIPE_CAP_VERTEX_COLOR_UNCLAMPED: case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION: case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT: case PIPE_CAP_STRING_MARKER: case PIPE_CAP_MIXED_COLOR_DEPTH_BITS: + case PIPE_CAP_USER_INDEX_BUFFERS: return 1; case PIPE_CAP_VERTEXID_NOBASE: return is_a3xx(screen) || is_a4xx(screen); case PIPE_CAP_USER_CONSTANT_BUFFERS: return is_a4xx(screen) ? 0 : 1; case PIPE_CAP_SHADER_STENCIL_EXPORT: case PIPE_CAP_TGSI_TEXCOORD: @@ -246,21 +247,20 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_GLSL_FEATURE_LEVEL: if (glsl120) return 120; return is_ir3(screen) ? 140 : 120; /* Unsupported features. */ case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS: case PIPE_CAP_USER_VERTEX_BUFFERS: - case PIPE_CAP_USER_INDEX_BUFFERS: case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_TEXTURE_BORD
Re: [Mesa-dev] [PATCH] glsl: enable early_fragment_tests implicitly with post_depth_coverage
Reviewed-by: Marek Olšák Marek On Wed, Feb 22, 2017 at 9:06 AM, Iago Toral Quiroga wrote: > From: Iago Toral Quiroga > > From ARB_post_depth_coverage: > >"This extension allows the fragment shader to control whether values in > gl_SampleMaskIn[] reflect the coverage after application of the early > depth and stencil tests. This feature can be enabled with the following > layout qualifier in the fragment shader: > >layout(post_depth_coverage) in; > > Use of this feature implicitly enables early fragment tests." > > And a bit later it also adds: > >"early_fragment_tests" requests that fragment tests be performed before > fragment shader execution, as described in section 15.2.4 "Early Fragment > Tests" of the OpenGL Specification. If neither this nor > post_depth_coverage > are declared, per-fragment tests will be performed after fragment shader > execution." > > Fixes: > GL45-CTS.post_depth_coverage_tests.PostDepthSampleMask > --- > src/compiler/glsl/linker.cpp | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp > index b6f8bc4..7343e4e 100644 > --- a/src/compiler/glsl/linker.cpp > +++ b/src/compiler/glsl/linker.cpp > @@ -1881,7 +1881,7 @@ link_fs_inout_layout_qualifiers(struct > gl_shader_program *prog, >} > >linked_shader->Program->info.fs.early_fragment_tests |= > - shader->EarlyFragmentTests; > + shader->EarlyFragmentTests || shader->PostDepthCoverage; >linked_shader->Program->info.fs.inner_coverage |= > shader->InnerCoverage; >linked_shader->Program->info.fs.post_depth_coverage |= > shader->PostDepthCoverage; > -- > 2.7.4 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] vl: u_upload_alloc might fail to allocate buffer in bicubic filter
It would be better to return from the function in that case. Marek On Wed, Feb 22, 2017 at 9:25 AM, Nayan Deshmukh wrote: > Signed-off-by: Nayan Deshmukh > --- > src/gallium/auxiliary/vl/vl_bicubic_filter.c | 8 +--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c > b/src/gallium/auxiliary/vl/vl_bicubic_filter.c > index 570f153..275dd2a 100644 > --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c > +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c > @@ -416,14 +416,16 @@ vl_bicubic_filter_render(struct vl_bicubic_filter > *filter, > viewport.scale[2] = 1; > > struct pipe_constant_buffer cb = {}; > - float *ptr; > + float *ptr = NULL; > > u_upload_alloc(filter->pipe->const_uploader, 0, 2 * sizeof(float), 256, >&cb.buffer_offset, &cb.buffer, (void**)&ptr); > cb.buffer_size = 2 * sizeof(float); > > - ptr[0] = 0.5f/viewport.scale[0]; > - ptr[1] = 0.5f/viewport.scale[1]; > + if (ptr) { > + ptr[0] = 0.5f/viewport.scale[0]; > + ptr[1] = 0.5f/viewport.scale[1]; > + } > u_upload_unmap(filter->pipe->const_uploader); > > memset(&fb_state, 0, sizeof(fb_state)); > -- > 2.9.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: enable early_fragment_tests implicitly with post_depth_coverage
On Wed, Feb 22, 2017 at 12:06 AM, Iago Toral Quiroga wrote: > From: Iago Toral Quiroga Oops :) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] vl: u_upload_alloc might fail to allocate buffer in bicubic filter
On Thu, Feb 23, 2017 at 1:34 AM, Marek Olšák wrote: > It would be better to return from the function in that case. > We can still execute it as it will display the video properly though the edges will be a bit jagged but it won't be much noticeable in most cases. Regards, Nayan > Marek > > On Wed, Feb 22, 2017 at 9:25 AM, Nayan Deshmukh > wrote: >> Signed-off-by: Nayan Deshmukh >> --- >> src/gallium/auxiliary/vl/vl_bicubic_filter.c | 8 +--- >> 1 file changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c >> b/src/gallium/auxiliary/vl/vl_bicubic_filter.c >> index 570f153..275dd2a 100644 >> --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c >> +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c >> @@ -416,14 +416,16 @@ vl_bicubic_filter_render(struct vl_bicubic_filter >> *filter, >> viewport.scale[2] = 1; >> >> struct pipe_constant_buffer cb = {}; >> - float *ptr; >> + float *ptr = NULL; >> >> u_upload_alloc(filter->pipe->const_uploader, 0, 2 * sizeof(float), 256, >>&cb.buffer_offset, &cb.buffer, (void**)&ptr); >> cb.buffer_size = 2 * sizeof(float); >> >> - ptr[0] = 0.5f/viewport.scale[0]; >> - ptr[1] = 0.5f/viewport.scale[1]; >> + if (ptr) { >> + ptr[0] = 0.5f/viewport.scale[0]; >> + ptr[1] = 0.5f/viewport.scale[1]; >> + } >> u_upload_unmap(filter->pipe->const_uploader); >> >> memset(&fb_state, 0, sizeof(fb_state)); >> -- >> 2.9.3 >> >> ___ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: enable early_fragment_tests implicitly with post_depth_coverage
On Wed, Feb 22, 2017 at 9:11 PM, Matt Turner wrote: > On Wed, Feb 22, 2017 at 12:06 AM, Iago Toral Quiroga > wrote: >> From: Iago Toral Quiroga > > Oops :) Sneaky product placement. :) Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] vl: u_upload_alloc might fail to allocate buffer in bicubic filter
OK sounds good. Reviewed-by: Marek Olšák Marek On Wed, Feb 22, 2017 at 9:16 PM, Nayan Deshmukh wrote: > On Thu, Feb 23, 2017 at 1:34 AM, Marek Olšák wrote: >> It would be better to return from the function in that case. >> > We can still execute it as it will display the video properly though > the edges will be > a bit jagged but it won't be much noticeable in most cases. > > Regards, > Nayan > > >> Marek >> >> On Wed, Feb 22, 2017 at 9:25 AM, Nayan Deshmukh >> wrote: >>> Signed-off-by: Nayan Deshmukh >>> --- >>> src/gallium/auxiliary/vl/vl_bicubic_filter.c | 8 +--- >>> 1 file changed, 5 insertions(+), 3 deletions(-) >>> >>> diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c >>> b/src/gallium/auxiliary/vl/vl_bicubic_filter.c >>> index 570f153..275dd2a 100644 >>> --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c >>> +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c >>> @@ -416,14 +416,16 @@ vl_bicubic_filter_render(struct vl_bicubic_filter >>> *filter, >>> viewport.scale[2] = 1; >>> >>> struct pipe_constant_buffer cb = {}; >>> - float *ptr; >>> + float *ptr = NULL; >>> >>> u_upload_alloc(filter->pipe->const_uploader, 0, 2 * sizeof(float), 256, >>>&cb.buffer_offset, &cb.buffer, (void**)&ptr); >>> cb.buffer_size = 2 * sizeof(float); >>> >>> - ptr[0] = 0.5f/viewport.scale[0]; >>> - ptr[1] = 0.5f/viewport.scale[1]; >>> + if (ptr) { >>> + ptr[0] = 0.5f/viewport.scale[0]; >>> + ptr[1] = 0.5f/viewport.scale[1]; >>> + } >>> u_upload_unmap(filter->pipe->const_uploader); >>> >>> memset(&fb_state, 0, sizeof(fb_state)); >>> -- >>> 2.9.3 >>> >>> ___ >>> mesa-dev mailing list >>> mesa-dev@lists.freedesktop.org >>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] anv: Enable MSAA compression
On Wed 22 Feb 2017, Jason Ekstrand wrote: > On Wed, Feb 22, 2017 at 11:09 AM, Chad Versace > wrote: > > > On Mon 20 Feb 2017, Jason Ekstrand wrote: > > > This just enables basic MSAA compression (no fast clears) for all > > > multisampled surfaces. This improves the framerate of the Sascha > > > "multisampling" demo by 76% on my Sky Lake laptop. Running Talos on > > > medium settings with 8x MSAA, this improves the framerate in the > > > benchmark by 80%. > > > --- > > > src/intel/vulkan/TODO | 2 +- > > > src/intel/vulkan/anv_blorp.c | 3 ++- > > > src/intel/vulkan/anv_image.c | 9 + > > > src/intel/vulkan/anv_pipeline.c| 19 +++ > > > src/intel/vulkan/genX_cmd_buffer.c | 5 + > > > 5 files changed, 36 insertions(+), 2 deletions(-) > > > > > > > diff --git a/src/intel/vulkan/genX_cmd_buffer.c > > b/src/intel/vulkan/genX_cmd_buffer.c > > > index 40a72f4..5d8c3ea 100644 > > > --- a/src/intel/vulkan/genX_cmd_buffer.c > > > +++ b/src/intel/vulkan/genX_cmd_buffer.c > > > @@ -222,6 +222,11 @@ color_attachment_compute_aux_usage(struct > > anv_device *device, > > >att_state->input_aux_usage = ISL_AUX_USAGE_NONE; > > >att_state->fast_clear = false; > > >return; > > > + } else if (iview->image->aux_usage == ISL_AUX_USAGE_MCS) { > > > + att_state->aux_usage = ISL_AUX_USAGE_MCS; > > > + att_state->input_aux_usage = ISL_AUX_USAGE_MCS; > > > + att_state->fast_clear = false; > > > + return; > > > } > > > > Small nit. It feels awkward that this function, above the hunk, checks > > iview->image->aux_surface.isl.size == 0, then the next branch checks > > iview->image->aux_usage. It seems more natural to check aux_usage in > > both branches. > > > > Not so much... aux_surface.isl.size == 0 implies aux_usage == NONE but not > the other way around. For gen7 fast clears, for instance, you get NONE in > aux_usage because that's the way we use it for texturing. Ok. That makes sense. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] GLX: Generate the libglvnd dispatch stub functions.
This patch adds a script to generate the dispatch stubs for libglvnd, instead of using a manually-edited list of functions. This should avoid problems in the future with the stub lists getting out of sync or out of order. I put the scripts into a new src/generate/ directory, because there's some overlap with the EGL scripts. Note that the genCommon.py module is the same as the one in my patch to add libglvnd support for EGL. I put the new scripts into a new generate/ directory so that the common stuff can be used for both EGL and GLX. Assuming that location is okay, I'll also put together an updated version of the EGL patch to use the same directory for its scripts. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH] st/mesa: inform the driver of framebuffer changes before compute dispatches
Makes sense. Reviewed-by: Marek Olšák Marek On Wed, Feb 22, 2017 at 7:59 PM, Nicolai Hähnle wrote: > From: Nicolai Hähnle > > Even though compute shaders cannot access the framebuffer, there is a > synchronization issue when a compute dispatch accesses a texture that > was previously bound and drawn to as a framebuffer. > > Section 9.3 (Feedback Loops Between Textures and the Framebuffer) of > the OpenGL 4.5 spec rather implicitly clarifies that undefined behavior > results if the texture is still attached to the currently bound > framebuffer. However, the feedback loop is broken when the application > changes the framebuffer binding before a compute dispatch, and the > state tracker needs to let the driver known about this. > > Fixes GL45-CTS.compute_shader.pipeline-post-fs on SI family Radeons. > > Cc: mesa-sta...@lists.freedesktop.org > --- > src/mesa/state_tracker/st_atom.c | 10 +- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/state_tracker/st_atom.c > b/src/mesa/state_tracker/st_atom.c > index 65ac517..9e1137e 100644 > --- a/src/mesa/state_tracker/st_atom.c > +++ b/src/mesa/state_tracker/st_atom.c > @@ -181,21 +181,29 @@ void st_validate_state( struct st_context *st, enum > st_pipeline pipeline ) >struct gl_program *new_cp = ctx->ComputeProgram._Current; > >if (new_cp != &old_cp->Base) { > if (old_cp) > st->dirty |= old_cp->affected_states; > assert(new_cp); > st->dirty |= st_compute_program(new_cp)->affected_states; >} > >st->compute_shader_may_be_dirty = false; > - pipeline_mask = ST_PIPELINE_COMPUTE_STATE_MASK; > + > + /* > + * We add the ST_NEW_FB_STATE bit here as well, because > glBindFramebuffer > + * acts as a barrier that breaks feedback loops between the framebuffer > + * and textures bound to the framebuffer, even when those textures are > + * accessed by compute shaders; so we must inform the driver of new > + * framebuffer state. > + */ > + pipeline_mask = ST_PIPELINE_COMPUTE_STATE_MASK | ST_NEW_FB_STATE; >break; > } > > default: >unreachable("Invalid pipeline specified"); > } > > dirty = st->dirty & pipeline_mask; > if (!dirty) >return; > -- > 2.9.3 > > ___ > mesa-stable mailing list > mesa-sta...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-stable ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] vl: u_upload_alloc might fail to allocate buffer in bicubic filter
Can you please push the patch. On Thu, Feb 23, 2017 at 1:46 AM, Marek Olšák wrote: > OK sounds good. > > Reviewed-by: Marek Olšák > > Marek > > On Wed, Feb 22, 2017 at 9:16 PM, Nayan Deshmukh > wrote: >> On Thu, Feb 23, 2017 at 1:34 AM, Marek Olšák wrote: >>> It would be better to return from the function in that case. >>> >> We can still execute it as it will display the video properly though >> the edges will be >> a bit jagged but it won't be much noticeable in most cases. >> >> Regards, >> Nayan >> >> >>> Marek >>> >>> On Wed, Feb 22, 2017 at 9:25 AM, Nayan Deshmukh >>> wrote: Signed-off-by: Nayan Deshmukh --- src/gallium/auxiliary/vl/vl_bicubic_filter.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c b/src/gallium/auxiliary/vl/vl_bicubic_filter.c index 570f153..275dd2a 100644 --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c @@ -416,14 +416,16 @@ vl_bicubic_filter_render(struct vl_bicubic_filter *filter, viewport.scale[2] = 1; struct pipe_constant_buffer cb = {}; - float *ptr; + float *ptr = NULL; u_upload_alloc(filter->pipe->const_uploader, 0, 2 * sizeof(float), 256, &cb.buffer_offset, &cb.buffer, (void**)&ptr); cb.buffer_size = 2 * sizeof(float); - ptr[0] = 0.5f/viewport.scale[0]; - ptr[1] = 0.5f/viewport.scale[1]; + if (ptr) { + ptr[0] = 0.5f/viewport.scale[0]; + ptr[1] = 0.5f/viewport.scale[1]; + } u_upload_unmap(filter->pipe->const_uploader); memset(&fb_state, 0, sizeof(fb_state)); -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/6] Removal of PIPE_CAP_USER_INDEX_BUFFERS (take 3)
On 02/22/2017 01:00 PM, Marek Olšák wrote: Hi, This version is hopefully final. I moved the helper code into a separate commit and fixed a pipe_resource leak there. (thanks Brian for the clue) The rest didn't really change. Please review, For the series, Reviewed-by: Brian Paul Tested-by: Brian Paul (VMware driver only) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] mesa: Avoid out-of-bounds stack read via _mesa_Materiali
For 1, 3, 4: Reviewed-by: Marek Olšák I need some time to review patch 2 unless someone else beats me to it. Marek On Wed, Feb 22, 2017 at 8:04 PM, Nicolai Hähnle wrote: > From: Nicolai Hähnle > > MATERIALFV may end up reading up to 4 floats from the passed parameter. > > This should really set a GL_INVALID_ENUM error in the cases where it > matters, but does anybody really care? > > Found by ASAN in piglit gl-1.0-beginend-coverage. > --- > src/mesa/main/api_loopback.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c > index 8b63d9c..1db6ce1 100644 > --- a/src/mesa/main/api_loopback.c > +++ b/src/mesa/main/api_loopback.c > @@ -858,21 +858,22 @@ void GLAPIENTRY > _mesa_Materialf( GLenum face, GLenum pname, GLfloat param ) > { > GLfloat fparam[4]; > fparam[0] = param; > MATERIALFV( face, pname, fparam ); > } > > void GLAPIENTRY > _mesa_Materiali(GLenum face, GLenum pname, GLint param ) > { > - GLfloat p = (GLfloat) param; > + GLfloat p[4]; > + p[0] = (GLfloat) param; > MATERIALFV(face, pname, &p); > } > > void GLAPIENTRY > _mesa_Materialiv(GLenum face, GLenum pname, const GLint *params ) > { > GLfloat fparam[4]; > switch (pname) { > case GL_AMBIENT: > case GL_DIFFUSE: > -- > 2.9.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH 2/4] glsl: fix use-after-free when processing array re-declarations
I thought we already landed a different patch for this. I'll look through the archives when I get back in front of a computer... On February 22, 2017 11:05:26 AM Nicolai Hähnle wrote: From: Nicolai Hähnle When determining whether the array is implicitly sized, we must avoid accessing var->data.mode (around line 5270), because var may have been deleted. Instead of adding yet another ternary condition based on earlier == NULL, refactor get_variable_being_redeclared so that we do not keep dangling pointers around. Found by ASAN in GL45-CTS.gtf21.GL.build.array10_frag. Cc: mesa-sta...@lists.freedesktop.org --- src/compiler/glsl/ast_to_hir.cpp | 55 ++-- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index b90ad97..57a9db9 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -3942,44 +3942,50 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, "the shared storage qualifiers can only be used with " "compute shaders"); } apply_image_qualifier_to_variable(qual, var, state, loc); } /** * Get the variable that is being redeclared by this declaration * + * \p pvar is changed to point to an existing variable in the current scope if + * the declaration that it initially points to is a redeclaration. + * + * The declaration originally pointed to by \p pvar may be deleted. + * * Semantic checks to verify the validity of the redeclaration are also * performed. If semantic checks fail, compilation error will be emitted via - * \c _mesa_glsl_error, but a non-\c NULL pointer will still be returned. + * \c _mesa_glsl_error, but a non-\c NULL pointer will still be provided. * * \returns - * A pointer to an existing variable in the current scope if the declaration - * is a redeclaration, \c NULL otherwise. + * Whether the declaration is a redeclaration. */ -static ir_variable * -get_variable_being_redeclared(ir_variable *var, YYLTYPE loc, +static bool +get_variable_being_redeclared(ir_variable **pvar, YYLTYPE loc, struct _mesa_glsl_parse_state *state, bool allow_all_redeclarations) { + ir_variable *var = *pvar; + /* Check if this declaration is actually a re-declaration, either to * resize an array or add qualifiers to an existing variable. * * This is allowed for variables in the current scope, or when at * global scope (for built-ins in the implicit outer scope). */ ir_variable *earlier = state->symbols->get_variable(var->name); if (earlier == NULL || (state->current_function != NULL && !state->symbols->name_declared_this_scope(var->name))) { - return NULL; + return false; } /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec, * * "It is legal to declare an array without a size and then * later re-declare the same name as an array of the same * type and specify a size." */ if (earlier->type->is_unsized_array() && var->type->is_array() @@ -4082,21 +4088,22 @@ get_variable_being_redeclared(ir_variable *var, YYLTYPE loc, var->name); } else if (earlier->type != var->type) { _mesa_glsl_error(&loc, state, "redeclaration of `%s' has incorrect type", var->name); } } else { _mesa_glsl_error(&loc, state, "`%s' redeclared", var->name); } - return earlier; + *pvar = earlier; + return true; } /** * Generate the IR for an initializer in a variable declaration */ ir_rvalue * process_initializer(ir_variable *var, ast_declaration *decl, ast_fully_specified_type *type, exec_list *initializer_instructions, struct _mesa_glsl_parse_state *state) @@ -5196,56 +5203,54 @@ ast_declarator_list::hir(exec_list *instructions, * list. This list will be added to the instruction stream (below) after * the declaration is added. This is done because in some cases (such as * redeclarations) the declaration may not actually be added to the * instruction stream. */ exec_list initializer_instructions; /* Examine var name here since var may get deleted in the next call */ bool var_is_gl_id = is_gl_identifier(var->name); - ir_variable *earlier = - get_variable_being_redeclared(var, decl->get_location(), state, + bool is_redeclaration = + get_variable_being_redeclared(&var, decl->get_location(), state, false /* allow_all_redeclarations */); - if (earlier != NULL) { + if (is_redeclaration) { if (var_is_gl_id && - earlier->data.how_declared == ir_var_declared_in_block) {
Re: [Mesa-dev] [PATCH] vl: u_upload_alloc might fail to allocate buffer in bicubic filter
Pushed, thanks. Marek On Wed, Feb 22, 2017 at 9:20 PM, Nayan Deshmukh wrote: > Can you please push the patch. > > On Thu, Feb 23, 2017 at 1:46 AM, Marek Olšák wrote: >> OK sounds good. >> >> Reviewed-by: Marek Olšák >> >> Marek >> >> On Wed, Feb 22, 2017 at 9:16 PM, Nayan Deshmukh >> wrote: >>> On Thu, Feb 23, 2017 at 1:34 AM, Marek Olšák wrote: It would be better to return from the function in that case. >>> We can still execute it as it will display the video properly though >>> the edges will be >>> a bit jagged but it won't be much noticeable in most cases. >>> >>> Regards, >>> Nayan >>> >>> Marek On Wed, Feb 22, 2017 at 9:25 AM, Nayan Deshmukh wrote: > Signed-off-by: Nayan Deshmukh > --- > src/gallium/auxiliary/vl/vl_bicubic_filter.c | 8 +--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c > b/src/gallium/auxiliary/vl/vl_bicubic_filter.c > index 570f153..275dd2a 100644 > --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c > +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c > @@ -416,14 +416,16 @@ vl_bicubic_filter_render(struct vl_bicubic_filter > *filter, > viewport.scale[2] = 1; > > struct pipe_constant_buffer cb = {}; > - float *ptr; > + float *ptr = NULL; > > u_upload_alloc(filter->pipe->const_uploader, 0, 2 * sizeof(float), > 256, >&cb.buffer_offset, &cb.buffer, (void**)&ptr); > cb.buffer_size = 2 * sizeof(float); > > - ptr[0] = 0.5f/viewport.scale[0]; > - ptr[1] = 0.5f/viewport.scale[1]; > + if (ptr) { > + ptr[0] = 0.5f/viewport.scale[0]; > + ptr[1] = 0.5f/viewport.scale[1]; > + } > u_upload_unmap(filter->pipe->const_uploader); > > memset(&fb_state, 0, sizeof(fb_state)); > -- > 2.9.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/1] clover: Dump linked module to a different file
> On Feb 22, 2017, at 07:51, Jan Vesely wrote: > > This allows to pass the generated files directly to llc or bugpoint. > Note that if program links multiple binaries they will still be in the same > file, the module name is "link”. Can you add a counter ID or something to ensure unique files? ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] r600/radeonsi: enable glsl/tgsi on-disk cache
On 23/02/17 01:57, Marc Dietrich wrote: Am Mittwoch, 22. Februar 2017, 15:48:18 CET schrieb Emil Velikov: On 22 February 2017 at 13:31, Marc Dietrich wrote: Am Mittwoch, 22. Februar 2017, 04:45:46 CET schrieb Timothy Arceri: For gpu generations that use LLVM we create a timestamp string containing both the LLVM and Mesa build times, otherwise we just use the Mesa build time. Reviewed-by: Marek Olšák Reviewed-by: Edward O'Callaghan --- src/gallium/drivers/radeon/r600_pipe_common.c | 43 +++ src/gallium/drivers/radeon/r600_pipe_common.h | 3 ++ 2 files changed, 46 insertions(+) diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 1781584..bae6d6f 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -43,6 +43,10 @@ #define HAVE_LLVM 0 #endif +#if HAVE_LLVM +#include +#endif + #ifndef MESA_LLVM_VERSION_PATCH #define MESA_LLVM_VERSION_PATCH 0 #endif @@ -779,6 +783,41 @@ static const char* r600_get_chip_name(struct r600_common_screen *rscreen) } } +static void r600_disk_cache_create(struct r600_common_screen *rscreen) +{ + uint32_t mesa_timestamp; + if (disk_cache_get_function_timestamp(r600_disk_cache_create, + &mesa_timestamp)) { + char *timestamp_str; + int res = -1; + if (rscreen->chip_class < SI) { + res = asprintf(×tamp_str, "%u",mesa_timestamp); + } +#if HAVE_LLVM + else { + uint32_t llvm_timestamp; + if (disk_cache_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, + &llvm_timestamp)) { + res = asprintf(×tamp_str, "%u_%u", +mesa_timestamp, llvm_timestamp); + } + } +#endif maybe this fails to link later in omx with r600 only compile. make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ wird betreten CXXLDlibomx_mesa.la ../../../../src/gallium/drivers/radeon/.libs/libradeon.a(r600_pipe_common. o): In function `r600_disk_cache_create': r600_pipe_common.c:(.text+0x2000): undefined reference to `LLVMInitializeAMDGPUTargetInfo' collect2: error: ld returned 1 exit status make[4]: *** [Makefile:791: libomx_mesa.la] Fehler 1 make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ wird verlassen That should not happen since - Compile guard HAVE_LLVM is defined when --enable-llvm is set (explicitly or not) - Makefile/link guard HAVE_GALLIUM_LLVM is set when the --enable-llvm is Please make clean/git clean and report the output of make V=1 if the final link still fails. still same. I added -lLLVMAMDGPUInfo to LLVM_{LDFLAGS|LIBS}. Now it compiles, but GL apps crash during context creation. I also tested the initial version posted and this worked just fine. I have llvm enabled. I just built it with omx and only r600 without any issues. Did you do 'git clean -xfd' of just make clean? If it's still failing with a git clean then please post the params you are using to build mesa. make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ wird betreten /bin/sh ../../../../libtool --tag=CXX --mode=link g++ -Wall -fno-math- errno -fno-trapping-math -shared -module -no-undefined -avoid-version -Wl,-- gc-sections -Wl,--no-undefined -Wl,--version-script=../../../../src/gallium/ targets/omx/omx.sym -L/usr/lib64 -o libomx_mesa.la -rpath /usr/lib64/ bellagio libomx_mesa_la-target.lo ../../../../src/gallium/state_trackers/omx/ libomxtracker.la ../../../../src/gallium/auxiliary/libgalliumvlwinsys.la ../../../../src/gallium/auxiliary/libgalliumvl.la ../../../../src/gallium/ auxiliary/libgallium.la ../../../../src/util/libmesautil.la -lomxil-bellagio - lxcb-dri3 -lxcb-present -lxcb-sync -lxshmfence -lxcb-xfixes -lX11-xcb -lX11 - lxcb -lxcb-dri2 -ldrm -lm -lpthread -ldl -ldrm ../../../../src/gallium/ auxiliary/pipe-loader/libpipe_loader_static.la ../../../../src/gallium/winsys/ sw/null/libws_null.la ../../../../src/gallium/winsys/sw/wrapper/libwsw.la ../../../../src/gallium/winsys/sw/dri/libswdri.la ../../../../src/gallium/ winsys/sw/kms-dri/libswkmsdri.la -ldrm ../../../../src/gallium/drivers/r600/ libr600.la -ldrm -ldrm_radeon -ldrm ../../../../src/gallium/winsys/radeon/ drm/libradeonwinsys.la ../../../../src/gallium/drivers/radeon/libradeon.la - lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG - lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMCodeGen -lLLVMScalarOpts - lLLVMInstCombine -lLLVMInstrumentation -lLLVMTransformUtils -lLLVMX86Desc - lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils - lLLVMMCJIT -lLLVMExecutionEngine -lLLVMTarget -lLLVMRuntimeDyld -lLLVMObject - lLLVMMCParser -lLLVMBitReade
Re: [Mesa-dev] [PATCH 8/8] r600/radeonsi: enable glsl/tgsi on-disk cache
On Tue, Feb 21, 2017 at 7:45 PM, Timothy Arceri wrote: > For gpu generations that use LLVM we create a timestamp string > containing both the LLVM and Mesa build times, otherwise we just > use the Mesa build time. Why not use the build id for Mesa? ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] st/wgl: flush with ST_FLUSH_WAIT before releasing shared contexts
Before releasing a shared context, flush the context with ST_FLUSH_WAIT to make sure all commands are executed. This ensures that rendering to any shared resources is completed before they will be referenced by another context. Fixes an intermittent flickering with Photoshop. (VMware bug# 1779340) --- src/gallium/state_trackers/wgl/stw_context.c | 16 ++-- src/gallium/state_trackers/wgl/stw_context.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c index b1e5f5e..85cffa6 100644 --- a/src/gallium/state_trackers/wgl/stw_context.c +++ b/src/gallium/state_trackers/wgl/stw_context.c @@ -104,8 +104,11 @@ DrvShareLists(DHGLRC dhglrc1, DHGLRC dhglrc2) ctx1 = stw_lookup_context_locked( dhglrc1 ); ctx2 = stw_lookup_context_locked( dhglrc2 ); - if (ctx1 && ctx2 && ctx2->st->share) + if (ctx1 && ctx2 && ctx2->st->share) { ret = ctx2->st->share(ctx2->st, ctx1->st); + ctx1->shared = TRUE; + ctx2->shared = TRUE; + } stw_unlock_contexts(stw_dev); @@ -175,6 +178,7 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext, if (hShareContext != 0) { stw_lock_contexts(stw_dev); shareCtx = stw_lookup_context_locked( hShareContext ); + shareCtx->shared = TRUE; stw_unlock_contexts(stw_dev); } @@ -184,6 +188,7 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext, ctx->hdc = hdc; ctx->iPixelFormat = iPixelFormat; + ctx->shared = shareCtx != NULL; memset(&attribs, 0, sizeof(attribs)); attribs.visual = pfi->stvis; @@ -403,7 +408,14 @@ stw_make_current(HDC hdc, DHGLRC dhglrc) return TRUE; } } else { - old_ctx->st->flush(old_ctx->st, ST_FLUSH_FRONT, NULL); + if (old_ctx->shared) { +struct pipe_fence_handle *fence = NULL; +old_ctx->st->flush(old_ctx->st, + ST_FLUSH_FRONT | ST_FLUSH_WAIT, &fence); + } + else { +old_ctx->st->flush(old_ctx->st, ST_FLUSH_FRONT, NULL); + } } } diff --git a/src/gallium/state_trackers/wgl/stw_context.h b/src/gallium/state_trackers/wgl/stw_context.h index 6bfa715..0f180c8 100644 --- a/src/gallium/state_trackers/wgl/stw_context.h +++ b/src/gallium/state_trackers/wgl/stw_context.h @@ -40,6 +40,7 @@ struct stw_context DHGLRC dhglrc; int iPixelFormat; HDC hdc; + BOOL shared; struct stw_framebuffer *current_framebuffer; -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] st: add ST_FLUSH_WAIT to st_context_flush()
When st_context_flush() is called with ST_FLUSH_WAIT, the function will return after the fence is completed. --- src/gallium/include/state_tracker/st_api.h | 1 + src/mesa/state_tracker/st_manager.c| 7 +++ 2 files changed, 8 insertions(+) diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index daa1f23..a999774 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -160,6 +160,7 @@ enum st_context_resource_type { */ #define ST_FLUSH_FRONT(1 << 0) #define ST_FLUSH_END_OF_FRAME (1 << 1) +#define ST_FLUSH_WAIT (1 << 2) /** * Value to st_manager->get_param function. diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index c3d8286..e663b01 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -504,6 +504,13 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags, } st_flush(st, fence, pipe_flags); + + if ((flags & ST_FLUSH_WAIT) && fence) { + st->pipe->screen->fence_finish(st->pipe->screen, NULL, *fence, + PIPE_TIMEOUT_INFINITE); + st->pipe->screen->fence_reference(st->pipe->screen, fence, NULL); + } + if (flags & ST_FLUSH_FRONT) st_manager_flush_frontbuffer(st); } -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] r600/radeonsi: enable glsl/tgsi on-disk cache
On 23/02/17 08:46, Matt Turner wrote: On Tue, Feb 21, 2017 at 7:45 PM, Timothy Arceri wrote: For gpu generations that use LLVM we create a timestamp string containing both the LLVM and Mesa build times, otherwise we just use the Mesa build time. Why not use the build id for Mesa? I would rather be using the same mechanism for both. I need to check if anything needs to be done to use this with llvm, in the meantime this allows me to get things into master and get some user feedback which is critical to be able to enable this be default next release. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] r600/radeonsi: enable glsl/tgsi on-disk cache
On Wed, Feb 22, 2017 at 2:12 PM, Timothy Arceri wrote: > On 23/02/17 08:46, Matt Turner wrote: >> On Tue, Feb 21, 2017 at 7:45 PM, Timothy Arceri >> wrote: >>> >>> For gpu generations that use LLVM we create a timestamp string >>> containing both the LLVM and Mesa build times, otherwise we just >>> use the Mesa build time. >> >> >> Why not use the build id for Mesa? >> > > I would rather be using the same mechanism for both. I need to check if > anything needs to be done to use this with llvm, in the meantime this allows > me to get things into master and get some user feedback which is critical to > be able to enable this be default next release. Right, okay. I might suggest attempting to use the build id first (return val of build_id_find_nhdr() would be NULL if build id is not present) and fallback to the timestamp. As far as I'm aware, binaries shipped by Fedora, Debian, Ubuntu, and Arch all have build-ids. Gentoo does not, but I expect that's something I can fix. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] anv/blorp/clear_subpass: Only set surface clear color for fast clears
This patch is also needed for MSAA compression. On Tue, Feb 21, 2017 at 7:31 PM, Jason Ekstrand wrote: > Not all clear colors are valid. In particular, on Broadwell and > earlier, only 0/1 colors are allowed in surface state. No CTS tests are > affected outright by this because, apparently, the CTS coverage for > different clear colors is pretty terrible. However, when multisample > compression is enabled, we do hit it with CTS tests and this commit > prevents regressions when enabling MCS on Broadwell and earlier. > > Cc: "13.0 17.0" > --- > src/intel/vulkan/anv_blorp.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c > index 4e7078b..8db03e4 100644 > --- a/src/intel/vulkan/anv_blorp.c > +++ b/src/intel/vulkan/anv_blorp.c > @@ -1198,9 +1198,10 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer > *cmd_buffer) >struct blorp_surf surf; >get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_COLOR_BIT, > att_state->aux_usage, &surf); > - surf.clear_color = vk_to_isl_color(att_state->clear_value.color); > >if (att_state->fast_clear) { > + surf.clear_color = vk_to_isl_color(att_state-> > clear_value.color); > + > blorp_fast_clear(&batch, &surf, iview->isl.format, >iview->isl.base_level, >iview->isl.base_array_layer, fb->layers, > @@ -1224,7 +1225,7 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer > *cmd_buffer) > render_area.offset.x, render_area.offset.y, > render_area.offset.x + render_area.extent.width, > render_area.offset.y + render_area.extent.height, > - surf.clear_color, NULL); > + vk_to_isl_color(att_state->clear_value.color), > NULL); >} > >att_state->pending_clear_aspects = 0; > -- > 2.5.0.400.gff86faf > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] r600/radeonsi: enable glsl/tgsi on-diskcache
Am Mittwoch, 22. Februar 2017, 22:27:42 CET schrieb Timothy Arceri: > On 23/02/17 01:57, Marc Dietrich wrote: > > Am Mittwoch, 22. Februar 2017, 15:48:18 CET schrieb Emil Velikov: > >> On 22 February 2017 at 13:31, Marc Dietrich wrote: > >>> Am Mittwoch, 22. Februar 2017, 04:45:46 CET schrieb Timothy Arceri: > For gpu generations that use LLVM we create a timestamp string > containing both the LLVM and Mesa build times, otherwise we just > use the Mesa build time. > > Reviewed-by: Marek Olšák > Reviewed-by: Edward O'Callaghan > --- > > src/gallium/drivers/radeon/r600_pipe_common.c | 43 > > +++ > src/gallium/drivers/radeon/r600_pipe_common.h > > 3 ++ > 2 files changed, 46 insertions(+) > > diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c > b/src/gallium/drivers/radeon/r600_pipe_common.c index 1781584..bae6d6f > 100644 > --- a/src/gallium/drivers/radeon/r600_pipe_common.c > +++ b/src/gallium/drivers/radeon/r600_pipe_common.c > @@ -43,6 +43,10 @@ > > #define HAVE_LLVM 0 > #endif > > +#if HAVE_LLVM > +#include > +#endif > + > > #ifndef MESA_LLVM_VERSION_PATCH > #define MESA_LLVM_VERSION_PATCH 0 > #endif > > @@ -779,6 +783,41 @@ static const char* r600_get_chip_name(struct > r600_common_screen *rscreen) } > > } > > +static void r600_disk_cache_create(struct r600_common_screen *rscreen) > +{ > + uint32_t mesa_timestamp; > + if (disk_cache_get_function_timestamp(r600_disk_cache_create, > + &mesa_timestamp)) { > + char *timestamp_str; > + int res = -1; > + if (rscreen->chip_class < SI) { > + res = asprintf(×tamp_str, > "%u",mesa_timestamp); > + } > +#if HAVE_LLVM > + else { > + uint32_t llvm_timestamp; > + if > (disk_cache_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, + > > &llvm_timestamp)) > > { + res = asprintf(×tamp_str, "%u_%u", > +mesa_timestamp, > llvm_timestamp); + } > + } > +#endif > >>> > >>> maybe this fails to link later in omx with r600 only compile. > >>> > >>> make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ > >>> wird betreten > >>> > >>> CXXLDlibomx_mesa.la > >>> > >>> ../../../../src/gallium/drivers/radeon/.libs/libradeon.a(r600_pipe_commo > >>> n. > >>> o): In function `r600_disk_cache_create': > >>> r600_pipe_common.c:(.text+0x2000): undefined reference to > >>> `LLVMInitializeAMDGPUTargetInfo' > >>> collect2: error: ld returned 1 exit status > >>> make[4]: *** [Makefile:791: libomx_mesa.la] Fehler 1 > >>> make[4]: Verzeichnis „/usr/src/dri-project/mesa/src/gallium/targets/omx“ > >>> wird verlassen > >> > >> That should not happen since > >> > >> - Compile guard HAVE_LLVM is defined when --enable-llvm is set > >> > >> (explicitly or not) > >> > >> - Makefile/link guard HAVE_GALLIUM_LLVM is set when the --enable-llvm is > >> > >> Please make clean/git clean and report the output of make V=1 if the > >> final link still fails. > > > > still same. I added -lLLVMAMDGPUInfo to LLVM_{LDFLAGS|LIBS}. Now it > > compiles, but GL apps crash during context creation. I also tested the > > initial version posted and this worked just fine. I have llvm enabled. > > I just built it with omx and only r600 without any issues. Did you do > 'git clean -xfd' of just make clean? yes - I always do. > If it's still failing with a git clean then please post the params you > are using to build mesa. #!/bin/sh -x git clean -fdx --exclude b.sh --exclude "0*" --exclude b2.sh COMMON_FLAGS="--prefix=/usr \ --enable-texture-float \ --enable-gles1 \ --enable-gles2 \ --enable-egl\ --enable-opengl \ --enable-shared-glapi \ --enable-gbm\ --enable-xa \ --enable-xvmc \ --enable-vdpau \ --enable-omx\ --enable-va \ --enable-nine \ --enable-gallium-osmesa \ --enable-dri3 \ --enable-gallium-llvm \ --disable-opencl-icd\ --disable-debug \ --enable-glx-tls\ --disable-opencl\ --with-gallium-drivers=r600,swrast \ --with-egl-platforms=drm,wayland,x11 \ --with-dri-drivers=no" ./autogen.sh \ $COMMON_FLAGS \ CFLAGS="$OPT_FLAGS $L
[Mesa-dev] [PATCH 2/2] haiku/winsys: fix dt prototype args
From: Jerome Duval --- src/gallium/winsys/sw/hgl/hgl_sw_winsys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c index 89dd547..f7bc907 100644 --- a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c +++ b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c @@ -106,7 +106,8 @@ hgl_winsys_convert_cs(enum pipe_format format) static struct sw_displaytarget* hgl_winsys_displaytarget_create(struct sw_winsys* winsys, unsigned textureUsage, enum pipe_format format, unsigned width, - unsigned height, unsigned alignment, unsigned* stride) + unsigned height, unsigned alignment, const void *front_private, + unsigned* stride) { struct haiku_displaytarget* haikuDisplayTarget = CALLOC_STRUCT(haiku_displaytarget); -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] haiku: build fixes around debug defines
From: Jerome Duval --- src/gallium/auxiliary/util/u_debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index 7da7f53..63940b7 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -39,13 +39,13 @@ #define U_DEBUG_H_ +#include "os/os_misc.h" + #if defined(PIPE_OS_HAIKU) /* Haiku provides debug_printf in libroot with OS.h */ #include #endif -#include "os/os_misc.h" - #include "pipe/p_format.h" #include "pipe/p_defines.h" -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH 2/4] glsl: fix use-after-free when processing array re-declarations
On 23/02/17 07:44, Ian Romanick wrote: I thought we already landed a different patch for this. I'll look through the archives when I get back in front of a computer... It looks like the patches are still waiting on a review: https://patchwork.freedesktop.org/series/19382/ On February 22, 2017 11:05:26 AM Nicolai Hähnle wrote: From: Nicolai Hähnle When determining whether the array is implicitly sized, we must avoid accessing var->data.mode (around line 5270), because var may have been deleted. Instead of adding yet another ternary condition based on earlier == NULL, refactor get_variable_being_redeclared so that we do not keep dangling pointers around. Found by ASAN in GL45-CTS.gtf21.GL.build.array10_frag. Cc: mesa-sta...@lists.freedesktop.org --- src/compiler/glsl/ast_to_hir.cpp | 55 ++-- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index b90ad97..57a9db9 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -3942,44 +3942,50 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, "the shared storage qualifiers can only be used with " "compute shaders"); } apply_image_qualifier_to_variable(qual, var, state, loc); } /** * Get the variable that is being redeclared by this declaration * + * \p pvar is changed to point to an existing variable in the current scope if + * the declaration that it initially points to is a redeclaration. + * + * The declaration originally pointed to by \p pvar may be deleted. + * * Semantic checks to verify the validity of the redeclaration are also * performed. If semantic checks fail, compilation error will be emitted via - * \c _mesa_glsl_error, but a non-\c NULL pointer will still be returned. + * \c _mesa_glsl_error, but a non-\c NULL pointer will still be provided. * * \returns - * A pointer to an existing variable in the current scope if the declaration - * is a redeclaration, \c NULL otherwise. + * Whether the declaration is a redeclaration. */ -static ir_variable * -get_variable_being_redeclared(ir_variable *var, YYLTYPE loc, +static bool +get_variable_being_redeclared(ir_variable **pvar, YYLTYPE loc, struct _mesa_glsl_parse_state *state, bool allow_all_redeclarations) { + ir_variable *var = *pvar; + /* Check if this declaration is actually a re-declaration, either to * resize an array or add qualifiers to an existing variable. * * This is allowed for variables in the current scope, or when at * global scope (for built-ins in the implicit outer scope). */ ir_variable *earlier = state->symbols->get_variable(var->name); if (earlier == NULL || (state->current_function != NULL && !state->symbols->name_declared_this_scope(var->name))) { - return NULL; + return false; } /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec, * * "It is legal to declare an array without a size and then * later re-declare the same name as an array of the same * type and specify a size." */ if (earlier->type->is_unsized_array() && var->type->is_array() @@ -4082,21 +4088,22 @@ get_variable_being_redeclared(ir_variable *var, YYLTYPE loc, var->name); } else if (earlier->type != var->type) { _mesa_glsl_error(&loc, state, "redeclaration of `%s' has incorrect type", var->name); } } else { _mesa_glsl_error(&loc, state, "`%s' redeclared", var->name); } - return earlier; + *pvar = earlier; + return true; } /** * Generate the IR for an initializer in a variable declaration */ ir_rvalue * process_initializer(ir_variable *var, ast_declaration *decl, ast_fully_specified_type *type, exec_list *initializer_instructions, struct _mesa_glsl_parse_state *state) @@ -5196,56 +5203,54 @@ ast_declarator_list::hir(exec_list *instructions, * list. This list will be added to the instruction stream (below) after * the declaration is added. This is done because in some cases (such as * redeclarations) the declaration may not actually be added to the * instruction stream. */ exec_list initializer_instructions; /* Examine var name here since var may get deleted in the next call */ bool var_is_gl_id = is_gl_identifier(var->name); - ir_variable *earlier = - get_variable_being_redeclared(var, decl->get_location(), state, + bool is_redeclaration = + get_variable_being_redeclared(&var, decl->get_location(), state, false /* allow_all_redeclarations
[Mesa-dev] [PATCH 06/13] anv: convert header generation in anv_entrypoints_gen.py to mako
This produces an identical file except for whitespace. Signed-off-by: Dylan Baker --- src/intel/vulkan/anv_entrypoints_gen.py | 75 ++--- 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index 3f7b5589e5..1b15b13b2f 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -27,6 +27,8 @@ import sys import textwrap import xml.etree.ElementTree as et +from mako.template import Template + VK_XML = os.path.join( os.path.dirname(__file__), '..', '..', 'vulkan', 'registry', 'vk.xml') @@ -49,6 +51,44 @@ SUPPORTED_EXTENSIONS = [ # function and a power-of-two size table. The prime numbers are determined # experimentally. +TEMPLATE_H = Template(textwrap.dedent("""\ +/* This file generated from vk_gen.py, don't edit directly. */ + +struct anv_dispatch_table { + union { + void *entrypoints[${len(entrypoints)}]; + struct { + % for _, name, _, _, _, guard in entrypoints: +% if guard is not None: +#ifdef ${guard} + PFN_vk${name} ${name}; +#else + void *${name}; +# endif +% else: + PFN_vk${name} ${name}; +% endif + % endfor + }; + }; +}; + +void anv_set_dispatch_devinfo(const struct gen_device_info *info); +% for type_, name, args, num, h, guard in entrypoints: + % if guard is not None: +#ifdef ${guard} + % endif + ${type_} anv_${name}(${args}); + ${type_} gen7_${name}(${args}); + ${type_} gen75_${name}(${args}); + ${type_} gen8_${name}(${args}); + ${type_} gen9_${name}(${args}); + % if guard is not None: +#endif // ${guard} + % endif +% endfor +""")) + NONE = 0x HASH_SIZE = 256 U32_MASK = 2**32 - 1 @@ -141,39 +181,6 @@ def get_entrypoints_defines(doc): return entrypoints_to_defines -def gen_header(entrypoints): -print "/* This file generated from vk_gen.py, don't edit directly. */\n" - -print "struct anv_dispatch_table {" -print " union {" -print " void *entrypoints[%d];" % len(entrypoints) -print " struct {" - -for type, name, args, num, h, guard in entrypoints: -if guard is not None: -print "#ifdef {0}".format(guard) -print " PFN_vk{0} {0};".format(name) -print "#else" -print " void *{0};".format(name) -print "#endif" -else: -print " PFN_vk{0} {0};".format(name) -print " };\n" -print " };\n" -print "};\n" - -print "void anv_set_dispatch_devinfo(const struct gen_device_info *info);\n" - -for type, name, args, num, h, guard in entrypoints: -print_guard_start(guard) -print "%s anv_%s(%s);" % (type, name, args) -print "%s gen7_%s(%s);" % (type, name, args) -print "%s gen75_%s(%s);" % (type, name, args) -print "%s gen8_%s(%s);" % (type, name, args) -print "%s gen9_%s(%s);" % (type, name, args) -print_guard_end(guard) - - def gen_code(entrypoints): print textwrap.dedent("""\ /* @@ -376,7 +383,7 @@ def main(): # For outputting entrypoints.h we generate a anv_EntryPoint() prototype # per entry point. if opt_header: -gen_header(entrypoints) +print TEMPLATE_H.render(entrypoints=entrypoints) else: gen_code(entrypoints) -- 2.11.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/13] anv: Use python style in anv_entrypoints_gen.py
These are all fairly small cleanups/tweaks that don't really deserve their own patch. - Prefer comprehensions to map() and filter(), since they're faster - replace unused variables with _ - Use 4 spaces of indent - drop semicolons from the end of lines - Don't use parens around if conditions - don't put spaces around brackets - don't import modules as caps (ET -> et) - Use docstrings instead of comments Signed-off-by: Dylan Baker --- src/intel/vulkan/anv_entrypoints_gen.py | 63 ++--- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index 3f7a1ce294..358cf1e1e2 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -24,20 +24,20 @@ import sys import textwrap -import xml.etree.ElementTree as ET +import xml.etree.ElementTree as et max_api_version = 1.0 supported_extensions = [ - 'VK_KHR_get_physical_device_properties2', - 'VK_KHR_maintenance1', - 'VK_KHR_sampler_mirror_clamp_to_edge', - 'VK_KHR_shader_draw_parameters', - 'VK_KHR_surface', - 'VK_KHR_swapchain', - 'VK_KHR_wayland_surface', - 'VK_KHR_xcb_surface', - 'VK_KHR_xlib_surface', +'VK_KHR_get_physical_device_properties2', +'VK_KHR_maintenance1', +'VK_KHR_sampler_mirror_clamp_to_edge', +'VK_KHR_shader_draw_parameters', +'VK_KHR_surface', +'VK_KHR_swapchain', +'VK_KHR_wayland_surface', +'VK_KHR_xcb_surface', +'VK_KHR_xlib_surface', ] # We generate a static hash table for entry point lookup @@ -53,33 +53,37 @@ hash_mask = hash_size - 1 prime_factor = 5024183 prime_step = 19 +opt_header = False +opt_code = False + +if sys.argv[1] == "header": +opt_header = True +sys.argv.pop() +elif sys.argv[1] == "code": +opt_code = True +sys.argv.pop() + + def hash(name): -h = 0; +h = 0 for c in name: h = (h * prime_factor + ord(c)) & u32_mask return h + def print_guard_start(guard): if guard is not None: print "#ifdef {0}".format(guard) + def print_guard_end(guard): if guard is not None: print "#endif // {0}".format(guard) -opt_header = False -opt_code = False -if (sys.argv[1] == "header"): -opt_header = True -sys.argv.pop() -elif (sys.argv[1] == "code"): -opt_code = True -sys.argv.pop() - -# Extract the entry points from the registry def get_entrypoints(doc, entrypoints_to_defines): +"""Extract the entry points from the registry.""" entrypoints = [] enabled_commands = set() @@ -108,7 +112,7 @@ def get_entrypoints(doc, entrypoints_to_defines): continue shortname = fullname[2:] -params = map(lambda p: "".join(p.itertext()), command.findall('./param')) +params = (''.join(p.itertext()) for p in command.findall('./param')) params = ', '.join(params) if fullname in entrypoints_to_defines: guard = entrypoints_to_defines[fullname] @@ -119,8 +123,9 @@ def get_entrypoints(doc, entrypoints_to_defines): return entrypoints -# Maps entry points to extension defines + def get_entrypoints_defines(doc): +"""Maps entry points to extension defines.""" entrypoints_to_defines = {} extensions = doc.findall('./extensions/extension') for extension in extensions: @@ -133,7 +138,7 @@ def get_entrypoints_defines(doc): def main(): -doc = ET.parse(sys.stdin) +doc = et.parse(sys.stdin) entrypoints = get_entrypoints(doc, get_entrypoints_defines(doc)) # Manually add CreateDmaBufImageINTEL for which we don't have an extension @@ -225,7 +230,7 @@ def main(): static const char strings[] =""") offsets = [] -i = 0; +i = 0 for type, name, args, num, h, guard in entrypoints: print " \"vk%s\\0\"" % name offsets.append(i) @@ -247,7 +252,7 @@ def main(): */ """) -for layer in [ "anv", "gen7", "gen75", "gen8", "gen9" ]: +for layer in ["anv", "gen7", "gen75", "gen8", "gen9"]: for type, name, args, num, h, guard in entrypoints: print_guard_start(guard) print "%s %s_%s(%s) __attribute__ ((weak));" % (type, layer, name, args) @@ -295,8 +300,8 @@ def main(): # uint16_t table of entry point indices. We use 0x to indicate an entry # in the hash table is empty. -map = [none for f in xrange(hash_size)] -collisions = [0 for f in xrange(10)] +map = [none for _ in xrange(hash_size)] +collisions = [0 for _ in xrange(10)] for type, name, args, num, h, guard in entrypoints: level = 0 while map[h & hash_mask] != none: @@ -312,7 +317,7 @@ def main(): print " * size %d entries" % hash_size print " * collisions entries" for i in xrange(10): -if (i == 9): +if i == 9: plus = "+" else: plus = " " -- 2.11.1 __
[Mesa-dev] [PATCH 01/13] anv: anv_entrypoints_gen.py: use a main function
This is just good practice. Signed-off-by: Dylan Baker --- src/intel/vulkan/anv_entrypoints_gen.py | 458 1 file changed, 233 insertions(+), 225 deletions(-) diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index 93511ec95e..3f7a1ce294 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -1,6 +1,6 @@ # coding=utf-8 # -# Copyright ?? 2015 Intel Corporation +# Copyright ?? 2015, 2017 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -23,6 +23,7 @@ # import sys +import textwrap import xml.etree.ElementTree as ET max_api_version = 1.0 @@ -130,235 +131,242 @@ def get_entrypoints_defines(doc): entrypoints_to_defines[fullname] = define return entrypoints_to_defines -doc = ET.parse(sys.stdin) -entrypoints = get_entrypoints(doc, get_entrypoints_defines(doc)) - -# Manually add CreateDmaBufImageINTEL for which we don't have an extension -# defined. -entrypoints.append(('VkResult', 'CreateDmaBufImageINTEL', -'VkDevice device, ' + -'const VkDmaBufImageCreateInfo* pCreateInfo, ' + -'const VkAllocationCallbacks* pAllocator,' + -'VkDeviceMemory* pMem,' + -'VkImage* pImage', len(entrypoints), -hash('vkCreateDmaBufImageINTEL'), None)) - -# For outputting entrypoints.h we generate a anv_EntryPoint() prototype -# per entry point. - -if opt_header: -print "/* This file generated from vk_gen.py, don't edit directly. */\n" - -print "struct anv_dispatch_table {" -print " union {" -print " void *entrypoints[%d];" % len(entrypoints) -print " struct {" +def main(): +doc = ET.parse(sys.stdin) +entrypoints = get_entrypoints(doc, get_entrypoints_defines(doc)) + +# Manually add CreateDmaBufImageINTEL for which we don't have an extension +# defined. +entrypoints.append(('VkResult', 'CreateDmaBufImageINTEL', +'VkDevice device, ' + +'const VkDmaBufImageCreateInfo* pCreateInfo, ' + +'const VkAllocationCallbacks* pAllocator,' + +'VkDeviceMemory* pMem,' + +'VkImage* pImage', len(entrypoints), +hash('vkCreateDmaBufImageINTEL'), None)) + +# For outputting entrypoints.h we generate a anv_EntryPoint() prototype +# per entry point. + +if opt_header: +print "/* This file generated from vk_gen.py, don't edit directly. */\n" + +print "struct anv_dispatch_table {" +print " union {" +print " void *entrypoints[%d];" % len(entrypoints) +print " struct {" + +for type, name, args, num, h, guard in entrypoints: +if guard is not None: +print "#ifdef {0}".format(guard) +print " PFN_vk{0} {0};".format(name) +print "#else" +print " void *{0};".format(name) +print "#endif" +else: +print " PFN_vk{0} {0};".format(name) +print " };\n" +print " };\n" +print "};\n" + +print "void anv_set_dispatch_devinfo(const struct gen_device_info *info);\n" + +for type, name, args, num, h, guard in entrypoints: +print_guard_start(guard) +print "%s anv_%s(%s);" % (type, name, args) +print "%s gen7_%s(%s);" % (type, name, args) +print "%s gen75_%s(%s);" % (type, name, args) +print "%s gen8_%s(%s);" % (type, name, args) +print "%s gen9_%s(%s);" % (type, name, args) +print_guard_end(guard) +exit() + + + +print textwrap.dedent("""\ +/* + * Copyright ?? 2015 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT H
[Mesa-dev] [PATCH 00/13] cleanup anv_entrpoints_gen.py
There are a number of small style cleanups and simplifications in this series, but the main changes are: - use a mako template to generate the header and code rather than prints - be python 3.x ready (the goal isn't to write python 3 code, but to write code that is easy to port or hybridize) - generate the header and the code in one go I've put emphasis on the readability of the template rather than the readability of the output code, it's relatively easy to pipe the code through 'indent' to make it more readable. Dylan Baker (13): anv: anv_entrypoints_gen.py: use a main function anv: Use python style in anv_entrypoints_gen.py anv: make constants capitals in anv_entrypoints_gen.py anv: don't pass xmlfile via stdin anv_entrypoints_gen.py anv: split main into two functions in anv_entrypoints_gen.py anv: convert header generation in anv_entrypoints_gen.py to mako anv: convert C generation to template in anv_entrypoints_gen.py anv: generate anv_entrypoints.{h,c} in one command anv: anv-entrypoints_gen.py: rename hash to cal_hash. anv: anv_entrypoints_gen.py: use reduce function. anv: use dict.get in anv_entrypoints_gen.py anv: don't use Element.get in anv_entrypoints_gen.py anv: use cElementTree in anv_entrypoints_gen.py src/intel/vulkan/Makefile.am| 9 +- src/intel/vulkan/anv_entrypoints_gen.py | 597 2 files changed, 306 insertions(+), 300 deletions(-) -- 2.11.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/13] anv: split main into two functions in anv_entrypoints_gen.py
This is groundwork for the next patches, it will allows porting the header and the code to mako separately, and will also allow both to be run simultaneously. Signed-off-by: Dylan Baker --- src/intel/vulkan/anv_entrypoints_gen.py | 96 + 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index 5403bcb4bc..3f7b5589e5 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -141,58 +141,40 @@ def get_entrypoints_defines(doc): return entrypoints_to_defines -def main(): -doc = et.parse(VK_XML) -entrypoints = get_entrypoints(doc, get_entrypoints_defines(doc)) - -# Manually add CreateDmaBufImageINTEL for which we don't have an extension -# defined. -entrypoints.append(('VkResult', 'CreateDmaBufImageINTEL', -'VkDevice device, ' + -'const VkDmaBufImageCreateInfo* pCreateInfo, ' + -'const VkAllocationCallbacks* pAllocator,' + -'VkDeviceMemory* pMem,' + -'VkImage* pImage', len(entrypoints), -hash('vkCreateDmaBufImageINTEL'), None)) - -# For outputting entrypoints.h we generate a anv_EntryPoint() prototype -# per entry point. - -if opt_header: -print "/* This file generated from vk_gen.py, don't edit directly. */\n" +def gen_header(entrypoints): +print "/* This file generated from vk_gen.py, don't edit directly. */\n" -print "struct anv_dispatch_table {" -print " union {" -print " void *entrypoints[%d];" % len(entrypoints) -print " struct {" +print "struct anv_dispatch_table {" +print " union {" +print " void *entrypoints[%d];" % len(entrypoints) +print " struct {" -for type, name, args, num, h, guard in entrypoints: -if guard is not None: -print "#ifdef {0}".format(guard) -print " PFN_vk{0} {0};".format(name) -print "#else" -print " void *{0};".format(name) -print "#endif" -else: -print " PFN_vk{0} {0};".format(name) -print " };\n" -print " };\n" -print "};\n" - -print "void anv_set_dispatch_devinfo(const struct gen_device_info *info);\n" +for type, name, args, num, h, guard in entrypoints: +if guard is not None: +print "#ifdef {0}".format(guard) +print " PFN_vk{0} {0};".format(name) +print "#else" +print " void *{0};".format(name) +print "#endif" +else: +print " PFN_vk{0} {0};".format(name) +print " };\n" +print " };\n" +print "};\n" -for type, name, args, num, h, guard in entrypoints: -print_guard_start(guard) -print "%s anv_%s(%s);" % (type, name, args) -print "%s gen7_%s(%s);" % (type, name, args) -print "%s gen75_%s(%s);" % (type, name, args) -print "%s gen8_%s(%s);" % (type, name, args) -print "%s gen9_%s(%s);" % (type, name, args) -print_guard_end(guard) -exit() +print "void anv_set_dispatch_devinfo(const struct gen_device_info *info);\n" +for type, name, args, num, h, guard in entrypoints: +print_guard_start(guard) +print "%s anv_%s(%s);" % (type, name, args) +print "%s gen7_%s(%s);" % (type, name, args) +print "%s gen75_%s(%s);" % (type, name, args) +print "%s gen8_%s(%s);" % (type, name, args) +print "%s gen9_%s(%s);" % (type, name, args) +print_guard_end(guard) +def gen_code(entrypoints): print textwrap.dedent("""\ /* * Copyright ?? 2015 Intel Corporation @@ -377,5 +359,27 @@ def main(): """) % (PRIME_FACTOR, PRIME_STEP, HASH_MASK) +def main(): +doc = et.parse(VK_XML) +entrypoints = get_entrypoints(doc, get_entrypoints_defines(doc)) + +# Manually add CreateDmaBufImageINTEL for which we don't have an extension +# defined. +entrypoints.append(('VkResult', 'CreateDmaBufImageINTEL', +'VkDevice device, ' + +'const VkDmaBufImageCreateInfo* pCreateInfo, ' + +'const VkAllocationCallbacks* pAllocator,' + +'VkDeviceMemory* pMem,' + +'VkImage* pImage', len(entrypoints), +hash('vkCreateDmaBufImageINTEL'), None)) + +# For outputting entrypoints.h we generate a anv_EntryPoint() prototype +# per entry point. +if opt_header: +gen_header(entrypoints) +else: +gen_code(entrypoints) + + if __name__ == '__main__': main() -- 2.11.1 ___