]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915/fbdev: Fix smem_start for LMEMBAR stolen objects
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 2 Feb 2024 22:43:37 +0000 (00:43 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 7 Feb 2024 00:01:43 +0000 (02:01 +0200)
The "io" address of an object is its dma address minus the
region.start. Subtract the latter to make smem_start correct.
The current code happens to work for genuine LMEM objects
as LMEM region.start==0, but for LMEMBAR stolen objects
region.start!=0.

TODO: perhaps just set smem_start=0 always as our .fb_mmap()
implementation no longer depends on it? Need to double check
it's not needed for anything else...

Reviewed-by: Andrzej Hajda <andrzej.hajda@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-14-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_fbdev_fb.c

index 1ac05d90b2e8a47620e80487a20240b5fbbaa6f3..0665f943f65f28fab51c3764862be40273ef3e2f 100644 (file)
@@ -79,7 +79,8 @@ int intel_fbdev_fb_fill_info(struct drm_i915_private *i915, struct fb_info *info
                /* Use fbdev's framebuffer from lmem for discrete */
                info->fix.smem_start =
                        (unsigned long)(mem->io.start +
-                                       i915_gem_object_get_dma_address(obj, 0));
+                                       i915_gem_object_get_dma_address(obj, 0) -
+                                       mem->region.start);
                info->fix.smem_len = obj->base.size;
        } else {
                struct i915_ggtt *ggtt = to_gt(i915)->ggtt;