Commit 46642a7d authored by Nirmoy Das's avatar Nirmoy Das Committed by Christian König

drm/vram-helper: don't use ttm bo->offset v4

Calculate GEM VRAM bo's offset within vram-helper without depending on
bo->offset.
Signed-off-by: default avatarNirmoy Das <nirmoy.das@amd.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/372938/
parent 8ef963ba
...@@ -281,6 +281,15 @@ u64 drm_gem_vram_mmap_offset(struct drm_gem_vram_object *gbo) ...@@ -281,6 +281,15 @@ u64 drm_gem_vram_mmap_offset(struct drm_gem_vram_object *gbo)
} }
EXPORT_SYMBOL(drm_gem_vram_mmap_offset); EXPORT_SYMBOL(drm_gem_vram_mmap_offset);
static u64 drm_gem_vram_pg_offset(struct drm_gem_vram_object *gbo)
{
/* Keep TTM behavior for now, remove when drivers are audited */
if (WARN_ON_ONCE(!gbo->bo.mem.mm_node))
return 0;
return gbo->bo.mem.start;
}
/** /**
* drm_gem_vram_offset() - \ * drm_gem_vram_offset() - \
Returns a GEM VRAM object's offset in video memory Returns a GEM VRAM object's offset in video memory
...@@ -297,7 +306,7 @@ s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo) ...@@ -297,7 +306,7 @@ s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo)
{ {
if (WARN_ON_ONCE(!gbo->pin_count)) if (WARN_ON_ONCE(!gbo->pin_count))
return (s64)-ENODEV; return (s64)-ENODEV;
return gbo->bo.offset; return drm_gem_vram_pg_offset(gbo) << PAGE_SHIFT;
} }
EXPORT_SYMBOL(drm_gem_vram_offset); EXPORT_SYMBOL(drm_gem_vram_offset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment