From: Jason Ekstrand Date: Wed, 1 Oct 2014 17:54:59 +0000 (-0700) Subject: i965/fs: Add a MAX_GRF_SIZE define and use it various places X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=50d0e2e118fb3e42dc83c83de34da3eac0a0d8a1;p=mesa.git i965/fs: Add a MAX_GRF_SIZE define and use it various places Previously, we had a MAX_SAMPLER_MESSAGE_SIZE which we used instead. However, some FB write messages can validly be longer than this so we need something different. Since MAX_SAMPLER_MESSAGE_SIZE is validly useful on its own, we leave it alone and add a new MAX_GRF_SIZE that's big enough for FB writes. Signed-off-by: Jason Ekstrand Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84539 Reviewed-by: Matt Turner --- diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 709c5b0128e..8d470f2e858 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1924,6 +1924,7 @@ fs_visitor::split_virtual_grfs() * new virtual GRF for the previous offset many registers */ if (split_points[reg]) { + assert(offset <= MAX_VGRF_SIZE); int grf = virtual_grf_alloc(offset); for (int k = reg - offset; k < reg; k++) new_virtual_grf[k] = grf; @@ -1935,6 +1936,7 @@ fs_visitor::split_virtual_grfs() } /* The last one gets the original register number */ + assert(offset <= MAX_VGRF_SIZE); virtual_grf_sizes[i] = offset; for (int k = reg - offset; k < reg; k++) new_virtual_grf[k] = i; diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 49024d87849..4ea987aa21f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -52,6 +52,7 @@ extern "C" { #include "glsl/ir.h" #define MAX_SAMPLER_MESSAGE_SIZE 11 +#define MAX_VGRF_SIZE 16 struct bblock_t; namespace { diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp index 63d9c05a575..176f91e11d7 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp @@ -105,7 +105,7 @@ brw_alloc_reg_set(struct intel_screen *screen, int reg_width) int class_sizes[BRW_MAX_MRF]; if (devinfo->gen >= 7) { - for (class_count = 0; class_count < BRW_MAX_MRF; class_count++) + for (class_count = 0; class_count < MAX_VGRF_SIZE; class_count++) class_sizes[class_count] = class_count + 1; } else { for (class_count = 0; class_count < 4; class_count++) diff --git a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp index 69d105a85c9..62788cd3091 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp @@ -161,10 +161,10 @@ fs_visitor::register_coalesce() int src_size = 0; int channels_remaining = 0; int reg_from = -1, reg_to = -1; - int reg_to_offset[MAX_SAMPLER_MESSAGE_SIZE]; - fs_inst *mov[MAX_SAMPLER_MESSAGE_SIZE]; - int var_to[MAX_SAMPLER_MESSAGE_SIZE]; - int var_from[MAX_SAMPLER_MESSAGE_SIZE]; + int reg_to_offset[MAX_VGRF_SIZE]; + fs_inst *mov[MAX_VGRF_SIZE]; + int var_to[MAX_VGRF_SIZE]; + int var_from[MAX_VGRF_SIZE]; foreach_block_and_inst(block, fs_inst, inst, cfg) { if (!is_coalesce_candidate(this, inst)) @@ -180,7 +180,7 @@ fs_visitor::register_coalesce() reg_from = inst->src[0].reg; src_size = virtual_grf_sizes[inst->src[0].reg]; - assert(src_size <= MAX_SAMPLER_MESSAGE_SIZE); + assert(src_size <= MAX_VGRF_SIZE); assert(inst->src[0].width % 8 == 0); channels_remaining = src_size;