[PATCH i-g-t 01/11] lib/intel_compute: Use common constant for surface state size
Thomas Hellström
thomas.hellstrom at linux.intel.com
Thu Mar 13 14:28:46 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 | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/lib/intel_compute.c b/lib/intel_compute.c
> index dd9c83c9c..7d3380186 100644
> --- a/lib/intel_compute.c
> +++ b/lib/intel_compute.c
> @@ -23,10 +23,13 @@
> #define PIPE_CONTROL 0x7a000004
> #define MEDIA_STATE_FLUSH 0x0
> #define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
> +
> #define SIZE_DATA 64
> #define SIZE_BATCH 0x10000
> #define SIZE_BUFFER_INPUT MAX(sizeof(float) *
> SIZE_DATA, 0x10000)
> #define SIZE_BUFFER_OUTPUT MAX(sizeof(float) *
> SIZE_DATA, 0x10000)
> +#define SIZE_SURFACE_STATE 0x10000
> +
> #define ADDR_SYNC 0x010000ULL
> #define ADDR_SYNC2 0x020000ULL
> #define ADDR_BATCH 0x100000ULL
> @@ -691,7 +694,7 @@ static void compute_exec(int fd, const unsigned
> char *kernel,
> .size = 0x1000,
> .name = "dynamic state base" },
> { .addr = ADDR_SURFACE_STATE_BASE,
> - .size = 0x1000,
> + .size = SIZE_SURFACE_STATE,
> .name = "surface state base" },
> { .addr = ADDR_INDIRECT_OBJECT_BASE +
> OFFSET_INDIRECT_DATA_START,
> .size = 0x10000,
> @@ -976,7 +979,7 @@ static void xehp_compute_exec(int fd, const
> unsigned char *kernel,
> .size = 0x100000,
> .name = "dynamic state base"},
> { .addr = ADDR_SURFACE_STATE_BASE,
> - .size = 0x10000,
> + .size = SIZE_SURFACE_STATE,
> .name = "surface state base"},
> { .addr = ADDR_GENERAL_STATE_BASE +
> OFFSET_INDIRECT_DATA_START,
> .size = 0x10000,
> @@ -1551,7 +1554,7 @@ static void xelpg_compute_exec(int fd, const
> unsigned char *kernel,
> .size = 0x100000,
> .name = "dynamic state base"},
> { .addr = ADDR_SURFACE_STATE_BASE,
> - .size = 0x1000,
> + .size = SIZE_SURFACE_STATE,
> .name = "surface state base"},
> { .addr = ADDR_GENERAL_STATE_BASE +
> OFFSET_INDIRECT_DATA_START,
> .size = 0x1000,
> @@ -1641,7 +1644,7 @@ static void xe2lpg_compute_exec(int fd, const
> unsigned char *kernel,
> .size = 0x100000,
> .name = "dynamic state base"},
> { .addr = ADDR_SURFACE_STATE_BASE,
> - .size = 0x1000,
> + .size = SIZE_SURFACE_STATE,
> .name = "surface state base"},
> { .addr = ADDR_GENERAL_STATE_BASE +
> OFFSET_INDIRECT_DATA_START,
> .size = 0x1000,
> @@ -1892,7 +1895,7 @@ static void xe2lpg_compute_preempt_exec(int fd,
> const unsigned char *long_kernel
> .size = 0x100000,
> .name = "dynamic state base"},
> { .addr = ADDR_SURFACE_STATE_BASE,
> - .size = 0x1000,
> + .size = SIZE_SURFACE_STATE,
> .name = "surface state base"},
> { .addr = ADDR_GENERAL_STATE_BASE +
> OFFSET_INDIRECT_DATA_START,
> .size = 0x1000,
More information about the igt-dev
mailing list