Skip to content

Commit

Permalink
drm/i915 (FreeBSD): Use info->fix.smem_* to register fictitious mem…
Browse files Browse the repository at this point in the history
… range

[Why]
When the code was adapted to use the new vt_drmfb integration, the i915
driver continued to use the values that used to be stored in
`info->apertures->ranges[0]`.

However they might be incorrect and in fact zero.

[How]
Instead, use the `info->fix.smem_*` values to register the fictitious
range. These are the values by vt_drmfb later.
  • Loading branch information
dumbbell committed Feb 2, 2025
1 parent 4d55c8e commit a0088f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
22 changes: 6 additions & 16 deletions drivers/gpu/drm/i915/display/intel_fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,22 +288,12 @@ static int intelfb_create(struct drm_fb_helper *helper,
if (i915_gem_object_is_lmem(obj)) {
struct intel_memory_region *mem = obj->mm.region;

#ifdef __FreeBSD__
info->aperture_base = mem->io_start;
info->aperture_size = mem->io_size;
#endif

/* 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 {
#ifdef __FreeBSD__
info->aperture_base = ggtt->gmadr.start;
info->aperture_size = ggtt->mappable_end;
#endif

/* Our framebuffer is the entirety of fbdev's system memory */
info->fix.smem_start =
(unsigned long)(ggtt->gmadr.start + i915_ggtt_offset(vma));
Expand All @@ -313,18 +303,18 @@ static int intelfb_create(struct drm_fb_helper *helper,
#ifdef __FreeBSD__
/*
* After the if() above, we can register the fictitious memory range
* based on the info->apertures->ranges[0] values.
* based on the info->fix.smem_* values.
*
* This was handled in register_framebuffer() in the past, also based
* on the values of info->apertures->ranges[0]. However, the `amdgpu`
* This was handled in register_framebuffer() in the past, but based on
* the values of info->apertures->ranges[0]. However, the `amdgpu`
* driver stopped setting them when it got rid of its specific
* framebuffer initialization to use the generic drm_fb_helper code.
*
* We can't do this in register_framebuffer() anymore because the
* values passed to register_fictitious_range() below are unavailable
* from a generic structure set by both drivers.
*/
register_fictitious_range(info->aperture_base, info->aperture_size);
register_fictitious_range(info->fix.smem_start, info->fix.smem_len);
#endif

for_i915_gem_ww(&ww, ret, false) {
Expand Down Expand Up @@ -401,8 +391,8 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)

#ifdef __FreeBSD__
unregister_fictitious_range(
ifbdev->helper.info->aperture_base,
ifbdev->helper.info->aperture_size);
ifbdev->helper.info->fix.smem_start,
ifbdev->helper.info->fix.smem_len);
#endif

drm_fb_helper_fini(&ifbdev->helper);
Expand Down
4 changes: 0 additions & 4 deletions linuxkpi/gplv2/include/linux/fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ struct linux_fb_info {
struct fb_info fbio;
device_t fb_bsddev;
struct task fb_mode_task;

/* i915 fictitious pages area */
resource_size_t aperture_base;
resource_size_t aperture_size;
#endif
} __aligned(sizeof(long));

Expand Down

0 comments on commit a0088f2

Please sign in to comment.