Re: [Mesa-dev] [PATCH v3] st/vdpau: change the order in which filters are applied(v3)
Hi Christian, On Tue, Aug 16, 2016 at 11:32 PM, Christian König wrote: > Am 16.08.2016 um 19:50 schrieb Nayan Deshmukh: >> >> Hi Christian, >> >> >> >> On Tue, Aug 16, 2016 at 11:02 PM, Christian König >> wrote: >>> >>> Am 16.08.2016 um 19:29 schrieb Nayan Deshmukh: Hi Andy, Thanks for testing. On Tue, Aug 16, 2016 at 9:14 PM, Andy Furniss wrote: > > Nayan Deshmukh wrote: >> >> Hi Andy, > > >> You are right :( It messes up chroma but only in case of sharpen at >> least for me. > > > Retested and denoise is also affected for me. > >> I tried some changes and the chroma effects are fixed if we apply the >> sharpness >> filter to only to the first surface instead of all the surfaces of the >> buffer. >> Can you verify this? > > > If you mean changing surfaces[i] to surfaces[0] below, then it is > better, but there are still artifacts/chroma errors. > > In addition to changing as above, changing sampler_views[0] seems > to fix denoise and negative sharpen, but gives a new sort of > artifact for positive sharpen. Sorry for the misleading language. What I meant was that the filter should only be applied to first resource i.e. use only first sampler_view and surface. As you replaced i by 0 the filter gets applied multiple times. I tried doing that and I am experiencing same problems i.e. artifacts with positive sharpen. So can you please it try it again by replacing VL_MAX_SURFACES with 1 in the for loop. It should probably fix the problems. >>> >>> >>> Well that would work around the problem, but not fix it. >>> >>> This way you only apply the filters to the luma channel and not all the >>> other ones. >>> >>> The problem is possible that the chroma channels are subsampled and you >>> don't use the correct resolution in the filters for them. >>> >> Yes that's it. This is what the problem is. But to resolve it we need >> to initialize >> the filters with different resolution. So how can this be coded. I >> will need a bit >> guidance on this one (as I need on most of the things :) ). > > > You probably need to create multiple instance of the filters, one for the > original video width/height, then one for width/2 and original height and > one for width/2 and height/2. > > Then check the chroma format of the video buffer and apply accordingly. > I was thinking of checking height and width of individual surfaces and applying the filter accordingly, it will reduce the no. of ifs. Regrads, Nayan. > Regards, > Christian. > > >> >> I have this habit of fixing of patches with workarounds, need to change >> this >> approach. >> >> Regards, >> Nayan. >>> >>> Regards, >>> Christian. >>> >>> Regards, Nayan. > > > + for(i = 0; i < VL_MAX_SURFACES; ++i) { > + if(sampler_views[i] != NULL && surfaces[i] != NULL) { > + if (vmixer->noise_reduction.filter) > + > vl_median_filter_render(vmixer->noise_reduction.filter, > +sampler_views[i], > surfaces[i]); > + > + if (vmixer->sharpness.filter) > +vl_matrix_filter_render(vmixer->sharpness.filter, > +sampler_views[i], > surfaces[i]); > > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] install: check for undefined symbols in shared libraries
On 08/16/2016 10:12 PM, Jan Ziak wrote: This patch ensures that shared libraries installed by Mesa do not contain any undefined symbols. The patch should help lowering the number of users experiencing undefined symbol errors with OpenGL apps. [http://google.sk/search?q=undefined+symbol:+_glapi_tls_Dispatch] 1250 results There's some discussion in this bug if we should just autodetect this or maybe enable by default: https://bugs.freedesktop.org/show_bug.cgi?id=72902 The patched install process performs the checks necessary for eventual replacement of all RTLD_NOW with RTLD_LAZY in Mesa source code. It is out of Mesa's scope of responsibility to ensure that later modifications to non-Mesa libs such as libLLVM*.so do not break OpenGL apps. Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com> --- bin/dlopen-check.sh | 16 install-gallium-links.mk | 4 install-lib-links.mk | 4 src/gallium/targets/dri/Makefile.am | 5 - src/gallium/targets/va/Makefile.am| 2 ++ src/gallium/targets/vdpau/Makefile.am | 2 ++ src/gallium/targets/xvmc/Makefile.am | 2 ++ src/mesa/drivers/dri/Makefile.am | 5 - 8 files changed, 38 insertions(+), 2 deletions(-) diff --git a/bin/dlopen-check.sh b/bin/dlopen-check.sh new file mode 100755 index 000..0a965ec --- /dev/null +++ b/bin/dlopen-check.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Check shared libraries for undefined symbols +set -e +set -o pipefail +if [ $# == 0 ]; then + echo "Usage: $0 SHARED-LIB..." + exit 1 +fi +UNDEFINED_SYMBOLS=$(ldd -d -r "$@" | { grep defined || true; }) +if [ -n "$UNDEFINED_SYMBOLS" ]; then + echo "$UNDEFINED_SYMBOLS" | sort | uniq | \ + while read -r LINE; do + echo "error: $LINE" + done + exit 1 +fi diff --git a/install-gallium-links.mk b/install-gallium-links.mk index ac5a499..5f6d696 100644 --- a/install-gallium-links.mk +++ b/install-gallium-links.mk @@ -6,6 +6,10 @@ if HAVE_COMPAT_SYMLINKS all-local : .install-gallium-links .install-gallium-links : $(dri_LTLIBRARIES) $(egl_LTLIBRARIES) $(lib_LTLIBRARIES) + if [ -n "$(shell find .libs -maxdepth 1 -name "*.so" -print -quit)" ]; then \ + LD_LIBRARY_PATH=$(top_builddir)/$(LIB_DIR) \ + $(top_srcdir)/bin/dlopen-check.sh .libs/*.so*; \ + fi $(AM_V_GEN)$(MKDIR_P) $(top_builddir)/$(LIB_DIR); \ link_dir=$(top_builddir)/$(LIB_DIR)/gallium;\ if test x$(egl_LTLIBRARIES) != x; then \ diff --git a/install-lib-links.mk b/install-lib-links.mk index 5fe9141..8de38cd 100644 --- a/install-lib-links.mk +++ b/install-lib-links.mk @@ -6,6 +6,10 @@ if HAVE_COMPAT_SYMLINKS all-local : .install-mesa-links .install-mesa-links : $(lib_LTLIBRARIES) + if [ -n "$(shell find .libs -maxdepth 1 -name "*.so" -print -quit)" ]; then \ + LD_LIBRARY_PATH=$(top_builddir)/$(LIB_DIR) \ + $(top_srcdir)/bin/dlopen-check.sh .libs/*.so*; \ + fi $(AM_V_GEN)$(MKDIR_P) $(top_builddir)/$(LIB_DIR); \ for f in $(join $(addsuffix .libs/,$(dir $(lib_LTLIBRARIES))),$(notdir $(lib_LTLIBRARIES:%.la=%.$(LIB_EXT)*))); do \ if test -h .libs/$$f; then \ diff --git a/src/gallium/targets/dri/Makefile.am b/src/gallium/targets/dri/Makefile.am index 06ade45..86ac6ea 100644 --- a/src/gallium/targets/dri/Makefile.am +++ b/src/gallium/targets/dri/Makefile.am @@ -136,7 +136,10 @@ endif # hardlink each megadriver instance, but don't actually have # gallium_dri.so in the set of final installed files. -install-data-hook: +install-data-hook: $(top_builddir)/$(LIB_DIR)/libGL.so + LD_PRELOAD=$(top_builddir)/$(LIB_DIR)/libGL.so \ + LD_LIBRARY_PATH=$(top_builddir)/$(LIB_DIR) \ + $(top_srcdir)/bin/dlopen-check.sh $(DESTDIR)$(dridir)/gallium_dri.so for i in $(TARGET_DRIVERS); do \ ln -f $(DESTDIR)$(dridir)/gallium_dri.so\ $(DESTDIR)$(dridir)/$${i}_dri.so; \ diff --git a/src/gallium/targets/va/Makefile.am b/src/gallium/targets/va/Makefile.am index df825b7..b31bc2d 100644 --- a/src/gallium/targets/va/Makefile.am +++ b/src/gallium/targets/va/Makefile.am @@ -70,6 +70,8 @@ endif # hardlink each megadriver instance, but don't actually have # gallium_drv_video.so in the set of final installed files. install-data-hook: + LD_LIBRARY_PATH=$(top_builddir)/$(LIB_DIR) \ + $(top_srcdir)/bin/dlopen-check.sh $(DESTDIR)$(vadir)/gallium_drv_video.so for i in $(TARGET_DRIVERS); do \ ln -f $(DESTDIR)$(vadir)/gallium_drv_video.so\ $(DESTDIR)$(vadir)/$${i}_drv_video.so; \ diff --git a/src/gallium/targets/vdpau/Makefile.am b/src/gallium/targets/vdpau/M
Re: [Mesa-dev] [PATCH v2 28/35] i965/blorp: Add a z_offset field to blorp_surface_info
On Tue, Jul 26, 2016 at 03:02:19PM -0700, Jason Ekstrand wrote: > The layer field is in terms of physical layers which isn't quite what the > sampler will want for 2-D MS array textures. > --- > src/mesa/drivers/dri/i965/brw_blorp.c| 9 + > src/mesa/drivers/dri/i965/brw_blorp.h| 3 +++ > src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 11 ++- > 3 files changed, 14 insertions(+), 9 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c > b/src/mesa/drivers/dri/i965/brw_blorp.c > index bc26e41..64e507a 100644 > --- a/src/mesa/drivers/dri/i965/brw_blorp.c > +++ b/src/mesa/drivers/dri/i965/brw_blorp.c > @@ -201,6 +201,15 @@ brw_blorp_surface_info_init(struct brw_context *brw, >}, > }; > > + if (brw->gen >= 8 && !is_render_target && info->surf.dim == > ISL_SURF_DIM_3D) { > + /* On gen8+ we use actual 3-D textures so we need to pass the layer > + * through to the sampler. > + */ > + info->z_offset = layer / layer_multiplier; Agreed offline to move the division by layer_multiplier to the next patch which start to use this path for 2D msaa. Here for 3D it doesn't really do anything. Reviewed-by: Topi Pohjolainen > + } else { > + info->z_offset = 0; > + } > + > info->level = level; > info->layer = layer; > > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h > b/src/mesa/drivers/dri/i965/brw_blorp.h > index 282235d..ec12dfe 100644 > --- a/src/mesa/drivers/dri/i965/brw_blorp.h > +++ b/src/mesa/drivers/dri/i965/brw_blorp.h > @@ -78,6 +78,9 @@ struct brw_blorp_surface_info > > struct isl_view view; > > + /* Z offset into a 3-D texture or slice of a 2-D array texture. */ > + uint32_t z_offset; > + > /** > * The miplevel to use. > */ > diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp > b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp > index a76d130..a35cdb3 100644 > --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp > +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp > @@ -1779,15 +1779,8 @@ brw_blorp_blit_miptrees(struct brw_context *brw, > brw_blorp_setup_coord_transform(¶ms.wm_inputs.coord_transform[1], > src_y0, src_y1, dst_y0, dst_y1, mirror_y); > > - if (brw->gen >= 8 && params.src.mt->target == GL_TEXTURE_3D) { > - /* On gen8+ we use actual 3-D textures so we need to pass the layer > - * through to the sampler. > - */ > - params.wm_inputs.src_z = params.src.layer; > - } else { > - /* On gen7 and earlier, we fake everything with 2-D textures */ > - params.wm_inputs.src_z = 0; > - } > + /* For some texture types, we need to pass the layer through the sampler. > */ > + params.wm_inputs.src_z = params.src.z_offset; > > if (brw->gen > 6 && dst_mt->msaa_layout == INTEL_MSAA_LAYOUT_IMS) { >/* We must expand the rectangle we send through the rendering pipeline, > -- > 2.5.0.400.gff86faf > > ___ > 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 v2 26/35] i965/blorp: Rework hiz rect alignment calculations
On Thu, Jul 28, 2016 at 10:54:43AM +0300, Pohjolainen, Topi wrote: > On Tue, Jul 26, 2016 at 03:02:17PM -0700, Jason Ekstrand wrote: > > At the moment, the minify operation does nothing because > > params.depth.view.base_level is always zero. However, as soon as we start > > using actual base miplevels and array slices, we are going to need the > > minification. Also, we only need to align the surface dimensions in the > > case where we are operating on miplevel 0. Previously, it didn't matter > > because it aligned on miplevel 0 and, for all other miplevels, the miptree > > code guaranteed that the level was already aligned. > > --- > > src/mesa/drivers/dri/i965/brw_blorp.c | 23 +++ > > 1 file changed, 15 insertions(+), 8 deletions(-) > > > > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c > > b/src/mesa/drivers/dri/i965/brw_blorp.c > > index 2cf0f99..bc26e41 100644 > > --- a/src/mesa/drivers/dri/i965/brw_blorp.c > > +++ b/src/mesa/drivers/dri/i965/brw_blorp.c > > @@ -593,14 +593,21 @@ gen6_blorp_hiz_exec(struct brw_context *brw, struct > > intel_mipmap_tree *mt, > > * not 8. But commit 1f112cc increased the alignment from 4 to 8, which > > * prevents the clobbering. > > */ > > - params.dst.surf.samples = MAX2(mt->num_samples, 1); > > - params.depth.surf.logical_level0_px.width = > > - ALIGN(params.depth.surf.logical_level0_px.width, 8); > > - params.depth.surf.logical_level0_px.height = > > - ALIGN(params.depth.surf.logical_level0_px.height, 4); > > - > > - params.x1 = params.depth.surf.logical_level0_px.width; > > - params.y1 = params.depth.surf.logical_level0_px.height; > > + params.x1 = minify(params.depth.surf.logical_level0_px.width, > > + params.depth.view.base_level); > > + params.y1 = minify(params.depth.surf.logical_level0_px.height, > > + params.depth.view.base_level); > > + params.x1 = ALIGN(params.x1, 8); > > + params.y1 = ALIGN(params.y1, 4); > > + > > + if (params.depth.view.base_level == 0) { > > + /* TODO: What about MSAA? */ > > What were you thinking is missing here? At least we don't need any stomping of > msaa to single sampled with hiz, do we? Right, after discussing offline a bit. We seem to have everything in place, but agreed to leave this TODO here for now. Reviewed-by: Topi Pohjolainen > > > + params.depth.surf.logical_level0_px.width = params.x1; > > + params.depth.surf.logical_level0_px.height = params.y1; > > + } > > + > > + params.dst.surf.samples = params.depth.surf.samples; > > + params.dst.surf.logical_level0_px = params.depth.surf.logical_level0_px; > > > > assert(intel_miptree_level_has_hiz(mt, level)); > > > > -- > > 2.5.0.400.gff86faf > > > > ___ > > mesa-dev mailing list > > mesa-dev@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 25/35] i965/blorp: Map 1-D render targets with DIM_LAYOUT_GEN4_2D as 2D on gen9
On Thu, Jul 28, 2016 at 06:35:58PM -0700, Jason Ekstrand wrote: >On Jul 28, 2016 2:41 AM, "Pohjolainen, Topi" ><[1]topi.pohjolai...@intel.com> wrote: >> >> On Tue, Jul 26, 2016 at 03:02:16PM -0700, Jason Ekstrand wrote: >> > The sampling hardware can handle them ok. It just looks at the >tiling to >> > determine whether it's the new gen9 1-D layout or the old one. The >render >> > hardware isn't so smart. >> >> To clarify, this is not needed at this point but prepares for the >upcoming >> patches (i.e, prevents regression there)? > >Yup. When we start using the actual surf with min lod and stay layer, >1-D depth surfaces become a bit of a problem. Reviewed-by: Topi Pohjolainen > >> > --- >> > src/mesa/drivers/dri/i965/brw_blorp.c | 6 ++ >> > 1 file changed, 6 insertions(+) >> > >> > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c >b/src/mesa/drivers/dri/i965/brw_blorp.c >> > index d9b5554..2cf0f99 100644 >> > --- a/src/mesa/drivers/dri/i965/brw_blorp.c >> > +++ b/src/mesa/drivers/dri/i965/brw_blorp.c >> > @@ -371,6 +371,12 @@ brw_blorp_emit_surface_state(struct >brw_context *brw, >> > >> > struct isl_surf surf = surface->surf; >> > >> > + if (surf.dim == ISL_SURF_DIM_1D && >> > + surf.dim_layout == ISL_DIM_LAYOUT_GEN4_2D) { >> > + assert(surf.logical_level0_px.height == 1); >> > + surf.dim = ISL_SURF_DIM_2D; >> > + } >> > + >> > union isl_color_value clear_color = { .u32 = { 0, 0, 0, 0 } }; >> > >> > const struct isl_surf *aux_surf = NULL; >> > -- >> > 2.5.0.400.gff86faf >> > >> > ___ >> > mesa-dev mailing list >> > [2]mesa-dev@lists.freedesktop.org >> > [3]https://lists.freedesktop.org/mailman/listinfo/mesa-dev > > References > >1. mailto:topi.pohjolai...@intel.com >2. mailto:mesa-dev@lists.freedesktop.org >3. 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 v2 21/35] i965/blorp: Use the isl_view from the blorp_surface_info
On Tue, Jul 26, 2016 at 03:02:12PM -0700, Jason Ekstrand wrote: > --- > src/mesa/drivers/dri/i965/brw_blorp.c | 18 +- > 1 file changed, 1 insertion(+), 17 deletions(-) Reviewed-by: Topi Pohjolainen > > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c > b/src/mesa/drivers/dri/i965/brw_blorp.c > index 78707ca..d9b5554 100644 > --- a/src/mesa/drivers/dri/i965/brw_blorp.c > +++ b/src/mesa/drivers/dri/i965/brw_blorp.c > @@ -386,22 +386,6 @@ brw_blorp_emit_surface_state(struct brw_context *brw, >clear_color = intel_miptree_get_isl_clear_color(brw, surface->mt); > } > > - struct isl_view view = { > - .format = surface->view.format, > - .base_level = 0, > - .levels = 1, > - .base_array_layer = 0, > - .array_len = 1, > - .channel_select = { > - ISL_CHANNEL_SELECT_RED, > - ISL_CHANNEL_SELECT_GREEN, > - ISL_CHANNEL_SELECT_BLUE, > - ISL_CHANNEL_SELECT_ALPHA, > - }, > - .usage = is_render_target ? ISL_SURF_USAGE_RENDER_TARGET_BIT : > - ISL_SURF_USAGE_TEXTURE_BIT, > - }; > - > uint32_t surf_offset; > uint32_t *dw = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, >ss_info.num_dwords * 4, ss_info.ss_align, > @@ -409,7 +393,7 @@ brw_blorp_emit_surface_state(struct brw_context *brw, > > const uint32_t mocs = is_render_target ? ss_info.rb_mocs : > ss_info.tex_mocs; > > - isl_surf_fill_state(&brw->isl_dev, dw, .surf = &surf, .view = &view, > + isl_surf_fill_state(&brw->isl_dev, dw, .surf = &surf, .view = > &surface->view, > .address = surface->mt->bo->offset64 + > surface->bo_offset, > .aux_surf = aux_surf, .aux_usage = surface->aux_usage, > .aux_address = aux_offset, > -- > 2.5.0.400.gff86faf > > ___ > 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 v2 01/35] isl: Fix the parameter names for get_intratile_offset
On Tue, Jul 26, 2016 at 03:01:52PM -0700, Jason Ekstrand wrote: > It's been in elements for a while but, for whatever reason, the parameter > names in the header file never got updated. > --- > src/intel/isl/isl.h | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Topi Pohjolainen > > diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h > index 19673f8..d0bac5d 100644 > --- a/src/intel/isl/isl.h > +++ b/src/intel/isl/isl.h > @@ -1353,11 +1353,11 @@ isl_tiling_get_intratile_offset_el(const struct > isl_device *dev, > enum isl_tiling tiling, > uint8_t bs, > uint32_t row_pitch, > - uint32_t total_x_offset_B, > - uint32_t total_y_offset_rows, > + uint32_t total_x_offset_el, > + uint32_t total_y_offset_el, > uint32_t *base_address_offset, > - uint32_t *x_offset_B, > - uint32_t *y_offset_rows); > + uint32_t *x_offset_el, > + uint32_t *y_offset_el); > > /** > * @brief Get value of 3DSTATE_DEPTH_BUFFER.SurfaceFormat > -- > 2.5.0.400.gff86faf > > ___ > 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/5] i965/sched: Change the scheduling heuristics to favor early program termination.
On Tue, Aug 16, 2016 at 1:54 PM, Francisco Jerez wrote: > This uses the unblocked time of the exit assigned to each available > node to attempt to unblock exit nodes as early as possible, > potentially reducing the runtime of the shader when an exit branch is > taken. There is a natural trade-off between terminating the program > as early as possible and reducing the worst-case latency of the > program as a whole (since this will typically move exit-unblocking > nodes closer to its dependencies potentially causing additional stalls > of the execution pipeline), but in practice the bandwidth and ALU > cycle savings from terminating the program earlier tend to outweigh > the slight increase in worst-case program execution latency, so it > makes sense to prefer nodes likely to unblock an earlier exit > regardless of the latency benefits of other available nodes. > > I haven't observed any benchmark regressions from this change after > testing on VLV, HSW, BDW, BSW and SKL. The FPS of the GfxBench > Manhattan benchmark increases by 10%-20% and the FPS of Unigine Valley > improves by roughly 5% depending on the platform and settings. > Thanks for working on this! We've known about it for a while and it's nice to finally get some progress. Reviewed-by: Jason Ekstrand > The change to the register pressure-sensitive heuristic is rather > conservative and gives precedence to the existing heuristic in order > to avoid increasing register pressure and causing spill count and SIMD > width regressions in shader-db. It may make sense to revisit this > with additional performance data. > --- > .../drivers/dri/i965/brw_schedule_instructions.cpp| 19 > --- > 1 file changed, 16 insertions(+), 3 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp > b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp > index 96562cf..dfcaa80 100644 > --- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp > +++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp > @@ -1407,11 +1407,15 @@ fs_instruction_scheduler::choose_instruction_to_ > schedule() > if (mode == SCHEDULE_PRE || mode == SCHEDULE_POST) { >int chosen_time = 0; > > - /* Of the instructions ready to execute or the closest to > - * being ready, choose the oldest one. > + /* Of the instructions ready to execute or the closest to being > ready, > + * choose the one most likely to unblock an early program exit, or > + * otherwise the oldest one. > */ >foreach_in_list(schedule_node, n, &instructions) { > - if (!chosen || n->unblocked_time < chosen_time) { > + if (!chosen || > + exit_unblocked_time(n) < exit_unblocked_time(chosen) || > + (exit_unblocked_time(n) == exit_unblocked_time(chosen) && > + n->unblocked_time < chosen_time)) { > chosen = n; > chosen_time = n->unblocked_time; > } > @@ -1500,6 +1504,15 @@ fs_instruction_scheduler::choose_instruction_to_ > schedule() > continue; > } > > + /* Prefer the node most likely to unblock an early program exit. > + */ > + if (exit_unblocked_time(n) < exit_unblocked_time(chosen)) { > +chosen = n; > +continue; > + } else if (exit_unblocked_time(n) > exit_unblocked_time(chosen)) > { > +continue; > + } > + > /* If all other metrics are equal, we prefer the first > instruction in >* the list (program execution). >*/ > -- > 2.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/5] i965/sched: Assign a preferred exit node to each node of the dependency graph.
On Tue, Aug 16, 2016 at 1:54 PM, Francisco Jerez wrote: > This adds a bit of metadata to schedule_node that will be used to > compare available nodes in the scheduling heuristic code based on > which of them unblocks the earliest successor exit node. Note that > assigning exit nodes wouldn't be necessary in a bottom-up scheduler > because we could achieve the same effect by scheduling the exit nodes > themselves appropriately. > Hopefully we can actually make that switch soon. > --- > .../drivers/dri/i965/brw_schedule_instructions.cpp | 59 > ++ > 1 file changed, 59 insertions(+) > > diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp > b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp > index 19d9ec1..96562cf 100644 > --- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp > +++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp > @@ -86,8 +86,34 @@ public: > * its children, or just the issue_time if it's a leaf node. > */ > int delay; > + > + /** > +* Preferred exit node among the (direct or indirect) successors of > this > +* node. Among the scheduler nodes blocked by this node, this will be > the > +* one that may cause earliest program termination, or NULL if none of > the > +* successors is an exit node. > +*/ > + schedule_node *exit; > }; > > +/** > + * Lower bound of the scheduling time after which one of the instructions > + * blocked by this node may lead to program termination. > + * > + * exit_unblocked_time() determines a strict partial ordering relation > '«' on > + * the set of scheduler nodes as follows: > + * > + * n « m <-> exit_unblocked_time(n) < exit_unblocked_time(m) > + * > + * which can be used to heuristically order nodes according to how early > they > + * can unblock an exit node and lead to program termination. > + */ > +static inline int > +exit_unblocked_time(const schedule_node *n) > +{ > + return n->exit ? n->exit->unblocked_time : INT_MAX; > +} > + > void > schedule_node::set_latency_gen4() > { > @@ -460,6 +486,7 @@ public: > void run(cfg_t *cfg); > void add_insts_from_block(bblock_t *block); > void compute_delays(); > + void compute_exits(); > virtual void calculate_deps() = 0; > virtual schedule_node *choose_instruction_to_schedule() = 0; > > @@ -772,6 +799,7 @@ schedule_node::schedule_node(backend_instruction > *inst, > this->unblocked_time = 0; > this->cand_generation = 0; > this->delay = 0; > + this->exit = NULL; > > /* We can't measure Gen6 timings directly but expect them to be much > * closer to Gen7 than Gen4. > @@ -812,6 +840,36 @@ instruction_scheduler::compute_delays() > } > } > > +void > +instruction_scheduler::compute_exits() > +{ > + /* Calculate a lower bound of the scheduling time of each node in the > +* graph. This is analogous to the node's critical path but calculated > +* from the top instead of from the bottom of the block. > +*/ > + foreach_in_list(schedule_node, n, &instructions) { > + for (int i = 0; i < n->child_count; i++) { > + n->children[i]->unblocked_time = > +MAX2(n->children[i]->unblocked_time, > + n->unblocked_time + issue_time(n->inst) + > n->child_latency[i]); > + } > + } > Dos this calculation affect scheduling later on? I don't think it will since we're effectively setting n->unblocked_time to the lowest possible based on a dependency DFS. Later uses *shouldn't* set it to anything less. Should be easy enough to check with shader-db. > + > + /* Calculate the exit of each node by induction based on the exit > nodes of > +* its children. The preferred exit of a node is the one among the > exit > +* nodes of its children which can be unblocked first according to the > +* optimistic unblocked time estimate calculated above. > +*/ > + foreach_in_list_reverse(schedule_node, n, &instructions) { > + n->exit = (n->inst->opcode == FS_OPCODE_DISCARD_JUMP ? n : NULL); > + > + for (int i = 0; i < n->child_count; i++) { > + if (exit_unblocked_time(n->children[i]) < > exit_unblocked_time(n)) > It strikes me as a bit odd that we compare n->children[i] with n rather than n->exit, but the next line means it's equivalent. > +n->exit = n->children[i]->exit; > + } > + } > +} > Assuming this patch *doesn't* change scheduling in any way, Reviewed-by: Jason Ekstrand > + > /** > * Add a dependency between two instruction nodes. > * > @@ -1631,6 +1689,7 @@ instruction_scheduler::run(cfg_t *cfg) >calculate_deps(); > >compute_delays(); > + compute_exits(); > >schedule_instructions(block); > } > -- > 2.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailin
Re: [Mesa-dev] [PATCH 1/5] i965/fs: Drop bogus writemasking disable bit from HALT instructions.
On Tue, Aug 16, 2016 at 1:54 PM, Francisco Jerez wrote: > This may have been the reason people ran into problems with > non-uniform HALT instructions and ended up using the inefficient > ANY16H/ANY8H predicates instead of ANY4H or NORMAL in order to prevent > non-uniform discard. The HALT instruction is able to handle > non-uniform execution masks just fine. > Do you know why we were setting MASK_DISABLE? Perhaps we were getting the exec size wrong before? In any case, if there's no piglig problems with patch 2, then I'll believe it works. Reviewed-by: Jason Ekstrand > --- > src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 4 > 1 file changed, 4 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp > b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp > index 647950f..22190f8 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp > @@ -1053,11 +1053,7 @@ fs_generator::generate_discard_jump(fs_inst *inst) > * current block (or the program). > */ > this->discard_halt_patches.push_tail(new(mem_ctx) > ip_record(p->nr_insn)); > - > - brw_push_insn_state(p); > - brw_set_default_mask_control(p, BRW_MASK_DISABLE); > gen6_HALT(p); > - brw_pop_insn_state(p); > } > > void > -- > 2.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/5] i965/fs: Switch to per-subspan discard jumps.
This makes a lot of sense Reviewed-by: Jason Ekstrand On Tue, Aug 16, 2016 at 1:54 PM, Francisco Jerez wrote: > ANY4H is more efficient than ANY8H and ANY16H because it makes sure > that whenever a whole subspan hits a discard statement it gets > disabled by the EU until the end of the program, regardless of whether > the discard condition is uniform across all channels of the SIMD8-16 > thread. OTOH ANY8H/ANY16H would cause the rest of the program to be > executed for *all* channels if only one of the channels hadn't taken > the discard branch, potentially increasing the bandwidth and ALU usage > of the program unnecessarily. > > This change increases the FPS by over 3x of a simple micro-benchmark > that discards a bunch of fragments and then does a single costly > texturing operation. I've just re-verified the FPS change on HSW and > SKL, but I expect all platforms from Gen6 up to get a similar benefit. > > Note that we could potentially be more aggressive and use the NORMAL > predicate to discard individual channels, but that would need to > happen post-scheduling because the scheduler currently doesn't care to > reorder HALT instructions with respect to other instructions, and the > NORMAL predicate would cause the results of subsequent derivative > computations to become undefined -- If the scheduler didn't reorder > HALT instructions it would actually be safe to switch to NORMAL > because the behavior of derivative computations after a non-uniform > discard statement is undefined by the GLSL spec, but that would make > the optimization implemented by one of the following commits somewhat > more difficult. > --- > src/mesa/drivers/dri/i965/brw_fs.cpp | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp > b/src/mesa/drivers/dri/i965/brw_fs.cpp > index d1ac80a..c5067cd 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp > @@ -1394,9 +1394,7 @@ fs_visitor::emit_discard_jump() > fs_inst *discard_jump = bld.emit(FS_OPCODE_DISCARD_JUMP); > discard_jump->flag_subreg = 1; > > - discard_jump->predicate = (dispatch_width == 8) > - ? BRW_PREDICATE_ALIGN1_ANY8H > - : BRW_PREDICATE_ALIGN1_ANY16H; > + discard_jump->predicate = BRW_PREDICATE_ALIGN1_ANY4H; > discard_jump->predicate_inverse = true; > } > > -- > 2.9.0 > > ___ > 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 05/23] mesa: Convert string_to_uint_map to the util hash table
On Tue, 2016-08-16 at 22:10 +0200, Thomas Helland wrote: > And remove the now unused hash_table_replace. As far as I can tell your not doing the equivalent hash_table_replace() here you are just leaking memory. See comments below. > > Signed-off-by: Thomas Helland > --- > src/mesa/program/hash_table.h | 62 +-- > > 1 file changed, 18 insertions(+), 44 deletions(-) > > diff --git a/src/mesa/program/hash_table.h > b/src/mesa/program/hash_table.h > index 421d0e9..bd50615 100644 > --- a/src/mesa/program/hash_table.h > +++ b/src/mesa/program/hash_table.h > @@ -111,8 +111,6 @@ static inline void *hash_table_find(struct > hash_table *ht, const void *key) > * \warning > * The value passed by \c key is kept in the hash table and is used > by later > * calls to \c hash_table_find. > - * > - * \sa hash_table_replace > */ > static inline void hash_table_insert(struct hash_table *ht, void > *data, > const void *key) > @@ -121,33 +119,6 @@ static inline void hash_table_insert(struct > hash_table *ht, void *data, > } > > /** > - * Add an element to a hash table with replacement > - * > - * \return > - * 1 if it did replace the value (in which case the old key is > kept), 0 if it > - * did not replace the value (in which case the new key is kept). > - * > - * \warning > - * If \c key is already in the hash table, \c data will \b replace > the most > - * recently inserted \c data (see the warning in \c > hash_table_insert) for > - * that key. > - * > - * \sa hash_table_insert > - */ > -static inline bool hash_table_replace(struct hash_table *ht, void > *data, > - const void *key) > -{ > - struct hash_entry *entry = _mesa_hash_table_search(ht, key); > - if (entry) { > - entry->data = data; > - return true; > - } else { > - _mesa_hash_table_insert(ht, key, data); > - return false; > - } > -} > - > -/** > * Remove a specific element from a hash table. > */ > static inline void hash_table_remove(struct hash_table *ht, const > void *key) > @@ -240,14 +211,14 @@ struct string_to_uint_map { > public: > string_to_uint_map() > { > - this->ht = hash_table_ctor(0, hash_table_string_hash, > - hash_table_string_compare); > + this->ht = _mesa_hash_table_create(NULL, > _mesa_key_hash_string, > + _mesa_key_string_equal); > } > > ~string_to_uint_map() > { > hash_table_call_foreach(this->ht, delete_key, NULL); > - hash_table_dtor(this->ht); > + _mesa_hash_table_destroy(this->ht, NULL); > } > > /** > @@ -256,7 +227,7 @@ public: > void clear() > { > hash_table_call_foreach(this->ht, delete_key, NULL); > - hash_table_clear(this->ht); > + _mesa_hash_table_clear(this->ht, NULL); > } > > /** > @@ -290,12 +261,13 @@ public: > */ > bool get(unsigned &value, const char *key) > { > - const intptr_t v = > - (intptr_t) hash_table_find(this->ht, (const void *) key); > + hash_entry *entry = _mesa_hash_table_search(this->ht, > + (const void *) > key); > > - if (v == 0) > - return false; > + if (!entry) > + return false; > > + const intptr_t v = (intptr_t) entry->data; > value = (unsigned)(v - 1); > return true; > } > @@ -307,19 +279,21 @@ public: > * valid value in the table. Bias the value by +1 so that a > * user-specified zero is stored as 1. This enables ::get to > tell the > * difference between a user-specified zero (returned as 1 by > - * hash_table_find) and the key not in the table (returned as > 0 by > - * hash_table_find). > + * _mesa_hash_table_search) and the key not in the table > (returned as 0 by > + * _mesa_hash_table_find). > * > * The net effect is that we can't store UINT_MAX in the > table. This is > * because UINT_MAX+1 = 0. > */ > assert(value != UINT_MAX); > char *dup_key = strdup(key); > - bool result = hash_table_replace(this->ht, > - (void *) (intptr_t) (value + > 1), > - dup_key); > - if (result) > - free(dup_key); > + > + hash_entry *entry = > +_mesa_hash_table_insert(this->ht, dup_key, > +(void *) (intptr_t) (value + > 1)); As far as I can tell entry->key will always be equal to dup_key as _mesa_hash_table_insert() just replaces a previous hash entry with a matching string. So we will never free the string from a previous insert. > + > + if (entry->key != dup_key) > + free(dup_key); > } > > private: ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop
Re: [Mesa-dev] [PATCH 3/5] i965/sched: Calculate the critical path of scheduling nodes non-recursively.
Reviewed-by: Jason Ekstrand On Tue, Aug 16, 2016 at 1:54 PM, Francisco Jerez wrote: > The critical path of each node is calculated by induction based on the > critical paths of its children, which can be done in a post-order > depth-first traversal of the dependency graph. The current code > implements graph traversal by iterating over all nodes of the graph > and then recursing into its children -- But it turns out that > recursion is unnecessary because the lexical order of instructions in > the block is already a good enough reverse post-order of the > dependency graph (if it weren't a reverse post-order some instruction > would have been located before one of its dependencies in the original > ordering of the basic block, which is impossible), so we just need to > walk the instruction list in reverse to achieve the same result more > efficiently. > > No shader-db changes. > --- > .../drivers/dri/i965/brw_schedule_instructions.cpp | 25 > +++--- > 1 file changed, 12 insertions(+), 13 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp > b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp > index 8afdc25..19d9ec1 100644 > --- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp > +++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp > @@ -459,7 +459,7 @@ public: > > void run(cfg_t *cfg); > void add_insts_from_block(bblock_t *block); > - void compute_delay(schedule_node *node); > + void compute_delays(); > virtual void calculate_deps() = 0; > virtual schedule_node *choose_instruction_to_schedule() = 0; > > @@ -796,17 +796,18 @@ instruction_scheduler::add_insts_from_block(bblock_t > *block) > this->instructions_to_schedule = block->end_ip - block->start_ip + 1; > } > > -/** Recursive computation of the delay member of a node. */ > +/** Computation of the delay member of each node. */ > void > -instruction_scheduler::compute_delay(schedule_node *n) > +instruction_scheduler::compute_delays() > { > - if (!n->child_count) { > - n->delay = issue_time(n->inst); > - } else { > - for (int i = 0; i < n->child_count; i++) { > - if (!n->children[i]->delay) > -compute_delay(n->children[i]); > - n->delay = MAX2(n->delay, n->latency + n->children[i]->delay); > + foreach_in_list_reverse(schedule_node, n, &instructions) { > + if (!n->child_count) { > + n->delay = issue_time(n->inst); > + } else { > + for (int i = 0; i < n->child_count; i++) { > +assert(n->children[i]->delay); > +n->delay = MAX2(n->delay, n->latency + n->children[i]->delay); > + } >} > } > } > @@ -1629,9 +1630,7 @@ instruction_scheduler::run(cfg_t *cfg) > >calculate_deps(); > > - foreach_in_list(schedule_node, n, &instructions) { > - compute_delay(n); > - } > + compute_delays(); > >schedule_instructions(block); > } > -- > 2.9.0 > > ___ > 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 02/23] mesa: Replace hashing functions of prog_hash_table
On Tue, 2016-08-16 at 22:10 +0200, Thomas Helland wrote: > This will make it functionally equivalent to the one in util. > This enables us to do a step-by-step replacement of the table. > > Signed-off-by: Thomas Helland You should really just move these to the header since you are moving them there in the next patch anyway. Otherwise this is just code churn. > --- > src/mesa/program/prog_hash_table.c | 22 -- > 1 file changed, 8 insertions(+), 14 deletions(-) > > diff --git a/src/mesa/program/prog_hash_table.c > b/src/mesa/program/prog_hash_table.c > index cbea74c..a712175 100644 > --- a/src/mesa/program/prog_hash_table.c > +++ b/src/mesa/program/prog_hash_table.c > @@ -35,33 +35,27 @@ > unsigned > hash_table_string_hash(const void *key) > { > -const char *str = (const char *) key; > -unsigned hash = 5381; > - > - > -while (*str != '\0') { > -hash = (hash * 33) + *str; > -str++; > -} > - > -return hash; > + const char *str = (const char *) key; > + uint32_t hash = _mesa_hash_string(str); > + return hash; > } > > -bool hash_table_string_compare(const void *a, const void *b) > +bool > +hash_table_string_compare(const void *a, const void *b) > { > - return strcmp(a, b) == 0; > + return _mesa_key_string_equal(a, b); > } > > > unsigned > hash_table_pointer_hash(const void *key) > { > - return (unsigned)((uintptr_t) key / sizeof(void *)); > + return _mesa_hash_pointer(key); > } > > > bool > hash_table_pointer_compare(const void *key1, const void *key2) > { > - return key1 == key2; > + return _mesa_key_pointer_equal(key1, key2); > } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 22/23] glsl: Convert glcpp-parse to the util hash table
On Tue, 2016-08-16 at 22:10 +0200, Thomas Helland wrote: > And change the include in glcpp.h accordingly. > > Signed-off-by: Thomas Helland > --- > src/compiler/glsl/glcpp/glcpp-parse.y | 54 ++--- > -- > src/compiler/glsl/glcpp/glcpp.h | 2 +- > 2 files changed, 35 insertions(+), 21 deletions(-) > > diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y > b/src/compiler/glsl/glcpp/glcpp-parse.y > index eff53be..04ca126 100644 > --- a/src/compiler/glsl/glcpp/glcpp-parse.y > +++ b/src/compiler/glsl/glcpp/glcpp-parse.y > @@ -278,6 +278,7 @@ control_line_success: > HASH_TOKEN DEFINE_TOKEN define > |HASH_TOKEN UNDEF IDENTIFIER NEWLINE { > macro_t *macro; > + struct hash_entry *entry; > > /* Section 3.4 (Preprocessor) of the GLSL ES 3.00 > spec says: > * > @@ -309,9 +310,10 @@ control_line_success: > glcpp_error(& @1, parser, "Built-in (pre- > defined)" > " macro names cannot be > undefined."); > > - macro = hash_table_find (parser->defines, $3); > - if (macro) { > - hash_table_remove (parser->defines, $3); > + entry = _mesa_hash_table_search (parser->defines, > $3); > + if (entry) { > + macro = entry->data; > + _mesa_hash_table_remove (parser->defines, > entry); > ralloc_free (macro); > } > ralloc_free ($3); > @@ -348,13 +350,16 @@ control_line_success: > _glcpp_parser_skip_stack_push_if (parser, & @1, 0); > } > |HASH_TOKEN IFDEF IDENTIFIER junk NEWLINE { > - macro_t *macro = hash_table_find (parser->defines, > $3); > + struct hash_entry *entry = > + _mesa_hash_table_search(parser- > >defines, $3); > + macro_t *macro = entry ? entry->data : NULL; > ralloc_free ($3); > _glcpp_parser_skip_stack_push_if (parser, & @1, > macro != NULL); > } > |HASH_TOKEN IFNDEF IDENTIFIER junk NEWLINE { > - macro_t *macro = hash_table_find (parser->defines, > $3); > - ralloc_free ($3); > + struct hash_entry *entry = > + _mesa_hash_table_search(parser- > >defines, $3); > + macro_t *macro = entry ? entry->data : NULL; > _glcpp_parser_skip_stack_push_if (parser, & @3, > macro == NULL); > } > |HASH_TOKEN ELIF pp_tokens NEWLINE { > @@ -1342,8 +1347,8 @@ glcpp_parser_create(glcpp_extension_iterator > extensions, void *state, gl_api api > parser = ralloc (NULL, glcpp_parser_t); > > glcpp_lex_init_extra (parser, &parser->scanner); > - parser->defines = hash_table_ctor(32, hash_table_string_hash, > - hash_table_string_compare); > + parser->defines = _mesa_hash_table_create(NULL, > _mesa_key_hash_string, > + > _mesa_key_string_equal); Git is reporting: .git/rebase-apply/patch:59: space before tab in indent. _mesa_key_string_equal); warning: 1 line adds whitespace errors. Ideally we should remove the tabs from this file but I'm not sure its worth it. > parser->active = NULL; > parser->lexing_directive = 0; > parser->space_tokens = 1; > @@ -1384,7 +1389,7 @@ void > glcpp_parser_destroy(glcpp_parser_t *parser) > { > glcpp_lex_destroy (parser->scanner); > - hash_table_dtor (parser->defines); > + _mesa_hash_table_destroy(parser->defines, NULL); > ralloc_free (parser); > } > > @@ -1563,8 +1568,8 @@ _glcpp_parser_evaluate_defined(glcpp_parser_t > *parser, token_node_t *node, > > *last = node; > > - return hash_table_find(parser->defines, > - argument->token->value.str) ? 1 : 0; > + return _mesa_hash_table_search(parser->defines, > + argument->token->value.str) ? 1 : > 0; > > FAIL: > glcpp_error (&defined->token->location, parser, > @@ -1705,6 +1710,7 @@ static token_list_t * > _glcpp_parser_expand_function(glcpp_parser_t *parser, token_node_t > *node, > token_node_t **last, expansion_mode_t > mode) > { > + struct hash_entry *entry; > macro_t *macro; > const char *identifier; > argument_list_t *arguments; > @@ -1714,7 +1720,8 @@ _glcpp_parser_expand_function(glcpp_parser_t > *parser, token_node_t *node, > > identifier = node->token->value.str; > > - macro = hash_table_find(parser->defines, identifier); > + entry = _mesa_hash_table_search(parser->defines, identifier); > + macro = entry ? entry->data : NULL; > > assert(macro->is_function); > > @@ -1811,6 +1818,7 @@ _glcpp_parser_expand_node(glcpp_parser_t > *p
Re: [Mesa-dev] [PATCH 14/16] i965: Enable GL_KHR_blend_equation_advanced on G45 and later.
Kenneth Graunke writes: > Signed-off-by: Kenneth Graunke Reviewed-by: Francisco Jerez > --- > src/mesa/drivers/dri/i965/brw_link.cpp | 2 ++ > src/mesa/drivers/dri/i965/intel_extensions.c | 4 +++- > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp > b/src/mesa/drivers/dri/i965/brw_link.cpp > index 1ad2369..4800be0 100644 > --- a/src/mesa/drivers/dri/i965/brw_link.cpp > +++ b/src/mesa/drivers/dri/i965/brw_link.cpp > @@ -101,6 +101,8 @@ process_glsl_ir(gl_shader_stage stage, > > ralloc_adopt(mem_ctx, shader->ir); > > + lower_blend_equation_advanced(shader); > + > /* lower_packing_builtins() inserts arithmetic instructions, so it > * must precede lower_instructions(). > */ > diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c > b/src/mesa/drivers/dri/i965/intel_extensions.c > index 33114db..daf5567 100644 > --- a/src/mesa/drivers/dri/i965/intel_extensions.c > +++ b/src/mesa/drivers/dri/i965/intel_extensions.c > @@ -280,8 +280,10 @@ intelInitExtensions(struct gl_context *ctx) > ctx->Extensions.EXT_shader_integer_mix = ctx->Const.GLSLVersion >= 130; > ctx->Extensions.MESA_shader_integer_functions = ctx->Const.GLSLVersion >= > 130; > > - if (brw->is_g4x || brw->gen >= 5) > + if (brw->is_g4x || brw->gen >= 5) { >ctx->Extensions.MESA_shader_framebuffer_fetch_non_coherent = true; > + ctx->Extensions.KHR_blend_equation_advanced = true; > + } > > if (brw->gen >= 5) { >ctx->Extensions.ARB_texture_query_levels = ctx->Const.GLSLVersion >= > 130; > -- > 2.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 16/16] i965: Implement GL_KHR_blend_equation_advanced_coherent on Gen9+.
Kenneth Graunke writes: > We always use a coherent read, and ignore the "opt out" enable flag. > > Signed-off-by: Kenneth Graunke Reviewed-by: Francisco Jerez > --- > src/mesa/drivers/dri/i965/intel_extensions.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c > b/src/mesa/drivers/dri/i965/intel_extensions.c > index daf5567..2878d42 100644 > --- a/src/mesa/drivers/dri/i965/intel_extensions.c > +++ b/src/mesa/drivers/dri/i965/intel_extensions.c > @@ -398,6 +398,7 @@ intelInitExtensions(struct gl_context *ctx) > } > > if (brw->gen >= 9) { > + ctx->Extensions.KHR_blend_equation_advanced_coherent = true; >ctx->Extensions.KHR_texture_compression_astc_ldr = true; >ctx->Extensions.KHR_texture_compression_astc_sliced_3d = true; >ctx->Extensions.ARB_shader_stencil_export = true; > -- > 2.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 15/16] mesa: Implement GL_KHR_blend_equation_advanced_coherent.
Kenneth Graunke writes: > This adds the extension enable (so drivers can advertise it) and the > extra boolean state flag, GL_BLEND_ADVANCED_COHERENT_KHR, which can > be set to request coherent blending. > > Signed-off-by: Kenneth Graunke Reviewed-by: Francisco Jerez > --- > src/mesa/main/blend.c| 2 ++ > src/mesa/main/enable.c | 12 > src/mesa/main/extensions_table.h | 1 + > src/mesa/main/get.c | 1 + > src/mesa/main/get_hash_params.py | 3 +++ > src/mesa/main/mtypes.h | 3 +++ > 6 files changed, 22 insertions(+) > > diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c > index e23b9cb..73fcb6a 100644 > --- a/src/mesa/main/blend.c > +++ b/src/mesa/main/blend.c > @@ -1021,6 +1021,8 @@ void _mesa_init_color( struct gl_context * ctx ) > * if EGL_KHR_gl_colorspace has been used to request sRGB. > */ > ctx->Color.sRGBEnabled = _mesa_is_gles(ctx); > + > + ctx->Color.BlendCoherent = true; > } > > /*@}*/ > diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c > index 1468a45..d1ab81e 100644 > --- a/src/mesa/main/enable.c > +++ b/src/mesa/main/enable.c > @@ -1017,6 +1017,14 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, > GLboolean state) > ctx->Multisample.SampleMask = state; > break; > > + case GL_BLEND_ADVANCED_COHERENT_KHR: > + CHECK_EXTENSION(KHR_blend_equation_advanced_coherent, cap); > + if (ctx->Color.BlendCoherent == state) > +return; > + FLUSH_VERTICES(ctx, _NEW_COLOR); > + ctx->Color.BlendCoherent = state; > + break; > + >default: > goto invalid_enum_error; > } > @@ -1619,6 +1627,10 @@ _mesa_IsEnabled( GLenum cap ) > CHECK_EXTENSION(ARB_sample_shading); > return ctx->Multisample.SampleShading; > > + case GL_BLEND_ADVANCED_COHERENT_KHR: > + CHECK_EXTENSION(KHR_blend_equation_advanced_coherent); > + return ctx->Color.BlendCoherent; > + >default: > goto invalid_enum_error; > } > diff --git a/src/mesa/main/extensions_table.h > b/src/mesa/main/extensions_table.h > index e8c825b..c6fdd2c 100644 > --- a/src/mesa/main/extensions_table.h > +++ b/src/mesa/main/extensions_table.h > @@ -283,6 +283,7 @@ EXT(INGR_blend_func_separate, > EXT_blend_func_separate > EXT(INTEL_performance_query , INTEL_performance_query > , GLL, GLC, x , ES2, 2013) > > EXT(KHR_blend_equation_advanced , KHR_blend_equation_advanced > , GLL, GLC, x , ES2, 2014) > +EXT(KHR_blend_equation_advanced_coherent, > KHR_blend_equation_advanced_coherent , GLL, GLC, x , ES2, 2014) > EXT(KHR_context_flush_control , dummy_true > , GLL, GLC, x , ES2, 2014) > EXT(KHR_debug , dummy_true > , GLL, GLC, 11, ES2, 2012) > EXT(KHR_robust_buffer_access_behavior , > ARB_robust_buffer_access_behavior , GLL, GLC, x , ES2, 2014) > diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c > index b017827..97dfb0c 100644 > --- a/src/mesa/main/get.c > +++ b/src/mesa/main/get.c > @@ -465,6 +465,7 @@ EXTRA_EXT(ATI_meminfo); > EXTRA_EXT(NVX_gpu_memory_info); > EXTRA_EXT(ARB_cull_distance); > EXTRA_EXT(EXT_window_rectangles); > +EXTRA_EXT(KHR_blend_equation_advanced_coherent); > > static const int > extra_ARB_color_buffer_float_or_glcore[] = { > diff --git a/src/mesa/main/get_hash_params.py > b/src/mesa/main/get_hash_params.py > index 89d164d..3414743 100644 > --- a/src/mesa/main/get_hash_params.py > +++ b/src/mesa/main/get_hash_params.py > @@ -338,6 +338,9 @@ descriptor=[ > > # blend_func_extended >[ "MAX_DUAL_SOURCE_DRAW_BUFFERS", > "CONTEXT_INT(Const.MaxDualSourceDrawBuffers), extra_ARB_blend_func_extended" > ], > + > +# GL_KHR_blend_equation_advanced_coherent > + [ "BLEND_ADVANCED_COHERENT_KHR", "CONTEXT_BOOL(Color.BlendCoherent), > extra_KHR_blend_equation_advanced_coherent" ], > ]}, > > # GLES3 is not a typo. > diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h > index 9e0b831..5603722 100644 > --- a/src/mesa/main/mtypes.h > +++ b/src/mesa/main/mtypes.h > @@ -454,6 +454,8 @@ struct gl_colorbuffer_attrib > GLboolean _BlendEquationPerBuffer; > /** Per-buffer "is an advanced blending equation set?" flags. */ > GLbitfield _AdvancedBlendEnabled; > + /** Coherency requested via glEnable(GL_BLEND_ADVANCED_COHERENT_KHR)? */ > + bool BlendCoherent; > /*@}*/ > > /** > @@ -3950,6 +3952,7 @@ struct gl_extensions > GLboolean GREMEDY_string_marker; > GLboolean INTEL_performance_query; > GLboolean KHR_blend_equation_advanced; > + GLboolean KHR_blend_equation_advanced_coherent; > GLboolean KHR_robustness; > GLboolean KHR_texture_compression_astc_hdr; > GLboolean KHR_texture_compression_astc_ldr; > -- > 2.9.0 > > _
Re: [Mesa-dev] [PATCH 08/16] mesa: Allow advanced blending enums in glBlendEquation[i].
Kenneth Graunke writes: > Don't allow them in glBlendEquationSeparate[i], though, as required > by the spec. > > Signed-off-by: Kenneth Graunke Reviewed-by: Francisco Jerez > --- > src/mesa/main/blend.c | 64 > +++ > 1 file changed, 54 insertions(+), 10 deletions(-) > > diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c > index 2ae22e9..fe83e59 100644 > --- a/src/mesa/main/blend.c > +++ b/src/mesa/main/blend.c > @@ -336,11 +336,11 @@ _mesa_BlendFuncSeparateiARB(GLuint buf, GLenum > sfactorRGB, GLenum dfactorRGB, > > > /** > - * Check if given blend equation is legal. > - * \return GL_TRUE if legal, GL_FALSE otherwise. > + * Return true if \p mode is a legal blending equation, excluding > + * GL_KHR_blend_equation_advanced modes. > */ > -static GLboolean > -legal_blend_equation(const struct gl_context *ctx, GLenum mode) > +static bool > +legal_simple_blend_equation(const struct gl_context *ctx, GLenum mode) > { > switch (mode) { > case GL_FUNC_ADD: > @@ -356,6 +356,36 @@ legal_blend_equation(const struct gl_context *ctx, > GLenum mode) > } > > > +/** > + * Return true if \p mode is one of the advanced blending equations > + * defined by GL_KHR_blend_equation_advanced. > + */ > +static bool > +legal_advanced_blend_equation(const struct gl_context *ctx, GLenum mode) > +{ > + switch (mode) { > + case GL_MULTIPLY_KHR: > + case GL_SCREEN_KHR: > + case GL_OVERLAY_KHR: > + case GL_DARKEN_KHR: > + case GL_LIGHTEN_KHR: > + case GL_COLORDODGE_KHR: > + case GL_COLORBURN_KHR: > + case GL_HARDLIGHT_KHR: > + case GL_SOFTLIGHT_KHR: > + case GL_DIFFERENCE_KHR: > + case GL_EXCLUSION_KHR: > + case GL_HSL_HUE_KHR: > + case GL_HSL_SATURATION_KHR: > + case GL_HSL_COLOR_KHR: > + case GL_HSL_LUMINOSITY_KHR: > + return _mesa_has_KHR_blend_equation_advanced(ctx); > + default: > + return false; > + } > +} > + > + > /* This is really an extension function! */ > void GLAPIENTRY > _mesa_BlendEquation( GLenum mode ) > @@ -390,7 +420,8 @@ _mesa_BlendEquation( GLenum mode ) > if (!changed) >return; > > - if (!legal_blend_equation(ctx, mode)) { > + if (!legal_simple_blend_equation(ctx, mode) && > + !legal_advanced_blend_equation(ctx, mode)) { >_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquation"); >return; > } > @@ -426,7 +457,8 @@ _mesa_BlendEquationiARB(GLuint buf, GLenum mode) >return; > } > > - if (!legal_blend_equation(ctx, mode)) { > + if (!legal_simple_blend_equation(ctx, mode) && > + !legal_advanced_blend_equation(ctx, mode)) { >_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationi"); >return; > } > @@ -482,12 +514,18 @@ _mesa_BlendEquationSeparate( GLenum modeRGB, GLenum > modeA ) >return; > } > > - if (!legal_blend_equation(ctx, modeRGB)) { > + /* Only allow simple blending equations. > +* The GL_KHR_blend_equation_advanced spec says: > +* > +*"NOTE: These enums are not accepted by the or > +* parameters of BlendEquationSeparate or BlendEquationSeparatei." > +*/ > + if (!legal_simple_blend_equation(ctx, modeRGB)) { >_mesa_error(ctx, GL_INVALID_ENUM, > "glBlendEquationSeparateEXT(modeRGB)"); >return; > } > > - if (!legal_blend_equation(ctx, modeA)) { > + if (!legal_simple_blend_equation(ctx, modeA)) { >_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeA)"); >return; > } > @@ -524,12 +562,18 @@ _mesa_BlendEquationSeparateiARB(GLuint buf, GLenum > modeRGB, GLenum modeA) >return; > } > > - if (!legal_blend_equation(ctx, modeRGB)) { > + /* Only allow simple blending equations. > +* The GL_KHR_blend_equation_advanced spec says: > +* > +*"NOTE: These enums are not accepted by the or > +* parameters of BlendEquationSeparate or BlendEquationSeparatei." > +*/ > + if (!legal_simple_blend_equation(ctx, modeRGB)) { >_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparatei(modeRGB)"); >return; > } > > - if (!legal_blend_equation(ctx, modeA)) { > + if (!legal_simple_blend_equation(ctx, modeA)) { >_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparatei(modeA)"); >return; > } > -- > 2.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 10/16] compiler: Add a new STATE_VAR_ADVANCED_BLENDING_MODE built-in uniform.
Kenneth Graunke writes: > This will be used for emulating GL_KHR_advanced_blend_equation features > in shader code. We'll pass in the blending mode that's in use, and use > that in (effectively) a switch statement in the shader. > > Signed-off-by: Kenneth Graunke Reviewed-by: Francisco Jerez > --- > src/mesa/program/prog_statevars.c | 53 > +++ > src/mesa/program/prog_statevars.h | 5 > 2 files changed, 58 insertions(+) > > diff --git a/src/mesa/program/prog_statevars.c > b/src/mesa/program/prog_statevars.c > index 8dddc0b..a63c2a5 100644 > --- a/src/mesa/program/prog_statevars.c > +++ b/src/mesa/program/prog_statevars.c > @@ -45,6 +45,44 @@ > > #define ONE_DIV_SQRT_LN2 (1.201122408786449815) > > +static enum gl_blend_support_qualifier > +advanced_blend_mode_from_gl_enum(GLenum mode) > +{ > + switch (mode) { > + case GL_MULTIPLY_KHR: > + return BLEND_MULTIPLY; > + case GL_SCREEN_KHR: > + return BLEND_SCREEN; > + case GL_OVERLAY_KHR: > + return BLEND_OVERLAY; > + case GL_DARKEN_KHR: > + return BLEND_DARKEN; > + case GL_LIGHTEN_KHR: > + return BLEND_LIGHTEN; > + case GL_COLORDODGE_KHR: > + return BLEND_COLORDODGE; > + case GL_COLORBURN_KHR: > + return BLEND_COLORBURN; > + case GL_HARDLIGHT_KHR: > + return BLEND_HARDLIGHT; > + case GL_SOFTLIGHT_KHR: > + return BLEND_SOFTLIGHT; > + case GL_DIFFERENCE_KHR: > + return BLEND_DIFFERENCE; > + case GL_EXCLUSION_KHR: > + return BLEND_EXCLUSION; > + case GL_HSL_HUE_KHR: > + return BLEND_HSL_HUE; > + case GL_HSL_SATURATION_KHR: > + return BLEND_HSL_SATURATION; > + case GL_HSL_COLOR_KHR: > + return BLEND_HSL_COLOR; > + case GL_HSL_LUMINOSITY_KHR: > + return BLEND_HSL_LUMINOSITY; > + default: > + return 0; > + } > +} > > /** > * Use the list of tokens in the state[] array to find global GL state > @@ -609,6 +647,15 @@ _mesa_fetch_state(struct gl_context *ctx, const > gl_state_index state[], > val[0].i = ctx->TessCtrlProgram.patch_vertices; > return; > > + case STATE_ADVANCED_BLENDING_MODE: > + if (ctx->Color.BlendEnabled & 1) { > +GLenum eqn = ctx->Color.Blend[0].EquationRGB; > +val[0].i = advanced_blend_mode_from_gl_enum(eqn); > + } else { > +val[0].i = 0; > + } > + return; > + >/* XXX: make sure new tokens added here are also handled in the > * _mesa_program_state_flags() switch, below. > */ > @@ -719,6 +766,9 @@ _mesa_program_state_flags(const gl_state_index > state[STATE_LENGTH]) >case STATE_FB_WPOS_Y_TRANSFORM: > return _NEW_BUFFERS; > > + case STATE_ADVANCED_BLENDING_MODE: > + return _NEW_COLOR; > + >default: > /* unknown state indexes are silently ignored and > * no flag set, since it is handled by the driver. > @@ -925,6 +975,9 @@ append_token(char *dst, gl_state_index k) > case STATE_FB_WPOS_Y_TRANSFORM: >append(dst, "FbWposYTransform"); >break; > + case STATE_ADVANCED_BLENDING_MODE: > + append(dst, "AdvancedBlendingMode"); > + break; > default: >/* probably STATE_INTERNAL_DRIVER+i (driver private state) */ >append(dst, "driverState"); > diff --git a/src/mesa/program/prog_statevars.h > b/src/mesa/program/prog_statevars.h > index e716d90..7fecb37 100644 > --- a/src/mesa/program/prog_statevars.h > +++ b/src/mesa/program/prog_statevars.h > @@ -130,6 +130,11 @@ typedef enum gl_state_index_ { > STATE_FB_WPOS_Y_TRANSFORM, /**< (1, 0, -1, height) if a FBO is bound, > (-1, height, 1, 0) otherwise */ > STATE_TCS_PATCH_VERTICES_IN, /**< gl_PatchVerticesIn for TCS (integer) */ > STATE_TES_PATCH_VERTICES_IN, /**< gl_PatchVerticesIn for TES (integer) */ > + /** > +* A single enum gl_blend_support_qualifier value representing the > +* currently active advanced blending equation, or zero if disabled. > +*/ > + STATE_ADVANCED_BLENDING_MODE, > STATE_INTERNAL_DRIVER /* first available state index for drivers > (must be last) */ > } gl_state_index; > > -- > 2.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 06/16] glsl: Rename link_fs_input_layout_qualifiers to "inout".
Kenneth Graunke writes: > We're going to handle output qualifiers here too, and calling it "inout" > seems to be the going convention. > > Signed-off-by: Kenneth Graunke Reviewed-by: Francisco Jerez > --- > src/compiler/glsl/linker.cpp | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp > index 3c527e0..10df74a 100644 > --- a/src/compiler/glsl/linker.cpp > +++ b/src/compiler/glsl/linker.cpp > @@ -1871,7 +1871,7 @@ link_tes_in_layout_qualifiers(struct gl_shader_program > *prog, > * and propagates them to the linked FS and linked shader program. > */ > static void > -link_fs_input_layout_qualifiers(struct gl_shader_program *prog, > +link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, > struct gl_linked_shader *linked_shader, > struct gl_shader **shader_list, > unsigned num_shaders) > @@ -2217,7 +2217,7 @@ link_intrastage_shaders(void *mem_ctx, > linked->ir = new(linked) exec_list; > clone_ir_list(mem_ctx, linked->ir, main->ir); > > - link_fs_input_layout_qualifiers(prog, linked, shader_list, num_shaders); > + link_fs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders); > link_tcs_out_layout_qualifiers(prog, linked, shader_list, num_shaders); > link_tes_in_layout_qualifiers(prog, linked, shader_list, num_shaders); > link_gs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders); > -- > 2.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 07/16] glsl: Merge blend_support qualifiers when linking.
Kenneth Graunke writes: > Since each qualifier represents a blending mode the shader can be used > with, we take the union of all possible modes when linking. > > Signed-off-by: Kenneth Graunke Reviewed-by: Francisco Jerez > --- > src/compiler/glsl/linker.cpp | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp > index 10df74a..e8f2e29 100644 > --- a/src/compiler/glsl/linker.cpp > +++ b/src/compiler/glsl/linker.cpp > @@ -1880,6 +1880,7 @@ link_fs_inout_layout_qualifiers(struct > gl_shader_program *prog, > linked_shader->info.uses_gl_fragcoord = false; > linked_shader->info.origin_upper_left = false; > linked_shader->info.pixel_center_integer = false; > + linked_shader->info.BlendSupport = 0; > > if (linked_shader->Stage != MESA_SHADER_FRAGMENT || > (prog->Version < 150 && !prog->ARB_fragment_coord_conventions_enable)) > @@ -1938,6 +1939,7 @@ link_fs_inout_layout_qualifiers(struct > gl_shader_program *prog, > >linked_shader->info.EarlyFragmentTests |= > shader->info.EarlyFragmentTests; > + linked_shader->info.BlendSupport |= shader->info.BlendSupport; > } > } > > -- > 2.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 05/16] glsl: process blend_support_* qualifiers
Kenneth Graunke writes: > From: Ilia Mirkin > > v2 (Ken): Add a BLEND_NONE enum value (no qualifiers in use). > > Signed-off-by: Ilia Mirkin > Reviewed-by: Kenneth Graunke Reviewed-by: Francisco Jerez > --- > src/compiler/glsl/ast.h | 5 > src/compiler/glsl/ast_type.cpp | 2 ++ > src/compiler/glsl/glsl_parser.yy | 45 > > src/compiler/glsl/glsl_parser_extras.cpp | 2 ++ > src/compiler/glsl/glsl_parser_extras.h | 2 ++ > src/compiler/shader_enums.h | 26 ++ > src/mesa/main/mtypes.h | 5 > 7 files changed, 87 insertions(+) > > diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h > index 75018a0..4c648d0 100644 > --- a/src/compiler/glsl/ast.h > +++ b/src/compiler/glsl/ast.h > @@ -596,6 +596,11 @@ struct ast_type_qualifier { > unsigned subroutine:1; /**< Is this marked 'subroutine' */ > unsigned subroutine_def:1; /**< Is this marked 'subroutine' with a > list of types */ >/** \} */ > + > + /** \name Qualifiers for GL_KHR_blend_equation_advanced */ > + /** \{ */ > + unsigned blend_support:1; /**< Are there any blend_support_ > qualifiers */ > + /** \} */ >} >/** \brief Set of flags, accessed by name. */ >q; > diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp > index cabc698..f3f6b29 100644 > --- a/src/compiler/glsl/ast_type.cpp > +++ b/src/compiler/glsl/ast_type.cpp > @@ -414,6 +414,8 @@ ast_type_qualifier::merge_out_qualifier(YYLTYPE *loc, >valid_out_mask.flags.q.xfb_buffer = 1; >valid_out_mask.flags.q.explicit_xfb_stride = 1; >valid_out_mask.flags.q.xfb_stride = 1; > + } else if (state->stage == MESA_SHADER_FRAGMENT) { > + valid_out_mask.flags.q.blend_support = 1; > } else { >_mesa_glsl_error(loc, state, "out layout qualifiers only valid in " > "geometry, tessellation and vertex shaders"); > diff --git a/src/compiler/glsl/glsl_parser.yy > b/src/compiler/glsl/glsl_parser.yy > index 5aa0daa..eb1a5df 100644 > --- a/src/compiler/glsl/glsl_parser.yy > +++ b/src/compiler/glsl/glsl_parser.yy > @@ -1447,6 +1447,51 @@ layout_qualifier_id: >} > >if (!$$.flags.i) { > + struct { > +const char *s; > +uint32_t mask; > + } map[] = { > + { "blend_support_multiply", BLEND_MULTIPLY }, > + { "blend_support_screen", BLEND_SCREEN }, > + { "blend_support_overlay",BLEND_OVERLAY }, > + { "blend_support_darken", BLEND_DARKEN }, > + { "blend_support_lighten",BLEND_LIGHTEN }, > + { "blend_support_colordodge", BLEND_COLORDODGE }, > + { "blend_support_colorburn", BLEND_COLORBURN }, > + { "blend_support_hardlight", BLEND_HARDLIGHT }, > + { "blend_support_softlight", BLEND_SOFTLIGHT }, > + { "blend_support_difference", BLEND_DIFFERENCE }, > + { "blend_support_exclusion", BLEND_EXCLUSION }, > + { "blend_support_hsl_hue",BLEND_HSL_HUE }, > + { "blend_support_hsl_saturation", BLEND_HSL_SATURATION }, > + { "blend_support_hsl_color", BLEND_HSL_COLOR }, > + { "blend_support_hsl_luminosity", BLEND_HSL_LUMINOSITY }, > + { "blend_support_all_equations", BLEND_ALL }, > + }; > + for (unsigned i = 0; i < ARRAY_SIZE(map); i++) { > +if (match_layout_qualifier($1, map[i].s, state) == 0) { > + $$.flags.q.blend_support = 1; > + state->fs_blend_support |= map[i].mask; > + break; > +} > + } > + > + if ($$.flags.i && > + !state->KHR_blend_equation_advanced_enable && > + !state->is_version(0, 320)) { > +_mesa_glsl_error(& @1, state, > + "advanced blending layout qualifiers require " > + "ESSL 3.20 or KHR_blend_equation_advanced"); > + } > + > + if ($$.flags.i && state->stage != MESA_SHADER_FRAGMENT) { > +_mesa_glsl_error(& @1, state, > + "advanced blending layout qualifiers only " > + "valid in fragment shaders"); > + } > + } > + > + if (!$$.flags.i) { > _mesa_glsl_error(& @1, state, "unrecognized layout identifier " >"`%s'", $1); > YYERROR; > diff --git a/src/compiler/glsl/glsl_parser_extras.cpp > b/src/compiler/glsl/glsl_parser_extras.cpp > index 1ca49b3..2337eae 100644 > --- a/src/compiler/glsl/glsl_parser_extras.cpp > +++ b/src/compiler/glsl/glsl_parser_extras.cpp > @@ -292,6 +292,7 @@ _mesa_glsl_parse_state
Re: [Mesa-dev] [PATCH 02/16] glapi: add KHR_blend_equation_advanced dispatch
Kenneth Graunke writes: > From: Ilia Mirkin > > v2 (Ken): Fix enum values, drop _mesa_BlendBarrierKHR stub as Curro has > already implemented it. > > Signed-off-by: Ilia Mirkin > Signed-off-by: Kenneth Graunke Reviewed-by: Francisco Jerez > --- > src/mapi/glapi/gen/gl_API.xml | 23 +++ > src/mesa/main/tests/dispatch_sanity.cpp | 6 ++ > 2 files changed, 29 insertions(+) > > diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml > index 79e1ba1..0481152 100644 > --- a/src/mapi/glapi/gen/gl_API.xml > +++ b/src/mapi/glapi/gen/gl_API.xml > @@ -8294,6 +8294,29 @@ > > xmlns:xi="http://www.w3.org/2001/XInclude"/> > > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > > > > diff --git a/src/mesa/main/tests/dispatch_sanity.cpp > b/src/mesa/main/tests/dispatch_sanity.cpp > index cfbf70d..a0bdd17 100644 > --- a/src/mesa/main/tests/dispatch_sanity.cpp > +++ b/src/mesa/main/tests/dispatch_sanity.cpp > @@ -955,6 +955,9 @@ const struct function common_desktop_functions_possible[] > = { > /* GL_EXT_window_rectangles */ > { "glWindowRectanglesEXT", 30, -1 }, > > + /* GL_KHR_blend_equation_advanced */ > + { "glBlendBarrierKHR", 20, -1 }, > + > { NULL, 0, -1 } > }; > > @@ -2322,6 +2325,9 @@ const struct function gles2_functions_possible[] = { > { "glGetnUniformivKHR", 20, -1 }, > { "glGetnUniformuivKHR", 20, -1 }, > > + /* GL_KHR_blend_equation_advanced */ > + { "glBlendBarrierKHR", 20, -1 }, > + > { NULL, 0, -1 } > }; > > -- > 2.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 04/16] glsl: add basic KHR_blend_equation_advanced infrastructure
Kenneth Graunke writes: > From: Ilia Mirkin > > Signed-off-by: Ilia Mirkin > Reviewed-by: Kenneth Graunke Reviewed-by: Francisco Jerez > --- > src/compiler/glsl/glsl_parser_extras.cpp | 1 + > src/compiler/glsl/glsl_parser_extras.h | 2 ++ > 2 files changed, 3 insertions(+) > > diff --git a/src/compiler/glsl/glsl_parser_extras.cpp > b/src/compiler/glsl/glsl_parser_extras.cpp > index a185759..1ca49b3 100644 > --- a/src/compiler/glsl/glsl_parser_extras.cpp > +++ b/src/compiler/glsl/glsl_parser_extras.cpp > @@ -622,6 +622,7 @@ static const _mesa_glsl_extension > _mesa_glsl_supported_extensions[] = { > > /* KHR extensions go here, sorted alphabetically. > */ > + EXT(KHR_blend_equation_advanced), > > /* OES extensions go here, sorted alphabetically. > */ > diff --git a/src/compiler/glsl/glsl_parser_extras.h > b/src/compiler/glsl/glsl_parser_extras.h > index 3311688..ad29149 100644 > --- a/src/compiler/glsl/glsl_parser_extras.h > +++ b/src/compiler/glsl/glsl_parser_extras.h > @@ -649,6 +649,8 @@ struct _mesa_glsl_parse_state { > > /* KHR extensions go here, sorted alphabetically. > */ > + bool KHR_blend_equation_advanced_enable; > + bool KHR_blend_equation_advanced_warn; > > /* OES extensions go here, sorted alphabetically. > */ > -- > 2.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/16] mesa: Rename _mesa_BlendBarrierMESA to _mesa_BlendBarrierKHR.
Kenneth Graunke writes: > Note that _mesa_BlendBarrierMESA is not currently hooked up in the > glapi XML, so we can just rename it. We'll hook it up for the > KHR_blend_equation_advanced extension shortly. > > XXX: sort out exactly what patches Curro plans to push and when. > FTR since we discussed this off-list shortly, would it make sense to rename it to BlendBarrier as in the GLES 3.2 spec and make both BlendBarrierKHR and BlendBarrierMESA aliases? > Signed-off-by: Kenneth Graunke > --- > src/mesa/main/barrier.c | 2 +- > src/mesa/main/barrier.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/main/barrier.c b/src/mesa/main/barrier.c > index 42a5e0f..82ddedb 100644 > --- a/src/mesa/main/barrier.c > +++ b/src/mesa/main/barrier.c > @@ -110,7 +110,7 @@ _mesa_MemoryBarrierByRegion(GLbitfield barriers) > } > > void GLAPIENTRY > -_mesa_BlendBarrierMESA(void) > +_mesa_BlendBarrierKHR(void) > { > GET_CURRENT_CONTEXT(ctx); > > diff --git a/src/mesa/main/barrier.h b/src/mesa/main/barrier.h > index 21dce90..8e60325 100644 > --- a/src/mesa/main/barrier.h > +++ b/src/mesa/main/barrier.h > @@ -48,6 +48,6 @@ void GLAPIENTRY > _mesa_MemoryBarrierByRegion(GLbitfield barriers); > > void GLAPIENTRY > -_mesa_BlendBarrierMESA(void); > +_mesa_BlendBarrierKHR(void); > > #endif /* BARRIER_H */ > -- > 2.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/5] i965/sched: Change the scheduling heuristics to favor early program termination.
This uses the unblocked time of the exit assigned to each available node to attempt to unblock exit nodes as early as possible, potentially reducing the runtime of the shader when an exit branch is taken. There is a natural trade-off between terminating the program as early as possible and reducing the worst-case latency of the program as a whole (since this will typically move exit-unblocking nodes closer to its dependencies potentially causing additional stalls of the execution pipeline), but in practice the bandwidth and ALU cycle savings from terminating the program earlier tend to outweigh the slight increase in worst-case program execution latency, so it makes sense to prefer nodes likely to unblock an earlier exit regardless of the latency benefits of other available nodes. I haven't observed any benchmark regressions from this change after testing on VLV, HSW, BDW, BSW and SKL. The FPS of the GfxBench Manhattan benchmark increases by 10%-20% and the FPS of Unigine Valley improves by roughly 5% depending on the platform and settings. The change to the register pressure-sensitive heuristic is rather conservative and gives precedence to the existing heuristic in order to avoid increasing register pressure and causing spill count and SIMD width regressions in shader-db. It may make sense to revisit this with additional performance data. --- .../drivers/dri/i965/brw_schedule_instructions.cpp| 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp index 96562cf..dfcaa80 100644 --- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp +++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp @@ -1407,11 +1407,15 @@ fs_instruction_scheduler::choose_instruction_to_schedule() if (mode == SCHEDULE_PRE || mode == SCHEDULE_POST) { int chosen_time = 0; - /* Of the instructions ready to execute or the closest to - * being ready, choose the oldest one. + /* Of the instructions ready to execute or the closest to being ready, + * choose the one most likely to unblock an early program exit, or + * otherwise the oldest one. */ foreach_in_list(schedule_node, n, &instructions) { - if (!chosen || n->unblocked_time < chosen_time) { + if (!chosen || + exit_unblocked_time(n) < exit_unblocked_time(chosen) || + (exit_unblocked_time(n) == exit_unblocked_time(chosen) && + n->unblocked_time < chosen_time)) { chosen = n; chosen_time = n->unblocked_time; } @@ -1500,6 +1504,15 @@ fs_instruction_scheduler::choose_instruction_to_schedule() continue; } + /* Prefer the node most likely to unblock an early program exit. + */ + if (exit_unblocked_time(n) < exit_unblocked_time(chosen)) { +chosen = n; +continue; + } else if (exit_unblocked_time(n) > exit_unblocked_time(chosen)) { +continue; + } + /* If all other metrics are equal, we prefer the first instruction in * the list (program execution). */ -- 2.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/5] i965/fs: Switch to per-subspan discard jumps.
ANY4H is more efficient than ANY8H and ANY16H because it makes sure that whenever a whole subspan hits a discard statement it gets disabled by the EU until the end of the program, regardless of whether the discard condition is uniform across all channels of the SIMD8-16 thread. OTOH ANY8H/ANY16H would cause the rest of the program to be executed for *all* channels if only one of the channels hadn't taken the discard branch, potentially increasing the bandwidth and ALU usage of the program unnecessarily. This change increases the FPS by over 3x of a simple micro-benchmark that discards a bunch of fragments and then does a single costly texturing operation. I've just re-verified the FPS change on HSW and SKL, but I expect all platforms from Gen6 up to get a similar benefit. Note that we could potentially be more aggressive and use the NORMAL predicate to discard individual channels, but that would need to happen post-scheduling because the scheduler currently doesn't care to reorder HALT instructions with respect to other instructions, and the NORMAL predicate would cause the results of subsequent derivative computations to become undefined -- If the scheduler didn't reorder HALT instructions it would actually be safe to switch to NORMAL because the behavior of derivative computations after a non-uniform discard statement is undefined by the GLSL spec, but that would make the optimization implemented by one of the following commits somewhat more difficult. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index d1ac80a..c5067cd 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1394,9 +1394,7 @@ fs_visitor::emit_discard_jump() fs_inst *discard_jump = bld.emit(FS_OPCODE_DISCARD_JUMP); discard_jump->flag_subreg = 1; - discard_jump->predicate = (dispatch_width == 8) - ? BRW_PREDICATE_ALIGN1_ANY8H - : BRW_PREDICATE_ALIGN1_ANY16H; + discard_jump->predicate = BRW_PREDICATE_ALIGN1_ANY4H; discard_jump->predicate_inverse = true; } -- 2.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/5] i965/fs: Drop bogus writemasking disable bit from HALT instructions.
This may have been the reason people ran into problems with non-uniform HALT instructions and ended up using the inefficient ANY16H/ANY8H predicates instead of ANY4H or NORMAL in order to prevent non-uniform discard. The HALT instruction is able to handle non-uniform execution masks just fine. --- src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 4 1 file changed, 4 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index 647950f..22190f8 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -1053,11 +1053,7 @@ fs_generator::generate_discard_jump(fs_inst *inst) * current block (or the program). */ this->discard_halt_patches.push_tail(new(mem_ctx) ip_record(p->nr_insn)); - - brw_push_insn_state(p); - brw_set_default_mask_control(p, BRW_MASK_DISABLE); gen6_HALT(p); - brw_pop_insn_state(p); } void -- 2.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/5] i965/sched: Calculate the critical path of scheduling nodes non-recursively.
The critical path of each node is calculated by induction based on the critical paths of its children, which can be done in a post-order depth-first traversal of the dependency graph. The current code implements graph traversal by iterating over all nodes of the graph and then recursing into its children -- But it turns out that recursion is unnecessary because the lexical order of instructions in the block is already a good enough reverse post-order of the dependency graph (if it weren't a reverse post-order some instruction would have been located before one of its dependencies in the original ordering of the basic block, which is impossible), so we just need to walk the instruction list in reverse to achieve the same result more efficiently. No shader-db changes. --- .../drivers/dri/i965/brw_schedule_instructions.cpp | 25 +++--- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp index 8afdc25..19d9ec1 100644 --- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp +++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp @@ -459,7 +459,7 @@ public: void run(cfg_t *cfg); void add_insts_from_block(bblock_t *block); - void compute_delay(schedule_node *node); + void compute_delays(); virtual void calculate_deps() = 0; virtual schedule_node *choose_instruction_to_schedule() = 0; @@ -796,17 +796,18 @@ instruction_scheduler::add_insts_from_block(bblock_t *block) this->instructions_to_schedule = block->end_ip - block->start_ip + 1; } -/** Recursive computation of the delay member of a node. */ +/** Computation of the delay member of each node. */ void -instruction_scheduler::compute_delay(schedule_node *n) +instruction_scheduler::compute_delays() { - if (!n->child_count) { - n->delay = issue_time(n->inst); - } else { - for (int i = 0; i < n->child_count; i++) { - if (!n->children[i]->delay) -compute_delay(n->children[i]); - n->delay = MAX2(n->delay, n->latency + n->children[i]->delay); + foreach_in_list_reverse(schedule_node, n, &instructions) { + if (!n->child_count) { + n->delay = issue_time(n->inst); + } else { + for (int i = 0; i < n->child_count; i++) { +assert(n->children[i]->delay); +n->delay = MAX2(n->delay, n->latency + n->children[i]->delay); + } } } } @@ -1629,9 +1630,7 @@ instruction_scheduler::run(cfg_t *cfg) calculate_deps(); - foreach_in_list(schedule_node, n, &instructions) { - compute_delay(n); - } + compute_delays(); schedule_instructions(block); } -- 2.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/5] i965: Assorted discard-related performance improvements.
This series contains two independent discard-related optimizations: PATCH 1-2 change the i965 back-end to do per-subspan instead of per-SIMD-thread discard jumps, which can save bandwidth and ALU cycles in some scenarios. This improves the FPS of a very simple microbenchmark that does a costly texturing operation after a conditional discard by roughly 3x (verified on HSW and SKL but the improvement should affect all platforms from Gen6 up). PATCH 3-5 change the scheduler heuristics to take into account the runtime benefit of scheduling exit nodes earlier in the program in addition to the current latency- and register pressure-sensitive heuristics. This results in a 10% to 20% FPS increase in the GfxBench Manhattan benchmark, and a roughly 5% FPS increase in Unigine Valley. The exact FPS change will be heavily dependent on the platform and settings, but I've observed comparable improvements on HSW, SKL, BDW, BSW and VLV. For a branch in testable form see: https://cgit.freedesktop.org/~currojerez/mesa/log/?h=i965-sched-discard [PATCH 1/5] i965/fs: Drop bogus writemasking disable bit from HALT instructions. [PATCH 2/5] i965/fs: Switch to per-subspan discard jumps. [PATCH 3/5] i965/sched: Calculate the critical path of scheduling nodes non-recursively. [PATCH 4/5] i965/sched: Assign a preferred exit node to each node of the dependency graph. [PATCH 5/5] i965/sched: Change the scheduling heuristics to favor early program termination. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/5] i965/sched: Assign a preferred exit node to each node of the dependency graph.
This adds a bit of metadata to schedule_node that will be used to compare available nodes in the scheduling heuristic code based on which of them unblocks the earliest successor exit node. Note that assigning exit nodes wouldn't be necessary in a bottom-up scheduler because we could achieve the same effect by scheduling the exit nodes themselves appropriately. --- .../drivers/dri/i965/brw_schedule_instructions.cpp | 59 ++ 1 file changed, 59 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp index 19d9ec1..96562cf 100644 --- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp +++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp @@ -86,8 +86,34 @@ public: * its children, or just the issue_time if it's a leaf node. */ int delay; + + /** +* Preferred exit node among the (direct or indirect) successors of this +* node. Among the scheduler nodes blocked by this node, this will be the +* one that may cause earliest program termination, or NULL if none of the +* successors is an exit node. +*/ + schedule_node *exit; }; +/** + * Lower bound of the scheduling time after which one of the instructions + * blocked by this node may lead to program termination. + * + * exit_unblocked_time() determines a strict partial ordering relation '«' on + * the set of scheduler nodes as follows: + * + * n « m <-> exit_unblocked_time(n) < exit_unblocked_time(m) + * + * which can be used to heuristically order nodes according to how early they + * can unblock an exit node and lead to program termination. + */ +static inline int +exit_unblocked_time(const schedule_node *n) +{ + return n->exit ? n->exit->unblocked_time : INT_MAX; +} + void schedule_node::set_latency_gen4() { @@ -460,6 +486,7 @@ public: void run(cfg_t *cfg); void add_insts_from_block(bblock_t *block); void compute_delays(); + void compute_exits(); virtual void calculate_deps() = 0; virtual schedule_node *choose_instruction_to_schedule() = 0; @@ -772,6 +799,7 @@ schedule_node::schedule_node(backend_instruction *inst, this->unblocked_time = 0; this->cand_generation = 0; this->delay = 0; + this->exit = NULL; /* We can't measure Gen6 timings directly but expect them to be much * closer to Gen7 than Gen4. @@ -812,6 +840,36 @@ instruction_scheduler::compute_delays() } } +void +instruction_scheduler::compute_exits() +{ + /* Calculate a lower bound of the scheduling time of each node in the +* graph. This is analogous to the node's critical path but calculated +* from the top instead of from the bottom of the block. +*/ + foreach_in_list(schedule_node, n, &instructions) { + for (int i = 0; i < n->child_count; i++) { + n->children[i]->unblocked_time = +MAX2(n->children[i]->unblocked_time, + n->unblocked_time + issue_time(n->inst) + n->child_latency[i]); + } + } + + /* Calculate the exit of each node by induction based on the exit nodes of +* its children. The preferred exit of a node is the one among the exit +* nodes of its children which can be unblocked first according to the +* optimistic unblocked time estimate calculated above. +*/ + foreach_in_list_reverse(schedule_node, n, &instructions) { + n->exit = (n->inst->opcode == FS_OPCODE_DISCARD_JUMP ? n : NULL); + + for (int i = 0; i < n->child_count; i++) { + if (exit_unblocked_time(n->children[i]) < exit_unblocked_time(n)) +n->exit = n->children[i]->exit; + } + } +} + /** * Add a dependency between two instruction nodes. * @@ -1631,6 +1689,7 @@ instruction_scheduler::run(cfg_t *cfg) calculate_deps(); compute_delays(); + compute_exits(); schedule_instructions(block); } -- 2.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 11/23] glsl: Convert link_functions to the util hash table
Signed-off-by: Thomas Helland --- src/compiler/glsl/link_functions.cpp | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/compiler/glsl/link_functions.cpp b/src/compiler/glsl/link_functions.cpp index 079f3b9..69bdef1 100644 --- a/src/compiler/glsl/link_functions.cpp +++ b/src/compiler/glsl/link_functions.cpp @@ -26,7 +26,7 @@ #include "glsl_parser_extras.h" #include "ir.h" #include "program.h" -#include "program/hash_table.h" +#include "util/hash_table.h" #include "linker.h" static ir_function_signature * @@ -46,18 +46,18 @@ public: this->success = true; this->linked = linked; - this->locals = hash_table_ctor(0, hash_table_pointer_hash, -hash_table_pointer_compare); + this->locals = _mesa_hash_table_create(NULL, _mesa_hash_pointer, + _mesa_key_pointer_equal); } ~call_link_visitor() { - hash_table_dtor(this->locals); + _mesa_hash_table_destroy(this->locals, NULL); } virtual ir_visitor_status visit(ir_variable *ir) { - hash_table_insert(locals, ir, ir); + _mesa_hash_table_insert(locals, ir, ir); return visit_continue; } @@ -147,14 +147,15 @@ public: * replace signature stored in a function. One could easily be added, * but this avoids the need. */ - struct hash_table *ht = hash_table_ctor(0, hash_table_pointer_hash, - hash_table_pointer_compare); + struct hash_table *ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer, + _mesa_key_pointer_equal); + exec_list formal_parameters; foreach_in_list(const ir_instruction, original, &sig->parameters) { -assert(const_cast(original)->as_variable()); + assert(const_cast(original)->as_variable()); -ir_instruction *copy = original->clone(linked, ht); -formal_parameters.push_tail(copy); + ir_instruction *copy = original->clone(linked, ht); + formal_parameters.push_tail(copy); } linked_sig->replace_parameters(&formal_parameters); @@ -170,7 +171,7 @@ public: linked_sig->is_defined = true; } - hash_table_dtor(ht); + _mesa_hash_table_destroy(ht, NULL); /* Patch references inside the function to things outside the function * (i.e., function calls and global variables). @@ -217,7 +218,7 @@ public: virtual ir_visitor_status visit(ir_dereference_variable *ir) { - if (hash_table_find(locals, ir->var) == NULL) { + if (_mesa_hash_table_search(locals, ir->var) == NULL) { /* The non-function variable must be a global, so try to find the * variable in the shader's symbol table. If the variable is not * found, then it's a global that *MUST* be defined in the original -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 22/23] glsl: Convert glcpp-parse to the util hash table
And change the include in glcpp.h accordingly. Signed-off-by: Thomas Helland --- src/compiler/glsl/glcpp/glcpp-parse.y | 54 ++- src/compiler/glsl/glcpp/glcpp.h | 2 +- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y index eff53be..04ca126 100644 --- a/src/compiler/glsl/glcpp/glcpp-parse.y +++ b/src/compiler/glsl/glcpp/glcpp-parse.y @@ -278,6 +278,7 @@ control_line_success: HASH_TOKEN DEFINE_TOKEN define | HASH_TOKEN UNDEF IDENTIFIER NEWLINE { macro_t *macro; + struct hash_entry *entry; /* Section 3.4 (Preprocessor) of the GLSL ES 3.00 spec says: * @@ -309,9 +310,10 @@ control_line_success: glcpp_error(& @1, parser, "Built-in (pre-defined)" " macro names cannot be undefined."); - macro = hash_table_find (parser->defines, $3); - if (macro) { - hash_table_remove (parser->defines, $3); + entry = _mesa_hash_table_search (parser->defines, $3); + if (entry) { + macro = entry->data; + _mesa_hash_table_remove (parser->defines, entry); ralloc_free (macro); } ralloc_free ($3); @@ -348,13 +350,16 @@ control_line_success: _glcpp_parser_skip_stack_push_if (parser, & @1, 0); } | HASH_TOKEN IFDEF IDENTIFIER junk NEWLINE { - macro_t *macro = hash_table_find (parser->defines, $3); + struct hash_entry *entry = + _mesa_hash_table_search(parser->defines, $3); + macro_t *macro = entry ? entry->data : NULL; ralloc_free ($3); _glcpp_parser_skip_stack_push_if (parser, & @1, macro != NULL); } | HASH_TOKEN IFNDEF IDENTIFIER junk NEWLINE { - macro_t *macro = hash_table_find (parser->defines, $3); - ralloc_free ($3); + struct hash_entry *entry = + _mesa_hash_table_search(parser->defines, $3); + macro_t *macro = entry ? entry->data : NULL; _glcpp_parser_skip_stack_push_if (parser, & @3, macro == NULL); } | HASH_TOKEN ELIF pp_tokens NEWLINE { @@ -1342,8 +1347,8 @@ glcpp_parser_create(glcpp_extension_iterator extensions, void *state, gl_api api parser = ralloc (NULL, glcpp_parser_t); glcpp_lex_init_extra (parser, &parser->scanner); - parser->defines = hash_table_ctor(32, hash_table_string_hash, - hash_table_string_compare); + parser->defines = _mesa_hash_table_create(NULL, _mesa_key_hash_string, + _mesa_key_string_equal); parser->active = NULL; parser->lexing_directive = 0; parser->space_tokens = 1; @@ -1384,7 +1389,7 @@ void glcpp_parser_destroy(glcpp_parser_t *parser) { glcpp_lex_destroy (parser->scanner); - hash_table_dtor (parser->defines); + _mesa_hash_table_destroy(parser->defines, NULL); ralloc_free (parser); } @@ -1563,8 +1568,8 @@ _glcpp_parser_evaluate_defined(glcpp_parser_t *parser, token_node_t *node, *last = node; - return hash_table_find(parser->defines, - argument->token->value.str) ? 1 : 0; + return _mesa_hash_table_search(parser->defines, + argument->token->value.str) ? 1 : 0; FAIL: glcpp_error (&defined->token->location, parser, @@ -1705,6 +1710,7 @@ static token_list_t * _glcpp_parser_expand_function(glcpp_parser_t *parser, token_node_t *node, token_node_t **last, expansion_mode_t mode) { + struct hash_entry *entry; macro_t *macro; const char *identifier; argument_list_t *arguments; @@ -1714,7 +1720,8 @@ _glcpp_parser_expand_function(glcpp_parser_t *parser, token_node_t *node, identifier = node->token->value.str; - macro = hash_table_find(parser->defines, identifier); + entry = _mesa_hash_table_search(parser->defines, identifier); + macro = entry ? entry->data : NULL; assert(macro->is_function); @@ -1811,6 +1818,7 @@ _glcpp_parser_expand_node(glcpp_parser_t *parser, token_node_t *node, { token_t *token = node->token; const char *identifier; + struct hash_entry *entry; macro_t *macro; /* We only expand identifiers */ @@ -1830,7 +1838,8 @@ _glcpp_parser_expand_node(glcpp_parser_t *parser, token_node_t *node, return _token_list_create_with_one_integer(parser, node->token->location.source); /* Look up this identifier in the hash table. */ - macro = hash_table_find(parser->defines, identifier); + entry = _mesa_hash_table_search(parser->defines, identifier); + ma
[Mesa-dev] [PATCH 23/23] mesa/glsl: Move string_to_uint_map into the util folder
This clears the last bits of the usecases of the hash table located in mesa/program, allowing us to remove it. Signed-off-by: Thomas Helland --- src/compiler/glsl/link_uniform_initializers.cpp| 2 +- src/compiler/glsl/link_uniforms.cpp| 2 +- src/compiler/glsl/linker.cpp | 2 +- src/compiler/glsl/standalone.cpp | 2 +- .../glsl/tests/set_uniform_initializer_tests.cpp | 2 +- src/mesa/Makefile.sources | 2 - src/mesa/main/shader_query.cpp | 2 +- src/mesa/main/shaderobj.c | 2 +- src/mesa/program/ir_to_mesa.cpp| 2 +- src/mesa/state_tracker/st_glsl_to_nir.cpp | 2 +- src/util/Makefile.sources | 2 + src/{mesa/program => util}/string_to_uint_map.cpp | 2 +- .../hash_table.h => util/string_to_uint_map.h} | 160 + 13 files changed, 17 insertions(+), 167 deletions(-) rename src/{mesa/program => util}/string_to_uint_map.cpp (97%) rename src/{mesa/program/hash_table.h => util/string_to_uint_map.h} (56%) diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp index 021e950..68ba167 100644 --- a/src/compiler/glsl/link_uniform_initializers.cpp +++ b/src/compiler/glsl/link_uniform_initializers.cpp @@ -22,10 +22,10 @@ */ #include "main/core.h" -#include "program/hash_table.h" #include "ir.h" #include "linker.h" #include "ir_uniform.h" +#include "util/string_to_uint_map.h" /* These functions are put in a "private" namespace instead of being marked * static so that the unit tests can access them. See diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp index 9f8adcc..4d3fc6d 100644 --- a/src/compiler/glsl/link_uniforms.cpp +++ b/src/compiler/glsl/link_uniforms.cpp @@ -26,8 +26,8 @@ #include "linker.h" #include "ir_uniform.h" #include "glsl_symbol_table.h" -#include "program/hash_table.h" #include "program.h" +#include "util/string_to_uint_map.h" /** * \file link_uniforms.cpp diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 379a5cc..a150377 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -71,9 +71,9 @@ #include "glsl_parser_extras.h" #include "ir.h" #include "program.h" -#include "program/hash_table.h" #include "program/prog_instruction.h" #include "util/set.h" +#include "util/string_to_uint_map.h" #include "linker.h" #include "link_varyings.h" #include "ir_optimization.h" diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp index 88fe5fd..d6e6829 100644 --- a/src/compiler/glsl/standalone.cpp +++ b/src/compiler/glsl/standalone.cpp @@ -33,10 +33,10 @@ #include "glsl_parser_extras.h" #include "ir_optimization.h" #include "program.h" -#include "program/hash_table.h" #include "loop_analysis.h" #include "standalone_scaffolding.h" #include "standalone.h" +#include "util/string_to_uint_map.h" static const struct standalone_options *options; diff --git a/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp b/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp index 9d41017..245494c 100644 --- a/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp +++ b/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp @@ -24,8 +24,8 @@ #include "main/compiler.h" #include "main/mtypes.h" #include "main/macros.h" -#include "program/hash_table.h" #include "util/ralloc.h" +#include "util/string_to_uint_map.h" #include "uniform_initializer_utils.h" namespace linker { diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index d113fd3..0562443 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -517,7 +517,6 @@ STATETRACKER_FILES = \ PROGRAM_FILES = \ program/arbprogparse.c \ program/arbprogparse.h \ - program/hash_table.h \ program/ir_to_mesa.cpp \ program/ir_to_mesa.h \ program/lex.yy.c \ @@ -548,7 +547,6 @@ PROGRAM_FILES = \ program/program_parser.h \ program/prog_statevars.c \ program/prog_statevars.h \ - program/string_to_uint_map.cpp \ program/symbol_table.c \ program/symbol_table.h diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index 0eae39a..5c42006 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -37,7 +37,7 @@ #include "compiler/glsl/glsl_symbol_table.h" #include "compiler/glsl/ir.h" #include "compiler/glsl/program.h" -#include "program/hash_table.h" +#include "util/string_to_uint_map.h" #include "util/strndup.h" diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 0075a6d..350b677 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -39,8 +39,8 @@ #include "main/uniforms.h" #include "program/program.h" #include
[Mesa-dev] [PATCH 14/23] glsl: Convert linker to the util hash table
We are getting the util hash table through the include in program/hash_table.h for the moment until we migrate the string_to_uint_map to a separate file. Signed-off-by: Thomas Helland --- src/compiler/glsl/linker.cpp | 29 + 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 51d7643..379a5cc 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1331,7 +1331,8 @@ remap_variables(ir_instruction *inst, struct gl_linked_shader *target, virtual ir_visitor_status visit(ir_dereference_variable *ir) { if (ir->var->data.mode == ir_var_temporary) { - ir_variable *var = (ir_variable *) hash_table_find(temps, ir->var); + hash_entry *entry = _mesa_hash_table_search(temps, ir->var); + ir_variable *var = entry ? (ir_variable *) entry->data : NULL; assert(var != NULL); ir->var = var; @@ -1394,8 +1395,8 @@ move_non_declarations(exec_list *instructions, exec_node *last, hash_table *temps = NULL; if (make_copies) - temps = hash_table_ctor(0, hash_table_pointer_hash, - hash_table_pointer_compare); + temps = _mesa_hash_table_create(NULL, _mesa_hash_pointer, + _mesa_key_pointer_equal); foreach_in_list_safe(ir_instruction, inst, instructions) { if (inst->as_function()) @@ -1414,7 +1415,7 @@ move_non_declarations(exec_list *instructions, exec_node *last, inst = inst->clone(target, NULL); if (var != NULL) - hash_table_insert(temps, inst, var); + _mesa_hash_table_insert(temps, var, inst); else remap_variables(inst, target, temps); } else { @@ -1426,7 +1427,7 @@ move_non_declarations(exec_list *instructions, exec_node *last, } if (make_copies) - hash_table_dtor(temps); + _mesa_hash_table_destroy(temps, NULL); return last; } @@ -1441,14 +1442,14 @@ class array_sizing_visitor : public ir_hierarchical_visitor { public: array_sizing_visitor() : mem_ctx(ralloc_context(NULL)), -unnamed_interfaces(hash_table_ctor(0, hash_table_pointer_hash, - hash_table_pointer_compare)) +unnamed_interfaces(_mesa_hash_table_create(NULL, _mesa_hash_pointer, + _mesa_key_pointer_equal)) { } ~array_sizing_visitor() { - hash_table_dtor(this->unnamed_interfaces); + _mesa_hash_table_destroy(this->unnamed_interfaces, NULL); ralloc_free(this->mem_ctx); } @@ -1483,13 +1484,17 @@ public: /* Store a pointer to the variable in the unnamed_interfaces * hashtable. */ - ir_variable **interface_vars = (ir_variable **) -hash_table_find(this->unnamed_interfaces, ifc_type); + hash_entry *entry = + _mesa_hash_table_search(this->unnamed_interfaces, + ifc_type); + + ir_variable **interface_vars = entry ? (ir_variable **) entry->data : NULL; + if (interface_vars == NULL) { interface_vars = rzalloc_array(mem_ctx, ir_variable *, ifc_type->length); -hash_table_insert(this->unnamed_interfaces, interface_vars, - ifc_type); +_mesa_hash_table_insert(this->unnamed_interfaces, ifc_type, +interface_vars); } unsigned index = ifc_type->field_index(var->name); assert(index < ifc_type->length); -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 15/23] glsl: Convert if lowering to use the util hash table
Also do some miner whitespace cleanups Signed-off-by: Thomas Helland --- src/compiler/glsl/lower_if_to_cond_assign.cpp | 44 ++- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/compiler/glsl/lower_if_to_cond_assign.cpp b/src/compiler/glsl/lower_if_to_cond_assign.cpp index 6a70347..a785ed3 100644 --- a/src/compiler/glsl/lower_if_to_cond_assign.cpp +++ b/src/compiler/glsl/lower_if_to_cond_assign.cpp @@ -47,7 +47,7 @@ #include "compiler/glsl_types.h" #include "ir.h" -#include "program/hash_table.h" +#include "util/hash_table.h" namespace { @@ -59,13 +59,14 @@ public: this->max_depth = max_depth; this->depth = 0; - this->condition_variables = hash_table_ctor(0, hash_table_pointer_hash, - hash_table_pointer_compare); + this->condition_variables = +_mesa_hash_table_create(NULL, _mesa_hash_pointer, +_mesa_key_pointer_equal); } ~ir_if_to_cond_assign_visitor() { - hash_table_dtor(this->condition_variables); + _mesa_hash_table_destroy(this->condition_variables, NULL); } ir_visitor_status visit_enter(ir_if *); @@ -120,32 +121,33 @@ move_block_to_cond_assign(void *mem_ctx, if (ir->ir_type == ir_type_assignment) { ir_assignment *assign = (ir_assignment *)ir; -if (hash_table_find(ht, assign) == NULL) { - hash_table_insert(ht, assign, assign); +if (_mesa_hash_table_search(ht, assign) == NULL) { + _mesa_hash_table_insert(ht, assign, assign); /* If the LHS of the assignment is a condition variable that was * previously added, insert an additional assignment of false to * the variable. */ const bool assign_to_cv = - hash_table_find(ht, assign->lhs->variable_referenced()) != NULL; + _mesa_hash_table_search( + ht, assign->lhs->variable_referenced()) != NULL; if (!assign->condition) { - if (assign_to_cv) { - assign->rhs = -new(mem_ctx) ir_expression(ir_binop_logic_and, - glsl_type::bool_type, - cond_expr->clone(mem_ctx, NULL), - assign->rhs); - } else { - assign->condition = cond_expr->clone(mem_ctx, NULL); + if (assign_to_cv) { + assign->rhs = + new(mem_ctx) ir_expression(ir_binop_logic_and, + glsl_type::bool_type, + cond_expr->clone(mem_ctx, NULL), + assign->rhs); + } else { + assign->condition = cond_expr->clone(mem_ctx, NULL); } } else { assign->condition = - new(mem_ctx) ir_expression(ir_binop_logic_and, -glsl_type::bool_type, -cond_expr->clone(mem_ctx, NULL), -assign->condition); + new(mem_ctx) ir_expression(ir_binop_logic_and, +glsl_type::bool_type, +cond_expr->clone(mem_ctx, NULL), +assign->condition); } } } @@ -210,7 +212,7 @@ ir_if_to_cond_assign_visitor::visit_leave(ir_if *ir) /* Add the new condition variable to the hash table. This allows us to * find this variable when lowering other (enclosing) if-statements. */ - hash_table_insert(this->condition_variables, then_var, then_var); + _mesa_hash_table_insert(this->condition_variables, then_var, then_var); /* If there are instructions in the else-clause, store the inverse of the * condition to a variable. Move all of the instructions from the @@ -241,7 +243,7 @@ ir_if_to_cond_assign_visitor::visit_leave(ir_if *ir) /* Add the new condition variable to the hash table. This allows us to * find this variable when lowering other (enclosing) if-statements. */ - hash_table_insert(this->condition_variables, else_var, else_var); + _mesa_hash_table_insert(this->condition_variables, else_var, else_var); } ir->remove(); -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 18/23] glsl: Convert output read lowering to the util hash table
Signed-off-by: Thomas Helland --- src/compiler/glsl/lower_output_reads.cpp | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/compiler/glsl/lower_output_reads.cpp b/src/compiler/glsl/lower_output_reads.cpp index 79488df..732f4d3 100644 --- a/src/compiler/glsl/lower_output_reads.cpp +++ b/src/compiler/glsl/lower_output_reads.cpp @@ -23,7 +23,7 @@ */ #include "ir.h" -#include "program/hash_table.h" +#include "util/hash_table.h" /** * \file lower_output_reads.cpp @@ -74,20 +74,20 @@ static unsigned hash_table_var_hash(const void *key) { const ir_variable * var = static_cast(key); - return hash_table_string_hash(var->name); + return _mesa_key_hash_string(var->name); } output_read_remover::output_read_remover(unsigned stage) { this->stage = stage; mem_ctx = ralloc_context(NULL); - replacements = - hash_table_ctor(0, hash_table_var_hash, hash_table_pointer_compare); + replacements = _mesa_hash_table_create(NULL, hash_table_var_hash, + _mesa_key_pointer_equal); } output_read_remover::~output_read_remover() { - hash_table_dtor(replacements); + _mesa_hash_table_destroy(replacements, NULL); ralloc_free(mem_ctx); } @@ -99,14 +99,15 @@ output_read_remover::visit(ir_dereference_variable *ir) if (stage == MESA_SHADER_TESS_CTRL) return visit_continue; - ir_variable *temp = (ir_variable *) hash_table_find(replacements, ir->var); + hash_entry *entry = _mesa_hash_table_search(replacements, ir->var); + ir_variable *temp = entry ? (ir_variable *) entry->data : NULL; /* If we don't have an existing temporary, create one. */ if (temp == NULL) { void *var_ctx = ralloc_parent(ir->var); temp = new(var_ctx) ir_variable(ir->var->type, ir->var->name, ir_var_temporary); - hash_table_insert(replacements, temp, ir->var); + _mesa_hash_table_insert(replacements, ir->var, temp); ir->var->insert_after(temp); } @@ -156,7 +157,7 @@ ir_visitor_status output_read_remover::visit_leave(ir_emit_vertex *ir) { hash_table_call_foreach(replacements, emit_return_copy, ir); - hash_table_clear(replacements); + _mesa_hash_table_clear(replacements, NULL); return visit_continue; } -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 20/23] mesa: Convert symbol table to the util hash table
Signed-off-by: Thomas Helland --- src/mesa/program/symbol_table.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mesa/program/symbol_table.c b/src/mesa/program/symbol_table.c index 5b22745..3e58432 100644 --- a/src/mesa/program/symbol_table.c +++ b/src/mesa/program/symbol_table.c @@ -23,7 +23,7 @@ #include "main/imports.h" #include "symbol_table.h" -#include "hash_table.h" +#include "../../util/hash_table.h" struct symbol { /** @@ -186,7 +186,8 @@ _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table) static struct symbol_header * find_symbol(struct _mesa_symbol_table *table, const char *name) { -return (struct symbol_header *) hash_table_find(table->ht, name); + struct hash_entry *entry = _mesa_hash_table_search(table->ht, name); + return entry ? (struct symbol_header *) entry->data : NULL; } @@ -271,7 +272,7 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table, return -1; } - hash_table_insert(table->ht, hdr, hdr->name); + _mesa_hash_table_insert(table->ht, hdr->name, hdr); hdr->next = table->hdr; table->hdr = hdr; } @@ -338,7 +339,7 @@ _mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table *table, hdr->name = strdup(name); -hash_table_insert(table->ht, hdr, hdr->name); +_mesa_hash_table_insert(table->ht, hdr->name, hdr); hdr->next = table->hdr; table->hdr = hdr; } @@ -404,8 +405,8 @@ _mesa_symbol_table_ctor(void) struct _mesa_symbol_table *table = calloc(1, sizeof(*table)); if (table != NULL) { - table->ht = hash_table_ctor(32, hash_table_string_hash, - hash_table_string_compare); + table->ht = _mesa_hash_table_create(NULL, _mesa_key_hash_string, + _mesa_key_string_equal); _mesa_symbol_table_push_scope(table); } @@ -430,6 +431,6 @@ _mesa_symbol_table_dtor(struct _mesa_symbol_table *table) free(hdr); } - hash_table_dtor(table->ht); + _mesa_hash_table_destroy(table->ht, NULL); free(table); } -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 21/23] glsl: Convert loop analysis to the util hash table
Signed-off-by: Thomas Helland --- src/compiler/glsl/loop_analysis.cpp | 25 ++--- src/compiler/glsl/loop_analysis.h | 8 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/compiler/glsl/loop_analysis.cpp b/src/compiler/glsl/loop_analysis.cpp index 096a80a..b9bae43 100644 --- a/src/compiler/glsl/loop_analysis.cpp +++ b/src/compiler/glsl/loop_analysis.cpp @@ -75,8 +75,8 @@ loop_variable::record_reference(bool in_assignee, loop_state::loop_state() { - this->ht = hash_table_ctor(0, hash_table_pointer_hash, - hash_table_pointer_compare); + this->ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer, + _mesa_key_pointer_equal); this->mem_ctx = ralloc_context(NULL); this->loop_found = false; } @@ -84,7 +84,7 @@ loop_state::loop_state() loop_state::~loop_state() { - hash_table_dtor(this->ht); + _mesa_hash_table_destroy(this->ht, NULL); ralloc_free(this->mem_ctx); } @@ -94,7 +94,7 @@ loop_state::insert(ir_loop *ir) { loop_variable_state *ls = new(this->mem_ctx) loop_variable_state; - hash_table_insert(this->ht, ls, ir); + _mesa_hash_table_insert(this->ht, ir, ls); this->loop_found = true; return ls; @@ -104,14 +104,16 @@ loop_state::insert(ir_loop *ir) loop_variable_state * loop_state::get(const ir_loop *ir) { - return (loop_variable_state *) hash_table_find(this->ht, ir); + hash_entry *entry = _mesa_hash_table_search(this->ht, ir); + return entry ? (loop_variable_state *) entry->data : NULL; } loop_variable * loop_variable_state::get(const ir_variable *ir) { - return (loop_variable *) hash_table_find(this->var_hash, ir); + hash_entry *entry = _mesa_hash_table_search(this->var_hash, ir); + return entry ? (loop_variable *) entry->data : NULL; } @@ -123,7 +125,7 @@ loop_variable_state::insert(ir_variable *var) lv->var = var; - hash_table_insert(this->var_hash, lv, lv->var); + _mesa_hash_table_insert(this->var_hash, lv->var, lv); this->variables.push_tail(lv); return lv; @@ -518,8 +520,9 @@ public: virtual ir_visitor_status visit(ir_dereference_variable *ir) { - loop_variable *lv = -(loop_variable *) hash_table_find(this->loop_variables, ir->var); + hash_entry *entry = _mesa_hash_table_search(this->loop_variables, + ir->var); + loop_variable *lv = entry ? (loop_variable *) entry->data : NULL; assert(lv != NULL); @@ -576,8 +579,8 @@ get_basic_induction_increment(ir_assignment *ir, hash_table *var_hash) if (inc->as_constant() == NULL) { ir_variable *const inc_var = inc->variable_referenced(); if (inc_var != NULL) { -loop_variable *lv = - (loop_variable *) hash_table_find(var_hash, inc_var); + hash_entry *entry = _mesa_hash_table_search(var_hash, inc_var); + loop_variable *lv = entry ? (loop_variable *) entry->data : NULL; if (lv == NULL || !lv->is_loop_constant()) { assert(lv != NULL); diff --git a/src/compiler/glsl/loop_analysis.h b/src/compiler/glsl/loop_analysis.h index 3b1971d..727a91c 100644 --- a/src/compiler/glsl/loop_analysis.h +++ b/src/compiler/glsl/loop_analysis.h @@ -27,7 +27,7 @@ #define LOOP_ANALYSIS_H #include "ir.h" -#include "program/hash_table.h" +#include "util/hash_table.h" /** * Analyze and classify all variables used in all loops in the instruction list @@ -130,14 +130,14 @@ public: { this->num_loop_jumps = 0; this->contains_calls = false; - this->var_hash = hash_table_ctor(0, hash_table_pointer_hash, - hash_table_pointer_compare); + this->var_hash = _mesa_hash_table_create(NULL, _mesa_hash_pointer, + _mesa_key_pointer_equal); this->limiting_terminator = NULL; } ~loop_variable_state() { - hash_table_dtor(this->var_hash); + _mesa_hash_table_destroy(this->var_hash, NULL); } DECLARE_RALLOC_CXX_OPERATORS(loop_variable_state) -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 19/23] glsl: Convert varying test to the util hash table
Signed-off-by: Thomas Helland --- src/compiler/glsl/tests/varyings_test.cpp | 73 --- 1 file changed, 29 insertions(+), 44 deletions(-) diff --git a/src/compiler/glsl/tests/varyings_test.cpp b/src/compiler/glsl/tests/varyings_test.cpp index cabda7a..791d0e1 100644 --- a/src/compiler/glsl/tests/varyings_test.cpp +++ b/src/compiler/glsl/tests/varyings_test.cpp @@ -26,7 +26,7 @@ #include "main/macros.h" #include "util/ralloc.h" #include "ir.h" -#include "program/hash_table.h" +#include "util/hash_table.h" /** * \file varyings_test.cpp @@ -92,11 +92,13 @@ link_varyings::SetUp() this->mem_ctx = ralloc_context(NULL); this->ir.make_empty(); - this->consumer_inputs - = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); + this->consumer_inputs = + _mesa_hash_table_create(NULL, _mesa_key_hash_string, + _mesa_key_string_equal); - this->consumer_interface_inputs - = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); + this->consumer_interface_inputs = + _mesa_hash_table_create(NULL, _mesa_key_hash_string, + _mesa_key_string_equal); } void @@ -105,9 +107,9 @@ link_varyings::TearDown() ralloc_free(this->mem_ctx); this->mem_ctx = NULL; - hash_table_dtor(this->consumer_inputs); + _mesa_hash_table_destroy(this->consumer_inputs, NULL); this->consumer_inputs = NULL; - hash_table_dtor(this->consumer_interface_inputs); + _mesa_hash_table_destroy(this->consumer_interface_inputs, NULL); this->consumer_interface_inputs = NULL; } @@ -124,28 +126,6 @@ ht_count_callback(const void *, void *, void *closure) (*counter)++; } -/** - * Helper function to count the number of elements in a hash table. - */ -static unsigned -num_elements(hash_table *ht) -{ - unsigned int counter = 0; - - hash_table_call_foreach(ht, ht_count_callback, (void *) &counter); - - return counter; -} - -/** - * Helper function to determine whether a hash table is empty. - */ -static bool -is_empty(hash_table *ht) -{ - return num_elements(ht) == 0; -} - TEST_F(link_varyings, single_simple_input) { ir_variable *const v = @@ -162,9 +142,10 @@ TEST_F(link_varyings, single_simple_input) consumer_interface_inputs, junk); - EXPECT_EQ((void *) v, hash_table_find(consumer_inputs, "a")); - EXPECT_EQ(1u, num_elements(consumer_inputs)); - EXPECT_TRUE(is_empty(consumer_interface_inputs)); + hash_entry *entry = _mesa_hash_table_search(consumer_inputs, "a"); + EXPECT_EQ((void *) v, entry->data); + EXPECT_EQ(1u, consumer_inputs->entries); + EXPECT_TRUE(consumer_interface_inputs->entries == 0); } TEST_F(link_varyings, gl_ClipDistance) @@ -190,8 +171,8 @@ TEST_F(link_varyings, gl_ClipDistance) junk); EXPECT_EQ(clipdistance, junk[VARYING_SLOT_CLIP_DIST0]); - EXPECT_TRUE(is_empty(consumer_inputs)); - EXPECT_TRUE(is_empty(consumer_interface_inputs)); + EXPECT_TRUE(consumer_inputs->entries == 0); + EXPECT_TRUE(consumer_interface_inputs->entries == 0); } TEST_F(link_varyings, gl_CullDistance) @@ -217,8 +198,8 @@ TEST_F(link_varyings, gl_CullDistance) junk); EXPECT_EQ(culldistance, junk[VARYING_SLOT_CULL_DIST0]); - EXPECT_TRUE(is_empty(consumer_inputs)); - EXPECT_TRUE(is_empty(consumer_interface_inputs)); + EXPECT_TRUE(consumer_inputs->entries == 0); + EXPECT_TRUE(consumer_interface_inputs->entries == 0); } TEST_F(link_varyings, single_interface_input) @@ -239,9 +220,11 @@ TEST_F(link_varyings, single_interface_input) junk); char *const full_name = interface_field_name(simple_interface); - EXPECT_EQ((void *) v, hash_table_find(consumer_interface_inputs, full_name)); - EXPECT_EQ(1u, num_elements(consumer_interface_inputs)); - EXPECT_TRUE(is_empty(consumer_inputs)); + hash_entry *entry = _mesa_hash_table_search(consumer_interface_inputs, + full_name); + EXPECT_EQ((void *) v, entry->data); + EXPECT_EQ(1u, consumer_interface_inputs->entries); + EXPECT_TRUE(consumer_inputs->entries == 0); } TEST_F(link_varyings, one_interface_and_one_simple_input) @@ -271,12 +254,14 @@ TEST_F(link_varyings, one_interface_and_one_simple_input) char *const iface_field_name = interface_field_name(simple_interface); - EXPECT_EQ((void *) iface, hash_table_find(consumer_interface_inputs, - iface_field_name)); - EXPECT_EQ(1u, num_elements(consumer_interface_inputs)); + hash_entry *entry = _mesa_hash_table_search(consumer_interface_inputs, + iface_field_name); + EXPECT_EQ((void *) iface, entry->data); + EXPECT_EQ(1u, consumer_interface_inputs->ent
[Mesa-dev] [PATCH 16/23] glsl: Convert if lowering to use a set
Signed-off-by: Thomas Helland --- src/compiler/glsl/lower_if_to_cond_assign.cpp | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/compiler/glsl/lower_if_to_cond_assign.cpp b/src/compiler/glsl/lower_if_to_cond_assign.cpp index a785ed3..a948466 100644 --- a/src/compiler/glsl/lower_if_to_cond_assign.cpp +++ b/src/compiler/glsl/lower_if_to_cond_assign.cpp @@ -47,7 +47,8 @@ #include "compiler/glsl_types.h" #include "ir.h" -#include "util/hash_table.h" +#include "util/set.h" +#include "util/hash_table.h" /* Needed for the hashing functions */ namespace { @@ -60,13 +61,13 @@ public: this->depth = 0; this->condition_variables = -_mesa_hash_table_create(NULL, _mesa_hash_pointer, +_mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); } ~ir_if_to_cond_assign_visitor() { - _mesa_hash_table_destroy(this->condition_variables, NULL); + _mesa_set_destroy(this->condition_variables, NULL); } ir_visitor_status visit_enter(ir_if *); @@ -76,7 +77,7 @@ public: unsigned max_depth; unsigned depth; - struct hash_table *condition_variables; + struct set *condition_variables; }; } /* anonymous namespace */ @@ -115,22 +116,22 @@ void move_block_to_cond_assign(void *mem_ctx, ir_if *if_ir, ir_rvalue *cond_expr, exec_list *instructions, - struct hash_table *ht) + struct set *set) { foreach_in_list_safe(ir_instruction, ir, instructions) { if (ir->ir_type == ir_type_assignment) { ir_assignment *assign = (ir_assignment *)ir; -if (_mesa_hash_table_search(ht, assign) == NULL) { - _mesa_hash_table_insert(ht, assign, assign); +if (_mesa_set_search(set, assign) == NULL) { + _mesa_set_add(set, assign); /* If the LHS of the assignment is a condition variable that was * previously added, insert an additional assignment of false to * the variable. */ const bool assign_to_cv = - _mesa_hash_table_search( - ht, assign->lhs->variable_referenced()) != NULL; + _mesa_set_search( + set, assign->lhs->variable_referenced()) != NULL; if (!assign->condition) { if (assign_to_cv) { @@ -212,7 +213,7 @@ ir_if_to_cond_assign_visitor::visit_leave(ir_if *ir) /* Add the new condition variable to the hash table. This allows us to * find this variable when lowering other (enclosing) if-statements. */ - _mesa_hash_table_insert(this->condition_variables, then_var, then_var); + _mesa_set_add(this->condition_variables, then_var); /* If there are instructions in the else-clause, store the inverse of the * condition to a variable. Move all of the instructions from the @@ -243,7 +244,7 @@ ir_if_to_cond_assign_visitor::visit_leave(ir_if *ir) /* Add the new condition variable to the hash table. This allows us to * find this variable when lowering other (enclosing) if-statements. */ - _mesa_hash_table_insert(this->condition_variables, else_var, else_var); + _mesa_set_add(this->condition_variables, else_var); } ir->remove(); -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 17/23] glsl: Convert interface block lowering to the util hash table
Signed-off-by: Thomas Helland --- src/compiler/glsl/lower_named_interface_blocks.cpp | 27 +++--- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/compiler/glsl/lower_named_interface_blocks.cpp b/src/compiler/glsl/lower_named_interface_blocks.cpp index dbf0c63..01b9ac1 100644 --- a/src/compiler/glsl/lower_named_interface_blocks.cpp +++ b/src/compiler/glsl/lower_named_interface_blocks.cpp @@ -63,7 +63,7 @@ #include "ir.h" #include "ir_optimization.h" #include "ir_rvalue_visitor.h" -#include "program/hash_table.h" +#include "util/hash_table.h" static const glsl_type * process_array_type(const glsl_type *type, unsigned idx) @@ -123,8 +123,8 @@ public: void flatten_named_interface_blocks_declarations::run(exec_list *instructions) { - interface_namespace = hash_table_ctor(0, hash_table_string_hash, - hash_table_string_compare); + interface_namespace = _mesa_hash_table_create(NULL, _mesa_key_hash_string, + _mesa_key_string_equal); /* First pass: adjust instance block variables with an instance name * to not have an instance name. @@ -157,9 +157,9 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions) var->data.mode == ir_var_shader_in ? "in" : "out", iface_t->name, var->name, field_name); - ir_variable *found_var = -(ir_variable *) hash_table_find(interface_namespace, -iface_field_name); + hash_entry *entry = _mesa_hash_table_search(interface_namespace, + iface_field_name); + ir_variable *found_var = entry ? (ir_variable *) entry->data : NULL; if (!found_var) { ir_variable *new_var; char *var_name = @@ -196,8 +196,8 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions) new_var->data.from_named_ifc_block = 1; new_var->init_interface_type(var->type); -hash_table_insert(interface_namespace, new_var, - iface_field_name); +_mesa_hash_table_insert(interface_namespace, iface_field_name, +new_var); insert_pos->insert_after(new_var); insert_pos = new_var; } @@ -209,7 +209,7 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions) * reference an interface block, then flatten the refererence out. */ visit_list_elements(this, instructions); - hash_table_dtor(interface_namespace); + _mesa_hash_table_destroy(interface_namespace, NULL); interface_namespace = NULL; } @@ -268,11 +268,12 @@ flatten_named_interface_blocks_declarations::handle_rvalue(ir_rvalue **rvalue) var->data.mode == ir_var_shader_in ? "in" : "out", var->get_interface_type()->name, var->name, ir->field); + hash_entry *entry = _mesa_hash_table_search(interface_namespace, + iface_field_name); + assert(entry); + /* Find the variable in the set of flattened interface blocks */ - ir_variable *found_var = - (ir_variable *) hash_table_find(interface_namespace, - iface_field_name); - assert(found_var); + ir_variable *found_var = (ir_variable *) entry->data; ir_dereference_variable *deref_var = new(mem_ctx) ir_dereference_variable(found_var); -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 07/23] glsl: Convert ir_clone to the util hash table
Signed-off-by: Thomas Helland --- src/compiler/glsl/ir_clone.cpp | 31 --- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/compiler/glsl/ir_clone.cpp b/src/compiler/glsl/ir_clone.cpp index ef2c4c3..b1e5ea8 100644 --- a/src/compiler/glsl/ir_clone.cpp +++ b/src/compiler/glsl/ir_clone.cpp @@ -25,7 +25,7 @@ #include "main/compiler.h" #include "ir.h" #include "compiler/glsl_types.h" -#include "program/hash_table.h" +#include "util/hash_table.h" ir_rvalue * ir_rvalue::clone(void *mem_ctx, struct hash_table *) const @@ -68,9 +68,8 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const var->interface_type = this->interface_type; - if (ht) { - hash_table_insert(ht, var, (void *)const_cast(this)); - } + if (ht) + _mesa_hash_table_insert(ht, (void *)const_cast(this), var); return var; } @@ -175,9 +174,8 @@ ir_dereference_variable::clone(void *mem_ctx, struct hash_table *ht) const ir_variable *new_var; if (ht) { - new_var = (ir_variable *)hash_table_find(ht, this->var); - if (!new_var) -new_var = this->var; + hash_entry *entry = _mesa_hash_table_search(ht, this->var); + new_var = entry ? (ir_variable *) entry->data : this->var; } else { new_var = this->var; } @@ -281,8 +279,8 @@ ir_function::clone(void *mem_ctx, struct hash_table *ht) const copy->add_signature(sig_copy); if (ht != NULL) -hash_table_insert(ht, sig_copy, - (void *)const_cast(sig)); + _mesa_hash_table_insert(ht, + (void *)const_cast(sig), sig_copy); } return copy; @@ -394,10 +392,13 @@ public: /* Try to find the function signature referenced by the ir_call in the * table. If it is found, replace it with the value from the table. */ - ir_function_signature *sig = -(ir_function_signature *) hash_table_find(this->ht, ir->callee); - if (sig != NULL) -ir->callee = sig; + ir_function_signature *sig; + hash_entry *entry = _mesa_hash_table_search(this->ht, ir->callee); + + if (entry != NULL) { + sig = (ir_function_signature *) entry->data; + ir->callee = sig; + } /* Since this may be used before function call parameters are flattened, * the children also need to be processed. @@ -422,7 +423,7 @@ void clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in) { struct hash_table *ht = - hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); + _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); foreach_in_list(const ir_instruction, original, in) { ir_instruction *copy = original->clone(mem_ctx, ht); @@ -437,5 +438,5 @@ clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in) */ fixup_function_calls(ht, out); - hash_table_dtor(ht); + _mesa_hash_table_destroy(ht, NULL); } -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/23] mesa: Replace hashing functions of prog_hash_table
This will make it functionally equivalent to the one in util. This enables us to do a step-by-step replacement of the table. Signed-off-by: Thomas Helland --- src/mesa/program/prog_hash_table.c | 22 -- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/mesa/program/prog_hash_table.c b/src/mesa/program/prog_hash_table.c index cbea74c..a712175 100644 --- a/src/mesa/program/prog_hash_table.c +++ b/src/mesa/program/prog_hash_table.c @@ -35,33 +35,27 @@ unsigned hash_table_string_hash(const void *key) { -const char *str = (const char *) key; -unsigned hash = 5381; - - -while (*str != '\0') { -hash = (hash * 33) + *str; -str++; -} - -return hash; + const char *str = (const char *) key; + uint32_t hash = _mesa_hash_string(str); + return hash; } -bool hash_table_string_compare(const void *a, const void *b) +bool +hash_table_string_compare(const void *a, const void *b) { - return strcmp(a, b) == 0; + return _mesa_key_string_equal(a, b); } unsigned hash_table_pointer_hash(const void *key) { - return (unsigned)((uintptr_t) key / sizeof(void *)); + return _mesa_hash_pointer(key); } bool hash_table_pointer_compare(const void *key1, const void *key2) { - return key1 == key2; + return _mesa_key_pointer_equal(key1, key2); } -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/23] mesa: Convert string_to_uint_map to the util hash table
And remove the now unused hash_table_replace. Signed-off-by: Thomas Helland --- src/mesa/program/hash_table.h | 62 +-- 1 file changed, 18 insertions(+), 44 deletions(-) diff --git a/src/mesa/program/hash_table.h b/src/mesa/program/hash_table.h index 421d0e9..bd50615 100644 --- a/src/mesa/program/hash_table.h +++ b/src/mesa/program/hash_table.h @@ -111,8 +111,6 @@ static inline void *hash_table_find(struct hash_table *ht, const void *key) * \warning * The value passed by \c key is kept in the hash table and is used by later * calls to \c hash_table_find. - * - * \sa hash_table_replace */ static inline void hash_table_insert(struct hash_table *ht, void *data, const void *key) @@ -121,33 +119,6 @@ static inline void hash_table_insert(struct hash_table *ht, void *data, } /** - * Add an element to a hash table with replacement - * - * \return - * 1 if it did replace the value (in which case the old key is kept), 0 if it - * did not replace the value (in which case the new key is kept). - * - * \warning - * If \c key is already in the hash table, \c data will \b replace the most - * recently inserted \c data (see the warning in \c hash_table_insert) for - * that key. - * - * \sa hash_table_insert - */ -static inline bool hash_table_replace(struct hash_table *ht, void *data, - const void *key) -{ - struct hash_entry *entry = _mesa_hash_table_search(ht, key); - if (entry) { - entry->data = data; - return true; - } else { - _mesa_hash_table_insert(ht, key, data); - return false; - } -} - -/** * Remove a specific element from a hash table. */ static inline void hash_table_remove(struct hash_table *ht, const void *key) @@ -240,14 +211,14 @@ struct string_to_uint_map { public: string_to_uint_map() { - this->ht = hash_table_ctor(0, hash_table_string_hash, -hash_table_string_compare); + this->ht = _mesa_hash_table_create(NULL, _mesa_key_hash_string, + _mesa_key_string_equal); } ~string_to_uint_map() { hash_table_call_foreach(this->ht, delete_key, NULL); - hash_table_dtor(this->ht); + _mesa_hash_table_destroy(this->ht, NULL); } /** @@ -256,7 +227,7 @@ public: void clear() { hash_table_call_foreach(this->ht, delete_key, NULL); - hash_table_clear(this->ht); + _mesa_hash_table_clear(this->ht, NULL); } /** @@ -290,12 +261,13 @@ public: */ bool get(unsigned &value, const char *key) { - const intptr_t v = -(intptr_t) hash_table_find(this->ht, (const void *) key); + hash_entry *entry = _mesa_hash_table_search(this->ht, + (const void *) key); - if (v == 0) -return false; + if (!entry) + return false; + const intptr_t v = (intptr_t) entry->data; value = (unsigned)(v - 1); return true; } @@ -307,19 +279,21 @@ public: * valid value in the table. Bias the value by +1 so that a * user-specified zero is stored as 1. This enables ::get to tell the * difference between a user-specified zero (returned as 1 by - * hash_table_find) and the key not in the table (returned as 0 by - * hash_table_find). + * _mesa_hash_table_search) and the key not in the table (returned as 0 by + * _mesa_hash_table_find). * * The net effect is that we can't store UINT_MAX in the table. This is * because UINT_MAX+1 = 0. */ assert(value != UINT_MAX); char *dup_key = strdup(key); - bool result = hash_table_replace(this->ht, - (void *) (intptr_t) (value + 1), - dup_key); - if (result) -free(dup_key); + + hash_entry *entry = +_mesa_hash_table_insert(this->ht, dup_key, +(void *) (intptr_t) (value + 1)); + + if (entry->key != dup_key) + free(dup_key); } private: -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/23] glsl: Convert link_varyings to the util hash table
Signed-off-by: Thomas Helland --- src/compiler/glsl/link_varyings.cpp | 58 + 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index 1bce3e0..f41a2a8 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -36,7 +36,7 @@ #include "linker.h" #include "link_varyings.h" #include "main/macros.h" -#include "program/hash_table.h" +#include "util/hash_table.h" #include "program.h" @@ -981,8 +981,11 @@ tfeedback_decl::find_candidate(gl_shader_program *prog, name = "gl_TessLevelInnerMESA"; break; } - this->matched_candidate = (const tfeedback_candidate *) - hash_table_find(tfeedback_candidates, name); + hash_entry *entry = _mesa_hash_table_search(tfeedback_candidates, name); + + this->matched_candidate = entry ? + (const tfeedback_candidate *) entry->data : NULL; + if (!this->matched_candidate) { /* From GL_EXT_transform_feedback: * A program will fail to link if: @@ -994,6 +997,7 @@ tfeedback_decl::find_candidate(gl_shader_program *prog, linker_error(prog, "Transform feedback varying %s undeclared.", this->orig_name); } + return this->matched_candidate; } @@ -1788,8 +1792,9 @@ private: candidate->toplevel_var = this->toplevel_var; candidate->type = type; candidate->offset = this->varying_floats; - hash_table_insert(this->tfeedback_candidates, candidate, -ralloc_strdup(this->mem_ctx, name)); + _mesa_hash_table_insert(this->tfeedback_candidates, + ralloc_strdup(this->mem_ctx, name), + candidate); this->varying_floats += type->component_slots(); } @@ -1860,11 +1865,12 @@ populate_consumer_input_sets(void *mem_ctx, exec_list *ir, ralloc_asprintf(mem_ctx, "%s.%s", input_var->get_interface_type()->without_array()->name, input_var->name); -hash_table_insert(consumer_interface_inputs, input_var, - iface_field_name); +_mesa_hash_table_insert(consumer_interface_inputs, +iface_field_name, input_var); } else { -hash_table_insert(consumer_inputs, input_var, - ralloc_strdup(mem_ctx, input_var->name)); +_mesa_hash_table_insert(consumer_inputs, +ralloc_strdup(mem_ctx, input_var->name), +input_var); } } } @@ -1892,12 +1898,11 @@ get_matching_input(void *mem_ctx, ralloc_asprintf(mem_ctx, "%s.%s", output_var->get_interface_type()->without_array()->name, output_var->name); - input_var = - (ir_variable *) hash_table_find(consumer_interface_inputs, - iface_field_name); + hash_entry *entry = _mesa_hash_table_search(consumer_interface_inputs, iface_field_name); + input_var = entry ? (ir_variable *) entry->data : NULL; } else { - input_var = - (ir_variable *) hash_table_find(consumer_inputs, output_var->name); + hash_entry *entry = _mesa_hash_table_search(consumer_inputs, output_var->name); + input_var = entry ? (ir_variable *) entry->data : NULL; } return (input_var == NULL || input_var->data.mode != ir_var_shader_in) @@ -2074,12 +2079,15 @@ assign_varying_locations(struct gl_context *ctx, varying_matches matches(disable_varying_packing, xfb_enabled, producer ? producer->Stage : (gl_shader_stage)-1, consumer ? consumer->Stage : (gl_shader_stage)-1); - hash_table *tfeedback_candidates - = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); - hash_table *consumer_inputs - = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); - hash_table *consumer_interface_inputs - = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); + hash_table *tfeedback_candidates = + _mesa_hash_table_create(NULL, _mesa_key_hash_string, + _mesa_key_string_equal); + hash_table *consumer_inputs = + _mesa_hash_table_create(NULL, _mesa_key_hash_string, + _mesa_key_string_equal); + hash_table *consumer_interface_inputs = + _mesa_hash_table_create(NULL, _mesa_key_hash_string, + _mesa_key_string_equal); ir_variable *consumer_inputs_with_locations[VARYING_SLOT_TESS_MAX] = { NULL, }; @@ -2174,8 +2182,8 @@ assign_varying_locations(struct gl_context *ctx, } } - hash_table_dtor(consumer_inputs); - hash_table_dtor(consumer_interface_inputs); + _mesa_hash_table_destroy(c
[Mesa-dev] [PATCH 08/23] glsl: Convert ast_to_hir to the util hash table
Signed-off-by: Thomas Helland --- src/compiler/glsl/ast_to_hir.cpp | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index e03a6e3..01a8a7f 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -53,7 +53,7 @@ #include "glsl_parser_extras.h" #include "ast.h" #include "compiler/glsl_types.h" -#include "program/hash_table.h" +#include "util/hash_table.h" #include "main/macros.h" #include "main/shaderobj.h" #include "ir.h" @@ -5923,8 +5923,9 @@ ast_switch_statement::hir(exec_list *instructions, state->switch_state.is_switch_innermost = true; state->switch_state.switch_nesting_ast = this; - state->switch_state.labels_ht = hash_table_ctor(0, hash_table_pointer_hash, - hash_table_pointer_compare); + state->switch_state.labels_ht = + _mesa_hash_table_create(NULL, _mesa_hash_pointer, + _mesa_key_pointer_equal); state->switch_state.previous_default = NULL; /* Initalize is_fallthru state to false. @@ -5998,7 +5999,7 @@ ast_switch_statement::hir(exec_list *instructions, instructions->push_tail(irif); } - hash_table_dtor(state->switch_state.labels_ht); + _mesa_hash_table_destroy(state->switch_state.labels_ht, NULL); state->switch_state = saved; @@ -6180,20 +6181,23 @@ ast_case_label::hir(exec_list *instructions, /* Stuff a dummy value in to allow processing to continue. */ label_const = new(ctx) ir_constant(0); } else { - ast_expression *previous_label = (ast_expression *) - hash_table_find(state->switch_state.labels_ht, - (void *)(uintptr_t)label_const->value.u[0]); + ast_expression *previous_label; - if (previous_label) { + hash_entry *entry = + _mesa_hash_table_search(state->switch_state.labels_ht, + (void *)(uintptr_t)label_const->value.u[0]); + + if (entry) { +previous_label = (ast_expression *) entry->data; YYLTYPE loc = this->test_value->get_location(); _mesa_glsl_error(& loc, state, "duplicate case value"); loc = previous_label->get_location(); _mesa_glsl_error(& loc, state, "this is the previous case label"); } else { -hash_table_insert(state->switch_state.labels_ht, - this->test_value, - (void *)(uintptr_t)label_const->value.u[0]); +_mesa_hash_table_insert(state->switch_state.labels_ht, +(void *)(uintptr_t)label_const->value.u[0], +this->test_value); } } -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/23] glsl: Convert constant_expression to the util hash table
Signed-off-by: Thomas Helland --- src/compiler/glsl/ir_constant_expression.cpp | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/compiler/glsl/ir_constant_expression.cpp b/src/compiler/glsl/ir_constant_expression.cpp index 6329acd..16c8fac 100644 --- a/src/compiler/glsl/ir_constant_expression.cpp +++ b/src/compiler/glsl/ir_constant_expression.cpp @@ -39,7 +39,7 @@ #include "util/half_float.h" #include "ir.h" #include "compiler/glsl_types.h" -#include "program/hash_table.h" +#include "util/hash_table.h" static float dot_f(ir_constant *op0, ir_constant *op1) @@ -457,7 +457,8 @@ constant_referenced(const ir_dereference *deref, const ir_dereference_variable *const dv = (const ir_dereference_variable *) deref; - store = (ir_constant *) hash_table_find(variable_context, dv->var); + hash_entry *entry = _mesa_hash_table_search(variable_context, dv->var); + store = (ir_constant *) entry->data; break; } @@ -1806,9 +1807,10 @@ ir_dereference_variable::constant_expression_value(struct hash_table *variable_c /* Give priority to the context hashtable, if it exists */ if (variable_context) { - ir_constant *value = (ir_constant *)hash_table_find(variable_context, var); - if(value) - return value; + hash_entry *entry = _mesa_hash_table_search(variable_context, var); + + if(entry) + return (ir_constant *) entry->data; } /* The constant_value of a uniform variable is its initializer, @@ -1926,7 +1928,7 @@ bool ir_function_signature::constant_expression_evaluate_expression_list(const s /* (declare () type symbol) */ case ir_type_variable: { ir_variable *var = inst->as_variable(); - hash_table_insert(variable_context, ir_constant::zero(this, var->type), var); + _mesa_hash_table_insert(variable_context, var, ir_constant::zero(this, var->type)); break; } @@ -2050,8 +2052,8 @@ ir_function_signature::constant_expression_value(exec_list *actual_parameters, s * We expect the correctness of the number of parameters to have * been checked earlier. */ - hash_table *deref_hash = hash_table_ctor(8, hash_table_pointer_hash, -hash_table_pointer_compare); + hash_table *deref_hash = _mesa_hash_table_create(NULL, _mesa_hash_pointer, +_mesa_key_pointer_equal); /* If "origin" is non-NULL, then the function body is there. So we * have to use the variable objects from the object with the body, @@ -2062,13 +2064,13 @@ ir_function_signature::constant_expression_value(exec_list *actual_parameters, s foreach_in_list(ir_rvalue, n, actual_parameters) { ir_constant *constant = n->constant_expression_value(variable_context); if (constant == NULL) { - hash_table_dtor(deref_hash); + _mesa_hash_table_destroy(deref_hash, NULL); return NULL; } ir_variable *var = (ir_variable *)parameter_info; - hash_table_insert(deref_hash, constant, var); + _mesa_hash_table_insert(deref_hash, constant, var); parameter_info = parameter_info->next; } @@ -2081,7 +2083,7 @@ ir_function_signature::constant_expression_value(exec_list *actual_parameters, s if (constant_expression_evaluate_expression_list(origin ? origin->body : body, deref_hash, &result) && result) result = result->clone(ralloc_parent(this), NULL); - hash_table_dtor(deref_hash); + _mesa_hash_table_destroy(deref_hash, NULL); return result; } -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/23] mesa: Remove prog_hash_table.c
By now it is just wrapping some hashing functions. This can just as well be done in the header file. Go with static instead of extern for string hashing. Signed-off-by: Thomas Helland --- src/Makefile.am| 1 - src/compiler/SConscript.glsl | 2 -- src/mesa/Android.libmesa_glsl_utils.mk | 2 -- src/mesa/Makefile.sources | 1 - src/mesa/program/hash_table.h | 35 --- src/mesa/program/prog_hash_table.c | 61 -- 6 files changed, 23 insertions(+), 79 deletions(-) delete mode 100644 src/mesa/program/prog_hash_table.c diff --git a/src/Makefile.am b/src/Makefile.am index d4e34b4..740e287 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -109,6 +109,5 @@ noinst_LTLIBRARIES = libglsl_util.la libglsl_util_la_SOURCES = \ mesa/main/extensions_table.c \ mesa/main/imports.c \ - mesa/program/prog_hash_table.c \ mesa/program/symbol_table.c \ mesa/program/dummy_errors.c diff --git a/src/compiler/SConscript.glsl b/src/compiler/SConscript.glsl index 31d8f6d..92429ae 100644 --- a/src/compiler/SConscript.glsl +++ b/src/compiler/SConscript.glsl @@ -73,7 +73,6 @@ env.Command('glsl/imports.c', '#src/mesa/main/imports.c', Copy('$TARGET', '$SOUR env.Command('glsl/extensions_table.c', '#src/mesa/main/extensions_table.c', Copy('$TARGET', '$SOURCE')) # Copy these files to avoid generation object files into src/mesa/program env.Prepend(CPPPATH = ['#src/mesa/program']) -env.Command('glsl/prog_hash_table.c', '#src/mesa/program/prog_hash_table.c', Copy('$TARGET', '$SOURCE')) env.Command('glsl/symbol_table.c', '#src/mesa/program/symbol_table.c', Copy('$TARGET', '$SOURCE')) env.Command('glsl/dummy_errors.c', '#src/mesa/program/dummy_errors.c', Copy('$TARGET', '$SOURCE')) @@ -82,7 +81,6 @@ compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_FILES']) mesa_objs = env.StaticObject([ 'glsl/extensions_table.c', 'glsl/imports.c', -'glsl/prog_hash_table.c', 'glsl/symbol_table.c', 'glsl/dummy_errors.c', ]) diff --git a/src/mesa/Android.libmesa_glsl_utils.mk b/src/mesa/Android.libmesa_glsl_utils.mk index dfea801..0d83cd5 100644 --- a/src/mesa/Android.libmesa_glsl_utils.mk +++ b/src/mesa/Android.libmesa_glsl_utils.mk @@ -44,7 +44,6 @@ LOCAL_C_INCLUDES := \ LOCAL_SRC_FILES := \ main/extensions_table.c \ main/imports.c \ - program/prog_hash_table.c \ program/symbol_table.c \ program/dummy_errors.c @@ -70,7 +69,6 @@ LOCAL_C_INCLUDES := \ LOCAL_SRC_FILES := \ main/extensions_table.c \ main/imports.c \ - program/prog_hash_table.c \ program/symbol_table.c \ program/dummy_errors.c diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 472e767..d113fd3 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -525,7 +525,6 @@ PROGRAM_FILES = \ program/prog_cache.h \ program/prog_execute.c \ program/prog_execute.h \ - program/prog_hash_table.c \ program/prog_instruction.c \ program/prog_instruction.h \ program/prog_noise.c \ diff --git a/src/mesa/program/hash_table.h b/src/mesa/program/hash_table.h index 91fc11e..687a996 100644 --- a/src/mesa/program/hash_table.h +++ b/src/mesa/program/hash_table.h @@ -161,16 +161,17 @@ static inline void hash_table_remove(struct hash_table *ht, const void *key) /** * Compute hash value of a string * - * Computes the hash value of a string using the DJB2 algorithm developed by - * Professor Daniel J. Bernstein. It was published on comp.lang.c once upon - * a time. I was unable to find the original posting in the archives. - * * \param key Pointer to a NUL terminated string to be hashed. * * \sa hash_table_string_compare */ -extern unsigned hash_table_string_hash(const void *key); - +static unsigned +hash_table_string_hash(const void *key) +{ + const char *str = (const char *) key; + uint32_t hash = _mesa_hash_string(str); + return hash; +} /** * Compare two strings used as keys @@ -179,7 +180,11 @@ extern unsigned hash_table_string_hash(const void *key); * * \sa hash_table_string_hash */ -bool hash_table_string_compare(const void *a, const void *b); +static bool +hash_table_string_compare(const void *a, const void *b) +{ + return _mesa_key_string_equal(a, b); +} /** * Compute hash value of a pointer @@ -192,17 +197,23 @@ bool hash_table_string_compare(const void *a, const void *b); * * \sa hash_table_pointer_compare */ -unsigned -hash_table_pointer_hash(const void *key); - +static unsigned +hash_table_pointer_hash(const void *key) +{ + return _mesa_hash_pointer(key); +} /** * Compare two pointers used as keys * * \sa hash_table_pointer_hash */ -bool -hash_table_pointer_compare(const void *key1, const void *key2); +static bool +hash_table_pointer_compare(const void *key1, const void *key2) +{ +
[Mesa-dev] [PATCH 01/23] mesa: Remove unused hash table includes
This should prevent us from rebuilding the world. Signed-off-by: Thomas Helland --- src/compiler/glsl/link_atomics.cpp | 1 - src/compiler/glsl/link_uniforms.cpp | 1 - src/compiler/glsl/lower_discard_flow.cpp | 1 - src/mesa/main/uniform_query.cpp | 1 - 4 files changed, 4 deletions(-) diff --git a/src/compiler/glsl/link_atomics.cpp b/src/compiler/glsl/link_atomics.cpp index b6b446f..053e7a4 100644 --- a/src/compiler/glsl/link_atomics.cpp +++ b/src/compiler/glsl/link_atomics.cpp @@ -25,7 +25,6 @@ #include "ir.h" #include "ir_uniform.h" #include "linker.h" -#include "program/hash_table.h" #include "main/macros.h" namespace { diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp index dbe808f..9f8adcc 100644 --- a/src/compiler/glsl/link_uniforms.cpp +++ b/src/compiler/glsl/link_uniforms.cpp @@ -28,7 +28,6 @@ #include "glsl_symbol_table.h" #include "program/hash_table.h" #include "program.h" -#include "util/hash_table.h" /** * \file link_uniforms.cpp diff --git a/src/compiler/glsl/lower_discard_flow.cpp b/src/compiler/glsl/lower_discard_flow.cpp index 9e3a7c0..1a30afe 100644 --- a/src/compiler/glsl/lower_discard_flow.cpp +++ b/src/compiler/glsl/lower_discard_flow.cpp @@ -46,7 +46,6 @@ #include "compiler/glsl_types.h" #include "ir.h" -#include "program/hash_table.h" namespace { diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index 9caf5e1..db700df 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -35,7 +35,6 @@ #include "compiler/glsl/ir_uniform.h" #include "compiler/glsl/glsl_parser_extras.h" #include "compiler/glsl/program.h" -#include "program/hash_table.h" #include "util/bitscan.h" -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/23] glsl: Convert function inlining to the util hash table
Signed-off-by: Thomas Helland --- src/compiler/glsl/opt_function_inlining.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/glsl/opt_function_inlining.cpp b/src/compiler/glsl/opt_function_inlining.cpp index 19f5fae..83534bf 100644 --- a/src/compiler/glsl/opt_function_inlining.cpp +++ b/src/compiler/glsl/opt_function_inlining.cpp @@ -32,7 +32,7 @@ #include "ir_function_inlining.h" #include "ir_expression_flattening.h" #include "compiler/glsl_types.h" -#include "program/hash_table.h" +#include "util/hash_table.h" static void do_variable_replacement(exec_list *instructions, @@ -104,7 +104,7 @@ ir_call::generate_inline(ir_instruction *next_ir) int i; struct hash_table *ht; - ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); + ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); num_parameters = this->callee->parameters.length(); parameters = new ir_variable *[num_parameters]; @@ -207,7 +207,7 @@ ir_call::generate_inline(ir_instruction *next_ir) delete [] parameters; - hash_table_dtor(ht); + _mesa_hash_table_destroy(ht, NULL); } -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/23] glsl: Convert recursion detection to the util hash table
Signed-off-by: Thomas Helland --- src/compiler/glsl/ir_function_detect_recursion.cpp | 30 -- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/compiler/glsl/ir_function_detect_recursion.cpp b/src/compiler/glsl/ir_function_detect_recursion.cpp index b2334d2..38e4357 100644 --- a/src/compiler/glsl/ir_function_detect_recursion.cpp +++ b/src/compiler/glsl/ir_function_detect_recursion.cpp @@ -124,7 +124,7 @@ #include "ir.h" #include "glsl_parser_extras.h" #include "linker.h" -#include "program/hash_table.h" +#include "util/hash_table.h" #include "program.h" namespace { @@ -159,22 +159,25 @@ public: { progress = false; this->mem_ctx = ralloc_context(NULL); - this->function_hash = hash_table_ctor(0, hash_table_pointer_hash, - hash_table_pointer_compare); + this->function_hash = _mesa_hash_table_create(NULL, _mesa_hash_pointer, +_mesa_key_pointer_equal); } ~has_recursion_visitor() { - hash_table_dtor(this->function_hash); + _mesa_hash_table_destroy(this->function_hash, NULL); ralloc_free(this->mem_ctx); } function *get_function(ir_function_signature *sig) { - function *f = (function *) hash_table_find(this->function_hash, sig); - if (f == NULL) { -f = new(mem_ctx) function(sig); -hash_table_insert(this->function_hash, f, sig); + function *f; + hash_entry *entry = _mesa_hash_table_search(this->function_hash, sig); + if (entry == NULL) { + f = new(mem_ctx) function(sig); + _mesa_hash_table_insert(this->function_hash, sig, f); + } else { + f = (function *) entry->data; } return f; @@ -251,16 +254,17 @@ remove_unlinked_functions(const void *key, void *data, void *closure) if (f->callers.is_empty() || f->callees.is_empty()) { while (!f->callers.is_empty()) { -struct call_node *n = (struct call_node *) f->callers.pop_head(); -destroy_links(& n->func->callees, f); + struct call_node *n = (struct call_node *) f->callers.pop_head(); + destroy_links(& n->func->callees, f); } while (!f->callees.is_empty()) { -struct call_node *n = (struct call_node *) f->callees.pop_head(); -destroy_links(& n->func->callers, f); + struct call_node *n = (struct call_node *) f->callees.pop_head(); + destroy_links(& n->func->callers, f); } - hash_table_remove(visitor->function_hash, key); + hash_entry *entry = _mesa_hash_table_search(visitor->function_hash, key); + _mesa_hash_table_remove(visitor->function_hash, entry); visitor->progress = true; } } -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 12/23] glsl: Change link_functions to use a set
The "locals" hash table is used as a set, so use a set to avoid confusion and also spare some minor memory. Signed-off-by: Thomas Helland --- src/compiler/glsl/link_functions.cpp | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/compiler/glsl/link_functions.cpp b/src/compiler/glsl/link_functions.cpp index 69bdef1..b4aae5e 100644 --- a/src/compiler/glsl/link_functions.cpp +++ b/src/compiler/glsl/link_functions.cpp @@ -26,6 +26,7 @@ #include "glsl_parser_extras.h" #include "ir.h" #include "program.h" +#include "util/set.h" #include "util/hash_table.h" #include "linker.h" @@ -46,18 +47,18 @@ public: this->success = true; this->linked = linked; - this->locals = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); + this->locals = _mesa_set_create(NULL, _mesa_hash_pointer, + _mesa_key_pointer_equal); } ~call_link_visitor() { - _mesa_hash_table_destroy(this->locals, NULL); + _mesa_set_destroy(this->locals, NULL); } virtual ir_visitor_status visit(ir_variable *ir) { - _mesa_hash_table_insert(locals, ir, ir); + _mesa_set_add(locals, ir); return visit_continue; } @@ -218,7 +219,7 @@ public: virtual ir_visitor_status visit(ir_dereference_variable *ir) { - if (_mesa_hash_table_search(locals, ir->var) == NULL) { + if (_mesa_set_search(locals, ir->var) == NULL) { /* The non-function variable must be a global, so try to find the * variable in the shader's symbol table. If the variable is not * found, then it's a global that *MUST* be defined in the original @@ -303,7 +304,7 @@ private: /** * Table of variables local to the function. */ - hash_table *locals; + set *locals; }; } /* anonymous namespace */ -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/23] util: Move hash_table_call_foreach to util hash table
It is included through the util/hash_table include in the program hash_table, so this should be safe. This will be needed when we start converting each use of the program_hash_table, as some places need this function. Signed-off-by: Thomas Helland --- src/mesa/program/hash_table.h | 14 -- src/util/hash_table.h | 13 + 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/mesa/program/hash_table.h b/src/mesa/program/hash_table.h index 687a996..421d0e9 100644 --- a/src/mesa/program/hash_table.h +++ b/src/mesa/program/hash_table.h @@ -214,20 +214,6 @@ hash_table_pointer_compare(const void *key1, const void *key2) return _mesa_key_pointer_equal(key1, key2); } - -static inline void -hash_table_call_foreach(struct hash_table *ht, - void (*callback)(const void *key, -void *data, -void *closure), - void *closure) -{ - struct hash_entry *entry; - - hash_table_foreach(ht, entry) - callback(entry->key, entry->data, closure); -} - struct string_to_uint_map * string_to_uint_map_ctor(); diff --git a/src/util/hash_table.h b/src/util/hash_table.h index c69abfa..b35ee87 100644 --- a/src/util/hash_table.h +++ b/src/util/hash_table.h @@ -139,6 +139,19 @@ _mesa_fnv32_1a_accumulate_block(uint32_t hash, const void *data, size_t size) entry != NULL; \ entry = _mesa_hash_table_next_entry(ht, entry)) +static inline void +hash_table_call_foreach(struct hash_table *ht, +void (*callback)(const void *key, + void *data, + void *closure), +void *closure) +{ + struct hash_entry *entry; + + hash_table_foreach(ht, entry) + callback(entry->key, entry->data, closure); +} + #ifdef __cplusplus } /* extern C */ #endif -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 00/23] Remove the hash table in mesa/program
This patch series is inspired by Eric's latest work. This should allow us to get rid of the hash table completely. It has been compile tested to ensure every commit compiles, but not it has not seen a piglit run yet. I have ran shader-db at sporadic intervals to ensure things work, and that the instruction count stays the same, as a safety measure. There are some compiler warnings appearing midways in this series., however these are all gone when we reach to final goal of removing the hash table all together at the last commit. I'm quite happy with how the series turned out, and I believe it should be quite easy to review. It would be favorable if the whole series lands in master at the same time, to avoid multiple recompiles of the whole world for everyone, as the changes are quite invasive. Thomas Helland (23): mesa: Remove unused hash table includes mesa: Replace hashing and compare functions of prog_hash_table mesa: Remove prog_hash_table.c util: Move hash_table_call_foreach to util hash table mesa: Convert string_to_uint_map to the util hash table glsl: Convert function inlining to the util hash table glsl: Convert ir_clone to the util hash table glsl: Convert ast_to_hir to the util hash table glsl: Convert ir_constant_expression to the util hash table glsl: Convert recursion detection to the util hash table glsl: Convert link_functions to the util hash table glsl: Change link_functions to use a set glsl: Convert link_varyings to the util hash table glsl: Convert linker to the util hash table glsl: Convert if lowering to use the util hash table glsl: Convert if lowering to use a set glsl: Convert interface block lowering to the util hash table glsl: Convert output read lowering to the util hash table glsl: Convert varying test to the util hash table mesa: Convert symbol table to the util hash table glsl: Convert loop analysis to the util hash table glsl: Convert glcpp-parse to the util hash table mesa/glsl: Move string_to_uint_map into the util folder src/Makefile.am| 1 - src/compiler/SConscript.glsl | 2 - src/compiler/glsl/ast_to_hir.cpp | 26 +- src/compiler/glsl/glcpp/glcpp-parse.y | 54 ++-- src/compiler/glsl/glcpp/glcpp.h| 2 +- src/compiler/glsl/ir_clone.cpp | 31 +- src/compiler/glsl/ir_constant_expression.cpp | 24 +- src/compiler/glsl/ir_function_detect_recursion.cpp | 30 +- src/compiler/glsl/link_atomics.cpp | 1 - src/compiler/glsl/link_functions.cpp | 28 +- src/compiler/glsl/link_uniform_initializers.cpp| 2 +- src/compiler/glsl/link_uniforms.cpp| 3 +- src/compiler/glsl/link_varyings.cpp| 58 ++-- src/compiler/glsl/linker.cpp | 31 +- src/compiler/glsl/loop_analysis.cpp| 25 +- src/compiler/glsl/loop_analysis.h | 8 +- src/compiler/glsl/lower_discard_flow.cpp | 1 - src/compiler/glsl/lower_if_to_cond_assign.cpp | 49 +-- src/compiler/glsl/lower_named_interface_blocks.cpp | 27 +- src/compiler/glsl/lower_output_reads.cpp | 17 +- src/compiler/glsl/opt_function_inlining.cpp| 6 +- src/compiler/glsl/standalone.cpp | 2 +- .../glsl/tests/set_uniform_initializer_tests.cpp | 2 +- src/compiler/glsl/tests/varyings_test.cpp | 73 ++--- src/mesa/Android.libmesa_glsl_utils.mk | 2 - src/mesa/Makefile.sources | 3 - src/mesa/main/shader_query.cpp | 2 +- src/mesa/main/shaderobj.c | 2 +- src/mesa/main/uniform_query.cpp| 1 - src/mesa/program/hash_table.h | 352 - src/mesa/program/ir_to_mesa.cpp| 2 +- src/mesa/program/prog_hash_table.c | 67 src/mesa/program/symbol_table.c| 15 +- src/mesa/state_tracker/st_glsl_to_nir.cpp | 2 +- src/util/Makefile.sources | 2 + src/util/hash_table.h | 13 + src/{mesa/program => util}/string_to_uint_map.cpp | 2 +- src/util/string_to_uint_map.h | 173 ++ 38 files changed, 466 insertions(+), 675 deletions(-) delete mode 100644 src/mesa/program/hash_table.h delete mode 100644 src/mesa/program/prog_hash_table.c rename src/{mesa/program => util}/string_to_uint_map.cpp (97%) create mode 100644 src/util/string_to_uint_map.h -- 2.9.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nv50/ir: fix bb positions after exit instructions
On 08/14/2016 04:22 AM, Ilia Mirkin wrote: It's fairly rare that the BB layout puts BBs after the exit block, which is likely the reason these issues lingered for so long. This fixes a fraction of issues with the giant pixmark piano shader. This sounds reasonable to me. Reviewed-by: Samuel Pitoiset Signed-off-by: Ilia Mirkin Cc: --- src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp index 7878f2f..cc2a88e 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp @@ -2139,7 +2139,7 @@ makeInstructionLong(Instruction *insn) insn->encSize = 8; for (int i = fn->bbCount - 1; i >= 0 && fn->bbArray[i] != insn->bb; --i) { - fn->bbArray[i]->binPos += 4; + fn->bbArray[i]->binPos += adj; } fn->binSize += adj; insn->bb->binSize += adj; @@ -2191,9 +2191,16 @@ replaceExitWithModifier(Function *func) return; } } - epilogue->binSize -= 8; - func->binSize -= 8; + + int adj = epilogue->getExit()->encSize; + epilogue->binSize -= adj; + func->binSize -= adj; delete_Instruction(func->getProgram(), epilogue->getExit()); + + // There may be BB's that are laid out after the exit block + for (int i = func->bbCount - 1; i >= 0 && func->bbArray[i] != epilogue; --i) { + func->bbArray[i]->binPos -= adj; + } } void ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure: additional libs for OpenCL with LLVM static linking
I am marking this patch as (de-facto) rejected at Patchwork. Reason: The patch moved from the 1st page to the 2nd page of https://patchwork.freedesktop.org/project/mesa/series/?ordering=-last_updated Although I am letting it go you can still merge it to master if you want to. On Wed, Jul 27, 2016 at 10:55 PM, Jan Ziak <0xe2.0x9a.0...@gmail.com> wrote: > Mesa compilation fails when "--disable-llvm-shared-libs --enable-opencl" is > passed to the configure script. > > Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com> > --- > configure.ac | 1 + > 1 file changed, 1 insertions(+), 0 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 5c196a9..58c2db4 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -2194,6 +2194,7 @@ if test "x$enable_gallium_llvm" = xyes; then > > LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker > instrumentation" > LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader option objcarcopts > profiledata" > +LLVM_COMPONENTS="${LLVM_COMPONENTS} coverage" > fi > DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT > -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH" > MESA_LLVM=1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] install: check for undefined symbols in shared libraries
This patch ensures that shared libraries installed by Mesa do not contain any undefined symbols. The patch should help lowering the number of users experiencing undefined symbol errors with OpenGL apps. [http://google.sk/search?q=undefined+symbol:+_glapi_tls_Dispatch] 1250 results The patched install process performs the checks necessary for eventual replacement of all RTLD_NOW with RTLD_LAZY in Mesa source code. It is out of Mesa's scope of responsibility to ensure that later modifications to non-Mesa libs such as libLLVM*.so do not break OpenGL apps. Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com> --- bin/dlopen-check.sh | 16 install-gallium-links.mk | 4 install-lib-links.mk | 4 src/gallium/targets/dri/Makefile.am | 5 - src/gallium/targets/va/Makefile.am| 2 ++ src/gallium/targets/vdpau/Makefile.am | 2 ++ src/gallium/targets/xvmc/Makefile.am | 2 ++ src/mesa/drivers/dri/Makefile.am | 5 - 8 files changed, 38 insertions(+), 2 deletions(-) diff --git a/bin/dlopen-check.sh b/bin/dlopen-check.sh new file mode 100755 index 000..0a965ec --- /dev/null +++ b/bin/dlopen-check.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Check shared libraries for undefined symbols +set -e +set -o pipefail +if [ $# == 0 ]; then + echo "Usage: $0 SHARED-LIB..." + exit 1 +fi +UNDEFINED_SYMBOLS=$(ldd -d -r "$@" | { grep defined || true; }) +if [ -n "$UNDEFINED_SYMBOLS" ]; then + echo "$UNDEFINED_SYMBOLS" | sort | uniq | \ + while read -r LINE; do + echo "error: $LINE" + done + exit 1 +fi diff --git a/install-gallium-links.mk b/install-gallium-links.mk index ac5a499..5f6d696 100644 --- a/install-gallium-links.mk +++ b/install-gallium-links.mk @@ -6,6 +6,10 @@ if HAVE_COMPAT_SYMLINKS all-local : .install-gallium-links .install-gallium-links : $(dri_LTLIBRARIES) $(egl_LTLIBRARIES) $(lib_LTLIBRARIES) + if [ -n "$(shell find .libs -maxdepth 1 -name "*.so" -print -quit)" ]; then \ + LD_LIBRARY_PATH=$(top_builddir)/$(LIB_DIR) \ + $(top_srcdir)/bin/dlopen-check.sh .libs/*.so*; \ + fi $(AM_V_GEN)$(MKDIR_P) $(top_builddir)/$(LIB_DIR); \ link_dir=$(top_builddir)/$(LIB_DIR)/gallium;\ if test x$(egl_LTLIBRARIES) != x; then \ diff --git a/install-lib-links.mk b/install-lib-links.mk index 5fe9141..8de38cd 100644 --- a/install-lib-links.mk +++ b/install-lib-links.mk @@ -6,6 +6,10 @@ if HAVE_COMPAT_SYMLINKS all-local : .install-mesa-links .install-mesa-links : $(lib_LTLIBRARIES) + if [ -n "$(shell find .libs -maxdepth 1 -name "*.so" -print -quit)" ]; then \ + LD_LIBRARY_PATH=$(top_builddir)/$(LIB_DIR) \ + $(top_srcdir)/bin/dlopen-check.sh .libs/*.so*; \ + fi $(AM_V_GEN)$(MKDIR_P) $(top_builddir)/$(LIB_DIR); \ for f in $(join $(addsuffix .libs/,$(dir $(lib_LTLIBRARIES))),$(notdir $(lib_LTLIBRARIES:%.la=%.$(LIB_EXT)*))); do \ if test -h .libs/$$f; then \ diff --git a/src/gallium/targets/dri/Makefile.am b/src/gallium/targets/dri/Makefile.am index 06ade45..86ac6ea 100644 --- a/src/gallium/targets/dri/Makefile.am +++ b/src/gallium/targets/dri/Makefile.am @@ -136,7 +136,10 @@ endif # hardlink each megadriver instance, but don't actually have # gallium_dri.so in the set of final installed files. -install-data-hook: +install-data-hook: $(top_builddir)/$(LIB_DIR)/libGL.so + LD_PRELOAD=$(top_builddir)/$(LIB_DIR)/libGL.so \ + LD_LIBRARY_PATH=$(top_builddir)/$(LIB_DIR) \ + $(top_srcdir)/bin/dlopen-check.sh $(DESTDIR)$(dridir)/gallium_dri.so for i in $(TARGET_DRIVERS); do \ ln -f $(DESTDIR)$(dridir)/gallium_dri.so\ $(DESTDIR)$(dridir)/$${i}_dri.so; \ diff --git a/src/gallium/targets/va/Makefile.am b/src/gallium/targets/va/Makefile.am index df825b7..b31bc2d 100644 --- a/src/gallium/targets/va/Makefile.am +++ b/src/gallium/targets/va/Makefile.am @@ -70,6 +70,8 @@ endif # hardlink each megadriver instance, but don't actually have # gallium_drv_video.so in the set of final installed files. install-data-hook: + LD_LIBRARY_PATH=$(top_builddir)/$(LIB_DIR) \ + $(top_srcdir)/bin/dlopen-check.sh $(DESTDIR)$(vadir)/gallium_drv_video.so for i in $(TARGET_DRIVERS); do \ ln -f $(DESTDIR)$(vadir)/gallium_drv_video.so\ $(DESTDIR)$(vadir)/$${i}_drv_video.so; \ diff --git a/src/gallium/targets/vdpau/Makefile.am b/src/gallium/targets/vdpau/Makefile.am index d388f8b..ff70069 100644 --- a/src/gallium/targets/vdpau/Makefile.am +++ b/src/gallium/targets/vdpau/Makefile.am @@ -106,6 +106,8 @@ endif # hardlink each megadriver instance, but
Re: [Mesa-dev] [PATCH v3] st/vdpau: change the order in which filters are applied(v3)
Nayan Deshmukh wrote: Hi Andy, So can you please it try it again by replacing VL_MAX_SURFACES with 1 in the for loop. It should probably fix the problems. Yea, I should have though of that - it does fix, but I see things have moved on anyway. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 89043] undefined symbol: _glapi_tls_Dispatch
https://bugs.freedesktop.org/show_bug.cgi?id=89043 Christian König changed: What|Removed |Added Resolution|--- |INVALID Status|NEEDINFO|RESOLVED --- Comment #7 from Christian König --- I would rather use resolved/invalid cause this sounds just like a missing configuration option to me. Anyway let's close this one. -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3] st/vdpau: change the order in which filters are applied(v3)
Am 16.08.2016 um 19:29 schrieb Nayan Deshmukh: Hi Andy, Thanks for testing. On Tue, Aug 16, 2016 at 9:14 PM, Andy Furniss wrote: Nayan Deshmukh wrote: Hi Andy, You are right :( It messes up chroma but only in case of sharpen at least for me. Retested and denoise is also affected for me. I tried some changes and the chroma effects are fixed if we apply the sharpness filter to only to the first surface instead of all the surfaces of the buffer. Can you verify this? If you mean changing surfaces[i] to surfaces[0] below, then it is better, but there are still artifacts/chroma errors. In addition to changing as above, changing sampler_views[0] seems to fix denoise and negative sharpen, but gives a new sort of artifact for positive sharpen. Sorry for the misleading language. What I meant was that the filter should only be applied to first resource i.e. use only first sampler_view and surface. As you replaced i by 0 the filter gets applied multiple times. I tried doing that and I am experiencing same problems i.e. artifacts with positive sharpen. So can you please it try it again by replacing VL_MAX_SURFACES with 1 in the for loop. It should probably fix the problems. Well that would work around the problem, but not fix it. This way you only apply the filters to the luma channel and not all the other ones. The problem is possible that the chroma channels are subsampled and you don't use the correct resolution in the filters for them. Regards, Christian. Regards, Nayan. + for(i = 0; i < VL_MAX_SURFACES; ++i) { + if(sampler_views[i] != NULL && surfaces[i] != NULL) { + if (vmixer->noise_reduction.filter) +vl_median_filter_render(vmixer->noise_reduction.filter, +sampler_views[i], surfaces[i]); + + if (vmixer->sharpness.filter) +vl_matrix_filter_render(vmixer->sharpness.filter, +sampler_views[i], surfaces[i]); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3] st/vdpau: change the order in which filters are applied(v3)
Am 16.08.2016 um 19:50 schrieb Nayan Deshmukh: Hi Christian, On Tue, Aug 16, 2016 at 11:02 PM, Christian König wrote: Am 16.08.2016 um 19:29 schrieb Nayan Deshmukh: Hi Andy, Thanks for testing. On Tue, Aug 16, 2016 at 9:14 PM, Andy Furniss wrote: Nayan Deshmukh wrote: Hi Andy, You are right :( It messes up chroma but only in case of sharpen at least for me. Retested and denoise is also affected for me. I tried some changes and the chroma effects are fixed if we apply the sharpness filter to only to the first surface instead of all the surfaces of the buffer. Can you verify this? If you mean changing surfaces[i] to surfaces[0] below, then it is better, but there are still artifacts/chroma errors. In addition to changing as above, changing sampler_views[0] seems to fix denoise and negative sharpen, but gives a new sort of artifact for positive sharpen. Sorry for the misleading language. What I meant was that the filter should only be applied to first resource i.e. use only first sampler_view and surface. As you replaced i by 0 the filter gets applied multiple times. I tried doing that and I am experiencing same problems i.e. artifacts with positive sharpen. So can you please it try it again by replacing VL_MAX_SURFACES with 1 in the for loop. It should probably fix the problems. Well that would work around the problem, but not fix it. This way you only apply the filters to the luma channel and not all the other ones. The problem is possible that the chroma channels are subsampled and you don't use the correct resolution in the filters for them. Yes that's it. This is what the problem is. But to resolve it we need to initialize the filters with different resolution. So how can this be coded. I will need a bit guidance on this one (as I need on most of the things :) ). You probably need to create multiple instance of the filters, one for the original video width/height, then one for width/2 and original height and one for width/2 and height/2. Then check the chroma format of the video buffer and apply accordingly. Regards, Christian. I have this habit of fixing of patches with workarounds, need to change this approach. Regards, Nayan. Regards, Christian. Regards, Nayan. + for(i = 0; i < VL_MAX_SURFACES; ++i) { + if(sampler_views[i] != NULL && surfaces[i] != NULL) { + if (vmixer->noise_reduction.filter) +vl_median_filter_render(vmixer->noise_reduction.filter, +sampler_views[i], surfaces[i]); + + if (vmixer->sharpness.filter) +vl_matrix_filter_render(vmixer->sharpness.filter, +sampler_views[i], surfaces[i]); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3] st/vdpau: change the order in which filters are applied(v3)
Hi Christian, On Tue, Aug 16, 2016 at 11:02 PM, Christian König wrote: > Am 16.08.2016 um 19:29 schrieb Nayan Deshmukh: >> >> Hi Andy, >> >> Thanks for testing. >> >> On Tue, Aug 16, 2016 at 9:14 PM, Andy Furniss wrote: >>> >>> Nayan Deshmukh wrote: Hi Andy, >>> >>> You are right :( It messes up chroma but only in case of sharpen at least for me. >>> >>> >>> Retested and denoise is also affected for me. >>> I tried some changes and the chroma effects are fixed if we apply the sharpness filter to only to the first surface instead of all the surfaces of the buffer. Can you verify this? >>> >>> >>> If you mean changing surfaces[i] to surfaces[0] below, then it is >>> better, but there are still artifacts/chroma errors. >>> >>> In addition to changing as above, changing sampler_views[0] seems >>> to fix denoise and negative sharpen, but gives a new sort of >>> artifact for positive sharpen. >> >> Sorry for the misleading language. What I meant was that the filter should >> only >> be applied to first resource i.e. use only first sampler_view and >> surface. As you >> replaced i by 0 the filter gets applied multiple times. I tried doing >> that and I am >> experiencing same problems i.e. artifacts with positive sharpen. >> >> So can you please it try it again by replacing VL_MAX_SURFACES with 1 in >> the >> for loop. It should probably fix the problems. > > > Well that would work around the problem, but not fix it. > > This way you only apply the filters to the luma channel and not all the > other ones. > > The problem is possible that the chroma channels are subsampled and you > don't use the correct resolution in the filters for them. > Yes that's it. This is what the problem is. But to resolve it we need to initialize the filters with different resolution. So how can this be coded. I will need a bit guidance on this one (as I need on most of the things :) ). I have this habit of fixing of patches with workarounds, need to change this approach. Regards, Nayan. > Regards, > Christian. > > >> >> Regards, >> Nayan. >>> >>> >>> + for(i = 0; i < VL_MAX_SURFACES; ++i) { >>> + if(sampler_views[i] != NULL && surfaces[i] != NULL) { >>> + if (vmixer->noise_reduction.filter) >>> +vl_median_filter_render(vmixer->noise_reduction.filter, >>> +sampler_views[i], surfaces[i]); >>> + >>> + if (vmixer->sharpness.filter) >>> +vl_matrix_filter_render(vmixer->sharpness.filter, >>> +sampler_views[i], surfaces[i]); >>> >>> > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] dri2: Insert a synchronisation point for glXWaitX
On Tue, 2016-08-16 at 15:55 +0100, Chris Wilson wrote: > On Mon, Aug 17, 2015 at 03:17:30PM -0700, Eric Anholt wrote: > > > > I think XSync makes more sense. It's cheaper, and it does exactly what > > you're supposed to do at this point -- make sure that all your X > > requests have been processed, so that any GL batchbuffer flushes happen > > after that. > > Quoting Adam Jackson: > > This is a bit incorrect. For direct contexts, DRI2's WaitX becomes > DRI2CopyRegion from real-front to fake-front. That _does_ generate a > reply, but whether it flushes the X rendering queue appears to be up to > the driver's CopyRegion{,2} hook Just to be screechingly precise: WaitX is not "wait for a reply so you know your requests have been heard", it's "guarantee that X rendering has flushed through enough that GL can see it". The only core X request that comes close to the same semantics is GetImage [1]. If you only have MMIO hardware, like an Indy or a Voodoo, then XSync would be as strong as WaitX. If you have a single command queue, then XSync is as strong as WaitX if the server flushes its rendering at FlushCallback. But even single-queue hardware might implement WaitX as "acquire breadcrumb for X's rendering queue, insert pipeline bubble for that breadcrumb into requesting client's GL queue in kernel", which is what the "does not require a round-trip" language in the WaitX man page is about. [1] - Even then, it would arguably be legal for the server to cheat. ClearWindow followed by a 1x1 GetImage could just return the bg pixel and leave the fill enqueued to the hardware. Whether that's a server you want to run is merely a quality-of-implementation issue. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 89043] undefined symbol: _glapi_tls_Dispatch
https://bugs.freedesktop.org/show_bug.cgi?id=89043 Jan Ziak <0xe2.0x9a.0...@gmail.com> changed: What|Removed |Added CC||0xe2.0x9a.0...@gmail.com -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 89043] undefined symbol: _glapi_tls_Dispatch
https://bugs.freedesktop.org/show_bug.cgi?id=89043 --- Comment #6 from Jan Ziak <0xe2.0x9a.0...@gmail.com> --- This issue seems obsoleted due to the 1.5 years of time elapsed since the last comment. Can I mark it as RESOLVED--WONTFIX ? -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3] st/vdpau: change the order in which filters are applied(v3)
Hi Andy, Thanks for testing. On Tue, Aug 16, 2016 at 9:14 PM, Andy Furniss wrote: > Nayan Deshmukh wrote: >> >> Hi Andy, > > >> You are right :( It messes up chroma but only in case of sharpen at >> least for me. > > > Retested and denoise is also affected for me. > >> I tried some changes and the chroma effects are fixed if we apply the >> sharpness >> filter to only to the first surface instead of all the surfaces of the >> buffer. >> Can you verify this? > > > If you mean changing surfaces[i] to surfaces[0] below, then it is > better, but there are still artifacts/chroma errors. > > In addition to changing as above, changing sampler_views[0] seems > to fix denoise and negative sharpen, but gives a new sort of > artifact for positive sharpen. Sorry for the misleading language. What I meant was that the filter should only be applied to first resource i.e. use only first sampler_view and surface. As you replaced i by 0 the filter gets applied multiple times. I tried doing that and I am experiencing same problems i.e. artifacts with positive sharpen. So can you please it try it again by replacing VL_MAX_SURFACES with 1 in the for loop. It should probably fix the problems. Regards, Nayan. > > > + for(i = 0; i < VL_MAX_SURFACES; ++i) { > + if(sampler_views[i] != NULL && surfaces[i] != NULL) { > + if (vmixer->noise_reduction.filter) > +vl_median_filter_render(vmixer->noise_reduction.filter, > +sampler_views[i], surfaces[i]); > + > + if (vmixer->sharpness.filter) > +vl_matrix_filter_render(vmixer->sharpness.filter, > +sampler_views[i], surfaces[i]); > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [RFC] gbm: wire up fence extension
I noticed that fence extension wasn't exposed for drm/gbm, which sort of defeats the purpose of using fence fd's for synchronizing rendering and atomic pageflip. I suppose that somewhere or other, there needs to be a similar change to .../state_trackers/dri/dri2.c to avoid breaking things on i965. --- src/egl/drivers/dri2/platform_drm.c | 1 + src/gallium/state_trackers/dri/dri2.c | 1 + src/gbm/backends/dri/gbm_dri.c| 1 + src/gbm/backends/dri/gbm_driint.h | 1 + 4 files changed, 4 insertions(+) diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 1ce282f..7bea8e1 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -645,6 +645,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp) dri2_dpy->dri_screen = dri2_dpy->gbm_dri->screen; dri2_dpy->core = dri2_dpy->gbm_dri->core; dri2_dpy->dri2 = dri2_dpy->gbm_dri->dri2; + dri2_dpy->fence = dri2_dpy->gbm_dri->fence; dri2_dpy->image = dri2_dpy->gbm_dri->image; dri2_dpy->flush = dri2_dpy->gbm_dri->flush; dri2_dpy->swrast = dri2_dpy->gbm_dri->swrast; diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index 75d740b..8ad8701 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -2042,6 +2042,7 @@ const __DRIextension *galliumdrm_driver_extensions[] = { &driImageDriverExtension.base, &driDRI2Extension.base, &gallium_config_options.base, +&dri2FenceExtension.base, NULL }; diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index c3626e3..d4602d1 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -250,6 +250,7 @@ static struct dri_extension_match dri_core_extensions[] = { static struct dri_extension_match gbm_dri_device_extensions[] = { { __DRI_CORE, 1, offsetof(struct gbm_dri_device, core) }, { __DRI_DRI2, 1, offsetof(struct gbm_dri_device, dri2) }, + { __DRI2_FENCE, 2, offsetof(struct gbm_dri_device, fence) }, { NULL, 0, 0 } }; diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h index 46bb5c1..9c55007 100644 --- a/src/gbm/backends/dri/gbm_driint.h +++ b/src/gbm/backends/dri/gbm_driint.h @@ -51,6 +51,7 @@ struct gbm_dri_device { const __DRIcoreExtension *core; const __DRIdri2Extension *dri2; + const __DRI2fenceExtension *fence; const __DRIimageExtension *image; const __DRIswrastExtension *swrast; const __DRI2flushExtension *flush; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3] st/vdpau: change the order in which filters are applied(v3)
Nayan Deshmukh wrote: Hi Andy, You are right :( It messes up chroma but only in case of sharpen at least for me. Retested and denoise is also affected for me. I tried some changes and the chroma effects are fixed if we apply the sharpness filter to only to the first surface instead of all the surfaces of the buffer. Can you verify this? If you mean changing surfaces[i] to surfaces[0] below, then it is better, but there are still artifacts/chroma errors. In addition to changing as above, changing sampler_views[0] seems to fix denoise and negative sharpen, but gives a new sort of artifact for positive sharpen. + for(i = 0; i < VL_MAX_SURFACES; ++i) { + if(sampler_views[i] != NULL && surfaces[i] != NULL) { + if (vmixer->noise_reduction.filter) +vl_median_filter_render(vmixer->noise_reduction.filter, +sampler_views[i], surfaces[i]); + + if (vmixer->sharpness.filter) +vl_matrix_filter_render(vmixer->sharpness.filter, +sampler_views[i], surfaces[i]); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] dri2: Insert a synchronisation point for glXWaitX
On Mon, Aug 17, 2015 at 03:17:30PM -0700, Eric Anholt wrote: > Chris Wilson writes: > > > "X rendering calls made prior to glXWaitX are guaranteed to be > > executed before GL rendering calls made after glXWaitX." > > > > The goal is to implement that without adding a round-trip to the > > Xserver. Adding one using XSync() is easy, but we can piggy-back > > another, the DRI2GetBuffers request made to update the render buffers > > before the next rendering (thus satisfying the condition of flushing all > > X operations before the next GL rendering). To this end we can just flag > > the DRI2 buffers as invalid, and the driver will refresh them in due > > course. If the DRI2 buffers are, or will be, invalid due to damage from > > X or through a SwapBuffers call, we will not have to add another > > roundtrip as the single DRI2GetBuffers will refresh over multiple > > invalidates. > > > > This should fix the historic issue that glXWaitX() has been unreliable, > > but has recently found itself a new trigger will the removal of > > unnecessary glViewport calls: > > I think XSync makes more sense. It's cheaper, and it does exactly what > you're supposed to do at this point -- make sure that all your X > requests have been processed, so that any GL batchbuffer flushes happen > after that. Quoting Adam Jackson: This is a bit incorrect. For direct contexts, DRI2's WaitX becomes DRI2CopyRegion from real-front to fake-front. That _does_ generate a reply, but whether it flushes the X rendering queue appears to be up to the driver's CopyRegion{,2} hook; at least ms doesn't do anything special for that case, although presumably glamor's Flush in BlockHandler will fire. (DRI3 does something similar, although apparently uses core X CopyArea to do it instead of present? Sigh.) Both the DRI2 and DRI3 paths are broken, in fact, since they will only emit the copy if there's a current context (per spec) and drawable (maybe implied by spec but questionable), and only for that drawable (definitely wrong). They ought to emit a real GLXWaitX request unconditionally, which the server then ought to have enough context to handle correctly since it keeps track of current drawables globally (and knows about all the different DRIs). Getting this right isn't hard, but as with pretty much everything else about multiple GL clients, people have historically decided it was too difficult to want to care about, thus ensuring it gets even more difficult to fix over time... The WaitX man page and GLX spec are wrong to mention XSync at all, which is just GetInputFocus on the wire and AFAIK no DDX ever has interpreted that as a hint to flush rendering; a future GLX spec update -- Chris Wilson, Intel Open Source Technology Centre ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/vdpau: use temporary buffers while applying filters
Hi, I sent out the patch in a hurry and later noticed that the coding style is off at some places especially the ifs. I will send a new patch with fixes once the patch before this is verified by Andy. Regards, Nayan. On Tue, Aug 16, 2016 at 2:53 PM, Nayan Deshmukh wrote: > We temporary buffers so that we don't read and write to the > same surface at the same time. > > Signed-off-by: Nayan Deshmukh > --- > src/gallium/state_trackers/vdpau/mixer.c | 54 > ++-- > 1 file changed, 45 insertions(+), 9 deletions(-) > > diff --git a/src/gallium/state_trackers/vdpau/mixer.c > b/src/gallium/state_trackers/vdpau/mixer.c > index 56b667d..ff6750f 100644 > --- a/src/gallium/state_trackers/vdpau/mixer.c > +++ b/src/gallium/state_trackers/vdpau/mixer.c > @@ -239,9 +239,10 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, > enum vl_compositor_deinterlace deinterlace; > struct u_rect rect, clip, *prect, dirty_area; > unsigned i, layer = 0; > - struct pipe_video_buffer *video_buffer; > + struct pipe_video_buffer *video_buffer, templ, *video_buffer_output, > *video_buffer_temp = NULL; > struct pipe_sampler_view *sampler_view, **sampler_views; > struct pipe_surface *surface, **surfaces; > + struct pipe_context *pipe; > > vlVdpVideoMixer *vmixer; > vlVdpSurface *surf; > @@ -325,19 +326,48 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, >} > } > > - surfaces = video_buffer->get_surfaces(video_buffer); > - sampler_views = video_buffer->get_sampler_view_planes(video_buffer); > + video_buffer_output = video_buffer; > > - for(i = 0; i < VL_MAX_SURFACES; ++i) { > - if(sampler_views[i] != NULL && surfaces[i] != NULL) { > - if (vmixer->noise_reduction.filter) > + if (vmixer->noise_reduction.filter || vmixer->sharpness.filter) { > + pipe = vmixer->device->context; > + > + memset(&templ, 0, sizeof(templ)); > + templ.buffer_format = video_buffer->buffer_format; > + templ.chroma_format = video_buffer->chroma_format; > + templ.width = video_buffer->width; > + templ.height = video_buffer->height; > + templ.interlaced = video_buffer->interlaced; > + > + } > + > + if (vmixer->noise_reduction.filter) { > + sampler_views = > video_buffer->get_sampler_view_planes(video_buffer_output); > + video_buffer_output = vl_video_buffer_create(pipe, &templ); > + surfaces = video_buffer_output->get_surfaces(video_buffer_output); > + > + for(i = 0; i < VL_MAX_SURFACES; ++i) { > + if(sampler_views[i] != NULL && surfaces[i] != NULL) > vl_median_filter_render(vmixer->noise_reduction.filter, > sampler_views[i], surfaces[i]); > + } > + } > > - if (vmixer->sharpness.filter) > + if (vmixer->sharpness.filter) { > + sampler_views = > video_buffer_output->get_sampler_view_planes(video_buffer_output); > + /* > + * To keep a pointer to the buffer allocated > + * if noise reduction is enabled so that it > + * can be destroyed in the end > + */ > + if (video_buffer_output != video_buffer) > + video_buffer_temp = video_buffer_output; > + video_buffer_output = vl_video_buffer_create(pipe, &templ); > + surfaces = video_buffer_output->get_surfaces(video_buffer_output); > + > + for (i = 0; i < VL_MAX_SURFACES; ++i) { > + if (sampler_views[i] != NULL && surfaces[i] != NULL) > vl_matrix_filter_render(vmixer->sharpness.filter, > sampler_views[i], surfaces[i]); > - >} > } > > @@ -349,7 +379,7 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, >rect.y1 = surf->templat.height; >prect = ▭ > } > - vl_compositor_set_buffer_layer(&vmixer->cstate, compositor, layer, > video_buffer, prect, NULL, deinterlace); > + vl_compositor_set_buffer_layer(&vmixer->cstate, compositor, layer, > video_buffer_output, prect, NULL, deinterlace); > > if(vmixer->bicubic.filter) { >struct pipe_context *pipe; > @@ -421,6 +451,12 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, > pipe_surface_reference(&surface, NULL); >} > } > + > + if(video_buffer_output != video_buffer) > + video_buffer_output->destroy(video_buffer_output); > + if(video_buffer_temp != NULL) > + video_buffer_temp->destroy(video_buffer_temp); > + > pipe_mutex_unlock(vmixer->device->mutex); > > return VDP_STATUS_OK; > -- > 2.7.4 > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3] st/vdpau: change the order in which filters are applied(v3)
Hi Andy, On Tue, Aug 16, 2016 at 3:20 PM, Andy Furniss wrote: > Christian König wrote: >> >> Am 12.08.2016 um 16:02 schrieb Nayan Deshmukh: >>> >>> Apply the median and matrix filter before the compostioning >>> we apply the deinterlacing first to avoid the extra overhead >>> in processing the past and the future surfaces in deinterlacing. >>> >>> v2: apply the filters on all the surfaces (Christian) >>> v3: use get_sampler_view_planes() instead of >>> get_sampler_view_components() and iterate over >>> VL_MAX_SURFACES (Christian) >>> >>> Signed-off-by: Nayan Deshmukh >> >> >> Reviewed and pushed, thanks for the help. > > > Sorry I didn't get to test this until now. > > It messes up chroma when sharpen or denoise are used. You are right :( It messes up chroma but only in case of sharpen at least for me. I tried some changes and the chroma effects are fixed if we apply the sharpness filter to only to the first surface instead of all the surfaces of the buffer. Can you verify this? Cheers, Nayan. > >> >> Christian. >> >>> --- >>> src/gallium/state_trackers/vdpau/mixer.c | 28 >>> ++-- >>> 1 file changed, 18 insertions(+), 10 deletions(-) >>> >>> diff --git a/src/gallium/state_trackers/vdpau/mixer.c >>> b/src/gallium/state_trackers/vdpau/mixer.c >>> index cb0ef03..56b667d 100644 >>> --- a/src/gallium/state_trackers/vdpau/mixer.c >>> +++ b/src/gallium/state_trackers/vdpau/mixer.c >>> @@ -240,8 +240,8 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, >>> struct u_rect rect, clip, *prect, dirty_area; >>> unsigned i, layer = 0; >>> struct pipe_video_buffer *video_buffer; >>> - struct pipe_sampler_view *sampler_view; >>> - struct pipe_surface *surface; >>> + struct pipe_sampler_view *sampler_view, **sampler_views; >>> + struct pipe_surface *surface, **surfaces; >>> vlVdpVideoMixer *vmixer; >>> vlVdpSurface *surf; >>> @@ -325,6 +325,22 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, >>> } >>> } >>> + surfaces = video_buffer->get_surfaces(video_buffer); >>> + sampler_views = video_buffer->get_sampler_view_planes(video_buffer); >>> + >>> + for(i = 0; i < VL_MAX_SURFACES; ++i) { >>> + if(sampler_views[i] != NULL && surfaces[i] != NULL) { >>> + if (vmixer->noise_reduction.filter) >>> +vl_median_filter_render(vmixer->noise_reduction.filter, >>> +sampler_views[i], surfaces[i]); >>> + >>> + if (vmixer->sharpness.filter) >>> +vl_matrix_filter_render(vmixer->sharpness.filter, >>> +sampler_views[i], surfaces[i]); >>> + >>> + } >>> + } >>> + >>> prect = RectToPipe(video_source_rect, &rect); >>> if (!prect) { >>> rect.x0 = 0; >>> @@ -394,14 +410,6 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, >>> else { >>> vl_compositor_render(&vmixer->cstate, compositor, surface, >>> &dirty_area, true); >>> - if (vmixer->noise_reduction.filter) >>> - vl_median_filter_render(vmixer->noise_reduction.filter, >>> - sampler_view, surface); >>> - >>> - if (vmixer->sharpness.filter) >>> - vl_matrix_filter_render(vmixer->sharpness.filter, >>> - sampler_view, surface); >>> - >>> if (vmixer->bicubic.filter) >>>vl_bicubic_filter_render(vmixer->bicubic.filter, >>>sampler_view, dst->surface, >> >> >> >> ___ >> 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/st: use llabs instead of abs for long args (v2)
v2: long has 32bit on Windows (Marek) Signed-off-by: Francesco Ansanelli --- src/mesa/state_tracker/st_atom_array.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c index dcead27..1c2cfa7 100644 --- a/src/mesa/state_tracker/st_atom_array.c +++ b/src/mesa/state_tracker/st_atom_array.c @@ -363,7 +363,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp, if (bufObj != firstBufObj) return GL_FALSE; /* arrays in different VBOs */ - if (abs(array->Ptr - firstPtr) > firstStride) + if (llabs(array->Ptr - firstPtr) > firstStride) return GL_FALSE; /* arrays start too far apart */ if ((!_mesa_is_bufferobj(bufObj)) != userSpaceBuffer) -- 1.7.9.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Fix uf10_to_f32() scale factor in the E == 0 and M != 0 case.
The patch looks good to me. Reviewed-by: Antia Puentes On lun, 2016-08-15 at 23:50 -0700, Kenneth Graunke wrote: > GL_EXT_packed_float, 2.1.B Unsigned 10-Bit Floating-Point Numbers: > > 0.0, if E == 0 and M == 0, > 2^-14 * (M / 32), if E == 0 and M != 0, > 2^(E-15) * (1 + M/32),if 0 < E < 31, > INF, if E == 31 and M == 0, or > NaN, if E == 31 and M != 0, > > In the second case (E == 0 and M != 0), we were multiplying the > mantissa > by 2^-20, when we should have been multiplying by 2^-19 (which is > 2^(-14 + -5), or 2^-14 * 2^-5, or 2^-14 / 32). > > The previous section defines the formula for 11-bit numbers, which > is: > > 2^-14 * (M / 64), if E == 0 and M != 0, > > In other words, we had accidentally copy and pasted the 11-bit code > to the 10-bit case, and neglected to change the exponent. > > Fixes dEQP-GLES3.functional.pbo.renderbuffer.r11f_g11f_b10f_triangles > when run with surface dimensions of 1536x1152 or 1920x1080. > > References: https://code.google.com/p/chrome-os-partner/issues/detail > ?id=56244 > Signed-off-by: Kenneth Graunke > Reviewed-by: Stephane Marchesin > --- > src/util/format_r11g11b10f.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/util/format_r11g11b10f.h > b/src/util/format_r11g11b10f.h > index c9e967c..f6cd4ac 100644 > --- a/src/util/format_r11g11b10f.h > +++ b/src/util/format_r11g11b10f.h > @@ -191,7 +191,7 @@ static inline float uf10_to_f32(uint16_t val) > > if (exponent == 0) { > if (mantissa != 0) { > - const float scale = 1.0 / (1 << 20); > + const float scale = 1.0 / (1 << 19); > f32.f = scale * mantissa; > } > } else if (exponent == 31) { ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] egl/x11: avoid using freed memory if dri2 init fails
On Mon, Aug 15, 2016 at 11:46:40AM -0700, Kristian Høgsberg wrote: > On Mon, Aug 15, 2016 at 11:33 AM, ⚛ <0xe2.0x9a.0...@gmail.com> wrote: > > On Mon, Aug 15, 2016 at 8:08 PM, Emil Velikov > > wrote: > >> > >> On 4 August 2016 at 03:13, Nicolas Boichat wrote: > >> > Thanks! See also related series here, which fixes the other platforms: > >> > https://lists.freedesktop.org/archives/mesa-dev/2016-August/125147.html > >> > > >> > Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display) > >> > Cc: "12.0" > >> > Reviewed-by: Nicolas Boichat > >> > > >> This and there remaining DriverData patches are in master now. > > > > Thanks. > > > >> Jan, I believe you're ok/don't mind Patchwork. Can you please > >> check/update things if needed. Patchwork seems unhappy whenever I look > >> up for you. > > > > I looked into updating my name at Patchwork some time ago but the > > website seems to be missing support for this. > > > > I failed to predict that Patchwork will infer the name from the 1st > > patch I send. > > > > Is there a person with low-level access to patchwork.freedesktop.org I > > can send an email to? There's a list of Mesa maintaners at > > https://patchwork.freedesktop.org/project/mesa/ but I am unable to > > tell who to contact. > > Damien should be able to help with patchwork. Sure thing, changed Jan's name. -- Damien ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] st/mesa: use pipe var instead of st->pipe in st_create_context_priv()
For the series: Reviewed-by: Marek Olšák Marek On Tue, Aug 16, 2016 at 12:07 AM, Brian Paul wrote: > As is done in most other places in the function. > --- > src/mesa/state_tracker/st_context.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/src/mesa/state_tracker/st_context.c > b/src/mesa/state_tracker/st_context.c > index 687ca19..ddc11a4 100644 > --- a/src/mesa/state_tracker/st_context.c > +++ b/src/mesa/state_tracker/st_context.c > @@ -337,11 +337,11 @@ st_create_context_priv( struct gl_context *ctx, struct > pipe_context *pipe, > /* Create upload manager for vertex data for glBitmap, glDrawPixels, > * glClear, etc. > */ > - st->uploader = u_upload_create(st->pipe, 65536, PIPE_BIND_VERTEX_BUFFER, > + st->uploader = u_upload_create(pipe, 65536, PIPE_BIND_VERTEX_BUFFER, >PIPE_USAGE_STREAM); > > if (!screen->get_param(screen, PIPE_CAP_USER_INDEX_BUFFERS)) { > - st->indexbuf_uploader = u_upload_create(st->pipe, 128 * 1024, > + st->indexbuf_uploader = u_upload_create(pipe, 128 * 1024, >PIPE_BIND_INDEX_BUFFER, >PIPE_USAGE_STREAM); > } > @@ -433,8 +433,8 @@ st_create_context_priv( struct gl_context *ctx, struct > pipe_context *pipe, >screen->get_param(screen, PIPE_CAP_MULTI_DRAW_INDIRECT); > > /* GL limits and extensions */ > - st_init_limits(st->pipe->screen, &ctx->Const, &ctx->Extensions); > - st_init_extensions(st->pipe->screen, &ctx->Const, > + st_init_limits(pipe->screen, &ctx->Const, &ctx->Extensions); > + st_init_extensions(pipe->screen, &ctx->Const, >&ctx->Extensions, &st->options, ctx->Mesa_DXTn); > > if (st_have_perfmon(st)) { > -- > 1.9.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa/st: use labs instead of abs for long args Signed-off-by: Francesco Ansanelli
This is not portable, because long has 32 bits on Windows. Alternative solutions: - llabs - MAX2(a, -a) Marek On Tue, Aug 16, 2016 at 10:15 AM, Francesco Ansanelli wrote: > --- > src/mesa/state_tracker/st_atom_array.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/mesa/state_tracker/st_atom_array.c > b/src/mesa/state_tracker/st_atom_array.c > index dcead27..70247b9 100644 > --- a/src/mesa/state_tracker/st_atom_array.c > +++ b/src/mesa/state_tracker/st_atom_array.c > @@ -363,7 +363,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp, > if (bufObj != firstBufObj) > return GL_FALSE; /* arrays in different VBOs */ > > - if (abs(array->Ptr - firstPtr) > firstStride) > + if (labs(array->Ptr - firstPtr) > firstStride) > return GL_FALSE; /* arrays start too far apart */ > > if ((!_mesa_is_bufferobj(bufObj)) != userSpaceBuffer) > -- > 1.7.9.5 > > ___ > 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 v3] st/vdpau: change the order in which filters are applied(v3)
Christian König wrote: Am 12.08.2016 um 16:02 schrieb Nayan Deshmukh: Apply the median and matrix filter before the compostioning we apply the deinterlacing first to avoid the extra overhead in processing the past and the future surfaces in deinterlacing. v2: apply the filters on all the surfaces (Christian) v3: use get_sampler_view_planes() instead of get_sampler_view_components() and iterate over VL_MAX_SURFACES (Christian) Signed-off-by: Nayan Deshmukh Reviewed and pushed, thanks for the help. Sorry I didn't get to test this until now. It messes up chroma when sharpen or denoise are used. Christian. --- src/gallium/state_trackers/vdpau/mixer.c | 28 ++-- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c index cb0ef03..56b667d 100644 --- a/src/gallium/state_trackers/vdpau/mixer.c +++ b/src/gallium/state_trackers/vdpau/mixer.c @@ -240,8 +240,8 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, struct u_rect rect, clip, *prect, dirty_area; unsigned i, layer = 0; struct pipe_video_buffer *video_buffer; - struct pipe_sampler_view *sampler_view; - struct pipe_surface *surface; + struct pipe_sampler_view *sampler_view, **sampler_views; + struct pipe_surface *surface, **surfaces; vlVdpVideoMixer *vmixer; vlVdpSurface *surf; @@ -325,6 +325,22 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, } } + surfaces = video_buffer->get_surfaces(video_buffer); + sampler_views = video_buffer->get_sampler_view_planes(video_buffer); + + for(i = 0; i < VL_MAX_SURFACES; ++i) { + if(sampler_views[i] != NULL && surfaces[i] != NULL) { + if (vmixer->noise_reduction.filter) +vl_median_filter_render(vmixer->noise_reduction.filter, +sampler_views[i], surfaces[i]); + + if (vmixer->sharpness.filter) +vl_matrix_filter_render(vmixer->sharpness.filter, +sampler_views[i], surfaces[i]); + + } + } + prect = RectToPipe(video_source_rect, &rect); if (!prect) { rect.x0 = 0; @@ -394,14 +410,6 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, else { vl_compositor_render(&vmixer->cstate, compositor, surface, &dirty_area, true); - if (vmixer->noise_reduction.filter) - vl_median_filter_render(vmixer->noise_reduction.filter, - sampler_view, surface); - - if (vmixer->sharpness.filter) - vl_matrix_filter_render(vmixer->sharpness.filter, - sampler_view, surface); - if (vmixer->bicubic.filter) vl_bicubic_filter_render(vmixer->bicubic.filter, sampler_view, dst->surface, ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] gallium: change pipe_sampler_view::first_element/last_element -> offset/size
On Tue, Aug 16, 2016 at 1:14 AM, Roland Scheidegger wrote: > Am 15.08.2016 um 19:48 schrieb Marek Olšák: >> On Sun, Aug 14, 2016 at 11:38 AM, Marek Olšák wrote: >>> On Aug 12, 2016 8:49 PM, "Roland Scheidegger" wrote: I can't say I'm a big fan of this. From an "api cleanness" point of view, defining things in elements makes more sense imho. This is due to the GL api though which uses generic buffer api to turn buffers into textures which can be sampled (somewhat different to what d3d10 does). Can't you just say you require 16 bytes alignment and call it a day? I don't think all hw can do 4 bytes anyway (actually though to satisfy d3d10 requirements, your hw would still need to be able to even support 1-byte alignment, if the format is r8). It also makes things asymmetric wrt pipe_surface (granted that's something gl can't do IIRC). But I guess we could live with this if necessary... Maybe hw does work more like that and not what d3d10 wants anyway... >>> >>> I'd like to expose what our hw can do and this is the only way. >> >> Just to clarify... >> >> The "offset" should be in bytes, because we can do 4-byte-aligned >> access for texel sizes >= 4 and 1-byte-aligned access otherwise. The >> hardware doesn't really have the "offset" field. The "offset" is just >> added to the buffer address and the new address is used instead. The >> fact that we have a bug report about it and a user demanding it is a >> strong indication that it's a design bug that should be fixed. > Hence why I suggested to return 16 as minimum alignment which would also > fix this. Unless there's some extension saying you have to support dword > alignment. > I say it's a design bug in the GL api :-). > (You're saying you can actually use 1 byte aligned accesses for 1 byte > texel sizes, and you can't expose that with GL neither.) > >> >> The "size" field can be in bytes or elements. I don't have a strong >> opinion here. "size" is more consistent with other interfaces >> (constant buffers, shader buffers). > If offset is in bytes, I'd say size should be as well (though it > probably should already be correctly rounded down). Mixing different > units there is probably more confusing. > >> >> pipe_surface buffer support (for DX10?) isn't really important or >> relevant because no in-tree state tracker uses it, and most drivers >> either don't implement it, or don't implement it correctly. > That is true. llvmpipe might be the only one fully supporting it. > >> If we ever >> see an in-tree DX10 state tracker, it should use "shader buffers" >> instead. > You can't quite easily emulate that, since the dx10 feature treats this > like any ordinary rtv. Meaning you can do things like blending. > >> I don't see a reason to have pipe_surface buffer support in >> the tree except for dx10->gallium->dx10 translation (I guess we can >> both agree that such a use case is highly unlikely in open source). > > Don't forget even the sampler_view bits for supporting buffer textures > predate support for texture buffers in mesa IIRC. It might have been > possible gl supports writing to buffers in that way one day as well > (there's definitely plenty of features in gallium which eventually got > supported by GL even though they were initially not used by mesa state > tracker). > > Anyway, I don't really have objections to this change, I'm just grumpy > GL didn't get the API right :-). I agree it's a better match for GL. And > it is still possible to support what d3d10 needs there. OK, I'll assume this is ready to land if there are no other comments. BTW, Vulkan is the same as GL here, so according to you, Vulkan didn't get it right either. :) Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/6] gallium/u_blitter: split out a helper for common clear state
On Tue, Aug 16, 2016 at 4:02 AM, Rob Clark wrote: > On Mon, Aug 15, 2016 at 10:44 AM, Marek Olšák wrote: >> On Sat, Aug 13, 2016 at 8:57 PM, Rob Clark wrote: >>> On Sat, Aug 13, 2016 at 2:23 PM, Rob Clark wrote: Signed-off-by: Rob Clark --- src/gallium/auxiliary/util/u_blitter.c | 38 ++ src/gallium/auxiliary/util/u_blitter.h | 5 + 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 9fbef9b..e008100 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -1268,19 +1268,13 @@ static void *get_clear_blend_state(struct blitter_context_priv *ctx, return ctx->blend_clear[index]; } -static void util_blitter_clear_custom(struct blitter_context *blitter, - unsigned width, unsigned height, - unsigned num_layers, - unsigned clear_buffers, - const union pipe_color_union *color, - double depth, unsigned stencil, - void *custom_blend, void *custom_dsa) +void util_blitter_common_clear_setup(struct blitter_context *blitter, + unsigned width, unsigned height, + unsigned clear_buffers, + void *custom_blend, void *custom_dsa) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->base.pipe; - struct pipe_stencil_ref sr = { { 0 } }; - - assert(ctx->has_layered || num_layers <= 1); util_blitter_set_running_flag(blitter); blitter_check_saved_vertex_states(ctx); >>> >>> so actually, I need to squash in: >>> >>> -- >>> diff --git a/src/gallium/auxiliary/util/u_blitter.c >>> b/src/gallium/auxiliary/util/u_blitter.c >>> index e008100..c0d3808 100644 >>> --- a/src/gallium/auxiliary/util/u_blitter.c >>> +++ b/src/gallium/auxiliary/util/u_blitter.c >>> @@ -1281,6 +1281,12 @@ void util_blitter_common_clear_setup(struct >>> blitter_context *blitter, >>> blitter_check_saved_fragment_states(ctx); >>> blitter_disable_render_cond(ctx); >>> >>> + /* this will end up getting set again in >>> blitter_set_common_draw_rect_state() >>> +* but needs to be here for drivers using >>> util_blitter_common_clear_setup() >>> +* but not util_blitter_clear_custom() >>> +*/ >>> + pipe->bind_rasterizer_state(pipe, ctx->rs_state); >>> + >>> /* bind states */ >>> if (custom_blend) { >>>pipe->bind_blend_state(pipe, custom_blend); >>> -- >>> >>> I don't think there should be any harm in doing >>> pipe->bind_rasterizer_state() twice for drivers using >>> util_blitter_clear_custom(), and this is easier that adding a new >>> helper (since ctx->rs_state is not visible outside of u_blitter.c), >>> but if someone sees a problem with binding rasterizer state twice then >>> I could make it a new helper fxn instead. >> >> For clarity, it would be better to expose ctx->rs_state to drivers >> (e.g. via a function) instead of this hack. > > since it only amounts to a few lines of code, I think I'll just create > my own rs_state in fd_context, and go back to the original patch here > without anything squashed in. Was that your only objection to patch > 3? Yes, the original patch is: Reviewed-by: Marek Olšák Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/vdpau: use temporary buffers while applying filters
We temporary buffers so that we don't read and write to the same surface at the same time. Signed-off-by: Nayan Deshmukh --- src/gallium/state_trackers/vdpau/mixer.c | 54 ++-- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c index 56b667d..ff6750f 100644 --- a/src/gallium/state_trackers/vdpau/mixer.c +++ b/src/gallium/state_trackers/vdpau/mixer.c @@ -239,9 +239,10 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, enum vl_compositor_deinterlace deinterlace; struct u_rect rect, clip, *prect, dirty_area; unsigned i, layer = 0; - struct pipe_video_buffer *video_buffer; + struct pipe_video_buffer *video_buffer, templ, *video_buffer_output, *video_buffer_temp = NULL; struct pipe_sampler_view *sampler_view, **sampler_views; struct pipe_surface *surface, **surfaces; + struct pipe_context *pipe; vlVdpVideoMixer *vmixer; vlVdpSurface *surf; @@ -325,19 +326,48 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, } } - surfaces = video_buffer->get_surfaces(video_buffer); - sampler_views = video_buffer->get_sampler_view_planes(video_buffer); + video_buffer_output = video_buffer; - for(i = 0; i < VL_MAX_SURFACES; ++i) { - if(sampler_views[i] != NULL && surfaces[i] != NULL) { - if (vmixer->noise_reduction.filter) + if (vmixer->noise_reduction.filter || vmixer->sharpness.filter) { + pipe = vmixer->device->context; + + memset(&templ, 0, sizeof(templ)); + templ.buffer_format = video_buffer->buffer_format; + templ.chroma_format = video_buffer->chroma_format; + templ.width = video_buffer->width; + templ.height = video_buffer->height; + templ.interlaced = video_buffer->interlaced; + + } + + if (vmixer->noise_reduction.filter) { + sampler_views = video_buffer->get_sampler_view_planes(video_buffer_output); + video_buffer_output = vl_video_buffer_create(pipe, &templ); + surfaces = video_buffer_output->get_surfaces(video_buffer_output); + + for(i = 0; i < VL_MAX_SURFACES; ++i) { + if(sampler_views[i] != NULL && surfaces[i] != NULL) vl_median_filter_render(vmixer->noise_reduction.filter, sampler_views[i], surfaces[i]); + } + } - if (vmixer->sharpness.filter) + if (vmixer->sharpness.filter) { + sampler_views = video_buffer_output->get_sampler_view_planes(video_buffer_output); + /* + * To keep a pointer to the buffer allocated + * if noise reduction is enabled so that it + * can be destroyed in the end + */ + if (video_buffer_output != video_buffer) + video_buffer_temp = video_buffer_output; + video_buffer_output = vl_video_buffer_create(pipe, &templ); + surfaces = video_buffer_output->get_surfaces(video_buffer_output); + + for (i = 0; i < VL_MAX_SURFACES; ++i) { + if (sampler_views[i] != NULL && surfaces[i] != NULL) vl_matrix_filter_render(vmixer->sharpness.filter, sampler_views[i], surfaces[i]); - } } @@ -349,7 +379,7 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, rect.y1 = surf->templat.height; prect = ▭ } - vl_compositor_set_buffer_layer(&vmixer->cstate, compositor, layer, video_buffer, prect, NULL, deinterlace); + vl_compositor_set_buffer_layer(&vmixer->cstate, compositor, layer, video_buffer_output, prect, NULL, deinterlace); if(vmixer->bicubic.filter) { struct pipe_context *pipe; @@ -421,6 +451,12 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, pipe_surface_reference(&surface, NULL); } } + + if(video_buffer_output != video_buffer) + video_buffer_output->destroy(video_buffer_output); + if(video_buffer_temp != NULL) + video_buffer_temp->destroy(video_buffer_temp); + pipe_mutex_unlock(vmixer->device->mutex); return VDP_STATUS_OK; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 97214] X not running with error "Failed to make EGL context current"
https://bugs.freedesktop.org/show_bug.cgi?id=97214 Michel Dänzer changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #13 from Michel Dänzer --- Module: Mesa Branch: master Commit: 78e3cea4197802253401766fc44362786898e024 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=78e3cea4197802253401766fc44362786898e024 Author: Nicolas Boichat Date: Thu Aug 11 16:43:32 2016 +0800 egl/dri2: dri2_make_current: Release previous context's display -- 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 v2] egl/dri2: dri2_make_current: Release previous context's display
On 11/08/16 05:43 PM, Nicolas Boichat wrote: > eglMakeCurrent can also be used to change the active display. In that > case, we need to decrement ref_count of the previous display (possibly > destroying it), and increment it on the next display. > > Also, old_dsurf/old_rsurf cannot be non-NULL if old_ctx is NULL, so > we only need to test if old_ctx is non-NULL. > > v2: Save the old display before destroying the context. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97214 > Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display) > Cc: "12.0" > Reported-by: Alexandr Zelinsky > Tested-by: Alexandr Zelinsky > Signed-off-by: Nicolas Boichat Reviewed, tested and pushed. Thanks! -- 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] mesa/st: use labs instead of abs for long args Signed-off-by: Francesco Ansanelli
--- src/mesa/state_tracker/st_atom_array.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c index dcead27..70247b9 100644 --- a/src/mesa/state_tracker/st_atom_array.c +++ b/src/mesa/state_tracker/st_atom_array.c @@ -363,7 +363,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp, if (bufObj != firstBufObj) return GL_FALSE; /* arrays in different VBOs */ - if (abs(array->Ptr - firstPtr) > firstStride) + if (labs(array->Ptr - firstPtr) > firstStride) return GL_FALSE; /* arrays start too far apart */ if ((!_mesa_is_bufferobj(bufObj)) != userSpaceBuffer) -- 1.7.9.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3] st/vdpau: change the order in which filters are applied(v3)
Am 12.08.2016 um 16:02 schrieb Nayan Deshmukh: Apply the median and matrix filter before the compostioning we apply the deinterlacing first to avoid the extra overhead in processing the past and the future surfaces in deinterlacing. v2: apply the filters on all the surfaces (Christian) v3: use get_sampler_view_planes() instead of get_sampler_view_components() and iterate over VL_MAX_SURFACES (Christian) Signed-off-by: Nayan Deshmukh Reviewed and pushed, thanks for the help. Christian. --- src/gallium/state_trackers/vdpau/mixer.c | 28 ++-- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c index cb0ef03..56b667d 100644 --- a/src/gallium/state_trackers/vdpau/mixer.c +++ b/src/gallium/state_trackers/vdpau/mixer.c @@ -240,8 +240,8 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, struct u_rect rect, clip, *prect, dirty_area; unsigned i, layer = 0; struct pipe_video_buffer *video_buffer; - struct pipe_sampler_view *sampler_view; - struct pipe_surface *surface; + struct pipe_sampler_view *sampler_view, **sampler_views; + struct pipe_surface *surface, **surfaces; vlVdpVideoMixer *vmixer; vlVdpSurface *surf; @@ -325,6 +325,22 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, } } + surfaces = video_buffer->get_surfaces(video_buffer); + sampler_views = video_buffer->get_sampler_view_planes(video_buffer); + + for(i = 0; i < VL_MAX_SURFACES; ++i) { + if(sampler_views[i] != NULL && surfaces[i] != NULL) { + if (vmixer->noise_reduction.filter) +vl_median_filter_render(vmixer->noise_reduction.filter, +sampler_views[i], surfaces[i]); + + if (vmixer->sharpness.filter) +vl_matrix_filter_render(vmixer->sharpness.filter, +sampler_views[i], surfaces[i]); + + } + } + prect = RectToPipe(video_source_rect, &rect); if (!prect) { rect.x0 = 0; @@ -394,14 +410,6 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, else { vl_compositor_render(&vmixer->cstate, compositor, surface, &dirty_area, true); - if (vmixer->noise_reduction.filter) - vl_median_filter_render(vmixer->noise_reduction.filter, - sampler_view, surface); - - if (vmixer->sharpness.filter) - vl_matrix_filter_render(vmixer->sharpness.filter, - sampler_view, surface); - if (vmixer->bicubic.filter) vl_bicubic_filter_render(vmixer->bicubic.filter, sampler_view, dst->surface, ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glx: Don't use current context in __glXSendError
On 08/16/2016 10:23 AM, Michel Dänzer wrote: On 16/08/16 04:11 PM, Tapani Pälli wrote: On 08/16/2016 09:49 AM, Michel Dänzer wrote: From: Michel Dänzer There's no guarantee that there is one, and we don't need one anyway. Fixes piglit tests: glx@glx-fbconfig-bad this one passes for me with and without the patch Does your Mesa build have assertions enabled? (May require --enable-debug) Ah right, yeah glx-fbconfig-bad gets hit. For the others I don't see difference in results. glx@glx_ext_import_context@import context, multi process glx@glx_ext_import_context@import context, single process these 2 fail for me with and without the patch (and have been failing already before 2e3f067458e4) ... do these all pass for you before that change? Yes, they did. (Using the radeonsi driver with DRI3) I'm using DRI2. Anyway, forgetting about piglit for a second, can you agree that the code change makes sense per se? :) Sure, context does not seem to be needed there so I do agree with the changes; Reviewed-by: Tapani Pälli // Tapani ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glx: Don't use current context in __glXSendError
On 16/08/16 04:11 PM, Tapani Pälli wrote: > On 08/16/2016 09:49 AM, Michel Dänzer wrote: >> From: Michel Dänzer >> >> There's no guarantee that there is one, and we don't need one anyway. >> >> Fixes piglit tests: >> >> glx@glx-fbconfig-bad > > this one passes for me with and without the patch Does your Mesa build have assertions enabled? (May require --enable-debug) >> glx@glx_ext_import_context@import context, multi process >> glx@glx_ext_import_context@import context, single process > > these 2 fail for me with and without the patch (and have been failing > already before 2e3f067458e4) ... do these all pass for you before that > change? Yes, they did. (Using the radeonsi driver with DRI3) Anyway, forgetting about piglit for a second, can you agree that the code change makes sense per se? :) -- 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
Re: [Mesa-dev] [PATCH] glx: Don't use current context in __glXSendError
Hi; On 08/16/2016 09:49 AM, Michel Dänzer wrote: From: Michel Dänzer There's no guarantee that there is one, and we don't need one anyway. Fixes piglit tests: glx@glx-fbconfig-bad this one passes for me with and without the patch glx@glx_ext_import_context@import context, multi process glx@glx_ext_import_context@import context, single process these 2 fail for me with and without the patch (and have been failing already before 2e3f067458e4) ... do these all pass for you before that change? Fixes: 2e3f067458e4 ("glx: fix error code when there is no context bound") Cc: "11.2" Signed-off-by: Michel Dänzer --- src/glx/glx_error.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/glx/glx_error.c b/src/glx/glx_error.c index e098682..653cbeb 100644 --- a/src/glx/glx_error.c +++ b/src/glx/glx_error.c @@ -39,11 +39,9 @@ __glXSendError(Display * dpy, int_fast8_t errorCode, uint_fast32_t resourceID, uint_fast16_t minorCode, bool coreX11error) { struct glx_display *glx_dpy = __glXInitialize(dpy); - struct glx_context *gc = __glXGetCurrentContext(); xError error; assert(glx_dpy); - assert(gc != &dummyContext); LockDisplay(dpy); @@ -59,7 +57,7 @@ __glXSendError(Display * dpy, int_fast8_t errorCode, uint_fast32_t resourceID, error.sequenceNumber = dpy->request; error.resourceID = resourceID; error.minorCode = minorCode; - error.majorCode = gc ? gc->majorOpcode : 0; + error.majorCode = glx_dpy->majorOpcode; _XError(dpy, &error); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev