[igt-dev] [PATCH i-g-t 3/3] lib/igt_fb: Support fbs backed by local memory

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Aug 19 16:44:48 UTC 2021


On Thu, Aug 19, 2021 at 01:59:42PM +0200, Thomas Hellström wrote:
> From: Ramalingam C <ramalingam.c at intel.com>
> 
> When local memory is supported, buffer object, backing the framebuffer
> should be allocated from local memory.
> 
> Dumb buffer allocation takes care of this requirement from kernel
> itself. So when we allocate BO through gem_create we make sure that
> BO is from local memory.
> 
> Cc: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
> Cc: Ashutosh Dixit <ashutosh.dixit at intel.com>
> Cc: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
> Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
> ---
>  lib/igt_fb.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 2e53d922..618842df 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -49,6 +49,7 @@
>  #include "intel_batchbuffer.h"
>  #include "intel_chipset.h"
>  #include "intel_bufops.h"
> +#include "i915/intel_memory_region.h"
>  
>  /**
>   * SECTION:igt_fb
> @@ -1102,9 +1103,10 @@ static int create_bo_for_fb(struct igt_fb *fb, bool prefer_sysmem)
>  		fb->is_dumb = false;
>  
>  		if (is_i915_device(fd)) {
> +			uint32_t region = gem_has_lmem(fd) ? REGION_LMEM(0) : REGION_SMEM;
>  			int err;
>  
> -			fb->gem_handle = gem_create(fd, fb->size);
> +			fb->gem_handle = gem_create_in_memory_regions(fd, fb->size, region);

Shouldn't we just have a gem_create_dtrt() for these sorts of things?

Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

>  			err = __gem_set_tiling(fd, fb->gem_handle,
>  					       igt_fb_mod_to_tiling(fb->modifier),
>  					       fb->strides[0]);
> -- 
> 2.31.1

-- 
Ville Syrjälä
Intel


More information about the igt-dev mailing list