diff options
author | Chih-Wei Huang <cwhuang@linux.org.tw> | 2016-11-15 16:02:40 +0800 |
---|---|---|
committer | Chih-Wei Huang <cwhuang@linux.org.tw> | 2016-11-16 10:46:46 +0800 |
commit | f43ac65d6166f73eb439391b463218d97c65cce9 (patch) | |
tree | 0d06ec98e48be80cd924d3f6647a3913f3686ce0 /src/gallium | |
parent | 1955a9ca8d71ba5eaff4073bdfff4dee76e1a73a (diff) | |
parent | f2f487ebbb808010528edd69000694bfe525f87b (diff) | |
download | external_mesa3d-f43ac65d6166f73eb439391b463218d97c65cce9.zip external_mesa3d-f43ac65d6166f73eb439391b463218d97c65cce9.tar.gz external_mesa3d-f43ac65d6166f73eb439391b463218d97c65cce9.tar.bz2 |
Merge remote-tracking branch 'mesa/13.0' into nougat-x86
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/hud/hud_cpufreq.c | 26 | ||||
-rw-r--r-- | src/gallium/auxiliary/hud/hud_diskstat.c | 31 | ||||
-rw-r--r-- | src/gallium/auxiliary/hud/hud_nic.c | 26 | ||||
-rw-r--r-- | src/gallium/auxiliary/hud/hud_sensors_temp.c | 28 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_blit.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c | 37 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_program.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/output.c | 2 |
8 files changed, 86 insertions, 70 deletions
diff --git a/src/gallium/auxiliary/hud/hud_cpufreq.c b/src/gallium/auxiliary/hud/hud_cpufreq.c index 4501bbb..19a6f08 100644 --- a/src/gallium/auxiliary/hud/hud_cpufreq.c +++ b/src/gallium/auxiliary/hud/hud_cpufreq.c @@ -36,6 +36,7 @@ #include "hud/hud_private.h" #include "util/list.h" #include "os/os_time.h" +#include "os/os_thread.h" #include "util/u_memory.h" #include <stdio.h> #include <unistd.h> @@ -61,6 +62,7 @@ struct cpufreq_info static int gcpufreq_count = 0; static struct list_head gcpufreq_list; +pipe_static_mutex(gcpufreq_mutex); static struct cpufreq_info * find_cfi_by_index(int cpu_index, int mode) @@ -112,14 +114,6 @@ query_cfi_load(struct hud_graph *gr) } } -static void -free_query_data(void *p) -{ - struct cpufreq_info *cfi = (struct cpufreq_info *)p; - list_del(&cfi->list); - FREE(cfi); -} - /** * Create and initialize a new object for a specific CPU. * \param pane parent context. @@ -162,11 +156,6 @@ hud_cpufreq_graph_install(struct hud_pane *pane, int cpu_index, gr->query_data = cfi; gr->query_new_value = query_cfi_load; - /* Don't use free() as our callback as that messes up Gallium's - * memory debugger. Use simple free_query_data() wrapper. - */ - gr->free_query_data = free_query_data; - hud_pane_add_graph(pane, gr); hud_pane_set_max_value(pane, 3000000 /* 3 GHz */); } @@ -199,16 +188,21 @@ hud_get_num_cpufreq(bool displayhelp) int cpu_index; /* Return the number of CPU metrics we support. */ - if (gcpufreq_count) + pipe_mutex_lock(gcpufreq_mutex); + if (gcpufreq_count) { + pipe_mutex_unlock(gcpufreq_mutex); return gcpufreq_count; + } /* Scan /sys/devices.../cpu, for every object type we support, create * and persist an object to represent its different metrics. */ list_inithead(&gcpufreq_list); DIR *dir = opendir("/sys/devices/system/cpu"); - if (!dir) + if (!dir) { + pipe_mutex_unlock(gcpufreq_mutex); return 0; + } while ((dp = readdir(dir)) != NULL) { @@ -238,6 +232,7 @@ hud_get_num_cpufreq(bool displayhelp) snprintf(fn, sizeof(fn), "%s/cpufreq/scaling_max_freq", basename); add_object(dp->d_name, fn, CPUFREQ_MAXIMUM, cpu_index); } + closedir(dir); if (displayhelp) { list_for_each_entry(struct cpufreq_info, cfi, &gcpufreq_list, list) { @@ -251,6 +246,7 @@ hud_get_num_cpufreq(bool displayhelp) } } + pipe_mutex_unlock(gcpufreq_mutex); return gcpufreq_count; } diff --git a/src/gallium/auxiliary/hud/hud_diskstat.c b/src/gallium/auxiliary/hud/hud_diskstat.c index b248baf..af6e62d 100644 --- a/src/gallium/auxiliary/hud/hud_diskstat.c +++ b/src/gallium/auxiliary/hud/hud_diskstat.c @@ -35,6 +35,7 @@ #include "hud/hud_private.h" #include "util/list.h" #include "os/os_time.h" +#include "os/os_thread.h" #include "util/u_memory.h" #include <stdio.h> #include <unistd.h> @@ -81,6 +82,7 @@ struct diskstat_info */ static int gdiskstat_count = 0; static struct list_head gdiskstat_list; +pipe_static_mutex(gdiskstat_mutex); static struct diskstat_info * find_dsi_by_name(const char *n, int mode) @@ -162,14 +164,6 @@ query_dsi_load(struct hud_graph *gr) } } -static void -free_query_data(void *p) -{ - struct diskstat_info *nic = (struct diskstat_info *) p; - list_del(&nic->list); - FREE(nic); -} - /** * Create and initialize a new object for a specific block I/O device. * \param pane parent context. @@ -208,11 +202,6 @@ hud_diskstat_graph_install(struct hud_pane *pane, const char *dev_name, gr->query_data = dsi; gr->query_new_value = query_dsi_load; - /* Don't use free() as our callback as that messes up Gallium's - * memory debugger. Use simple free_query_data() wrapper. - */ - gr->free_query_data = free_query_data; - hud_pane_add_graph(pane, gr); hud_pane_set_max_value(pane, 100); } @@ -257,16 +246,21 @@ hud_get_num_disks(bool displayhelp) char name[64]; /* Return the number of block devices and partitions. */ - if (gdiskstat_count) + pipe_mutex_lock(gdiskstat_mutex); + if (gdiskstat_count) { + pipe_mutex_unlock(gdiskstat_mutex); return gdiskstat_count; + } /* Scan /sys/block, for every object type we support, create and * persist an object to represent its different statistics. */ list_inithead(&gdiskstat_list); DIR *dir = opendir("/sys/block/"); - if (!dir) + if (!dir) { + pipe_mutex_unlock(gdiskstat_mutex); return 0; + } while ((dp = readdir(dir)) != NULL) { @@ -290,8 +284,11 @@ hud_get_num_disks(bool displayhelp) /* Add any partitions */ struct dirent *dpart; DIR *pdir = opendir(basename); - if (!pdir) + if (!pdir) { + pipe_mutex_unlock(gdiskstat_mutex); + closedir(dir); return 0; + } while ((dpart = readdir(pdir)) != NULL) { /* Avoid 'lo' and '..' and '.' */ @@ -311,6 +308,7 @@ hud_get_num_disks(bool displayhelp) add_object_part(basename, dpart->d_name, DISKSTAT_WR); } } + closedir(dir); if (displayhelp) { list_for_each_entry(struct diskstat_info, dsi, &gdiskstat_list, list) { @@ -322,6 +320,7 @@ hud_get_num_disks(bool displayhelp) puts(line); } } + pipe_mutex_unlock(gdiskstat_mutex); return gdiskstat_count; } diff --git a/src/gallium/auxiliary/hud/hud_nic.c b/src/gallium/auxiliary/hud/hud_nic.c index fb6b8c0..f9935de 100644 --- a/src/gallium/auxiliary/hud/hud_nic.c +++ b/src/gallium/auxiliary/hud/hud_nic.c @@ -35,6 +35,7 @@ #include "hud/hud_private.h" #include "util/list.h" #include "os/os_time.h" +#include "os/os_thread.h" #include "util/u_memory.h" #include <stdio.h> #include <unistd.h> @@ -66,6 +67,7 @@ struct nic_info */ static int gnic_count = 0; static struct list_head gnic_list; +pipe_static_mutex(gnic_mutex); static struct nic_info * find_nic_by_name(const char *n, int mode) @@ -234,14 +236,6 @@ query_nic_load(struct hud_graph *gr) } } -static void -free_query_data(void *p) -{ - struct nic_info *nic = (struct nic_info *) p; - list_del(&nic->list); - FREE(nic); -} - /** * Create and initialize a new object for a specific network interface dev. * \param pane parent context. @@ -284,11 +278,6 @@ hud_nic_graph_install(struct hud_pane *pane, const char *nic_name, gr->query_data = nic; gr->query_new_value = query_nic_load; - /* Don't use free() as our callback as that messes up Gallium's - * memory debugger. Use simple free_query_data() wrapper. - */ - gr->free_query_data = free_query_data; - hud_pane_add_graph(pane, gr); hud_pane_set_max_value(pane, 100); } @@ -342,16 +331,21 @@ hud_get_num_nics(bool displayhelp) char name[64]; /* Return the number if network interfaces. */ - if (gnic_count) + pipe_mutex_lock(gnic_mutex); + if (gnic_count) { + pipe_mutex_unlock(gnic_mutex); return gnic_count; + } /* Scan /sys/block, for every object type we support, create and * persist an object to represent its different statistics. */ list_inithead(&gnic_list); DIR *dir = opendir("/sys/class/net/"); - if (!dir) + if (!dir) { + pipe_mutex_unlock(gnic_mutex); return 0; + } while ((dp = readdir(dir)) != NULL) { @@ -412,6 +406,7 @@ hud_get_num_nics(bool displayhelp) } } + closedir(dir); list_for_each_entry(struct nic_info, nic, &gnic_list, list) { char line[64]; @@ -424,6 +419,7 @@ hud_get_num_nics(bool displayhelp) } + pipe_mutex_unlock(gnic_mutex); return gnic_count; } diff --git a/src/gallium/auxiliary/hud/hud_sensors_temp.c b/src/gallium/auxiliary/hud/hud_sensors_temp.c index e41b847..11b8a4c 100644 --- a/src/gallium/auxiliary/hud/hud_sensors_temp.c +++ b/src/gallium/auxiliary/hud/hud_sensors_temp.c @@ -32,6 +32,7 @@ #include "hud/hud_private.h" #include "util/list.h" #include "os/os_time.h" +#include "os/os_thread.h" #include "util/u_memory.h" #include <stdio.h> #include <unistd.h> @@ -49,6 +50,7 @@ */ static int gsensors_temp_count = 0; static struct list_head gsensors_temp_list; +pipe_static_mutex(gsensor_temp_mutex); struct sensors_temp_info { @@ -189,17 +191,6 @@ query_sti_load(struct hud_graph *gr) } } -static void -free_query_data(void *p) -{ - struct sensors_temp_info *sti = (struct sensors_temp_info *) p; - list_del(&sti->list); - if (sti->chip) - sensors_free_chip_name(sti->chip); - FREE(sti); - sensors_cleanup(); -} - /** * Create and initialize a new object for a specific sensor interface dev. * \param pane parent context. @@ -237,11 +228,6 @@ hud_sensors_temp_graph_install(struct hud_pane *pane, const char *dev_name, gr->query_data = sti; gr->query_new_value = query_sti_load; - /* Don't use free() as our callback as that messes up Gallium's - * memory debugger. Use simple free_query_data() wrapper. - */ - gr->free_query_data = free_query_data; - hud_pane_add_graph(pane, gr); switch (sti->mode) { case SENSORS_TEMP_CURRENT: @@ -338,12 +324,17 @@ int hud_get_num_sensors(bool displayhelp) { /* Return the number of sensors detected. */ - if (gsensors_temp_count) + pipe_mutex_lock(gsensor_temp_mutex); + if (gsensors_temp_count) { + pipe_mutex_unlock(gsensor_temp_mutex); return gsensors_temp_count; + } int ret = sensors_init(NULL); - if (ret) + if (ret) { + pipe_mutex_unlock(gsensor_temp_mutex); return 0; + } list_inithead(&gsensors_temp_list); @@ -377,6 +368,7 @@ hud_get_num_sensors(bool displayhelp) } } + pipe_mutex_unlock(gsensor_temp_mutex); return gsensors_temp_count; } diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c index db41f56..dd8f83b 100644 --- a/src/gallium/drivers/radeonsi/si_blit.c +++ b/src/gallium/drivers/radeonsi/si_blit.c @@ -487,7 +487,9 @@ si_decompress_sampler_color_textures(struct si_context *sctx, assert(view); tex = (struct r600_texture *)view->texture; - assert(tex->cmask.size || tex->fmask.size || tex->dcc_offset); + /* CMASK or DCC can be discarded and we can still end up here. */ + if (!tex->cmask.size && !tex->fmask.size && !tex->dcc_offset) + continue; si_blit_decompress_color(&sctx->b.b, tex, view->u.tex.first_level, view->u.tex.last_level, diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c index 123ff5d..18e905b 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c @@ -459,6 +459,8 @@ static void emit_bfi(const struct lp_build_tgsi_action *action, struct gallivm_state *gallivm = bld_base->base.gallivm; LLVMBuilderRef builder = gallivm->builder; LLVMValueRef bfi_args[3]; + LLVMValueRef bfi_sm5; + LLVMValueRef cond; // Calculate the bitmask: (((1 << src3) - 1) << src2 bfi_args[0] = LLVMBuildShl(builder, @@ -478,11 +480,40 @@ static void emit_bfi(const struct lp_build_tgsi_action *action, * (arg0 & arg1) | (~arg0 & arg2) = arg2 ^ (arg0 & (arg1 ^ arg2) * Use the right-hand side, which the LLVM backend can convert to V_BFI. */ - emit_data->output[emit_data->chan] = + bfi_sm5 = LLVMBuildXor(builder, bfi_args[2], LLVMBuildAnd(builder, bfi_args[0], LLVMBuildXor(builder, bfi_args[1], bfi_args[2], ""), ""), ""); + + /* Since shifts of >= 32 bits are undefined in LLVM IR, the backend + * uses the convenient V_BFI lowering for the above, which follows SM5 + * and disagrees with GLSL semantics when bits (src3) is 32. + */ + cond = LLVMBuildICmp(builder, LLVMIntUGE, emit_data->args[3], + lp_build_const_int32(gallivm, 32), ""); + emit_data->output[emit_data->chan] = + LLVMBuildSelect(builder, cond, emit_data->args[1], bfi_sm5, ""); +} + +static void emit_bfe(const struct lp_build_tgsi_action *action, + struct lp_build_tgsi_context *bld_base, + struct lp_build_emit_data *emit_data) +{ + struct gallivm_state *gallivm = bld_base->base.gallivm; + LLVMBuilderRef builder = gallivm->builder; + LLVMValueRef bfe_sm5; + LLVMValueRef cond; + + bfe_sm5 = lp_build_intrinsic(builder, action->intr_name, + emit_data->dst_type, emit_data->args, + emit_data->arg_count, LLVMReadNoneAttribute); + + /* Correct for GLSL semantics. */ + cond = LLVMBuildICmp(builder, LLVMIntUGE, emit_data->args[2], + lp_build_const_int32(gallivm, 32), ""); + emit_data->output[emit_data->chan] = + LLVMBuildSelect(builder, cond, emit_data->args[0], bfe_sm5, ""); } /* this is ffs in C */ @@ -783,7 +814,7 @@ void si_shader_context_init_alu(struct lp_build_tgsi_context *bld_base) bld_base->op_actions[TGSI_OPCODE_FSLT].emit = emit_fcmp; bld_base->op_actions[TGSI_OPCODE_FSNE].emit = emit_fcmp; bld_base->op_actions[TGSI_OPCODE_IABS].emit = emit_iabs; - bld_base->op_actions[TGSI_OPCODE_IBFE].emit = build_tgsi_intrinsic_nomem; + bld_base->op_actions[TGSI_OPCODE_IBFE].emit = emit_bfe; bld_base->op_actions[TGSI_OPCODE_IBFE].intr_name = "llvm.AMDGPU.bfe.i32"; bld_base->op_actions[TGSI_OPCODE_IDIV].emit = emit_idiv; bld_base->op_actions[TGSI_OPCODE_IMAX].emit = emit_minmax_int; @@ -835,7 +866,7 @@ void si_shader_context_init_alu(struct lp_build_tgsi_context *bld_base) bld_base->op_actions[TGSI_OPCODE_TRUNC].emit = build_tgsi_intrinsic_nomem; bld_base->op_actions[TGSI_OPCODE_TRUNC].intr_name = "llvm.trunc.f32"; bld_base->op_actions[TGSI_OPCODE_UADD].emit = emit_uadd; - bld_base->op_actions[TGSI_OPCODE_UBFE].emit = build_tgsi_intrinsic_nomem; + bld_base->op_actions[TGSI_OPCODE_UBFE].emit = emit_bfe; bld_base->op_actions[TGSI_OPCODE_UBFE].intr_name = "llvm.AMDGPU.bfe.u32"; bld_base->op_actions[TGSI_OPCODE_UDIV].emit = emit_udiv; bld_base->op_actions[TGSI_OPCODE_UMAX].emit = emit_minmax_int; diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 81ac070..0145488 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -1370,7 +1370,7 @@ emit_vert_end(struct vc4_compile *c, struct vc4_varying_slot *fs_inputs, uint32_t num_fs_inputs) { - struct qreg rcp_w = qir_RCP(c, c->outputs[c->output_position_index + 3]); + struct qreg rcp_w = ntq_rcp(c, c->outputs[c->output_position_index + 3]); emit_stub_vpm_read(c); diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c index f4d62a3..8c29a3f 100644 --- a/src/gallium/state_trackers/vdpau/output.c +++ b/src/gallium/state_trackers/vdpau/output.c @@ -82,7 +82,7 @@ vlVdpOutputSurfaceCreate(VdpDevice device, res_tmpl.depth0 = 1; res_tmpl.array_size = 1; res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET | - PIPE_BIND_LINEAR | PIPE_BIND_SHARED; + PIPE_BIND_SHARED; res_tmpl.usage = PIPE_USAGE_DEFAULT; pipe_mutex_lock(dev->mutex); |