drm/i915: Fix region start during initial plane readout
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 2 Feb 2024 22:43:32 +0000 (00:43 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 6 Feb 2024 23:59:07 +0000 (01:59 +0200)
commitd74f3a930c1d075a876a22b44723556455526881
tree2d33815aa1b95617a03ec2158caab9626d8ed1a5
parent6b757e1d420cf01bc135212922906b8616b779d5
drm/i915: Fix region start during initial plane readout

On MTL the stolen region starts at offset 8MiB from the start of
LMEMBAR. The dma addresses are thus also offset by 8MiB. However the
mm_node/etc. is zero based, and i915_pages_create_for_stolen() will
add the appropriate region.start into the sg dma address. So when
we do the readout we need to convert the dma address read from
the PTE to be zero based as well.

Note that currently we don't take this path on MTL, but we should
and thus this needs to be fixed. For lmem this works correctly
already as the lmem region.start==0.

While at it let's also make sure the address points to somewhere within
the memory region. We don't need to check the size as
i915_gem_object_create_region_at() should later fail if the object size
exceeds the region size.

Reviewed-by: Uma Shankar <uma.shankar@intel.com>
Tested-by: Paz Zcharya <pazz@chromium.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240202224340.30647-9-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_plane_initial.c