diff mbox series

[v2] drm/i915: Disregard drm_mode_config.fb_base

Message ID 20190813182112.23227-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [v2] drm/i915: Disregard drm_mode_config.fb_base | expand

Commit Message

Chris Wilson Aug. 13, 2019, 6:21 p.m. UTC
The fb_base is only used for communicating the GTT BAR from one piece of
the display code (kms setup) to another (fbdev). What is required in the
fbdev is just the aperture address which should be derived from the
bo we allocate for the framebuffer directly.

The same appears true for drm/; it is not used by the core or the uAPI,
it is merely for conveniently passing a device address from bit of
display management code to another.

v2: Note that since we only expose enough of a system map to cover our
single framebuffer, the screen_base/size and the smem are one and the
same.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 3 ---
 drivers/gpu/drm/i915/display/intel_fbdev.c   | 9 +++++----
 2 files changed, 5 insertions(+), 7 deletions(-)

Comments

Srivatsa, Anusha Aug. 13, 2019, 11:41 p.m. UTC | #1
> -----Original Message-----
> From: Chris Wilson <chris@chris-wilson.co.uk>
> Sent: Tuesday, August 13, 2019 11:21 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: Chris Wilson <chris@chris-wilson.co.uk>; Daniel Vetter
> <daniel.vetter@ffwll.ch>; Maarten Lankhorst
> <maarten.lankhorst@linux.intel.com>; Srivatsa, Anusha
> <anusha.srivatsa@intel.com>
> Subject: [PATCH v2] drm/i915: Disregard drm_mode_config.fb_base
> 
> The fb_base is only used for communicating the GTT BAR from one piece of the
> display code (kms setup) to another (fbdev). What is required in the fbdev is just
> the aperture address which should be derived from the bo we allocate for the
> framebuffer directly.
> 
> The same appears true for drm/; it is not used by the core or the uAPI, it is
> merely for conveniently passing a device address from bit of display
> management code to another.
> 
> v2: Note that since we only expose enough of a system map to cover our single
> framebuffer, the screen_base/size and the smem are one and the same.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>

Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 3 ---
>  drivers/gpu/drm/i915/display/intel_fbdev.c   | 9 +++++----
>  2 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> b/drivers/gpu/drm/i915/display/intel_display.c
> index c9cf4bc7ee10..776d13101156 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16122,7 +16122,6 @@ static int intel_initial_commit(struct drm_device
> *dev)  int intel_modeset_init(struct drm_device *dev)  {
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> -	struct i915_ggtt *ggtt = &dev_priv->ggtt;
>  	enum pipe pipe;
>  	struct intel_crtc *crtc;
>  	int ret;
> @@ -16202,8 +16201,6 @@ int intel_modeset_init(struct drm_device *dev)
>  		dev->mode_config.cursor_height = 256;
>  	}
> 
> -	dev->mode_config.fb_base = ggtt->gmadr.start;
> -
>  	DRM_DEBUG_KMS("%d display pipe%s available.\n",
>  		      INTEL_INFO(dev_priv)->num_pipes,
>  		      INTEL_INFO(dev_priv)->num_pipes > 1 ? "s" : ""); diff --git
> a/drivers/gpu/drm/i915/display/intel_fbdev.c
> b/drivers/gpu/drm/i915/display/intel_fbdev.c
> index 5e7cc5a6ac7f..d59eee5c5d9c 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> @@ -232,12 +232,9 @@ static int intelfb_create(struct drm_fb_helper *helper,
>  	info->fbops = &intelfb_ops;
> 
>  	/* setup aperture base/size for vesafb takeover */
> -	info->apertures->ranges[0].base = dev->mode_config.fb_base;
> +	info->apertures->ranges[0].base = ggtt->gmadr.start;
>  	info->apertures->ranges[0].size = ggtt->mappable_end;
> 
> -	info->fix.smem_start = dev->mode_config.fb_base +
> i915_ggtt_offset(vma);
> -	info->fix.smem_len = vma->node.size;
> -
>  	vaddr = i915_vma_pin_iomap(vma);
>  	if (IS_ERR(vaddr)) {
>  		DRM_ERROR("Failed to remap framebuffer into virtual
> memory\n"); @@ -247,6 +244,10 @@ static int intelfb_create(struct
> drm_fb_helper *helper,
>  	info->screen_base = vaddr;
>  	info->screen_size = vma->node.size;
> 
> +	/* Our framebuffer is the entirety of fbdev's system memory */
> +	info->fix.smem_start = (unsigned long)info->screen_base;
> +	info->fix.smem_len = info->screen_size;
> +
>  	drm_fb_helper_fill_info(info, &ifbdev->helper, sizes);
> 
>  	/* If the object is shmemfs backed, it will have given us zeroed pages.
> --
> 2.23.0.rc1
Chris Wilson Aug. 14, 2019, 8:43 a.m. UTC | #2
Quoting Srivatsa, Anusha (2019-08-14 00:41:15)
> 
> 
> > -----Original Message-----
> > From: Chris Wilson <chris@chris-wilson.co.uk>
> > Sent: Tuesday, August 13, 2019 11:21 AM
> > To: intel-gfx@lists.freedesktop.org
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>; Daniel Vetter
> > <daniel.vetter@ffwll.ch>; Maarten Lankhorst
> > <maarten.lankhorst@linux.intel.com>; Srivatsa, Anusha
> > <anusha.srivatsa@intel.com>
> > Subject: [PATCH v2] drm/i915: Disregard drm_mode_config.fb_base
> > 
> > The fb_base is only used for communicating the GTT BAR from one piece of the
> > display code (kms setup) to another (fbdev). What is required in the fbdev is just
> > the aperture address which should be derived from the bo we allocate for the
> > framebuffer directly.
> > 
> > The same appears true for drm/; it is not used by the core or the uAPI, it is
> > merely for conveniently passing a device address from bit of display
> > management code to another.
> > 
> > v2: Note that since we only expose enough of a system map to cover our single
> > framebuffer, the screen_base/size and the smem are one and the same.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
> 
> Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>

Plonked it in as I hope it stands it stead as a nice little
simplification.
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index c9cf4bc7ee10..776d13101156 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16122,7 +16122,6 @@  static int intel_initial_commit(struct drm_device *dev)
 int intel_modeset_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	struct i915_ggtt *ggtt = &dev_priv->ggtt;
 	enum pipe pipe;
 	struct intel_crtc *crtc;
 	int ret;
@@ -16202,8 +16201,6 @@  int intel_modeset_init(struct drm_device *dev)
 		dev->mode_config.cursor_height = 256;
 	}
 
-	dev->mode_config.fb_base = ggtt->gmadr.start;
-
 	DRM_DEBUG_KMS("%d display pipe%s available.\n",
 		      INTEL_INFO(dev_priv)->num_pipes,
 		      INTEL_INFO(dev_priv)->num_pipes > 1 ? "s" : "");
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 5e7cc5a6ac7f..d59eee5c5d9c 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -232,12 +232,9 @@  static int intelfb_create(struct drm_fb_helper *helper,
 	info->fbops = &intelfb_ops;
 
 	/* setup aperture base/size for vesafb takeover */
-	info->apertures->ranges[0].base = dev->mode_config.fb_base;
+	info->apertures->ranges[0].base = ggtt->gmadr.start;
 	info->apertures->ranges[0].size = ggtt->mappable_end;
 
-	info->fix.smem_start = dev->mode_config.fb_base + i915_ggtt_offset(vma);
-	info->fix.smem_len = vma->node.size;
-
 	vaddr = i915_vma_pin_iomap(vma);
 	if (IS_ERR(vaddr)) {
 		DRM_ERROR("Failed to remap framebuffer into virtual memory\n");
@@ -247,6 +244,10 @@  static int intelfb_create(struct drm_fb_helper *helper,
 	info->screen_base = vaddr;
 	info->screen_size = vma->node.size;
 
+	/* Our framebuffer is the entirety of fbdev's system memory */
+	info->fix.smem_start = (unsigned long)info->screen_base;
+	info->fix.smem_len = info->screen_size;
+
 	drm_fb_helper_fill_info(info, &ifbdev->helper, sizes);
 
 	/* If the object is shmemfs backed, it will have given us zeroed pages.