[Mesa-dev] [PATCH 2/9] radeonsi: clean up more HAVE_LLVM #ifdefs
Nicolai Hähnle
nhaehnle at gmail.com
Fri Jan 6 11:42:25 UTC 2017
On 02.01.2017 21:16, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> src/gallium/drivers/radeon/r600_pipe_common.c | 14 +++++++++-----
> src/gallium/drivers/radeonsi/si_shader.c | 19 +++++++++++--------
> 2 files changed, 20 insertions(+), 13 deletions(-)
>
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index 74e8de9..d45a385 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -36,20 +36,24 @@
> #include "vl/vl_decoder.h"
> #include "vl/vl_video_buffer.h"
> #include "radeon/radeon_video.h"
> #include <inttypes.h>
> #include <sys/utsname.h>
>
> #ifndef HAVE_LLVM
> #define HAVE_LLVM 0
> #endif
>
> +#ifndef MESA_LLVM_VERSION_PATCH
> +#define MESA_LLVM_VERSION_PATCH 0
> +#endif
> +
Are you sure this isn't needed? configure.ac looks like it doesn't set
this if only r600 without llvm is compiled.
Nicolai
> struct r600_multi_fence {
> struct pipe_reference reference;
> struct pipe_fence_handle *gfx;
> struct pipe_fence_handle *sdma;
>
> /* If the context wasn't flushed at fence creation, this is non-NULL. */
> struct {
> struct r600_common_context *ctx;
> unsigned ib_index;
> } gfx_unflushed;
> @@ -1194,25 +1198,25 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
> {
> char llvm_string[32] = {}, kernel_version[128] = {};
> struct utsname uname_data;
>
> ws->query_info(ws, &rscreen->info);
>
> if (uname(&uname_data) == 0)
> snprintf(kernel_version, sizeof(kernel_version),
> " / %s", uname_data.release);
>
> -#if HAVE_LLVM
> - snprintf(llvm_string, sizeof(llvm_string),
> - ", LLVM %i.%i.%i", (HAVE_LLVM >> 8) & 0xff,
> - HAVE_LLVM & 0xff, MESA_LLVM_VERSION_PATCH);
> -#endif
> + if (HAVE_LLVM > 0) {
> + snprintf(llvm_string, sizeof(llvm_string),
> + ", LLVM %i.%i.%i", (HAVE_LLVM >> 8) & 0xff,
> + HAVE_LLVM & 0xff, MESA_LLVM_VERSION_PATCH);
> + }
>
> snprintf(rscreen->renderer_string, sizeof(rscreen->renderer_string),
> "%s (DRM %i.%i.%i%s%s)",
> r600_get_chip_name(rscreen), rscreen->info.drm_major,
> rscreen->info.drm_minor, rscreen->info.drm_patchlevel,
> kernel_version, llvm_string);
>
> rscreen->b.get_name = r600_get_name;
> rscreen->b.get_vendor = r600_get_vendor;
> rscreen->b.get_device_vendor = r600_get_device_vendor;
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index 72cf827..f18aa82 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -1764,30 +1764,33 @@ static void declare_system_value(
> }
>
> case TGSI_SEMANTIC_BLOCK_ID:
> value = LLVMGetParam(radeon_bld->main_fn, SI_PARAM_BLOCK_ID);
> break;
>
> case TGSI_SEMANTIC_THREAD_ID:
> value = LLVMGetParam(radeon_bld->main_fn, SI_PARAM_THREAD_ID);
> break;
>
> -#if HAVE_LLVM >= 0x0309
> case TGSI_SEMANTIC_HELPER_INVOCATION:
> - value = lp_build_intrinsic(gallivm->builder,
> - "llvm.amdgcn.ps.live",
> - ctx->i1, NULL, 0,
> - LP_FUNC_ATTR_READNONE);
> - value = LLVMBuildNot(gallivm->builder, value, "");
> - value = LLVMBuildSExt(gallivm->builder, value, ctx->i32, "");
> + if (HAVE_LLVM >= 0x0309) {
> + value = lp_build_intrinsic(gallivm->builder,
> + "llvm.amdgcn.ps.live",
> + ctx->i1, NULL, 0,
> + LP_FUNC_ATTR_READNONE);
> + value = LLVMBuildNot(gallivm->builder, value, "");
> + value = LLVMBuildSExt(gallivm->builder, value, ctx->i32, "");
> + } else {
> + assert(!"TGSI_SEMANTIC_HELPER_INVOCATION unsupported");
> + return;
> + }
> break;
> -#endif
>
> default:
> assert(!"unknown system value");
> return;
> }
>
> radeon_bld->system_values[index] = value;
> }
>
> static void declare_compute_memory(struct si_shader_context *radeon_bld,
>
More information about the mesa-dev
mailing list