[PATCH 05/14] drm/mgag200: Initialize data needed to map fbdev memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Egbert Eich <eich@xxxxxxx>

Due to a missing initialization there was no way to map fbdev memory.
Thus for example using the Xserver with the fbdev driver failed.
This fix adds initialization for fix.smem_start and fix.smem_len
in the fb_info structure, which fixes this problem.

Signed-off-by: Egbert Eich <eich@xxxxxxx>
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
 drivers/gpu/drm/mgag200/mgag200_drv.h  | 1 +
 drivers/gpu/drm/mgag200/mgag200_fb.c   | 7 +++++++
 drivers/gpu/drm/mgag200/mgag200_mode.c | 3 ++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h
index c88b6ec88dd2..a724e1931e87 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.h
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.h
@@ -250,6 +250,7 @@ void mgag200_modeset_fini(struct mga_device *mdev);
 				/* mgag200_fb.c */
 int mgag200_fbdev_init(struct mga_device *mdev);
 void mgag200_fbdev_fini(struct mga_device *mdev);
+void mgag200_fbdev_set_base(struct mga_device *mdev, unsigned long gpu_addr);
 
 				/* mgag200_main.c */
 int mgag200_framebuffer_init(struct drm_device *dev,
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 5d3b1fac906f..bb9a4c409dc0 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -315,3 +315,10 @@ void mgag200_fbdev_fini(struct mga_device *mdev)
 
 	mga_fbdev_destroy(mdev->dev, mdev->mfbdev);
 }
+
+void mgag200_fbdev_set_base(struct mga_device *mdev, unsigned long gpu_addr)
+{
+	mdev->mfbdev->helper.fbdev->fix.smem_start =
+		mdev->mfbdev->helper.fbdev->apertures->ranges[0].base + gpu_addr;
+	mdev->mfbdev->helper.fbdev->fix.smem_len = mdev->mc.vram_size - gpu_addr;
+}
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index ca5a6df98fa3..afec8f190ee3 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -895,7 +895,8 @@ static int mga_crtc_do_set_base(struct drm_crtc *crtc,
 		ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
 		if (ret)
 			DRM_ERROR("failed to kmap fbcon\n");
-
+		else
+			mgag200_fbdev_set_base(mdev, gpu_addr);
 	}
 	mgag200_bo_unreserve(bo);
 
-- 
2.13.2

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux