[openchrome-devel] drm-openchrome: Branch 'drm-next-4.20' - 3 commits - drivers/gpu/drm

Kevin Brace kevinbrace at kemper.freedesktop.org
Fri Oct 12 20:00:28 UTC 2018


 drivers/gpu/drm/openchrome/openchrome_drv.c |   16 +++++++++++-
 drivers/gpu/drm/openchrome/openchrome_drv.h |    8 +++---
 drivers/gpu/drm/openchrome/openchrome_fb.c  |   37 +++++++++++++++++++++++++++-
 drivers/gpu/drm/openchrome/openchrome_ttm.c |   15 -----------
 4 files changed, 56 insertions(+), 20 deletions(-)

New commits:
commit fc6b318ed29de6c3361ca286014b54734bac71df
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Fri Oct 12 12:59:28 2018 -0700

    drm/openchrome: Version bumped to 3.0.88
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index b5a7e1c99cfb..312f659efb63 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -31,11 +31,11 @@
 #define DRIVER_AUTHOR		"OpenChrome Project"
 #define DRIVER_NAME		"openchrome"
 #define DRIVER_DESC		"OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE		"20181011"
+#define DRIVER_DATE		"20181012"
 
 #define DRIVER_MAJOR		3
 #define DRIVER_MINOR		0
-#define DRIVER_PATCHLEVEL	87
+#define DRIVER_PATCHLEVEL	88
 #include <linux/module.h>
 
 #include "ttm/ttm_bo_api.h"
commit e7297defa29aabe360208400407e636e2617195c
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Fri Oct 12 12:55:29 2018 -0700

    drm/openchrome: Change how VRAM is mapped and unmapped
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.c b/drivers/gpu/drm/openchrome/openchrome_drv.c
index df6fbe355420..505e546d7375 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.c
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.c
@@ -447,6 +447,15 @@ static int via_device_init(struct via_device *dev_priv)
 		goto exit;
 	}
 
+	/*
+	 * Map VRAM.
+	 */
+	ret = openchrome_vram_init(dev_priv);
+	if (ret) {
+		DRM_ERROR("Failed to initialize video RAM.\n");
+		goto exit;
+	}
+
 	ret = openchrome_mmio_init(dev_priv);
 	if (ret) {
 		DRM_ERROR("Failed to initialize MMIO.\n");
@@ -499,6 +508,11 @@ static void via_driver_unload(struct drm_device *dev)
 
 	via_mm_fini(dev);
 
+	/*
+	 * Unmap VRAM.
+	 */
+	openchrome_vram_fini(dev_priv);
+
 	openchrome_mmio_fini(dev_priv);
 
 #if IS_ENABLED(CONFIG_AGP)
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index d7622876e64e..b5a7e1c99cfb 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -330,6 +330,8 @@ extern int via_wait_irq(struct drm_device *dev, void *data,
 extern int via_wait_idle(struct via_device *dev_priv);
 
 extern int via_vram_detect(struct via_device *dev_priv);
+extern int openchrome_vram_init(struct via_device *dev_priv);
+extern void openchrome_vram_fini(struct via_device *dev_priv);
 
 extern int via_enable_vblank(struct drm_crtc *crtc);
 extern void via_disable_vblank(struct drm_crtc *crtc);
diff --git a/drivers/gpu/drm/openchrome/openchrome_fb.c b/drivers/gpu/drm/openchrome/openchrome_fb.c
index 9a6382eb7002..18e4a3bcf202 100644
--- a/drivers/gpu/drm/openchrome/openchrome_fb.c
+++ b/drivers/gpu/drm/openchrome/openchrome_fb.c
@@ -911,6 +911,41 @@ out_err:
 	return ret;
 }
 
+int openchrome_vram_init(struct via_device *dev_priv)
+{
+	int ret = 0;
+
+	DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+	/* Add an MTRR for the video RAM. */
+	dev_priv->vram_mtrr = arch_phys_wc_add(dev_priv->vram_start,
+						dev_priv->vram_size);
+
+	DRM_INFO("VIA Technologies Chrome IGP VRAM "
+			"Physical Address: 0x%08llx\n",
+			dev_priv->vram_start);
+	DRM_INFO("VIA Technologies Chrome IGP VRAM "
+			"Size: %llu\n",
+			(unsigned long long) dev_priv->vram_size >> 20);
+
+	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+	return ret;
+}
+
+void openchrome_vram_fini(struct via_device *dev_priv)
+{
+	DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+	if (dev_priv->vram_mtrr) {
+		arch_phys_wc_del(dev_priv->vram_mtrr);
+		arch_io_free_memtype_wc(dev_priv->vram_start,
+					dev_priv->vram_size);
+		dev_priv->vram_mtrr = 0;
+	}
+
+	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+}
+
 static int
 via_user_framebuffer_create_handle(struct drm_framebuffer *fb,
 					struct drm_file *file_priv,
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index 29ccfd9e1ff0..b9d449a99e32 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -612,14 +612,6 @@ int via_mm_init(struct via_device *dev_priv)
 		goto exit;
 	}
 
-	/* Add an MTRR for the video RAM. */
-	dev_priv->vram_mtrr = arch_phys_wc_add(dev_priv->vram_start,
-						dev_priv->vram_size);
-
-	DRM_INFO("Mapped %llu MB of video RAM at physical "
-		"address 0x%08llx.\n",
-		(unsigned long long) dev_priv->vram_size >> 20,
-		dev_priv->vram_start);
 exit:
 	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
 	return ret;
@@ -637,13 +629,6 @@ void via_mm_fini(struct drm_device *dev)
 				&dev_priv->ttm.bo_global_ref,
 				&dev_priv->ttm.bdev);
 
