[PATCH i-g-t 04/11] lib/intel_compute: Use common constant for binding table size

Thomas Hellström thomas.hellstrom at linux.intel.com
Thu Mar 13 14:34:03 UTC 2025


On Tue, 2025-03-11 at 16:21 +0100, Francois Dugast wrote:
> Reduce magic values in the code, homogenize the size which has no
> reason to be different among pipelines, define this value close to
> the addresses to make it easier to spot potential overlaps in the
> future.
> 
> Signed-off-by: Francois Dugast <francois.dugast at intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>

> ---
>  lib/intel_compute.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/intel_compute.c b/lib/intel_compute.c
> index e3c8cf244..a85fd8121 100644
> --- a/lib/intel_compute.c
> +++ b/lib/intel_compute.c
> @@ -31,6 +31,7 @@
>  #define SIZE_SURFACE_STATE		0x10000
>  #define SIZE_DYNAMIC_STATE		0x100000
>  #define SIZE_INDIRECT_OBJECT		0x10000
> +#define SIZE_BINDING_TABLE		0x10000
>  
>  #define ADDR_SYNC			0x010000ULL
>  #define ADDR_SYNC2			0x020000ULL
> @@ -993,7 +994,7 @@ static void xehp_compute_exec(int fd, const
> unsigned char *kernel,
>  		{ .addr = ADDR_GENERAL_STATE_BASE, .size = 0x100000,
>  		  .name = "general state base" },
>  		{ .addr = ADDR_SURFACE_STATE_BASE +
> OFFSET_BINDING_TABLE,
> -		  .size = 0x10000,
> +		  .size = SIZE_BINDING_TABLE,
>  		  .name = "binding table" },
>  		{ .addr = ADDR_BATCH, .size = SIZE_BATCH,
>  		  .name = "batch" },
> @@ -1568,7 +1569,7 @@ static void xelpg_compute_exec(int fd, const
> unsigned char *kernel,
>  		{ .addr = ADDR_GENERAL_STATE_BASE, .size = 0x100000,
>  		  .name = "general state base" },
>  		{ .addr = ADDR_SURFACE_STATE_BASE +
> OFFSET_BINDING_TABLE,
> -		  .size = 0x1000,
> +		  .size = SIZE_BINDING_TABLE,
>  		  .name = "binding table" },
>  		{ .addr = ADDR_BATCH,
>  		  .size = SIZE_BATCH,
> @@ -1658,7 +1659,7 @@ static void xe2lpg_compute_exec(int fd, const
> unsigned char *kernel,
>  		{ .addr = ADDR_GENERAL_STATE_BASE, .size = 0x100000,
>  		  .name = "general state base" },
>  		{ .addr = ADDR_SURFACE_STATE_BASE +
> OFFSET_BINDING_TABLE,
> -		  .size = 0x1000,
> +		  .size = SIZE_BINDING_TABLE,
>  		  .name = "binding table" },
>  		{ .addr = ADDR_BATCH,
>  		  .size = SIZE_BATCH,
> @@ -1909,7 +1910,7 @@ static void xe2lpg_compute_preempt_exec(int fd,
> const unsigned char *long_kernel
>  		{ .addr = ADDR_GENERAL_STATE_BASE, .size = 0x100000,
>  		  .name = "general state base" },
>  		{ .addr = ADDR_SURFACE_STATE_BASE +
> OFFSET_BINDING_TABLE,
> -		  .size = 0x1000,
> +		  .size = SIZE_BINDING_TABLE,
>  		  .name = "binding table" },
>  		{ .addr = ADDR_BATCH,
>  		  .size = SIZE_BATCH,



More information about the igt-dev mailing list