drm/i915: Limit the display memory alignment to 32 bit instead of 64
authorAndi Shyti <andi.shyti@linux.intel.com>
Wed, 30 Nov 2022 23:58:01 +0000 (00:58 +0100)
committerAndi Shyti <andi.shyti@linux.intel.com>
Tue, 6 Dec 2022 09:52:41 +0000 (10:52 +0100)
The coming commit "drm/i915: Introduce guard pages to i915_vma"
from Chris, was originally changing display_alignment to u32
from u64. The reason is that the display GGTT is and will be
limited o 4GB.

Put it in a separate patch and use "max(...)" instead of
"max_t(64, ...)" when asigning the value. We can safely use max
as we know beforehand that the comparison is between two u32
variables.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221130235805.221010-2-andi.shyti@linux.intel.com
drivers/gpu/drm/i915/display/intel_fb_pin.c
drivers/gpu/drm/i915/gem/i915_gem_domain.c
drivers/gpu/drm/i915/i915_vma_types.h

index 6900acbb1381cb9b433d3321ba092cc32a67d26d..1aca7552a85d03bde806c340cf44b8800ef437c6 100644 (file)
@@ -91,7 +91,7 @@ intel_pin_fb_obj_dpt(struct drm_framebuffer *fb,
                goto err;
        }
 
-       vma->display_alignment = max_t(u64, vma->display_alignment, alignment);
+       vma->display_alignment = max(vma->display_alignment, alignment);
 
        i915_gem_object_flush_if_display(obj);
 
index d44a152ce680022846033be47c084b98f3488cea..850776a783ac7b4254d1a0b8c54b88caa04b903a 100644 (file)
@@ -444,7 +444,7 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
        if (IS_ERR(vma))
                return vma;
 
-       vma->display_alignment = max_t(u64, vma->display_alignment, alignment);
+       vma->display_alignment = max(vma->display_alignment, alignment);
        i915_vma_mark_scanout(vma);
 
        i915_gem_object_flush_if_display_locked(obj);
index ec0f6c9f57d027958a5a2a8d34c336179e7eace2..0375812792b9c1a7893bbac78809a9b6e1c26f80 100644 (file)
@@ -197,7 +197,6 @@ struct i915_vma {
        struct i915_fence_reg *fence;
 
        u64 size;
-       u64 display_alignment;
        struct i915_page_sizes page_sizes;
 
        /* mmap-offset associated with fencing for this vma */
@@ -205,6 +204,7 @@ struct i915_vma {
 
        u32 fence_size;
        u32 fence_alignment;
+       u32 display_alignment;
 
        /**
         * Count of the number of times this vma has been opened by different