-	/* mtrr delete the vram */
-	if (dev_priv->vram_mtrr >= 0) {
-		arch_phys_wc_del(dev_priv->vram_mtrr);
-	}
-
-	dev_priv->vram_mtrr = 0;
-
 	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
 }
 
commit 12b07c52087e59fdcb90a408ed910160a1de45c4
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Fri Oct 12 12:45:09 2018 -0700

    drm/openchrome: Rename via_vram_init to via_vram_detect
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.c b/drivers/gpu/drm/openchrome/openchrome_drv.c
index d5899ed20506..df6fbe355420 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.c
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.c
@@ -441,9 +441,9 @@ static int via_device_init(struct via_device *dev_priv)
 
 	openchrome_flag_init(dev_priv);
 
-	ret = via_vram_init(dev_priv);
+	ret = via_vram_detect(dev_priv);
 	if (ret) {
-		DRM_ERROR("Failed to initialize video RAM.\n");
+		DRM_ERROR("Failed to detect video RAM.\n");
 		goto exit;
 	}
 
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index 5bde11a83947..d7622876e64e 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -329,7 +329,7 @@ extern int via_wait_irq(struct drm_device *dev, void *data,
 			struct drm_file *file_priv);
 extern int via_wait_idle(struct via_device *dev_priv);
 
-extern int via_vram_init(struct via_device *dev_priv);
+extern int via_vram_detect(struct via_device *dev_priv);
 
 extern int via_enable_vblank(struct drm_crtc *crtc);
 extern void via_disable_vblank(struct drm_crtc *crtc);
diff --git a/drivers/gpu/drm/openchrome/openchrome_fb.c b/drivers/gpu/drm/openchrome/openchrome_fb.c
index ca122c71535f..9a6382eb7002 100644
--- a/drivers/gpu/drm/openchrome/openchrome_fb.c
+++ b/drivers/gpu/drm/openchrome/openchrome_fb.c
@@ -688,7 +688,7 @@ vx900_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
 	return ret;
 }
 
-int via_vram_init(struct via_device *dev_priv)
+int via_vram_detect(struct via_device *dev_priv)
 {
 	struct drm_device *dev = dev_priv->dev;
 	struct pci_dev *bridge = NULL;


More information about the openchrome-devel mailing list