mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 01:41:39 +00:00
drm/i915/fbdev: Use lmem physical addresses for fb_mmap() on discrete
Use local memory io BAR address for fbdev's fb_mmap() operation on discrete, fbdev uses the physical address of our framebuffer for its fb_mmap() fn. Signed-off-by: Mohammed Khajapasha <mohammed.khajapasha@intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Signed-off-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210427085417.120246-5-matthew.auld@intel.com
This commit is contained in:
parent
6aed5673f0
commit
a9cf6ab3e7
1 changed files with 23 additions and 6 deletions
|
@ -41,6 +41,8 @@
|
||||||
#include <drm/drm_fb_helper.h>
|
#include <drm/drm_fb_helper.h>
|
||||||
#include <drm/drm_fourcc.h>
|
#include <drm/drm_fourcc.h>
|
||||||
|
|
||||||
|
#include "gem/i915_gem_lmem.h"
|
||||||
|
|
||||||
#include "i915_drv.h"
|
#include "i915_drv.h"
|
||||||
#include "intel_display_types.h"
|
#include "intel_display_types.h"
|
||||||
#include "intel_fbdev.h"
|
#include "intel_fbdev.h"
|
||||||
|
@ -178,6 +180,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
|
||||||
unsigned long flags = 0;
|
unsigned long flags = 0;
|
||||||
bool prealloc = false;
|
bool prealloc = false;
|
||||||
void __iomem *vaddr;
|
void __iomem *vaddr;
|
||||||
|
struct drm_i915_gem_object *obj;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (intel_fb &&
|
if (intel_fb &&
|
||||||
|
@ -232,6 +235,19 @@ static int intelfb_create(struct drm_fb_helper *helper,
|
||||||
info->fbops = &intelfb_ops;
|
info->fbops = &intelfb_ops;
|
||||||
|
|
||||||
/* setup aperture base/size for vesafb takeover */
|
/* setup aperture base/size for vesafb takeover */
|
||||||
|
obj = intel_fb_obj(&intel_fb->base);
|
||||||
|
if (i915_gem_object_is_lmem(obj)) {
|
||||||
|
struct intel_memory_region *mem = obj->mm.region;
|
||||||
|
|
||||||
|
info->apertures->ranges[0].base = mem->io_start;
|
||||||
|
info->apertures->ranges[0].size = mem->total;
|
||||||
|
|
||||||
|
/* 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));
|
||||||
|
info->fix.smem_len = obj->base.size;
|
||||||
|
} else {
|
||||||
info->apertures->ranges[0].base = ggtt->gmadr.start;
|
info->apertures->ranges[0].base = ggtt->gmadr.start;
|
||||||
info->apertures->ranges[0].size = ggtt->mappable_end;
|
info->apertures->ranges[0].size = ggtt->mappable_end;
|
||||||
|
|
||||||
|
@ -239,6 +255,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
|
||||||
info->fix.smem_start =
|
info->fix.smem_start =
|
||||||
(unsigned long)(ggtt->gmadr.start + vma->node.start);
|
(unsigned long)(ggtt->gmadr.start + vma->node.start);
|
||||||
info->fix.smem_len = vma->node.size;
|
info->fix.smem_len = vma->node.size;
|
||||||
|
}
|
||||||
|
|
||||||
vaddr = i915_vma_pin_iomap(vma);
|
vaddr = i915_vma_pin_iomap(vma);
|
||||||
if (IS_ERR(vaddr)) {
|
if (IS_ERR(vaddr)) {
|
||||||
|
|
Loading…
Reference in a new issue