[Intel-gfx] [PATCH v3 1/2] i965/gen9: Pass alignment as function parameter in drm_intel_gem_bo_alloc_internal()

Chris Wilson chris at chris-wilson.co.uk
Thu Jul 2 12:21:59 PDT 2015


On Thu, Jul 02, 2015 at 12:00:43PM -0700, Anuj Phogat wrote:
> and use it to initialize the align variable in drm_intel_bo.

Please don't split sentences across the one-line header and the
changelog.
 
> @@ -787,6 +791,8 @@ retry:
>  	bo_gem->aub_annotation_count = 0;
>  
>  	drm_intel_bo_gem_set_in_aperture_size(bufmgr_gem, bo_gem);
> +	/* Update the aperture size estimate assuming worst case */
> +	bo_gem->reloc_tree_size += alignment;

This should be inside drm_intel_bo_gem_set_in_aperture_size() as that
is its raison-d'etre. Something like

 static void
 drm_intel_bo_gem_set_in_aperture_size(drm_intel_bufmgr_gem *bufmgr_gem,
-                                     drm_intel_bo_gem *bo_gem)
+                                     drm_intel_bo_gem *bo_gem,
+                                     uint64_t alignment)
 {
        int size;
 
@@ -522,10 +523,10 @@ drm_intel_bo_gem_set_in_aperture_size(drm_intel_bufmgr_gem *bufmgr_gem,
                        min_size = size;
 
                /* Account for worst-case alignment. */
-               size = 2 * min_size;
+               alignment = max(alignment, min_size);
        }
 
-       bo_gem->reloc_tree_size = size;
+       bo_gem->reloc_tree_size = size + alignment;
 }
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list