[Openchrome-devel] drm-openchrome: 4 commits - drivers/gpu/drm
Kevin Brace
kevinbrace at kemper.freedesktop.org
Mon Jan 23 22:50:56 UTC 2017
drivers/gpu/drm/via/via_drv.c | 12 +++----
drivers/gpu/drm/via/via_drv.h | 10 +++---
drivers/gpu/drm/via/via_fb.c | 68 ++++++++++++++++++++----------------------
drivers/gpu/drm/via/via_ttm.c | 20 +++++++++++-
4 files changed, 63 insertions(+), 47 deletions(-)
New commits:
commit 732f0f6a0771f3ac499f52643117c1caf96b4b03
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 23 16:50:01 2017 -0600
Version bumped to 3.0.18
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/via/via_drv.h b/drivers/gpu/drm/via/via_drv.h
index 7f4fa6d..2c8f0ac 100644
--- a/drivers/gpu/drm/via/via_drv.h
+++ b/drivers/gpu/drm/via/via_drv.h
@@ -30,11 +30,11 @@
#define DRIVER_AUTHOR "The OpenChrome Project"
#define DRIVER_NAME "via"
#define DRIVER_DESC "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE "20170120"
+#define DRIVER_DATE "20170123"
#define DRIVER_MAJOR 3
#define DRIVER_MINOR 0
-#define DRIVER_PATCHLEVEL 17
+#define DRIVER_PATCHLEVEL 18
#include <linux/module.h>
commit 3ed7ee6d6db066c564ceb0dd220e8d4764558479
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 23 16:49:13 2017 -0600
Moving VRAM memory mapping code
Also made small improvements to via_detect_vram function
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c
index eb9c21a..e9f8fb5 100644
--- a/drivers/gpu/drm/via/via_drv.c
+++ b/drivers/gpu/drm/via/via_drv.c
@@ -331,18 +331,18 @@ via_driver_load(struct drm_device *dev, unsigned long chipset)
via_init_command_verifier();
+ ret = via_detect_vram(dev);
+ if (ret) {
+ DRM_ERROR("Failed to initialize video RAM.\n");
+ goto init_error;
+ }
+
ret = via_mm_init(dev_priv);
if (ret) {
DRM_ERROR("Failed to initialize TTM.\n");
goto init_error;
}
- ret = via_detect_vram(dev);
- if (ret) {
- DRM_ERROR("Failed to initialize video RAM.\n");
- goto init_error;
- }
-
ret = via_mmio_setup(dev);
if (ret) {
DRM_ERROR("Failed to map Chrome IGP MMIO region.\n");
diff --git a/drivers/gpu/drm/via/via_fb.c b/drivers/gpu/drm/via/via_fb.c
index 24a4af6..b48808a 100644
--- a/drivers/gpu/drm/via/via_fb.c
+++ b/drivers/gpu/drm/via/via_fb.c
@@ -697,7 +697,7 @@ int via_detect_vram(struct drm_device *dev)
struct via_device *dev_priv = dev->dev_private;
struct pci_dev *bridge = NULL;
struct pci_dev *fn3 = NULL;
- char *name = "Unknown";
+ char *name = "unknown";
struct pci_bus *bus;
u8 size;
int ret = 0;
@@ -741,7 +741,7 @@ int via_detect_vram(struct drm_device *dev)
dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
break;
- /* KM400/KN400 */
+ /* KM400 / KN400 / KM400A / KN400A */
case PCI_DEVICE_ID_VIA_8378_0:
ret = km400_mem_type(dev_priv, bridge);
@@ -761,7 +761,7 @@ int via_detect_vram(struct drm_device *dev)
dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
break;
- /* K8M800/K8N800 */
+ /* K8M800 / K8N800 */
case PCI_DEVICE_ID_VIA_8380_0:
/* K8M890 */
case PCI_DEVICE_ID_VIA_VT3336:
@@ -778,7 +778,7 @@ int via_detect_vram(struct drm_device *dev)
goto out_err;
break;
- /* CN400/PM800/PM880 */
+ /* CN400 / PM800 / PM880 */
case PCI_DEVICE_ID_VIA_PX8X0_0:
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
@@ -790,9 +790,9 @@ int via_detect_vram(struct drm_device *dev)
goto out_err;
break;
- /* CN700/VN800/P4M800CE/P4M800Pro */
+ /* P4M800CE / P4M800 Pro / VN800 / CN700 */
case PCI_DEVICE_ID_VIA_P4M800CE:
- /* P4M900/VN896/CN896 */
+ /* P4M900 / VN896 / CN896 */
case PCI_DEVICE_ID_VIA_VT3364:
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
@@ -807,13 +807,13 @@ int via_detect_vram(struct drm_device *dev)
goto out_err;
break;
- /* CX700/VX700 */
+ /* CX700 / VX700 */
case PCI_DEVICE_ID_VIA_VT3324:
- /* P4M890 */
+ /* P4M890 / VN890 */
case PCI_DEVICE_ID_VIA_P4M890:
- /* VX800 */
+ /* VX800 / VX820 */
case PCI_DEVICE_ID_VIA_VT3353:
- /* VX855 */
+ /* VX855 / VX875 */
case PCI_DEVICE_ID_VIA_VT3409:
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
@@ -840,7 +840,7 @@ int via_detect_vram(struct drm_device *dev)
break;
default:
- DRM_ERROR("Unknown north bridge device 0x%04x.\n", bridge->device);
+ DRM_ERROR("Unknown north bridge device: 0x%04x\n", bridge->device);
goto out_err;
}
@@ -903,15 +903,8 @@ int via_detect_vram(struct drm_device *dev)
break;
}
- /* Add an MTRR for the VRAM */
- dev_priv->vram_mtrr = arch_phys_wc_add(dev_priv->vram_start, dev_priv->vram_size);
-
- ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM, dev_priv->vram_size >> PAGE_SHIFT);
- if (!ret) {
- DRM_INFO("Detected %llu MB of %s video RAM at physical address 0x%08llx.\n",
- (unsigned long long) dev_priv->vram_size >> 20, name, dev_priv->vram_start);
- }
-
+ DRM_INFO("Found %s video RAM.\n",
+ name);
out_err:
if (bridge)
pci_dev_put(bridge);
diff --git a/drivers/gpu/drm/via/via_ttm.c b/drivers/gpu/drm/via/via_ttm.c
index a4c82ed..8cd1f72 100644
--- a/drivers/gpu/drm/via/via_ttm.c
+++ b/drivers/gpu/drm/via/via_ttm.c
@@ -562,8 +562,10 @@ int via_mm_init(struct via_device *dev_priv)
DRM_DEBUG("Entered via_mm_init.\n");
ret = via_ttm_global_init(dev_priv);
- if (ret)
- return ret;
+ if (ret) {
+ DRM_ERROR("Failed to initialise TTM: %d\n", ret);
+ goto exit;
+ }
dev_priv->bdev.dev_mapping = dev->anon_inode->i_mapping;
@@ -575,8 +577,22 @@ int via_mm_init(struct via_device *dev_priv)
false);
if (ret) {
DRM_ERROR("Error initialising bo driver: %d\n", ret);
+ goto exit;
+ }
+
+ ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM, dev_priv->vram_size >> PAGE_SHIFT);
+ if (ret) {
+ DRM_ERROR("Failed to map video RAM: %d\n", ret);
+ goto exit;
}
+ /* Add an MTRR for the VRAM. */
+ 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("Exiting via_mm_init.\n");
return ret;
}
commit a76a193b203ff17db05fca95e53253d94c5b2923
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 23 16:47:06 2017 -0600
Initializing ret variable inside via_detect_vram
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/via/via_fb.c b/drivers/gpu/drm/via/via_fb.c
index 51cbd3f..24a4af6 100644
--- a/drivers/gpu/drm/via/via_fb.c
+++ b/drivers/gpu/drm/via/via_fb.c
@@ -700,7 +700,7 @@ int via_detect_vram(struct drm_device *dev)
char *name = "Unknown";
struct pci_bus *bus;
u8 size;
- int ret;
+ int ret = 0;
DRM_DEBUG("Entered via_detect_vram.\n");
commit 853c34c9d30ca388396779e20a3afe8c0d9185e3
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 23 16:46:13 2017 -0600
Made improvements to via_detect_vram
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/via/via_drv.h b/drivers/gpu/drm/via/via_drv.h
index f98ef6d..7f4fa6d 100644
--- a/drivers/gpu/drm/via/via_drv.h
+++ b/drivers/gpu/drm/via/via_drv.h
@@ -132,8 +132,10 @@ struct via_device {
struct ttm_bo_kmap_obj vq;
struct drm_fb_helper *helper;
- int vram_mtrr;
- u8 vram_type;
+ u8 vram_type;
+ unsigned long long vram_start;
+ unsigned int vram_size;
+ int vram_mtrr;
struct via_state pm_cache;
diff --git a/drivers/gpu/drm/via/via_fb.c b/drivers/gpu/drm/via/via_fb.c
index ae93b8b..51cbd3f 100644
--- a/drivers/gpu/drm/via/via_fb.c
+++ b/drivers/gpu/drm/via/via_fb.c
@@ -695,14 +695,16 @@ vx900_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
int via_detect_vram(struct drm_device *dev)
{
struct via_device *dev_priv = dev->dev_private;
- struct pci_dev *bridge = NULL, *fn3 = NULL;
- unsigned long long vram_start;
- int vram_size = 0, ret = 0;
+ struct pci_dev *bridge = NULL;
+ struct pci_dev *fn3 = NULL;
char *name = "Unknown";
struct pci_bus *bus;
u8 size;
+ int ret;
- bus = pci_find_bus(0, 0);
+ DRM_DEBUG("Entered via_detect_vram.\n");
+
+ bus = pci_find_bus(0, 0);
if (bus == NULL) {
ret = -EINVAL;
goto out_err;
@@ -723,7 +725,7 @@ int via_detect_vram(struct drm_device *dev)
DRM_ERROR("No function 3 on host bridge...\n");
goto out_err;
}
- vram_start = pci_resource_start(dev->pdev, 0);
+ dev_priv->vram_start = pci_resource_start(dev->pdev, 0);
switch (bridge->device) {
@@ -736,7 +738,7 @@ int via_detect_vram(struct drm_device *dev)
ret = pci_read_config_byte(bridge, 0xE1, &size);
if (ret)
goto out_err;
- vram_size = (1 << ((size & 0x70) >> 4)) << 20;
+ dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
break;
/* KM400/KN400 */
@@ -746,7 +748,7 @@ int via_detect_vram(struct drm_device *dev)
ret = pci_read_config_byte(bridge, 0xE1, &size);
if (ret)
goto out_err;
- vram_size = (1 << ((size & 0x70) >> 4)) << 20;
+ dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
break;
/* P4M800 */
@@ -756,7 +758,7 @@ int via_detect_vram(struct drm_device *dev)
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
goto out_err;
- vram_size = (1 << ((size & 0x70) >> 4)) << 20;
+ dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
break;
/* K8M800/K8N800 */
@@ -766,10 +768,10 @@ int via_detect_vram(struct drm_device *dev)
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
goto out_err;
- vram_size = (1 << ((size & 0x70) >> 4)) << 20;
+ dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
if (bridge->device == PCI_DEVICE_ID_VIA_VT3336)
- vram_size <<= 2;
+ dev_priv->vram_size <<= 2;
ret = km8xx_mem_type(dev_priv);
if (ret)
@@ -781,7 +783,7 @@ int via_detect_vram(struct drm_device *dev)
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
goto out_err;
- vram_size = (1 << ((size & 0x70) >> 4)) << 20;
+ dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
ret = cn400_mem_type(dev_priv, bus, fn3);
if (ret)
@@ -795,10 +797,10 @@ int via_detect_vram(struct drm_device *dev)
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
goto out_err;
- vram_size = (1 << ((size & 0x70) >> 4)) << 20;
+ dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
if (bridge->device != PCI_DEVICE_ID_VIA_P4M800CE)
- vram_size <<= 2;
+ dev_priv->vram_size <<= 2;
ret = cn700_mem_type(dev_priv, fn3);
if (ret)
@@ -816,7 +818,7 @@ int via_detect_vram(struct drm_device *dev)
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
goto out_err;
- vram_size = (1 << ((size & 0x70) >> 4)) << 22;
+ dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 22;
ret = cx700_mem_type(dev_priv, fn3);
if (ret)
@@ -825,12 +827,12 @@ int via_detect_vram(struct drm_device *dev)
/* VX900 */
case PCI_DEVICE_ID_VIA_VT3410:
- vram_start = pci_resource_start(dev->pdev, 2);
+ dev_priv->vram_start = pci_resource_start(dev->pdev, 2);
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
goto out_err;
- vram_size = (1 << ((size & 0x70) >> 4)) << 22;
+ dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 22;
ret = vx900_mem_type(dev_priv, fn3);
if (ret)
@@ -838,7 +840,7 @@ int via_detect_vram(struct drm_device *dev)
break;
default:
- DRM_ERROR("Unknown North Bridge device 0x%04x.\n", bridge->device);
+ DRM_ERROR("Unknown north bridge device 0x%04x.\n", bridge->device);
goto out_err;
}
@@ -902,18 +904,21 @@ int via_detect_vram(struct drm_device *dev)
}
/* Add an MTRR for the VRAM */
- dev_priv->vram_mtrr = arch_phys_wc_add(vram_start, vram_size);
+ dev_priv->vram_mtrr = arch_phys_wc_add(dev_priv->vram_start, dev_priv->vram_size);
- ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM, vram_size >> PAGE_SHIFT);
+ ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM, dev_priv->vram_size >> PAGE_SHIFT);
if (!ret) {
- DRM_INFO("Detected %llu MB of %s Video RAM at physical address 0x%08llx.\n",
- (unsigned long long) vram_size >> 20, name, vram_start);
+ DRM_INFO("Detected %llu MB of %s video RAM at physical address 0x%08llx.\n",
+ (unsigned long long) dev_priv->vram_size >> 20, name, dev_priv->vram_start);
}
+
out_err:
if (bridge)
pci_dev_put(bridge);
if (fn3)
pci_dev_put(fn3);
+
+ DRM_DEBUG("Exiting via_detect_vram.\n");
return ret;
}
More information about the Openchrome-devel
mailing list