[igt-dev] [PATCH i-g-t 3/4] lib: Removing duplications in gpu_fill library

Katarzyna Dec katarzyna.dec at intel.com
Fri Apr 6 07:15:58 UTC 2018


On Thu, Apr 05, 2018 at 12:19:00PM -0700, Daniele Ceraolo Spurio wrote:
> 
> 
> On 05/04/18 06:53, Katarzyna Dec wrote:
> > After moving all functions needed for gpgpu and media fill testing
> > there is a lot of duplications which can be removed:
> >    Library media_fill_gen8lp for CHT was removed, media state flush
> > for !CHT was added to gen7_emit_media_objects.
> >    Many gen8 functions were replaced with gen7 version with devid
> > parameter (gen7_fill_curbe_load, gen7_emit_interface_descriptor,
> > gen7_fill_binding_table, gen7_emit_media_objects).
> >    Duplicated constants like GEN8_MEDIA_VFE_STATE, GEN8_MEDIA_CURBE_LOAD,
> > GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD, GEN8_MEDIA_OBJECT were
> > replaced by GEN7 version. However this constants were not removed
> > from gen8_media.h library, because they are used by other tests
> > for Gen8+. More refactoring in this gen*_media.h libraries is needed.
> > 
> > It seems that further unification of *_fillfunc functions will
> > introduce more confusion in understanding what the tests are doing
> > and what were changes between Gens.
> > 
> > Signed-off-by: Katarzyna Dec <katarzyna.dec at intel.com>
> > Cc: Lukasz Kalamarz <lukasz.kalamarz at intel.com>
> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> > ---
> >   lib/Makefile.sources    |   1 -
> >   lib/gpgpu_fill.c        |  27 +++++-----
> >   lib/gpgpu_fill.h        |   6 +--
> >   lib/gpu_fill.c          | 135 +++++++++---------------------------------------
> >   lib/gpu_fill.h          |  33 +++---------
> >   lib/intel_batchbuffer.c |   4 +-
> >   lib/intel_batchbuffer.h |   3 +-
> >   lib/media_fill.h        |  13 ++---
> >   lib/media_fill_gen7.c   |  11 ++--
> >   lib/media_fill_gen8.c   |  11 ++--
> >   lib/media_fill_gen8lp.c |  90 --------------------------------
> >   lib/media_fill_gen9.c   |  11 ++--
> >   lib/meson.build         |   1 -
> >   tests/gem_gpgpu_fill.c  |   2 +-
> >   tests/gem_media_fill.c  |   2 +-
> >   15 files changed, 77 insertions(+), 273 deletions(-)
> >   delete mode 100644 lib/media_fill_gen8lp.c
> > 
> > diff --git a/lib/Makefile.sources b/lib/Makefile.sources
> > index 690a1d35..86be2838 100644
> > --- a/lib/Makefile.sources
> > +++ b/lib/Makefile.sources
> > @@ -60,7 +60,6 @@ lib_source_list =	 	\
> >   	media_fill.h            \
> >   	media_fill_gen7.c       \
> >   	media_fill_gen8.c       \
> > -	media_fill_gen8lp.c     \
> >   	media_fill_gen9.c       \
> >   	media_spin.h		\
> >   	media_spin.c		\
> > diff --git a/lib/gpgpu_fill.c b/lib/gpgpu_fill.c
> > index bf64867d..9046e3b5 100644
> > --- a/lib/gpgpu_fill.c
> > +++ b/lib/gpgpu_fill.c
> > @@ -103,7 +103,7 @@ gen7_gpgpu_fillfunc(struct intel_batchbuffer *batch,
> >   		    struct igt_buf *dst,
> >   		    unsigned int x, unsigned int y,
> >   		    unsigned int width, unsigned int height,
> > -		    uint8_t color)
> > +		    uint8_t color, int devid)
> 
> devid is stored in intel_batchbuffer so you don't need to pass it in and can
> just use batch->devid instead. The same applies for all other functions that
> have intel_batchbuffer as one of the parameters.
>
Sorry, I've missed that, I will for sure fix it.
> >   {
> >   	uint32_t curbe_buffer, interface_descriptor;
> >   	uint32_t batch_end;
> > @@ -123,7 +123,8 @@ gen7_gpgpu_fillfunc(struct intel_batchbuffer *batch,
> >   	interface_descriptor = gen7_fill_interface_descriptor(batch, dst,
> >   							      gen7_gpgpu_kernel,
> > -							      sizeof(gen7_gpgpu_kernel));
> > +							      sizeof(gen7_gpgpu_kernel),
> > +							      devid);
> >   	igt_assert(batch->ptr < &batch->buffer[4095]);
> >   	batch->ptr = batch->buffer;
> > @@ -133,8 +134,8 @@ gen7_gpgpu_fillfunc(struct intel_batchbuffer *batch,
> >   	gen7_emit_state_base_address(batch);
> >   	gen7_emit_vfe_state_gpgpu(batch);
> > -	gen7_emit_curbe_load(batch, curbe_buffer);
> > -	gen7_emit_interface_descriptor_load(batch, interface_descriptor);
> > +	gen7_emit_curbe_load(batch, curbe_buffer, devid);
> > +	gen7_emit_interface_descriptor_load(batch, interface_descriptor, devid);
> >   	gen7_emit_gpgpu_walk(batch, x, y, width, height);
> >   	OUT_BATCH(MI_BATCH_BUFFER_END);
> > @@ -151,7 +152,7 @@ gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch,
> >   		    struct igt_buf *dst,
> >   		    unsigned int x, unsigned int y,
> >   		    unsigned int width, unsigned int height,
> > -		    uint8_t color)
> > +		    uint8_t color, int devid)
> >   {
> >   	uint32_t curbe_buffer, interface_descriptor;
> >   	uint32_t batch_end;
> > @@ -171,7 +172,8 @@ gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch,
> >   	interface_descriptor = gen8_fill_interface_descriptor(batch, dst,
> >   							      gen8_gpgpu_kernel,
> > -							      sizeof(gen8_gpgpu_kernel));
> > +							      sizeof(gen8_gpgpu_kernel),
> > +							      devid);
> >   	igt_assert(batch->ptr < &batch->buffer[4095]);
> >   	batch->ptr = batch->buffer;
> > @@ -181,8 +183,8 @@ gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch,
> >   	gen8_emit_state_base_address(batch);
> >   	gen8_emit_vfe_state_gpgpu(batch);
> > -	gen7_emit_curbe_load(batch, curbe_buffer);
> > -	gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > +	gen7_emit_curbe_load(batch, curbe_buffer, devid);
> > +	gen7_emit_interface_descriptor_load(batch, interface_descriptor, devid);
> >   	gen8_emit_gpgpu_walk(batch, x, y, width, height);
> >   	OUT_BATCH(MI_BATCH_BUFFER_END);
> > @@ -199,7 +201,7 @@ gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
> >   		    struct igt_buf *dst,
> >   		    unsigned int x, unsigned int y,
> >   		    unsigned int width, unsigned int height,
> > -		    uint8_t color)
> > +		    uint8_t color, int devid)
> >   {
> >   	uint32_t curbe_buffer, interface_descriptor;
> >   	uint32_t batch_end;
> > @@ -219,7 +221,8 @@ gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
> >   	interface_descriptor = gen8_fill_interface_descriptor(batch, dst,
> >   							      gen9_gpgpu_kernel,
> > -							      sizeof(gen9_gpgpu_kernel));
> > +							      sizeof(gen9_gpgpu_kernel),
> > +							      devid);
> >   	igt_assert(batch->ptr < &batch->buffer[4095]);
> >   	batch->ptr = batch->buffer;
> > @@ -229,8 +232,8 @@ gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
> >   	gen9_emit_state_base_address(batch);
> >   	gen8_emit_vfe_state_gpgpu(batch);
> > -	gen7_emit_curbe_load(batch, curbe_buffer);
> > -	gen7_emit_interface_descriptor_load(batch, interface_descriptor);
> > +	gen7_emit_curbe_load(batch, curbe_buffer, devid);
> > +	gen7_emit_interface_descriptor_load(batch, interface_descriptor, devid);
> >   	gen8_emit_gpgpu_walk(batch, x, y, width, height);
> >   	OUT_BATCH(MI_BATCH_BUFFER_END);
> > diff --git a/lib/gpgpu_fill.h b/lib/gpgpu_fill.h
> > index f0d188ae..5c3c8e0f 100644
> > --- a/lib/gpgpu_fill.h
> > +++ b/lib/gpgpu_fill.h
> > @@ -32,20 +32,20 @@ gen7_gpgpu_fillfunc(struct intel_batchbuffer *batch,
> >   		    struct igt_buf *dst,
> >   		    unsigned int x, unsigned int y,
> >   		    unsigned int width, unsigned int height,
> > -		    uint8_t color);
> > +		    uint8_t color, int devid);
> >   void
> >   gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch,
> >   		    struct igt_buf *dst,
> >   		    unsigned int x, unsigned int y,
> >   		    unsigned int width, unsigned int height,
> > -		    uint8_t color);
> > +		    uint8_t color, int devid);
> >   void
> >   gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
> >   		    struct igt_buf *dst,
> >   		    unsigned int x, unsigned int y,
> >   		    unsigned int width, unsigned int height,
> > -		    uint8_t color);
> > +		    uint8_t color, int devid);
> >   #endif /* GPGPU_FILL_H */
> > diff --git a/lib/gpu_fill.c b/lib/gpu_fill.c
> > index 3fd67172..037f9377 100644
> > --- a/lib/gpu_fill.c
> > +++ b/lib/gpu_fill.c
> > @@ -2,6 +2,7 @@
> >   #include <i915_drm.h>
> >   #include "intel_reg.h"
> > +#include "intel_chipset.h"
> >   #include "drmtest.h"
> >   #include "gpu_fill.h"
> >   #include <assert.h>
> > @@ -120,15 +121,20 @@ gen7_fill_surface_state(struct intel_batchbuffer *batch, struct igt_buf *buf,
> >   }
> >   uint32_t
> > -gen7_fill_binding_table(struct intel_batchbuffer *batch, struct igt_buf *dst)
> > +gen7_fill_binding_table(struct intel_batchbuffer *batch, struct igt_buf *dst,
> > +			int devid)
> >   {
> 
> Since this now applies to all gens we can probably drop the gen7_ prefix.
> The same applies to other functions that are now applicable to all gens.
> Some of those renamings can probably go in patch 1.
> 
I was wondering if we should change that and I think that removing gen7 prefix would
affect test understanding. Now, if you look at main fill function, you can easily see
what is 'a base' for media/gpgpu pipeline and what was changes in other gens.
This is my point of view. If there will be a demand for change, I will do it.

> >   	uint32_t *binding_table, offset;
> >   	binding_table = batch_alloc(batch, 32, 64);
> >   	offset = batch_offset(batch, binding_table);
> > -	binding_table[0] = gen7_fill_surface_state(batch, dst,
> > +	if (IS_GEN7(devid))
> > +		binding_table[0] = gen7_fill_surface_state(batch, dst,
> >   						GEN7_SURFACEFORMAT_R8_UNORM, 1);
> > +	else
> > +		binding_table[0] = gen8_fill_surface_state(batch, dst,
> > +						GEN8_SURFACEFORMAT_R8_UNORM, 1);
> >   	return offset;
> >   }
> > @@ -146,14 +152,14 @@ gen7_fill_kernel(struct intel_batchbuffer *batch, const uint32_t kernel[][4],
> >   uint32_t
> >   gen7_fill_interface_descriptor(struct intel_batchbuffer *batch,
> > -			       struct igt_buf *dst,
> > -			       const uint32_t kernel[][4], size_t size)
> > +			       struct igt_buf *dst, const uint32_t kernel[][4],
> > +			       size_t size, int devid)
> >   {
> >   	struct gen7_interface_descriptor_data *idd;
> >   	uint32_t offset;
> >   	uint32_t binding_table_offset, kernel_offset;
> > -	binding_table_offset = gen7_fill_binding_table(batch, dst);
> > +	binding_table_offset = gen7_fill_binding_table(batch, dst, devid);
> >   	kernel_offset = gen7_fill_kernel(batch, kernel, size);
> >   	idd = batch_alloc(batch, sizeof(*idd), 64);
> > @@ -256,7 +262,8 @@ gen7_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch)
> >   }
> >   void
> > -gen7_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
> > +gen7_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer,
> > +		     int devid)
> >   {
> >   	OUT_BATCH(GEN7_MEDIA_CURBE_LOAD | (4 - 2));
> >   	OUT_BATCH(0);
> > @@ -267,12 +274,15 @@ gen7_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
> >   }
> >   void
> > -gen7_emit_interface_descriptor_load(struct intel_batchbuffer *batch, uint32_t interface_descriptor)
> > +gen7_emit_interface_descriptor_load(struct intel_batchbuffer *batch, uint32_t interface_descriptor, int devid)
> >   {
> >   	OUT_BATCH(GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
> >   	OUT_BATCH(0);
> >   	/* interface descriptor data length */
> > -	OUT_BATCH(sizeof(struct gen7_interface_descriptor_data));
> > +	if (IS_GEN7(devid))
> > +		OUT_BATCH(sizeof(struct gen7_interface_descriptor_data));
> > +	else
> > +		OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
> >   	/* interface descriptor address, is relative to the dynamics base
> >   	 * address
> >   	 */
> > @@ -282,7 +292,7 @@ gen7_emit_interface_descriptor_load(struct intel_batchbuffer *batch, uint32_t in
> >   void
> >   gen7_emit_media_objects(struct intel_batchbuffer *batch,
> >   			unsigned int x, unsigned int y,
> > -			unsigned int width, unsigned int height)
> > +			unsigned int width, unsigned int height, int devid)
> >   {
> >   	int i, j;
> > @@ -304,6 +314,8 @@ gen7_emit_media_objects(struct intel_batchbuffer *batch,
> >   			/* inline data (xoffset, yoffset) */
> >   			OUT_BATCH(x + i * 16);
> >   			OUT_BATCH(y + j * 16);
> > +			if (!IS_CHERRYVIEW(devid))
> 
> This won't work for gen7, as the below only applies for gen8+ (excluding
> CHV). you can use something like:
> 
> 	if (AT_LEAST_GEN(devid, 8) && !IS_CHERRYVIEW(devid)).
> 
> Daniele
I will definitely change that this way.
I also need to look at APL becasue this tests are failing there.

Thanks for the review Daniele!
Kasia :)
> 
> > +				gen8_emit_media_state_flush(batch);
> >   		}
> >   	}
> >   }
> > @@ -414,30 +426,16 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch, struct igt_buf *buf,
> >   	return offset;
> >   }
> > -uint32_t
> > -gen8_fill_binding_table(struct intel_batchbuffer *batch, struct igt_buf *dst)
> > -{
> > -	uint32_t *binding_table, offset;
> > -
> > -	binding_table = batch_alloc(batch, 32, 64);
> > -	offset = batch_offset(batch, binding_table);
> > -
> > -	binding_table[0] = gen8_fill_surface_state(batch, dst,
> > -						GEN8_SURFACEFORMAT_R8_UNORM, 1);
> > -
> > -	return offset;
> > -}
> > -
> >   uint32_t
> >   gen8_fill_interface_descriptor(struct intel_batchbuffer *batch,
> >   			       struct igt_buf *dst, const uint32_t kernel[][4],
> > -			       size_t size)
> > +			       size_t size, int devid)
> >   {
> >   	struct gen8_interface_descriptor_data *idd;
> >   	uint32_t offset;
> >   	uint32_t binding_table_offset, kernel_offset;
> > -	binding_table_offset = gen8_fill_binding_table(batch, dst);
> > +	binding_table_offset = gen7_fill_binding_table(batch, dst, devid);
> >   	kernel_offset = gen7_fill_kernel(batch, kernel, sizeof(kernel));
> >   	idd = batch_alloc(batch, sizeof(*idd), 64);
> > @@ -501,7 +499,7 @@ gen8_emit_state_base_address(struct intel_batchbuffer *batch)
> >   void
> >   gen8_emit_vfe_state(struct intel_batchbuffer *batch)
> >   {
> > -	OUT_BATCH(GEN8_MEDIA_VFE_STATE | (9 - 2));
> > +	OUT_BATCH(GEN7_MEDIA_VFE_STATE | (9 - 2));
> >   	/* scratch buffer */
> >   	OUT_BATCH(0);
> > @@ -526,7 +524,7 @@ gen8_emit_vfe_state(struct intel_batchbuffer *batch)
> >   void
> >   gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch)
> >   {
> > -	OUT_BATCH(GEN8_MEDIA_VFE_STATE | (9 - 2));
> > +	OUT_BATCH(GEN7_MEDIA_VFE_STATE | (9 - 2));
> >   	/* scratch buffer */
> >   	OUT_BATCH(0);
> > @@ -546,31 +544,6 @@ gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch)
> >   	OUT_BATCH(0);
> >   }
> > -void
> > -gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
> > -{
> > -	OUT_BATCH(GEN8_MEDIA_CURBE_LOAD | (4 - 2));
> > -	OUT_BATCH(0);
> > -	/* curbe total data length */
> > -	OUT_BATCH(64);
> > -	/* curbe data start address, is relative to the dynamics base address */
> > -	OUT_BATCH(curbe_buffer);
> > -}
> > -
> > -void
> > -gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> > -				    uint32_t interface_descriptor)
> > -{
> > -	OUT_BATCH(GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
> > -	OUT_BATCH(0);
> > -	/* interface descriptor data length */
> > -	OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
> > -	/* interface descriptor address, is relative to the dynamics base
> > -	 * address
> > -	 */
> > -	OUT_BATCH(interface_descriptor);
> > -}
> > -
> >   void
> >   gen8_emit_media_state_flush(struct intel_batchbuffer *batch)
> >   {
> > @@ -578,64 +551,6 @@ gen8_emit_media_state_flush(struct intel_batchbuffer *batch)
> >   	OUT_BATCH(0);
> >   }
> > -void
> > -gen8_emit_media_objects(struct intel_batchbuffer *batch,
> > -			unsigned int x, unsigned int y,
> > -			unsigned int width, unsigned int height)
> > -{
> > -	int i, j;
> > -
> > -	for (i = 0; i < width / 16; i++) {
> > -		for (j = 0; j < height / 16; j++) {
> > -			OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
> > -
> > -			/* interface descriptor offset */
> > -			OUT_BATCH(0);
> > -
> > -			/* without indirect data */
> > -			OUT_BATCH(0);
> > -			OUT_BATCH(0);
> > -
> > -			/* scoreboard */
> > -			OUT_BATCH(0);
> > -			OUT_BATCH(0);
> > -
> > -			/* inline data (xoffset, yoffset) */
> > -			OUT_BATCH(x + i * 16);
> > -			OUT_BATCH(y + j * 16);
> > -			gen8_emit_media_state_flush(batch);
> > -		}
> > -	}
> > -}
> > -
> > -void
> > -gen8lp_emit_media_objects(struct intel_batchbuffer *batch,
> > -			unsigned int x, unsigned int y,
> > -			unsigned int width, unsigned int height)
> > -{
> > -	int i, j;
> > -
> > -	for (i = 0; i < width / 16; i++) {
> > -		for (j = 0; j < height / 16; j++) {
> > -			OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
> > -
> > -			/* interface descriptor offset */
> > -			OUT_BATCH(0);
> > -
> > -			/* without indirect data */
> > -			OUT_BATCH(0);
> > -			OUT_BATCH(0);
> > -
> > -			/* scoreboard */
> > -			OUT_BATCH(0);
> > -			OUT_BATCH(0);
> > -
> > -			/* inline data (xoffset, yoffset) */
> > -			OUT_BATCH(x + i * 16);
> > -			OUT_BATCH(y + j * 16);
> > -		}
> > -	}
> > -}
> >   void
> >   gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > diff --git a/lib/gpu_fill.h b/lib/gpu_fill.h
> > index a7897323..4fac88fe 100644
> > --- a/lib/gpu_fill.h
> > +++ b/lib/gpu_fill.h
> > @@ -53,7 +53,8 @@ gen7_fill_surface_state(struct intel_batchbuffer *batch, struct igt_buf *buf,
> >   			uint32_t format, int is_dst);
> >   uint32_t
> > -gen7_fill_binding_table(struct intel_batchbuffer *batch, struct igt_buf *dst);
> > +gen7_fill_binding_table(struct intel_batchbuffer *batch, struct igt_buf *dst,
> > +			int devid);
> >   uint32_t
> >   gen7_fill_kernel(struct intel_batchbuffer *batch, const uint32_t kernel[][4],
> > @@ -62,7 +63,7 @@ gen7_fill_kernel(struct intel_batchbuffer *batch, const uint32_t kernel[][4],
> >   uint32_t
> >   gen7_fill_interface_descriptor(struct intel_batchbuffer *batch,
> >   			       struct igt_buf *dst, const uint32_t kernel[][4],
> > -			       size_t size);
> > +			       size_t size, int devid);
> >   void
> >   gen7_emit_state_base_address(struct intel_batchbuffer *batch);
> > @@ -74,28 +75,26 @@ void
> >   gen7_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch);
> >   void
> > -gen7_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer);
> > +gen7_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer,
> > +		     int devid);
> >   void
> >   gen7_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> > -				    uint32_t interface_descriptor);
> > +				    uint32_t interface_descriptor, int devid);
> >   void
> >   gen7_emit_media_objects(struct intel_batchbuffer *batch,
> >   			unsigned int x, unsigned int y,
> > -			unsigned int width, unsigned int height);
> > +			unsigned int width, unsigned int height, int devid);
> >   uint32_t
> >   gen8_fill_surface_state(struct intel_batchbuffer *batch, struct igt_buf *buf,
> >   			uint32_t format, int is_dst);
> > -uint32_t
> > -gen8_fill_binding_table(struct intel_batchbuffer *batch, struct igt_buf *dst);
> > -
> >   uint32_t
> >   gen8_fill_interface_descriptor(struct intel_batchbuffer *batch,
> >   			       struct igt_buf *dst, const uint32_t kernel[][4],
> > -			       size_t size);
> > +			       size_t size, int devid);
> >   void
> >   gen8_emit_state_base_address(struct intel_batchbuffer *batch);
> > @@ -106,25 +105,9 @@ gen8_emit_vfe_state(struct intel_batchbuffer *batch);
> >   void
> >   gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch);
> > -void
> > -gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer);
> > -
> > -void
> > -gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch, uint32_t interface_descriptor);
> > -
> >   void
> >   gen8_emit_media_state_flush(struct intel_batchbuffer *batch);
> > -void
> > -gen8_emit_media_objects(struct intel_batchbuffer *batch,
> > -			unsigned int x, unsigned int y,
> > -			unsigned int width, unsigned int height);
> > -
> > -void
> > -gen8lp_emit_media_objects(struct intel_batchbuffer *batch,
> > -			unsigned int x, unsigned int y,
> > -			unsigned int width, unsigned int height);
> > -
> >   void
> >   gen9_emit_state_base_address(struct intel_batchbuffer *batch);
> > diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
> > index 7c04ccf3..10d4dce8 100644
> > --- a/lib/intel_batchbuffer.c
> > +++ b/lib/intel_batchbuffer.c
> > @@ -796,12 +796,10 @@ igt_fillfunc_t igt_get_media_fillfunc(int devid)
> >   	if (IS_GEN9(devid))
> >   		fill = gen9_media_fillfunc;
> > -	else if (IS_BROADWELL(devid))
> > +	else if (IS_GEN8(devid))
> >   		fill = gen8_media_fillfunc;
> >   	else if (IS_GEN7(devid))
> >   		fill = gen7_media_fillfunc;
> > -	else if (IS_CHERRYVIEW(devid))
> > -		fill = gen8lp_media_fillfunc;
> >   	return fill;
> >   }
> > diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
> > index 2c262d7d..c96e11b7 100644
> > --- a/lib/intel_batchbuffer.h
> > +++ b/lib/intel_batchbuffer.h
> > @@ -304,7 +304,8 @@ typedef void (*igt_fillfunc_t)(struct intel_batchbuffer *batch,
> >   			       struct igt_buf *dst,
> >   			       unsigned x, unsigned y,
> >   			       unsigned width, unsigned height,
> > -			       uint8_t color);
> > +			       uint8_t color,
> > +			       int devid);
> >   igt_fillfunc_t igt_get_media_fillfunc(int devid);
> >   igt_fillfunc_t igt_get_gpgpu_fillfunc(int devid);
> > diff --git a/lib/media_fill.h b/lib/media_fill.h
> > index f418a0d6..bcb2f4e0 100644
> > --- a/lib/media_fill.h
> > +++ b/lib/media_fill.h
> > @@ -9,27 +9,20 @@ gen7_media_fillfunc(struct intel_batchbuffer *batch,
> >   		    struct igt_buf *dst,
> >   		    unsigned int x, unsigned int y,
> >   		    unsigned int width, unsigned int height,
> > -		    uint8_t color);
> > +		    uint8_t color, int devid);
> >   void
> >   gen8_media_fillfunc(struct intel_batchbuffer *batch,
> >   		    struct igt_buf *dst,
> >   		    unsigned int x, unsigned int y,
> >   		    unsigned int width, unsigned int height,
> > -		    uint8_t color);
> > -
> > -void
> > -gen8lp_media_fillfunc(struct intel_batchbuffer *batch,
> > -		    struct igt_buf *dst,
> > -		    unsigned int x, unsigned int y,
> > -		    unsigned int width, unsigned int height,
> > -		    uint8_t color);
> > +		    uint8_t color, int devid);
> >   void
> >   gen9_media_fillfunc(struct intel_batchbuffer *batch,
> >   		    struct igt_buf *dst,
> >   		    unsigned int x, unsigned int y,
> >   		    unsigned int width, unsigned int height,
> > -		    uint8_t color);
> > +		    uint8_t color, int devid);
> >   #endif /* RENDE_MEDIA_FILL_H */
> > diff --git a/lib/media_fill_gen7.c b/lib/media_fill_gen7.c
> > index eb364a1f..4e796867 100644
> > --- a/lib/media_fill_gen7.c
> > +++ b/lib/media_fill_gen7.c
> > @@ -49,7 +49,7 @@ gen7_media_fillfunc(struct intel_batchbuffer *batch,
> >   		struct igt_buf *dst,
> >   		unsigned int x, unsigned int y,
> >   		unsigned int width, unsigned int height,
> > -		uint8_t color)
> > +		uint8_t color, int devid)
> >   {
> >   	uint32_t curbe_buffer, interface_descriptor;
> >   	uint32_t batch_end;
> > @@ -63,7 +63,8 @@ gen7_media_fillfunc(struct intel_batchbuffer *batch,
> >   	interface_descriptor = gen7_fill_interface_descriptor(batch, dst,
> >   							      media_kernel,
> >   							      sizeof
> > -							      (media_kernel));
> > +							      (media_kernel),
> > +							      devid);
> >   	igt_assert(batch->ptr < &batch->buffer[4095]);
> >   	/* media pipeline */
> > @@ -74,11 +75,11 @@ gen7_media_fillfunc(struct intel_batchbuffer *batch,
> >   	gen7_emit_vfe_state(batch);
> > -	gen7_emit_curbe_load(batch, curbe_buffer);
> > +	gen7_emit_curbe_load(batch, curbe_buffer, devid);
> > -	gen7_emit_interface_descriptor_load(batch, interface_descriptor);
> > +	gen7_emit_interface_descriptor_load(batch, interface_descriptor, devid);
> > -	gen7_emit_media_objects(batch, x, y, width, height);
> > +	gen7_emit_media_objects(batch, x, y, width, height, devid);
> >   	OUT_BATCH(MI_BATCH_BUFFER_END);
> > diff --git a/lib/media_fill_gen8.c b/lib/media_fill_gen8.c
> > index bf908d95..5f1adbe1 100644
> > --- a/lib/media_fill_gen8.c
> > +++ b/lib/media_fill_gen8.c
> > @@ -50,7 +50,7 @@ gen8_media_fillfunc(struct intel_batchbuffer *batch,
> >   		struct igt_buf *dst,
> >   		unsigned int x, unsigned int y,
> >   		unsigned int width, unsigned int height,
> > -		uint8_t color)
> > +		uint8_t color, int devid)
> >   {
> >   	uint32_t curbe_buffer, interface_descriptor;
> >   	uint32_t batch_end;
> > @@ -64,7 +64,8 @@ gen8_media_fillfunc(struct intel_batchbuffer *batch,
> >   	interface_descriptor = gen8_fill_interface_descriptor(batch, dst,
> >   							      media_kernel,
> >   							      sizeof
> > -							      (media_kernel));
> > +							      (media_kernel),
> > +							      devid);
> >   	igt_assert(batch->ptr < &batch->buffer[4095]);
> > @@ -75,11 +76,11 @@ gen8_media_fillfunc(struct intel_batchbuffer *batch,
> >   	gen8_emit_vfe_state(batch);
> > -	gen8_emit_curbe_load(batch, curbe_buffer);
> > +	gen7_emit_curbe_load(batch, curbe_buffer, devid);
> > -	gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > +	gen7_emit_interface_descriptor_load(batch, interface_descriptor, devid);
> > -	gen8_emit_media_objects(batch, x, y, width, height);
> > +	gen7_emit_media_objects(batch, x, y, width, height, devid);
> >   	OUT_BATCH(MI_BATCH_BUFFER_END);
> > diff --git a/lib/media_fill_gen8lp.c b/lib/media_fill_gen8lp.c
> > deleted file mode 100644
> > index ba249904..00000000
> > --- a/lib/media_fill_gen8lp.c
> > +++ /dev/null
> > @@ -1,90 +0,0 @@
> > -#include <intel_bufmgr.h>
> > -#include <i915_drm.h>
> > -
> > -#include "media_fill.h"
> > -#include "gen8_media.h"
> > -#include "intel_reg.h"
> > -#include "drmtest.h"
> > -#include "gpu_fill.h"
> > -#include <assert.h>
> > -
> > -
> > -static const uint32_t media_kernel[][4] = {
> > -	{ 0x00400001, 0x20202288, 0x00000020, 0x00000000 },
> > -	{ 0x00600001, 0x20800208, 0x008d0000, 0x00000000 },
> > -	{ 0x00200001, 0x20800208, 0x00450040, 0x00000000 },
> > -	{ 0x00000001, 0x20880608, 0x00000000, 0x000f000f },
> > -	{ 0x00800001, 0x20a00208, 0x00000020, 0x00000000 },
> > -	{ 0x00800001, 0x20e00208, 0x00000020, 0x00000000 },
> > -	{ 0x00800001, 0x21200208, 0x00000020, 0x00000000 },
> > -	{ 0x00800001, 0x21600208, 0x00000020, 0x00000000 },
> > -	{ 0x0c800031, 0x24000a40, 0x0e000080, 0x120a8000 },
> > -	{ 0x00600001, 0x2e000208, 0x008d0000, 0x00000000 },
> > -	{ 0x07800031, 0x20000a40, 0x0e000e00, 0x82000010 },
> > -};
> > -
> > -/*
> > - * This sets up the media pipeline,
> > - *
> > - * +---------------+ <---- 4096
> > - * |       ^       |
> > - * |       |       |
> > - * |    various    |
> > - * |      state    |
> > - * |       |       |
> > - * |_______|_______| <---- 2048 + ?
> > - * |       ^       |
> > - * |       |       |
> > - * |   batch       |
> > - * |    commands   |
> > - * |       |       |
> > - * |       |       |
> > - * +---------------+ <---- 0 + ?
> > - *
> > - */
> > -
> > -#define BATCH_STATE_SPLIT 2048
> > -
> > -void
> > -gen8lp_media_fillfunc(struct intel_batchbuffer *batch,
> > -		struct igt_buf *dst,
> > -		unsigned int x, unsigned int y,
> > -		unsigned int width, unsigned int height,
> > -		uint8_t color)
> > -{
> > -	uint32_t curbe_buffer, interface_descriptor;
> > -	uint32_t batch_end;
> > -
> > -	intel_batchbuffer_flush(batch);
> > -
> > -	/* setup states */
> > -	batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
> > -
> > -	curbe_buffer = gen7_fill_curbe_buffer_data(batch, color);
> > -	interface_descriptor = gen8_fill_interface_descriptor(batch, dst,
> > -							      media_kernel,
> > -							      sizeof
> > -							      (media_kernel));
> > -	igt_assert(batch->ptr < &batch->buffer[4095]);
> > -
> > -	/* media pipeline */
> > -	batch->ptr = batch->buffer;
> > -	OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA);
> > -	gen8_emit_state_base_address(batch);
> > -
> > -	gen8_emit_vfe_state(batch);
> > -
> > -	gen8_emit_curbe_load(batch, curbe_buffer);
> > -
> > -	gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > -
> > -	gen8lp_emit_media_objects(batch, x, y, width, height);
> > -
> > -	OUT_BATCH(MI_BATCH_BUFFER_END);
> > -
> > -	batch_end = batch_align(batch, 8);
> > -	igt_assert(batch_end < BATCH_STATE_SPLIT);
> > -
> > -	gen7_render_flush(batch, batch_end);
> > -	intel_batchbuffer_reset(batch);
> > -}
> > diff --git a/lib/media_fill_gen9.c b/lib/media_fill_gen9.c
> > index b9c5a536..4b3c7ba8 100644
> > --- a/lib/media_fill_gen9.c
> > +++ b/lib/media_fill_gen9.c
> > @@ -48,7 +48,7 @@ gen9_media_fillfunc(struct intel_batchbuffer *batch,
> >   		struct igt_buf *dst,
> >   		unsigned int x, unsigned int y,
> >   		unsigned int width, unsigned int height,
> > -		uint8_t color)
> > +		uint8_t color, int devid)
> >   {
> >   	uint32_t curbe_buffer, interface_descriptor;
> >   	uint32_t batch_end;
> > @@ -62,7 +62,8 @@ gen9_media_fillfunc(struct intel_batchbuffer *batch,
> >   	interface_descriptor = gen8_fill_interface_descriptor(batch, dst,
> >   							      media_kernel,
> >   							      sizeof
> > -							      (media_kernel));
> > +							      (media_kernel),
> > +							      devid);
> >   	assert(batch->ptr < &batch->buffer[4095]);
> >   	/* media pipeline */
> > @@ -77,11 +78,11 @@ gen9_media_fillfunc(struct intel_batchbuffer *batch,
> >   	gen8_emit_vfe_state(batch);
> > -	gen8_emit_curbe_load(batch, curbe_buffer);
> > +	gen7_emit_curbe_load(batch, curbe_buffer, devid);
> > -	gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > +	gen7_emit_interface_descriptor_load(batch, interface_descriptor, devid);
> > -	gen8_emit_media_objects(batch, x, y, width, height);
> > +	gen7_emit_media_objects(batch, x, y, width, height, devid);
> >   	OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA |
> >   		  GEN9_FORCE_MEDIA_AWAKE_DISABLE |
> > diff --git a/lib/meson.build b/lib/meson.build
> > index 38c3f107..77dcdc87 100644
> > --- a/lib/meson.build
> > +++ b/lib/meson.build
> > @@ -27,7 +27,6 @@ lib_sources = [
> >   	'gpu_fill.c',
> >   	'media_fill_gen7.c',
> >   	'media_fill_gen8.c',
> > -	'media_fill_gen8lp.c',
> >   	'media_fill_gen9.c',
> >   	'media_spin.c',
> >   	'gpgpu_fill.c',
> > diff --git a/tests/gem_gpgpu_fill.c b/tests/gem_gpgpu_fill.c
> > index df9e86f6..0e433306 100644
> > --- a/tests/gem_gpgpu_fill.c
> > +++ b/tests/gem_gpgpu_fill.c
> > @@ -124,7 +124,7 @@ igt_simple_main
> >   	gpgpu_fill(batch,
> >   		   &dst, 0, 0, WIDTH / 2, HEIGHT / 2,
> > -		   COLOR_4C);
> > +		   COLOR_4C, data.devid);
> >   	for (i = 0; i < WIDTH; i++) {
> >   		for (j = 0; j < HEIGHT; j++) {
> > diff --git a/tests/gem_media_fill.c b/tests/gem_media_fill.c
> > index e3564e8b..d75a70c1 100644
> > --- a/tests/gem_media_fill.c
> > +++ b/tests/gem_media_fill.c
> > @@ -129,7 +129,7 @@ igt_simple_main
> >   	media_fill(batch,
> >   		&dst, 0, 0, WIDTH / 2, HEIGHT / 2,
> > -		COLOR_4C);
> > +		COLOR_4C, data.devid);
> >   	for (i = 0; i < WIDTH; i++) {
> >   		for (j = 0; j < HEIGHT; j++) {
> > 


More information about the igt-dev mailing list