Re: [Mesa-dev] [PATCH 3/4] radeon, r200: allow hyperz for radeon DRM module v2
On 10.07.2015 12:44, Michel Dänzer wrote: On 10.07.2015 05:13, Emil Velikov wrote: The original code only half considered hyperz as an option. As per previous commit major != 2 cannot occur we can simply things, and allow users to set the option if they choose to do so. Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- src/mesa/drivers/dri/r200/r200_context.c | 10 ++ src/mesa/drivers/dri/radeon/radeon_context.c | 9 ++--- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 40cc50a..2a42ab3 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -225,14 +225,8 @@ GLboolean r200CreateContext( gl_api api, rmesa-radeon.initialMaxAnisotropy = driQueryOptionf(rmesa-radeon.optionCache, def_max_anisotropy); - if ( sPriv-drm_version.major == 1 -driQueryOptionb( rmesa-radeon.optionCache, hyperz ) ) { - if ( sPriv-drm_version.minor 13 ) - fprintf( stderr, DRM version 1.%d too old to support HyperZ, - disabling.\n, sPriv-drm_version.minor ); - else - rmesa-using_hyperz = GL_TRUE; - } This code only set rmesa-using_hyperz = GL_TRUE if sPriv-drm_version.major == 1. It was disabled for KMS in commit e541845959761e9f47d14ade6b58a32db04ef7e4 (r200: Fix piglit paths test.). + if (driQueryOptionb( rmesa-radeon.optionCache, hyperz)) + rmesa-using_hyperz = GL_TRUE; This enables it again for KMS. Maybe that's okay though, especially if the driconf option is disabled by default. The rest of the series is Reviewed-by: Michel Dänzer michel.daen...@amd.com And so is this patch, based on Roland's feedback. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] radeonsi indirect sampler, llvm backend issue
Hey, So i tried to get ARB_gpu_shader5 indirect sampler support to work in radeonsi, The attached patch to mesa adds support, but the llvm backend appears to do the wrong thing, and I'm not sure how to fix it. So the image sampling functions needs the resource and sampler address in SGPR, So I generate a load of v8i32 for the resource, and v4i32 for the sampler, however the backend translate the v4i32 load into a VGPR based load, then it all chokes when it tries to pass that to the image sample. commenting out the following pattern in the backend makes things work as a workaround. defm : MUBUFLoad_Pattern BUFFER_LOAD_DWORDX4_ADDR64, v4i32, constant_load; I then get an s_load_dwordx4 instead of a buffer_load_dwordx4. I've exhausted my knowledge of llvm already on this, so any ideas let me know. Below is the tgsi/llvm inputs I create. Dave. FRAG DCL OUT[0], COLOR DCL SAMP[0] DCL SAMP[1] DCL SAMP[2] DCL SAMP[3] DCL SVIEW[0], 2D, FLOAT DCL SVIEW[1], 2D, FLOAT DCL SVIEW[2], 2D, FLOAT DCL SVIEW[3], 2D, FLOAT DCL CONST[4] DCL TEMP[0], LOCAL DCL ADDR[0..2] IMM[0] FLT32 {0.7500, 0.2500, 0., 0.} 0: MOV TEMP[0].xy, IMM[0].xyyy 1: UARL ADDR[2].x, CONST[4]. 2: TEX TEMP[0], TEMP[0], SAMP[ADDR[2].x], 2D 3: MOV OUT[0], TEMP[0] 4: END ; ModuleID = 'tgsi' define void @main([6 x 16 x i8] addrspace(2)* byval, [17 x 16 x i8] addrspace(2)* byval, [17 x 4 x i32] addrspace(2)* byval, [34 x 8 x i32] addrspace(2)* byval, float inreg, i32 inreg, 2 x i32, 2 x i32, 2 x i32, 3 x i32, 2 x i32, 2 x i32, 2 x i32, float, float, float, float, float, float, i32, float, float) #0 { main_body: %22 = getelementptr [17 x 16 x i8], [17 x 16 x i8] addrspace(2)* %1, i64 0, i64 0 %23 = load 16 x i8, 16 x i8 addrspace(2)* %22, align 16, !tbaa !0 %24 = call float @llvm.SI.load.const(16 x i8 %23, i32 64) %25 = bitcast float %24 to i32 %26 = sext i32 %25 to i64 %27 = getelementptr [34 x 8 x i32], [34 x 8 x i32] addrspace(2)* %3, i64 0, i64 %26 %28 = load 8 x i32, 8 x i32 addrspace(2)* %27, align 32, !tbaa !0 %29 = sext i32 %25 to i64 %30 = getelementptr [17 x 4 x i32], [17 x 4 x i32] addrspace(2)* %2, i64 0, i64 %29 %31 = load 4 x i32, 4 x i32 addrspace(2)* %30, align 16, !tbaa !0 %32 = call 4 x float @llvm.SI.image.sample.v2i32(2 x i32 i32 1061158912, i32 1048576000, 8 x i32 %28, 4 x i32 %31, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) %33 = extractelement 4 x float %32, i32 0 %34 = extractelement 4 x float %32, i32 1 %35 = extractelement 4 x float %32, i32 2 %36 = extractelement 4 x float %32, i32 3 %37 = call i32 @llvm.SI.packf16(float %33, float %34) %38 = bitcast i32 %37 to float %39 = call i32 @llvm.SI.packf16(float %35, float %36) %40 = bitcast i32 %39 to float call void @llvm.SI.export(i32 15, i32 1, i32 1, i32 0, i32 1, float %38, float %40, float %38, float %40) ret void } From 23ee04b806875724ddeb6d9731f9bd42383272e8 Mon Sep 17 00:00:00 2001 From: Dave Airlie airl...@redhat.com Date: Mon, 13 Jul 2015 00:07:09 +0100 Subject: [PATCH] radeonsi: add support for indirect samplers This is the necessary frontend work, the llvm backend is producing the wrong code for the v4i32 load, --- src/gallium/drivers/radeonsi/si_shader.c | 70 1 file changed, 62 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 75a29ae..38ad74e 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1603,6 +1603,24 @@ static bool tgsi_is_shadow_sampler(unsigned target) static const struct lp_build_tgsi_action tex_action; +/** + * Return the value of tgsi_ind_register for indexing. + * This is the indirect index with the constant offset added to it. + */ +static LLVMValueRef get_indirect_index(struct si_shader_context *si_shader_ctx, + const struct tgsi_ind_register *ind, + int rel_index) +{ + struct gallivm_state *gallivm = si_shader_ctx-radeon_bld.soa.bld_base.base.gallivm; + LLVMValueRef result; + + result = si_shader_ctx-radeon_bld.soa.addr[ind-Index][ind-Swizzle]; + result = LLVMBuildLoad(gallivm-builder, result, ); + result = LLVMBuildAdd(gallivm-builder, result, + lp_build_const_int32(gallivm, rel_index), ); + return result; +} + static void tex_fetch_args( struct lp_build_tgsi_context * bld_base, struct lp_build_emit_data * emit_data) @@ -1618,10 +1636,41 @@ static void tex_fetch_args( unsigned num_coords = tgsi_util_get_texture_coord_dim(target, ref_pos); unsigned count = 0; unsigned chan; - unsigned sampler_src = emit_data-inst-Instruction.NumSrcRegs - 1; - unsigned sampler_index = emit_data-inst-Src[sampler_src].Register.Index; + unsigned sampler_src; + unsigned sampler_index; bool has_offset = HAVE_LLVM = 0x0305 ? inst-Texture.NumOffsets 0 : false; + bool has_sampler_indirect = false; + LLVMValueRef res_ptr, samp_ptr; + sampler_src =
Re: [Mesa-dev] [PATCH] radeonsi: ARB_gpu_shader_fp64 + ARB_vertex_attrib_64bit support.
Reviewed-by: Marek Olšák marek.ol...@amd.com Marek On Sun, Jul 12, 2015 at 4:55 AM, Dave Airlie airl...@gmail.com wrote: From: Dave Airlie airl...@redhat.com This adds the translation from TGSI to AMDGPU llvm backend, for the 64-bit opcodes. The backend pretty much handles everything for us fine. There is one patch required for SI DFRAC support, that I know off. Signed-off-by: Dave Airlie airl...@redhat.com --- docs/GL3.txt | 4 +- src/gallium/drivers/radeon/radeon_llvm.h | 7 +- .../drivers/radeon/radeon_setup_tgsi_llvm.c| 143 - src/gallium/drivers/radeonsi/si_pipe.c | 1 + src/gallium/drivers/radeonsi/si_shader.c | 31 - 5 files changed, 173 insertions(+), 13 deletions(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index 94bbcd1..d1a42be 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -109,7 +109,7 @@ GL 4.0, GLSL 4.00: - Enhanced per-sample shadingDONE (r600, radeonsi) - Interpolation functionsDONE (r600) - New overload resolution rules DONE - GL_ARB_gpu_shader_fp64 DONE (nvc0, llvmpipe, softpipe) + GL_ARB_gpu_shader_fp64 DONE (nvc0, radeonsi, llvmpipe, softpipe) GL_ARB_sample_shadingDONE (i965, nv50, nvc0, r600, radeonsi) GL_ARB_shader_subroutine started (Dave) GL_ARB_tessellation_shader started (Chris, Ilia) @@ -127,7 +127,7 @@ GL 4.1, GLSL 4.10: GL_ARB_get_program_binaryDONE (0 binary formats) GL_ARB_separate_shader_objects DONE (all drivers) GL_ARB_shader_precision started (Micah) - GL_ARB_vertex_attrib_64bit DONE (nvc0, llvmpipe, softpipe) + GL_ARB_vertex_attrib_64bit DONE (nvc0, radeonsi llvmpipe, softpipe) GL_ARB_viewport_arrayDONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe) diff --git a/src/gallium/drivers/radeon/radeon_llvm.h b/src/gallium/drivers/radeon/radeon_llvm.h index 6a9557b..591e698 100644 --- a/src/gallium/drivers/radeon/radeon_llvm.h +++ b/src/gallium/drivers/radeon/radeon_llvm.h @@ -146,6 +146,8 @@ static inline LLVMTypeRef tgsi2llvmtype( case TGSI_TYPE_UNSIGNED: case TGSI_TYPE_SIGNED: return LLVMInt32TypeInContext(ctx); + case TGSI_TYPE_DOUBLE: + return LLVMDoubleTypeInContext(ctx); case TGSI_TYPE_UNTYPED: case TGSI_TYPE_FLOAT: return LLVMFloatTypeInContext(ctx); @@ -205,6 +207,9 @@ build_tgsi_intrinsic_nomem( struct lp_build_tgsi_context * bld_base, struct lp_build_emit_data * emit_data); - +LLVMValueRef +radeon_llvm_emit_fetch_double(struct lp_build_tgsi_context *bld_base, + LLVMValueRef ptr, + LLVMValueRef ptr2); #endif /* RADEON_LLVM_H */ diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c index c8c980d..444a41c 100644 --- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c +++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c @@ -116,6 +116,28 @@ emit_fetch( enum tgsi_opcode_type type, unsigned swizzle); +LLVMValueRef +radeon_llvm_emit_fetch_double( + struct lp_build_tgsi_context *bld_base, + LLVMValueRef ptr, + LLVMValueRef ptr2) +{ + LLVMBuilderRef builder = bld_base-base.gallivm-builder; + LLVMValueRef result; + + result = LLVMGetUndef(LLVMVectorType(LLVMIntTypeInContext(bld_base-base.gallivm-context, 32), bld_base-base.type.length * 2)); + + result = LLVMBuildInsertElement(builder, + result, + bitcast(bld_base, TGSI_TYPE_UNSIGNED, ptr), + bld_base-int_bld.zero, ); + result = LLVMBuildInsertElement(builder, + result, + bitcast(bld_base, TGSI_TYPE_UNSIGNED, ptr2), + bld_base-int_bld.one, ); + return bitcast(bld_base, TGSI_TYPE_DOUBLE, result); +} + static LLVMValueRef emit_array_fetch( struct lp_build_tgsi_context *bld_base, @@ -160,7 +182,7 @@ emit_fetch( struct radeon_llvm_context * ctx = radeon_llvm_context(bld_base); struct lp_build_tgsi_soa_context *bld = lp_soa_context(bld_base); LLVMBuilderRef builder = bld_base-base.gallivm-builder; - LLVMValueRef result = NULL, ptr; + LLVMValueRef result = NULL, ptr, ptr2; if (swizzle == ~0) {
Re: [Mesa-dev] Disagreement between ChooseTextureFormat and QuerySamplesForFormat
Am 12.07.2015 um 19:30 schrieb Ilia Mirkin: I asked this on IRC, but figured I'd get wider distribution for the question. The situation is that nv50 doesn't support RGBA32 MS8 textures. However QuerySamplesForFormat will try its hardest to find supported sample counts, which means it'll go down st/mesa's fallback format list, which includes RGBA16, which can handle MS8 just fine. So the teximage.c code thinks that the # of samples is OK. However when it selects the teximage format, ChooseTextureFormat, which does not take a sample count, will return RGBA32 (which is supported for MS1, MS2, MS4 on nv50). When later it attempts to AllocTextureStorage, it will again attempt to do so using RGBA32 with MS8, which will fail. The core code handles this case (since texture storage allocation can happen for a wide variety of reasons), but I think this is suboptimal. Should ChooseTextureFormat take a sample count? This would allow the driver to provide the correct TexFormat for that format / sample count combo. Maybe. I got some doubts though this is the correct fix at least in this case. I think st_choose_format should be more clever not to try such fallback formats, at least if that was for some kind of query. In particular RGBA32F is a required supported format (in newer gl versions), thus it is not correct to fallback to something with less bits, msaa or not. Roland Cheers, -ilia PS. See bug https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D91314d=BQIGaQc=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEsr=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_Im=3BB07M6i6rr_12jeHSanF_yCvMJQ0T9C4eU_aPexd5ss=zbecr-W4tpKpVL_cZ95nluvrNcpMa0ir770_oTNJsiIe= but the assert fail happens due to improper handling in the storage allocation failure case, which ought to get handled anyways. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddevd=BQIGaQc=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEsr=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_Im=3BB07M6i6rr_12jeHSanF_yCvMJQ0T9C4eU_aPexd5ss=PyabKxbFvxr16cgQmADlD5nbqc6U6Ntmvelr6KkJo7we= ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 90264] [Regression, bisected] Tooltip corruption in Chrome
https://bugs.freedesktop.org/show_bug.cgi?id=90264 --- Comment #35 from Heiko lil_...@web.de --- Just some more input Debuggable with smth like `/usr/lib/chromium-browser/chrome --user-data-dir=/tmp/fake --no-sandbox --enable-gpu-debugging --gpu-launcher=xterm -e gdb --args` and break at gfx::NativeViewGLSurfaceGLX::Resize 531 bool NativeViewGLSurfaceGLX::Resize(const gfx::Size size) { 532 size_ = size; 533 glXWaitGL(); 534 XResizeWindow(g_display, window_, size.width(), size.height()); 535 glXWaitX(); 536 return true; 537 } Is called for every tooltip. Looks like the tooltip xwindow is resized: (gdb) x/2d $rsi 0x7fffc2f0: 221 21 ('New tab' tooltip 221x21) (gdb) x/2d $rsi 0x7fffc2f0: 370 72 (chromium bug 442111 tooltip 370x72) From the 'New tab' tooltip to chromium bug 442111 tooltip, the gl calls looks really wierd. The final tooltip should be 370x72, but the gl calls setup something from the old 112x21 tooltip plus the missing 51px to get to Xx72 100959 glUseProgram(program = 15) 100960 glDisable(cap = GL_SCISSOR_TEST) 100961 glScissor(x = 0, y = 51, width = 112, height = 21) 100962 glViewport(x = 0, y = 0, width = 59, height = 21) 100963 glBindTexture(target = GL_TEXTURE_2D, texture = 145) 100965 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MIN_FILTER, param = GL_LINEAR) 100967 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MAG_FILTER, param = GL_LINEAR) 100969 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_S, param = GL_CLAMP_TO_EDGE) 100971 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_T, param = GL_CLAMP_TO_EDGE) 100974 glBindTexture(target = GL_TEXTURE_2D, texture = 145) 100977 glTexStorage2D(target = GL_TEXTURE_2D, levels = 1, internalformat = GL_RGBA8, width = 370, height = 72) 100980 glBindTexture(target = GL_TEXTURE_2D, texture = 145) 100983 glTexSubImage2D(target = GL_TEXTURE_2D, level = 0, xoffset = 0, yoffset = 0, width = 370, height = 72, format = GL_BGRA, type = GL_UNSIGNED_BYTE, pixels = blob(106560)) 100987 glXWaitGL() // right here the above ::Resize is called for the xwindow.. probably confusing Mesa? 100988 glXWaitX() Iirc from my last post, radeon_draw_buffer() does re-evaluate window sizes. That's probably why the reverted commit makes things work again. -- 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 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4] egl: implement EGL_KHR_gl_colorspace (v2)
From: Marek Olšák marek.ol...@amd.com v2: add missing break --- src/egl/drivers/dri2/egl_dri2.c | 41 ++--- src/egl/drivers/dri2/egl_dri2.h | 6 + src/egl/drivers/dri2/platform_android.c | 4 src/egl/drivers/dri2/platform_drm.c | 9 +--- src/egl/drivers/dri2/platform_wayland.c | 11 + src/egl/drivers/dri2/platform_x11.c | 12 +- src/egl/main/eglconfig.c| 3 ++- src/egl/main/eglsurface.c | 24 +++ src/egl/main/eglsurface.h | 1 + 9 files changed, 89 insertions(+), 22 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 65194cb..c07d281 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -28,6 +28,7 @@ #define WL_HIDE_DEPRECATED #include stdint.h +#include stdbool.h #include stdlib.h #include string.h #include stdio.h @@ -109,6 +110,18 @@ EGLint dri2_to_egl_attribute_map[] = { 0, /* __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE */ }; +const __DRIconfig * +dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type, +EGLenum colorspace) +{ + if (colorspace == EGL_GL_COLORSPACE_SRGB_KHR) + return surface_type == EGL_WINDOW_BIT ? conf-dri_srgb_double_config : + conf-dri_srgb_single_config; + else + return surface_type == EGL_WINDOW_BIT ? conf-dri_double_config : + conf-dri_single_config; +} + static EGLBoolean dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria) { @@ -130,6 +143,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id, struct dri2_egl_display *dri2_dpy; _EGLConfig base; unsigned int attrib, value, double_buffer; + bool srgb = false; EGLint key, bind_to_texture_rgb, bind_to_texture_rgba; unsigned int dri_masks[4] = { 0, 0, 0, 0 }; _EGLConfig *matching_config; @@ -204,6 +218,10 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id, return NULL; break; + case __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE: + srgb = value != 0; + break; + default: key = dri2_to_egl_attribute_map[attrib]; if (key != 0) @@ -249,28 +267,35 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id, if (num_configs == 1) { conf = (struct dri2_egl_config *) matching_config; - if (double_buffer !conf-dri_double_config) + if (double_buffer srgb !conf-dri_srgb_double_config) + conf-dri_srgb_double_config = dri_config; + else if (double_buffer !srgb !conf-dri_double_config) conf-dri_double_config = dri_config; - else if (!double_buffer !conf-dri_single_config) + else if (!double_buffer srgb !conf-dri_srgb_single_config) + conf-dri_srgb_single_config = dri_config; + else if (!double_buffer !srgb !conf-dri_single_config) conf-dri_single_config = dri_config; else /* a similar config type is already added (unlikely) = discard */ return NULL; } else if (num_configs == 0) { - conf = malloc(sizeof *conf); + conf = calloc(1, sizeof *conf); if (conf == NULL) return NULL; memcpy(conf-base, base, sizeof base); if (double_buffer) { - conf-dri_double_config = dri_config; - conf-dri_single_config = NULL; + if (srgb) +conf-dri_srgb_double_config = dri_config; + else +conf-dri_double_config = dri_config; } else { - conf-dri_single_config = dri_config; - conf-dri_double_config = NULL; + if (srgb) +conf-dri_srgb_single_config = dri_config; + else +conf-dri_single_config = dri_config; } - conf-base.SurfaceType = 0; conf-base.ConfigID = config_id; _eglLinkConfig(conf-base); diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index f0cc6da..0dfbc75 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -285,6 +285,8 @@ struct dri2_egl_config _EGLConfig base; const __DRIconfig *dri_single_config; const __DRIconfig *dri_double_config; + const __DRIconfig *dri_srgb_single_config; + const __DRIconfig *dri_srgb_double_config; }; struct dri2_egl_image @@ -357,4 +359,8 @@ dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp); void dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw); +const __DRIconfig * +dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type, +EGLenum colorspace); + #endif /* EGL_DRI2_INCLUDED */ diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index fed3073..3cb2459
[Mesa-dev] [PATCH 3/4] egl, dri_interface: use DRI2rendererQueryExtension to enable 3D textures sRGB
From: Marek Olšák marek.ol...@amd.com --- include/GL/internal/dri_interface.h | 5 + src/egl/drivers/dri2/egl_dri2.c | 23 +++ src/egl/drivers/dri2/egl_dri2.h | 1 + 3 files changed, 29 insertions(+) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index c827bb6..f04799a 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1444,6 +1444,11 @@ typedef struct __DRIDriverVtableExtensionRec { #define __DRI2_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION 0x0008 #define __DRI2_RENDERER_OPENGL_ES_PROFILE_VERSION 0x0009 #define __DRI2_RENDERER_OPENGL_ES2_PROFILE_VERSION0x000a +#define __DRI2_RENDERER_HAS_TEXTURE_3D0x000b +/* Whether there is an sRGB format support for every supported 32-bit UNORM + * color format. + */ +#define __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB 0x000c typedef struct __DRI2rendererQueryExtensionRec __DRI2rendererQueryExtension; struct __DRI2rendererQueryExtensionRec { diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index c07d281..daeee89 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -525,6 +525,19 @@ dri2_load_driver_swrast(_EGLDisplay *disp) return EGL_TRUE; } +static unsigned +dri2_renderer_query_integer(struct dri2_egl_display *dri2_dpy, int param) +{ + const __DRI2rendererQueryExtension *rendererQuery = dri2_dpy-rendererQuery; + unsigned int value = 0; + + if (!rendererQuery || + rendererQuery-queryInteger(dri2_dpy-dri_screen, param, value) == -1) + return 0; + + return value; +} + void dri2_setup_screen(_EGLDisplay *disp) { @@ -555,6 +568,10 @@ dri2_setup_screen(_EGLDisplay *disp) disp-Extensions.KHR_surfaceless_context = EGL_TRUE; disp-Extensions.MESA_configless_context = EGL_TRUE; + if (dri2_renderer_query_integer(dri2_dpy, + __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB)) + disp-Extensions.KHR_gl_colorspace = EGL_TRUE; + if (dri2_dpy-dri2 dri2_dpy-dri2-base.version = 3) { disp-Extensions.KHR_create_context = EGL_TRUE; @@ -592,6 +609,9 @@ dri2_setup_screen(_EGLDisplay *disp) disp-Extensions.KHR_gl_texture_2D_image = EGL_TRUE; disp-Extensions.KHR_gl_texture_cubemap_image = EGL_TRUE; } + if (dri2_renderer_query_integer(dri2_dpy, + __DRI2_RENDERER_HAS_TEXTURE_3D)) + disp-Extensions.KHR_gl_texture_3D_image = EGL_TRUE; #ifdef HAVE_LIBDRM if (dri2_dpy-image-base.version = 8 dri2_dpy-image-createImageFromDmaBufs) { @@ -669,6 +689,9 @@ dri2_create_screen(_EGLDisplay *disp) if (strcmp(extensions[i]-name, __DRI2_FENCE) == 0) { dri2_dpy-fence = (__DRI2fenceExtension *) extensions[i]; } + if (strcmp(extensions[i]-name, __DRI2_RENDERER_QUERY) == 0) { + dri2_dpy-rendererQuery = (__DRI2rendererQueryExtension *) extensions[i]; + } } dri2_setup_screen(disp); diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 0dfbc75..9aa2a8c 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -166,6 +166,7 @@ struct dri2_egl_display const __DRIrobustnessExtension *robustness; const __DRI2configQueryExtension *config; const __DRI2fenceExtension *fence; + const __DRI2rendererQueryExtension *rendererQuery; int fd; int own_device; -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] st/dri: expose sRGB visuals (v2)
From: Marek Olšák marek.ol...@amd.com v2: The fix for the darkness in Ubuntu Unity is in the hunk with the 4-line comment. --- src/gallium/state_trackers/dri/dri2.c | 2 ++ src/gallium/state_trackers/dri/dri_drawable.c | 7 ++- src/gallium/state_trackers/dri/dri_screen.c | 23 +++ src/mesa/state_tracker/st_manager.c | 1 + 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index 1eda036..5aa785c 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -189,9 +189,11 @@ dri2_drawable_get_buffers(struct dri_drawable *drawable, */ switch(format) { case PIPE_FORMAT_B8G8R8A8_UNORM: + case PIPE_FORMAT_B8G8R8A8_SRGB: depth = 32; break; case PIPE_FORMAT_B8G8R8X8_UNORM: + case PIPE_FORMAT_B8G8R8X8_SRGB: depth = 24; break; case PIPE_FORMAT_B5G6R5_UNORM: diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index b8afe6c..0d2929a 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -279,7 +279,12 @@ dri_drawable_get_format(struct dri_drawable *drawable, case ST_ATTACHMENT_BACK_LEFT: case ST_ATTACHMENT_FRONT_RIGHT: case ST_ATTACHMENT_BACK_RIGHT: - *format = drawable-stvis.color_format; + /* Other pieces of the driver stack get confused and behave incorrectly + * when they get an sRGB drawable. st/mesa receives drawable-stvis + * though other means and handles it correctly, so we don't really need + * to use an sRGB format here. + */ + *format = util_format_linear(drawable-stvis.color_format); *bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; break; case ST_ATTACHMENT_DEPTH_STENCIL: diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 85393d8..c4c2d9c 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -103,14 +103,18 @@ dri_fill_st_options(struct st_config_options *options, static const __DRIconfig ** dri_fill_in_modes(struct dri_screen *screen) { - static const mesa_format mesa_formats[3] = { + static const mesa_format mesa_formats[] = { MESA_FORMAT_B8G8R8A8_UNORM, MESA_FORMAT_B8G8R8X8_UNORM, + MESA_FORMAT_B8G8R8A8_SRGB, + MESA_FORMAT_B8G8R8X8_SRGB, MESA_FORMAT_B5G6R5_UNORM, }; - static const enum pipe_format pipe_formats[3] = { + static const enum pipe_format pipe_formats[] = { PIPE_FORMAT_BGRA_UNORM, PIPE_FORMAT_BGRX_UNORM, + PIPE_FORMAT_BGRA_SRGB, + PIPE_FORMAT_BGRX_SRGB, PIPE_FORMAT_B5G6R5_UNORM, }; mesa_format format; @@ -186,6 +190,11 @@ dri_fill_in_modes(struct dri_screen *screen) unsigned num_msaa_modes = 0; /* includes a single-sample mode */ uint8_t msaa_modes[MSAA_VISUAL_MAX_SAMPLES]; + if (!p_screen-is_format_supported(p_screen, pipe_formats[format], + PIPE_TEXTURE_2D, 0, + PIPE_BIND_RENDER_TARGET)) + continue; + for (i = 1; i = msaa_samples_max; i++) { int samples = i 1 ? i : 0; @@ -241,9 +250,15 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen, if (mode-redBits == 8) { if (mode-alphaBits == 8) - stvis-color_format = PIPE_FORMAT_BGRA_UNORM; + if (mode-sRGBCapable) +stvis-color_format = PIPE_FORMAT_BGRA_SRGB; + else +stvis-color_format = PIPE_FORMAT_BGRA_UNORM; else - stvis-color_format = PIPE_FORMAT_BGRX_UNORM; + if (mode-sRGBCapable) +stvis-color_format = PIPE_FORMAT_BGRX_SRGB; + else +stvis-color_format = PIPE_FORMAT_BGRX_UNORM; } else { stvis-color_format = PIPE_FORMAT_B5G6R5_UNORM; } diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index a2dee62..2e2c8ff 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -368,6 +368,7 @@ st_visual_to_context_mode(const struct st_visual *visual, mode-rgbBits = mode-redBits + mode-greenBits + mode-blueBits + mode-alphaBits; + mode-sRGBCapable = util_format_is_srgb(visual-color_format); } if (visual-depth_stencil_format != PIPE_FORMAT_NONE) { -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4] st/dri: enable 3D textures and sRGB colorspace for EGL
From: Anatoli Antonovitch anatoli.antonovi...@amd.com --- src/gallium/state_trackers/dri/dri_query_renderer.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/src/gallium/state_trackers/dri/dri_query_renderer.c b/src/gallium/state_trackers/dri/dri_query_renderer.c index 4a28ac3..ea31b6c 100644 --- a/src/gallium/state_trackers/dri/dri_query_renderer.c +++ b/src/gallium/state_trackers/dri/dri_query_renderer.c @@ -42,6 +42,20 @@ dri2_query_renderer_integer(__DRIscreen *_screen, int param, PIPE_CAP_UMA); return 0; + case __DRI2_RENDERER_HAS_TEXTURE_3D: + value[0] = + screen-base.screen-get_param(screen-base.screen, +PIPE_CAP_MAX_TEXTURE_3D_LEVELS) != 0; + return 0; + + case __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB: + value[0] = + screen-base.screen-is_format_supported(screen-base.screen, + PIPE_FORMAT_B8G8R8A8_SRGB, + PIPE_TEXTURE_2D, 0, + PIPE_BIND_RENDER_TARGET); + return 0; + default: return driQueryRendererIntegerCommon(_screen, param, value); } -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/4] Last EGL 1.5 bits (v2)
Hi, These are the last EGL 1.5 bits. I have fixed the Ubuntu Unity darkness issue in patch 1 and dropped the ugly workaround from libGL. Please help review the patches. Thanks, Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Disagreement between ChooseTextureFormat and QuerySamplesForFormat
On Sun, Jul 12, 2015 at 7:30 PM, Ilia Mirkin imir...@alum.mit.edu wrote: I asked this on IRC, but figured I'd get wider distribution for the question. The situation is that nv50 doesn't support RGBA32 MS8 textures. However QuerySamplesForFormat will try its hardest to find supported sample counts, which means it'll go down st/mesa's fallback format list, which includes RGBA16, which can handle MS8 just fine. So the teximage.c code thinks that the # of samples is OK. However when it selects the teximage format, ChooseTextureFormat, which does not take a sample count, will return RGBA32 (which is supported for MS1, MS2, MS4 on nv50). When later it attempts to AllocTextureStorage, it will again attempt to do so using RGBA32 with MS8, which will fail. The core code handles this case (since texture storage allocation can happen for a wide variety of reasons), but I think this is suboptimal. Should ChooseTextureFormat take a sample count? This would allow the driver to provide the correct TexFormat for that format / sample count combo. Yes. If your hardware has such limitations, ChooseTextureFormat needs to be updated to reflect that. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 91314] The Witcher 2 (native) fails to start, throws Assertion `img-_BaseFormat != -1' failed.
https://bugs.freedesktop.org/show_bug.cgi?id=91314 --- Comment #3 from Ilia Mirkin imir...@alum.mit.edu --- Created attachment 117078 -- https://bugs.freedesktop.org/attachment.cgi?id=117078action=edit make ChooseTextureFormat look at samples Untested beyond compilation. [and not even for radeon] -- 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 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: fix Bug 85252 - Segfault in compiler while processing ternary operator with void arguments
Hi Samuel. Thanks, patch v2 is on the way. I guess the piglit tests you mention in the commit log are going to check these cases, right? That's right following tests are done: * binary operator * unary operators * ternary operator * comparison operators (except equal and nequal operator) * assignement operators (=, +=, =, ...) These are added in the following patches sent to the piglit mailing list: * glsl 1.10: Fix broken ternary void test * glsl-1.10 Adds tests on how void functions are handled Have you run piglit to verify that it doesn't add any regression? Yes I have. It doesn't -- Renaud Gaubert ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 (part1) 25/26] glsl: Lower shader storage buffer object writes to GLSL IR instrinsics
On 10/07/15 22:47, Jordan Justen wrote: On 2015-07-10 03:13:44, Iago Toral Quiroga wrote: From: Samuel Iglesias Gonsalvez sigles...@igalia.com Extend the existing lower_ubo_reference pass to also detect SSBO writes and lower them to __intrinsic_store_ssbo intrinsics. Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com --- src/glsl/lower_ubo_reference.cpp | 441 +++ 1 file changed, 311 insertions(+), 130 deletions(-) diff --git a/src/glsl/lower_ubo_reference.cpp b/src/glsl/lower_ubo_reference.cpp index a61ff29..460b490 100644 --- a/src/glsl/lower_ubo_reference.cpp +++ b/src/glsl/lower_ubo_reference.cpp @@ -37,6 +37,7 @@ #include ir_builder.h #include ir_rvalue_visitor.h #include main/macros.h +#include glsl_parser_extras.h using namespace ir_builder; @@ -139,12 +140,31 @@ public: } void handle_rvalue(ir_rvalue **rvalue); - void emit_ubo_loads(ir_dereference *deref, ir_variable *base_offset, - unsigned int deref_offset, bool row_major, - int matrix_columns); + ir_visitor_status visit_enter(ir_assignment *ir); + + void setup_for_load_or_write(ir_variable *var, How about setup_for_load_or_store, or setup_for_buffer_access? I prefer the former, as it is also called for UBO reads. +ir_dereference *deref, +ir_rvalue **offset, +unsigned *const_offset, +bool *row_major, +int *matrix_columns); ir_expression *ubo_load(const struct glsl_type *type, ir_rvalue *offset); + + void check_for_ssbo_write(ir_assignment *ir); Since we are using load elsewhere, I guess 'store' is better than 'write'. OK + void write_to_memory(ir_dereference *deref, +ir_variable *var, +ir_variable *write_var, +unsigned write_mask); + ir_call *ssbo_write(ir_rvalue *deref, ir_rvalue *offset, + unsigned write_mask); store + + void emit_reads_or_writes(bool is_write, ir_dereference *deref, + ir_variable *base_offset, unsigned int deref_offset, + bool row_major, int matrix_columns, + unsigned write_mask); What about emit_access? OK + void *mem_ctx; struct gl_shader *shader; struct gl_uniform_buffer_variable *ubo_var; @@ -218,26 +238,20 @@ interface_field_name(void *mem_ctx, char *base_name, ir_dereference *d, } void -lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue) +lower_ubo_reference_visitor::setup_for_load_or_write(ir_variable *var, + ir_dereference *deref, + ir_rvalue **offset, + unsigned *const_offset, + bool *row_major, + int *matrix_columns) { - if (!*rvalue) - return; - - ir_dereference *deref = (*rvalue)-as_dereference(); - if (!deref) - return; - - ir_variable *var = deref-variable_referenced(); - if (!var || !var-is_in_buffer_block()) - return; - - mem_ctx = ralloc_parent(*rvalue); - + /* Fix out the name of the interface block */ Maybe 'Fix out' = 'Determine'? OK ir_rvalue *nonconst_block_index; const char *const field_name = interface_field_name(mem_ctx, (char *) var-get_interface_type()-name, deref, nonconst_block_index); + /* Locate the ubo block by interface name */ this-uniform_block = NULL; for (unsigned i = 0; i shader-NumUniformBlocks; i++) { if (strcmp(field_name, shader-UniformBlocks[i].Name) == 0) { @@ -263,10 +277,10 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue) assert(this-uniform_block); - ir_rvalue *offset = new(mem_ctx) ir_constant(0u); - unsigned const_offset = 0; - bool row_major = is_dereferenced_thing_row_major(deref); - int matrix_columns = 1; + *offset = new(mem_ctx) ir_constant(0u); + *const_offset = 0; + *row_major = is_dereferenced_thing_row_major(deref); + *matrix_columns = 1; /* Calculate the offset to the start of the region of the UBO * dereferenced by *rvalue. This may be a variable offset if an @@ -275,76 +289,76 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue) while (deref) { switch (deref-ir_type) { case ir_type_dereference_variable: { -const_offset += ubo_var-Offset; -deref = NULL; -break; + *const_offset += ubo_var-Offset; + deref = NULL; +
Re: [Mesa-dev] [PATCH] radeonsi: ARB_gpu_shader_fp64 + ARB_vertex_attrib_64bit support.
Am Sonntag, 12. Juli 2015, 03:55:22 schrieb Dave Airlie: From: Dave Airlie airl...@redhat.com This adds the translation from TGSI to AMDGPU llvm backend, for the 64-bit opcodes. The backend pretty much handles everything for us fine. There is one patch required for SI DFRAC support, that I know off. Signed-off-by: Dave Airlie airl...@redhat.com --- docs/GL3.txt | 4 +- src/gallium/drivers/radeon/radeon_llvm.h | 7 +- .../drivers/radeon/radeon_setup_tgsi_llvm.c| 143 - src/gallium/drivers/radeonsi/si_pipe.c | 1 + src/gallium/drivers/radeonsi/si_shader.c | 31 - 5 files changed, 173 insertions(+), 13 deletions(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index 94bbcd1..d1a42be 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -109,7 +109,7 @@ GL 4.0, GLSL 4.00: - Enhanced per-sample shadingDONE (r600, radeonsi) - Interpolation functionsDONE (r600) - New overload resolution rules DONE - GL_ARB_gpu_shader_fp64 DONE (nvc0, llvmpipe, softpipe) + GL_ARB_gpu_shader_fp64 DONE (nvc0, radeonsi, llvmpipe, softpipe) GL_ARB_sample_shadingDONE (i965, nv50, nvc0, r600, radeonsi) GL_ARB_shader_subroutine started (Dave) GL_ARB_tessellation_shader started (Chris, Ilia) @@ -127,7 +127,7 @@ GL 4.1, GLSL 4.10: GL_ARB_get_program_binaryDONE (0 binary formats) GL_ARB_separate_shader_objects DONE (all drivers) GL_ARB_shader_precision started (Micah) - GL_ARB_vertex_attrib_64bit DONE (nvc0, llvmpipe, softpipe) + GL_ARB_vertex_attrib_64bit DONE (nvc0, radeonsi llvmpipe, softpipe) Comma please. Otherwise it's harder to parse for mesamatrix.net :-) GL_ARB_viewport_arrayDONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe) diff --git a/src/gallium/drivers/radeon/radeon_llvm.h b/src/gallium/drivers/radeon/radeon_llvm.h index 6a9557b..591e698 100644 --- a/src/gallium/drivers/radeon/radeon_llvm.h +++ b/src/gallium/drivers/radeon/radeon_llvm.h @@ -146,6 +146,8 @@ static inline LLVMTypeRef tgsi2llvmtype( case TGSI_TYPE_UNSIGNED: case TGSI_TYPE_SIGNED: return LLVMInt32TypeInContext(ctx); + case TGSI_TYPE_DOUBLE: + return LLVMDoubleTypeInContext(ctx); case TGSI_TYPE_UNTYPED: case TGSI_TYPE_FLOAT: return LLVMFloatTypeInContext(ctx); @@ -205,6 +207,9 @@ build_tgsi_intrinsic_nomem( struct lp_build_tgsi_context * bld_base, struct lp_build_emit_data * emit_data); - +LLVMValueRef +radeon_llvm_emit_fetch_double(struct lp_build_tgsi_context *bld_base, + LLVMValueRef ptr, + LLVMValueRef ptr2); #endif /* RADEON_LLVM_H */ diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c index c8c980d..444a41c 100644 --- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c +++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c @@ -116,6 +116,28 @@ emit_fetch( enum tgsi_opcode_type type, unsigned swizzle); +LLVMValueRef +radeon_llvm_emit_fetch_double( + struct lp_build_tgsi_context *bld_base, + LLVMValueRef ptr, + LLVMValueRef ptr2) +{ + LLVMBuilderRef builder = bld_base-base.gallivm-builder; + LLVMValueRef result; + + result = LLVMGetUndef(LLVMVectorType(LLVMIntTypeInContext(bld_base-base.gallivm-context, 32), bld_base-base.type.length * 2)); + + result = LLVMBuildInsertElement(builder, + result, + bitcast(bld_base, TGSI_TYPE_UNSIGNED, ptr), + bld_base-int_bld.zero, ); + result = LLVMBuildInsertElement(builder, + result, + bitcast(bld_base, TGSI_TYPE_UNSIGNED, ptr2), + bld_base-int_bld.one, ); + return bitcast(bld_base, TGSI_TYPE_DOUBLE, result); +} + static LLVMValueRef emit_array_fetch( struct lp_build_tgsi_context *bld_base, @@ -160,7 +182,7 @@ emit_fetch( struct radeon_llvm_context * ctx = radeon_llvm_context(bld_base); struct lp_build_tgsi_soa_context *bld = lp_soa_context(bld_base); LLVMBuilderRef builder = bld_base-base.gallivm-builder; - LLVMValueRef result = NULL, ptr; + LLVMValueRef result = NULL, ptr, ptr2; if (swizzle == ~0) { LLVMValueRef values[TGSI_NUM_CHANNELS]; @@
[Mesa-dev] [Bug 91314] The Witcher 2 (native) fails to start, throws Assertion `img-_BaseFormat != -1' failed.
https://bugs.freedesktop.org/show_bug.cgi?id=91314 Bug ID: 91314 Summary: The Witcher 2 (native) fails to start, throws Assertion `img-_BaseFormat != -1' failed. Product: Mesa Version: git Hardware: Other OS: All Status: NEW Keywords: bisected, regression Severity: normal Priority: medium Component: Mesa core Assignee: mesa-dev@lists.freedesktop.org Reporter: gyebr...@gmail.com QA Contact: mesa-dev@lists.freedesktop.org I was trying to reproduce bug #91310 on my NV92, but the game fails to start for me, terminal shows: witcher2: main/teximage.c:1320: init_teximage_fields_ms: Assertion `img-_BaseFormat != -1' failed. The game starts properly when using the llvmpipe driver. The problem was introduced by commit 3473a84fb2c2cdab0bcecb43fbf519d9b3fc0142 Author: Iago Toral Quiroga ito...@igalia.com Date: Fri Nov 28 10:03:56 2014 +0100 mesa: Fix incorrect assertion in init_teximage_fields_ms _BaseFormat is a GLenum (unsigned int) so testing if its value is greater than 0 to detect the cases where _mesa_base_tex_format returns -1 doesn't work. Fixing the assertion breaks the arb_texture_view-lifetime-format piglit test on nouveau, since that test calls _mesa_base_tex_format with GL_R16F with a context that does not have ARB_texture_float, so it returns -1 for the BaseFormat, which was not being caught properly by the ASSERT in init_teximage_fields_ms until now. Reverting the patch on Mesa 10.5.9 fixes the issue for me. Fedora 22 32-bit Kernel 4.1.2 VGA compatible controller: NVIDIA Corporation G92 [GeForce GTS 250] (rev a2) (prog-if 00 [VGA controller]) libdrm, nouveau ddx, Mesa from git -- 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 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH V2] glsl: remove dead code in a single pass
On Sun, 2015-07-12 at 15:47 +1000, Timothy Arceri wrote: Currently only one ir assignment is removed for each var in a single dead code optimisation pass. This means if a var has more than one assignment, then it requires all the glsl optimisations to be run again for each additional assignment to be removed. Another pass is also required to remove the variable itself. With this change all assignments and the variable are removed in a single pass. Some of the arrays of arrays conformance tests that were looping through 8 dimensions ended up with a var with hundreds of assignments. This change helps ES31-CTS.arrays_of_arrays.InteractionFunctionCalls1 go from around 3 min 20 sec - 2 min ES31-CTS.arrays_of_arrays.InteractionFunctionCalls2 went from around 9 min 20 sec to 7 min 30 sec I had difficulty getting the public shader-db to give a constent result with or without this change but the results seemed unchanged at between 15-20 seconds. V2: Dont add assignment ir to the list if its declaration is out of scope. On second thought I'm not 100% sure this is safe to check like this in the refcount visitor I'll probably drop this version 2 and just stick with the original if people think its ok. Add assert to be sure references are counted before assignments. --- It would be great if someone could check this against the larger shader-db. The final place where there tests are getting stuck is in constant folding and propagation. src/glsl/ir_variable_refcount.cpp | 29 ++--- src/glsl/ir_variable_refcount.h | 13 - src/glsl/opt_dead_code.cpp| 30 +- src/glsl/opt_tree_grafting.cpp| 2 -- 4 files changed, 59 insertions(+), 15 deletions(-) diff --git a/src/glsl/ir_variable_refcount.cpp b/src/glsl/ir_variable_refcount.cpp index e4d825c..46eb2ca 100644 --- a/src/glsl/ir_variable_refcount.cpp +++ b/src/glsl/ir_variable_refcount.cpp @@ -46,6 +46,16 @@ static void free_entry(struct hash_entry *entry) { ir_variable_refcount_entry *ivre = (ir_variable_refcount_entry *) entry -data; + + /* Free assignment list */ + while (!ivre-assign_list.is_empty()) { + struct assignment_entry *assignment_entry = + exec_node_data(struct assignment_entry, +ivre-assign_list.head, link); + assignment_entry-link.remove(); + free(assignment_entry); + } + delete ivre; } @@ -59,7 +69,6 @@ ir_variable_refcount_visitor::~ir_variable_refcount_visitor() ir_variable_refcount_entry::ir_variable_refcount_entry(ir_variable *var) { this-var = var; - assign = NULL; assigned_count = 0; declaration = false; referenced_count = 0; @@ -125,8 +134,22 @@ ir_variable_refcount_visitor::visit_leave(ir_assignment *ir) entry = this-get_variable_entry(ir-lhs-variable_referenced()); if (entry) { entry-assigned_count++; - if (entry-assign == NULL) - entry-assign = ir; + + /** + * Build a list for dead code optimisation. Dont add assingment if it + * was declared out of scope (outside the instruction stream). Also dont + * bother adding any more to the list if there are more references then + * assignments as this means the variable is used and won't be optimised + * out. + */ + assert(entry-referenced_count = entry-assigned_count); + if (entry-declaration + entry-referenced_count == entry-assigned_count) { + struct assignment_entry *assignment_entry = +(struct assignment_entry *)calloc(1, sizeof(*assignment_entry)); + assignment_entry-assign = ir; + entry-assign_list.push_head(assignment_entry-link); + } } return visit_continue; diff --git a/src/glsl/ir_variable_refcount.h b/src/glsl/ir_variable_refcount.h index c15e8110..5c74c31 100644 --- a/src/glsl/ir_variable_refcount.h +++ b/src/glsl/ir_variable_refcount.h @@ -33,13 +33,24 @@ #include ir_visitor.h #include glsl_types.h +struct assignment_entry { + exec_node link; + ir_assignment *assign; +}; + class ir_variable_refcount_entry { public: ir_variable_refcount_entry(ir_variable *var); ir_variable *var; /* The key: the variable's pointer. */ - ir_assignment *assign; /* An assignment to the variable, if any */ + + /** +* List of assignments to the variable, if any. +* This is intended to be used for dead code optimisation and may +* not be a complete list. +*/ + exec_list assign_list; /** Number of times the variable is referenced, including assignments. */ unsigned referenced_count; diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp index f45bf5d..6d1f675 100644 --- a/src/glsl/opt_dead_code.cpp +++ b/src/glsl/opt_dead_code.cpp @@ -75,22 +75,34 @@ do_dead_code(exec_list *instructions, bool
[Mesa-dev] [PATCH] glsl: remove dead code in a single pass
2015-07-12 1:17 GMT+02:00 Timothy Arceri t_arc...@yahoo.com.au: Currently only one ir assignment is removed for each var in a single dead code optimisation pass. This means if a var has more than one assignment, then it requires all the glsl optimisations to be run again for each additional assignment to be removed. Another pass is also required to remove the variable itself. With this change all assignments and the variable are removed in a single pass. Some of the arrays of arrays conformance tests that were looping through 8 dimensions ended up with a var with hundreds of assignments. This change helps ES31-CTS.arrays_of_arrays.InteractionFunctionCalls1 go from around 3 min 20 sec - 2 min ES31-CTS.arrays_of_arrays.InteractionFunctionCalls2 went from around 9 min 20 sec to 7 min 30 sec I had difficulty getting the public shader-db to give a constent result with or without this change but the results seemed unchanged at between 15-20 seconds. --- src/glsl/ir_variable_refcount.cpp | 23 --- src/glsl/ir_variable_refcount.h | 7 ++- src/glsl/opt_dead_code.cpp| 30 +- src/glsl/opt_tree_grafting.cpp| 2 -- 4 files changed, 47 insertions(+), 15 deletions(-) diff --git a/src/glsl/ir_variable_refcount.cpp b/src/glsl/ir_variable_refcount.cpp index e4d825c..cc13ac0 100644 --- a/src/glsl/ir_variable_refcount.cpp +++ b/src/glsl/ir_variable_refcount.cpp @@ -46,6 +46,16 @@ static void free_entry(struct hash_entry *entry) { ir_variable_refcount_entry *ivre = (ir_variable_refcount_entry *) entry-data; + + /* Free assignment list */ + while (!ivre-assign_list.is_empty()) { + struct assignment_entry *assignment_entry = + exec_node_data(struct assignment_entry, +ivre-assign_list.head, link); + assignment_entry-link.remove(); + free(assignment_entry); + } + delete ivre; } @@ -59,7 +69,6 @@ ir_variable_refcount_visitor::~ir_variable_refcount_visitor() ir_variable_refcount_entry::ir_variable_refcount_entry(ir_variable *var) { this-var = var; - assign = NULL; assigned_count = 0; declaration = false; referenced_count = 0; @@ -125,8 +134,16 @@ ir_variable_refcount_visitor::visit_leave(ir_assignment *ir) entry = this-get_variable_entry(ir-lhs-variable_referenced()); if (entry) { entry-assigned_count++; - if (entry-assign == NULL) -entry-assign = ir; + /* Build a list for dead code optimisation. Don't bother adding any more + * if there are more references then assignments as this means the + * variable is used and won't be optimised out. + */ + if (entry-referenced_count == entry-assigned_count) { + struct assignment_entry *assignment_entry = +(struct assignment_entry *)calloc(1, sizeof(*assignment_entry)); + assignment_entry-assign = ir; + entry-assign_list.push_head(assignment_entry-link); + } } return visit_continue; diff --git a/src/glsl/ir_variable_refcount.h b/src/glsl/ir_variable_refcount.h index c15e8110..1fecd52 100644 --- a/src/glsl/ir_variable_refcount.h +++ b/src/glsl/ir_variable_refcount.h @@ -33,13 +33,18 @@ #include ir_visitor.h #include glsl_types.h +struct assignment_entry { + exec_node link; + ir_assignment *assign; +}; + class ir_variable_refcount_entry { public: ir_variable_refcount_entry(ir_variable *var); ir_variable *var; /* The key: the variable's pointer. */ - ir_assignment *assign; /* An assignment to the variable, if any */ + exec_list assign_list; /* List of assignments to the variable, if any */ /** Number of times the variable is referenced, including assignments. */ unsigned referenced_count; diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp index f45bf5d..6d1f675 100644 --- a/src/glsl/opt_dead_code.cpp +++ b/src/glsl/opt_dead_code.cpp @@ -75,22 +75,34 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned) || !entry-declaration) continue; - if (entry-assign) { -/* Remove a single dead assignment to the variable we found. + if (!entry-assign_list.is_empty()) { +/* Remove all the dead assignments to the variable we found. * Don't do so if it's a shader or function output, though. */ if (entry-var-data.mode != ir_var_function_out entry-var-data.mode != ir_var_function_inout entry-var-data.mode != ir_var_shader_out) { - entry-assign-remove(); - progress = true; - if (debug) { - printf(Removed assignment to %s@%p\n, - entry-var-name, (void *) entry-var); - } +while (!entry-assign_list.is_empty()) { + struct assignment_entry *assignment_entry = +
Re: [Mesa-dev] [PATCH] clover: replace --enable-opencl-icd with --with-opencl-icd
Hello Would you prefer --enable-opencl-icd that install in $sysconfdir/OpenCL/vendors by default and can be forced to /etc/OpenCL/vendors with something like --enable-opencl-icd=standard-path? EdB On Wednesday 06 May 2015 23:34:26 EdB wrote: The standard ICD file path is /etc/OpenCL/vendor/. However it doesn't fit well with custom build. This option allow ICD vendor file installation path override --- configure.ac | 46 +++--- src/gallium/targets/opencl/Makefile.am | 2 +- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 095e23e..90dba4e 100644 --- a/configure.ac +++ b/configure.ac @@ -804,12 +804,6 @@ AC_ARG_ENABLE([opencl], [enable OpenCL library @:@default=disabled@:@])], [enable_opencl=$enableval], [enable_opencl=no]) -AC_ARG_ENABLE([opencl_icd], - [AS_HELP_STRING([--enable-opencl-icd], - [Build an OpenCL ICD library to be loaded by an ICD implementation - @:@default=disabled@:@])], -[enable_opencl_icd=$enableval], -[enable_opencl_icd=no]) AC_ARG_ENABLE([xlib-glx], [AS_HELP_STRING([--enable-xlib-glx], [make GLX library Xlib-based instead of DRI-based @:@default=disabled@:@])], @@ -1689,19 +1683,11 @@ if test x$enable_opencl = xyes; then # XXX: Use $enable_shared_pipe_drivers once converted to use static/shared pipe-drivers enable_gallium_loader=yes -if test x$enable_opencl_icd = xyes; then -OPENCL_LIBNAME=MesaOpenCL -else -OPENCL_LIBNAME=OpenCL -fi - if test x$have_libelf != xyes; then AC_MSG_ERROR([Clover requires libelf]) fi fi AM_CONDITIONAL(HAVE_CLOVER, test x$enable_opencl = xyes) -AM_CONDITIONAL(HAVE_CLOVER_ICD, test x$enable_opencl_icd = xyes) -AC_SUBST([OPENCL_LIBNAME]) dnl dnl Gallium configuration @@ -2006,6 +1992,38 @@ AC_ARG_WITH([d3d-libdir], [D3D_DRIVER_INSTALL_DIR=${libdir}/d3d]) AC_SUBST([D3D_DRIVER_INSTALL_DIR]) +dnl OpenCL ICD + +AC_ARG_WITH([opencl-icd], +[AS_HELP_STRING([--with-opencl-icd=@:@no,standard,sysconfdir@:@], +[Build an OpenCL ICD library to be loaded by an ICD implementation. + If @:@standard@:@ the OpenCL ICD vendor file installs in /etc/OpenCL/vendors. + @:@sysconfdir@:@ installs the file in $sysconfdir/OpenCL/vendors + @:@default=no@:@])], +[OPENCL_ICD=$withval], +[OPENCL_ICD=no]) + +case x$OPENCL_ICD in +xno) +OPENCL_LIBNAME=OpenCL +;; +xstandard) +OPENCL_LIBNAME=MesaOpenCL +ICD_FILE_DIR=/etc/OpenCL/vendors +;; +xsysconfdir) +OPENCL_LIBNAME=MesaOpenCL +ICD_FILE_DIR=$sysconfdir/OpenCL/vendors +;; +*) +AC_MSG_ERROR(['$OPENCL_ICD' is not a valid option for --with-opencl-icd]) +;; +esac + +AM_CONDITIONAL(HAVE_CLOVER_ICD, test x$OPENCL_ICD != xno) +AC_SUBST([OPENCL_LIBNAME]) +AC_SUBST([ICD_FILE_DIR]) + dnl dnl Gallium helper functions dnl diff --git a/src/gallium/targets/opencl/Makefile.am b/src/gallium/targets/opencl/Makefile.am index 5daf327..781daa0 100644 --- a/src/gallium/targets/opencl/Makefile.am +++ b/src/gallium/targets/opencl/Makefile.am @@ -47,7 +47,7 @@ EXTRA_lib@OPENCL_LIBNAME@_la_DEPENDENCIES = opencl.sym EXTRA_DIST = mesa.icd opencl.sym if HAVE_CLOVER_ICD -icddir = /etc/OpenCL/vendors/ +icddir = $(ICD_FILE_DIR) icd_DATA = mesa.icd endif ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 91314] The Witcher 2 (native) fails to start, throws Assertion `img-_BaseFormat != -1' failed.
https://bugs.freedesktop.org/show_bug.cgi?id=91314 --- Comment #1 from Ilia Mirkin imir...@alum.mit.edu --- For those of us without the game, could you figure out what internalFormat is? in gdb, do p internalFormat p *img-TexObject bt that should provide some useful info. And/or if you could provide a trace, which when replayed triggers this issue, that'd be most helpful. -- 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 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] Disagreement between ChooseTextureFormat and QuerySamplesForFormat
I asked this on IRC, but figured I'd get wider distribution for the question. The situation is that nv50 doesn't support RGBA32 MS8 textures. However QuerySamplesForFormat will try its hardest to find supported sample counts, which means it'll go down st/mesa's fallback format list, which includes RGBA16, which can handle MS8 just fine. So the teximage.c code thinks that the # of samples is OK. However when it selects the teximage format, ChooseTextureFormat, which does not take a sample count, will return RGBA32 (which is supported for MS1, MS2, MS4 on nv50). When later it attempts to AllocTextureStorage, it will again attempt to do so using RGBA32 with MS8, which will fail. The core code handles this case (since texture storage allocation can happen for a wide variety of reasons), but I think this is suboptimal. Should ChooseTextureFormat take a sample count? This would allow the driver to provide the correct TexFormat for that format / sample count combo. Cheers, -ilia PS. See bug https://bugs.freedesktop.org/show_bug.cgi?id=91314 but the assert fail happens due to improper handling in the storage allocation failure case, which ought to get handled anyways. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 91314] The Witcher 2 (native) fails to start, throws Assertion `img-_BaseFormat != -1' failed.
https://bugs.freedesktop.org/show_bug.cgi?id=91314 Ilia Mirkin imir...@alum.mit.edu changed: What|Removed |Added CC||imir...@alum.mit.edu, ||ito...@igalia.com --- Comment #2 from Ilia Mirkin imir...@alum.mit.edu --- So from the backtrace on IRC we see: #5 0xb6ab9a64 in init_teximage_fields_ms (ctx=optimized out, img=0x204c7420, width=optimized out, height=0, depth=0, border=0, internalFormat=0, format=MESA_FORMAT_NONE, numSamples=0, fixedSampleLocations=1 '\001') at main/teximage.c:1320 #6 0xb6ab9d4a in _mesa_init_teximage_fields (ctx=0x2055bed0, img=0x204c7420, width=0, height=0, depth=0, border=0, internalFormat=0, format=MESA_FORMAT_NONE) at main/teximage.c:1420 #7 0xb6abee31 in _mesa_texture_image_multisample (ctx=0x2055bed0, dims=2, texObj=0x204a55d8, target=37120, samples=5, internalformat=34836, width=32, height=32, depth=1, fixedsamplelocations=0 '\000', immutable=0 '\000', func=0xb6ec6f81 glTexImage2DMultisample) at main/teximage.c:5703 #8 0xb6abeecc in _mesa_TexImage2DMultisample (target=37120, samples=5, internalformat=34836, width=32, height=32, fixedsamplelocations=0 '\000') at main/teximage.c:5731 So the culprit is: if (width 0 height 0 depth 0) { if (!ctx-Driver.AllocTextureStorage(ctx, texObj, 1, width, height, depth)) { /* tidy up the texture image state. strictly speaking, * we're allowed to just leave this in whatever state we * like, but being tidy is good. */ _mesa_init_teximage_fields(ctx, texImage, 0, 0, 0, 0, GL_NONE, MESA_FORMAT_NONE); } } The texture storage allocation fails because nv50 doesn't support GL_RGBA32F with 4 samples. Of course the sample count check above (samplesOK) passes because in st/mesa format choosing, GL_RGBA32F will happily fall back to RGBA16F, which is perfectly allowed to have 8 samples on nv50. However st_AllocTextureStorage is blissfully unaware of such a restriction, and fails when it can't create a RGBA32F MS8 texture. So the bug is 2-fold: (a) st_AllocateTextureStorage should use st_choose_format (or equivalent) so that it deals with any sample count limitations (b) _mesa_init_teximage_fields with MESA_FORMAT_NONE appears to trigger the assert no matter what -- this should be handled better. Iago, should we just let MESA_FORMAT_NONE through the assert, as was done before? (By the way, GLenum, which is the type of baseFormat, appears to be unsigned, so a check against -1 is a bit dangerous.) -- 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 http://lists.freedesktop.org/mailman/listinfo/mesa-dev