[openchrome-devel] drm-openchrome: Branch 'drm-next-5.10' - 21 commits - drivers/gpu/drm
Kevin Brace
kevinbrace at kemper.freedesktop.org
Tue Oct 27 23:43:04 UTC 2020
drivers/gpu/drm/openchrome/openchrome_crtc.c | 2
drivers/gpu/drm/openchrome/openchrome_drv.c | 2
drivers/gpu/drm/openchrome/openchrome_drv.h | 10 +-
drivers/gpu/drm/openchrome/openchrome_fb.c | 23 +++---
drivers/gpu/drm/openchrome/openchrome_ioctl.c | 3
drivers/gpu/drm/openchrome/openchrome_object.c | 25 ++++---
drivers/gpu/drm/openchrome/openchrome_ttm.c | 85 +++++++++----------------
7 files changed, 67 insertions(+), 83 deletions(-)
New commits:
commit 84cc9003a62d5b6bac8006ba24d9ee2084b88f34
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 16:38:57 2020 -0700
drm/openchrome: Version bumped to 3.4.0
TTM discontinued TTM_PL_FLAG_SYSTEM, TTM_PL_FLAG_TT, and
TTM_PL_FLAG_VRAM placement flag macros. Since OpenChrome DDX was
passing them to OpenChrome DRM, there is now a uAPI breakage.
Instead, pass TTM placement macros. Increment the minor version
number to indicate a uAPI change.
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 3a6f3efbbc42..22b85efaefaa 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -60,11 +60,11 @@
#define DRIVER_MAJOR 3
-#define DRIVER_MINOR 3
-#define DRIVER_PATCHLEVEL 8
+#define DRIVER_MINOR 4
+#define DRIVER_PATCHLEVEL 0
#define DRIVER_NAME "openchrome"
#define DRIVER_DESC "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE "20200916"
+#define DRIVER_DATE "20201027"
#define DRIVER_AUTHOR "OpenChrome Project"
commit 7f3bee19fa33ca4b535a670d076b6a0c87b21498
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:42:34 2020 -0700
drm/ttm: remove available_caching
Based on commit 9c3006a (drm/ttm: remove available_caching).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_object.c b/drivers/gpu/drm/openchrome/openchrome_object.c
index c605234ef72f..24b421672a58 100644
--- a/drivers/gpu/drm/openchrome/openchrome_object.c
+++ b/drivers/gpu/drm/openchrome/openchrome_object.c
@@ -273,7 +273,6 @@ int openchrome_mm_init(struct openchrome_drm_private *dev_private)
* Initialize TTM range manager for VRAM management.
*/
ret = ttm_range_man_init(&dev_private->bdev, TTM_PL_VRAM,
- TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC,
false,
dev_private->vram_size >> PAGE_SHIFT);
if (ret) {
commit 8ad671b1372393a48a6699a41cf94e2622d3b7c0
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:42:26 2020 -0700
drm/ttm: remove default caching
Based on commit 0fe438c (drm/ttm: remove default caching).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_object.c b/drivers/gpu/drm/openchrome/openchrome_object.c
index da5a79607656..c605234ef72f 100644
--- a/drivers/gpu/drm/openchrome/openchrome_object.c
+++ b/drivers/gpu/drm/openchrome/openchrome_object.c
@@ -274,7 +274,6 @@ int openchrome_mm_init(struct openchrome_drm_private *dev_private)
*/
ret = ttm_range_man_init(&dev_private->bdev, TTM_PL_VRAM,
TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC,
- TTM_PL_FLAG_WC,
false,
dev_private->vram_size >> PAGE_SHIFT);
if (ret) {
commit 6fba8723e9ff19da66d6d7b415314a3b30df44a3
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:42:19 2020 -0700
drm/ttm: nuke memory type flags
Based on commit 48e07c2 (drm/ttm: nuke memory type flags).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_crtc.c b/drivers/gpu/drm/openchrome/openchrome_crtc.c
index e42b98f906fe..b8499e21aa34 100644
--- a/drivers/gpu/drm/openchrome/openchrome_crtc.c
+++ b/drivers/gpu/drm/openchrome/openchrome_crtc.c
@@ -1704,7 +1704,7 @@ static int openchrome_crtc_mode_set_base(struct drm_crtc *crtc,
goto exit;
}
- ret = openchrome_bo_pin(bo, TTM_PL_FLAG_VRAM);
+ ret = openchrome_bo_pin(bo, TTM_PL_VRAM);
ttm_bo_unreserve(&bo->ttm_bo);
if (ret) {
DRM_DEBUG_KMS("Failed to pin FB.\n");
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.c b/drivers/gpu/drm/openchrome/openchrome_drv.c
index 7a106b50f572..86bb3cdd120f 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.c
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.c
@@ -97,7 +97,7 @@ static int openchrome_drm_driver_dumb_create(
&dev_private->bdev,
size,
ttm_bo_type_device,
- TTM_PL_FLAG_VRAM,
+ TTM_PL_VRAM,
false,
&bo);
if (ret) {
diff --git a/drivers/gpu/drm/openchrome/openchrome_fb.c b/drivers/gpu/drm/openchrome/openchrome_fb.c
index 94ad1900c695..e327e8f9b7da 100644
--- a/drivers/gpu/drm/openchrome/openchrome_fb.c
+++ b/drivers/gpu/drm/openchrome/openchrome_fb.c
@@ -185,7 +185,7 @@ openchrome_fb_probe(struct drm_fb_helper *helper,
&dev_private->bdev,
size,
ttm_bo_type_kernel,
- TTM_PL_FLAG_VRAM,
+ TTM_PL_VRAM,
true,
&openchrome_fb->bo);
if (ret) {
diff --git a/drivers/gpu/drm/openchrome/openchrome_ioctl.c b/drivers/gpu/drm/openchrome/openchrome_ioctl.c
index 15670ca57f46..b3693748ae4a 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ioctl.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ioctl.c
@@ -66,8 +66,7 @@ static int openchrome_gem_create_ioctl(struct drm_device *dev,
}
args->size = bo->ttm_bo.mem.size;
- args->domain = bo->ttm_bo.mem.placement &
- TTM_PL_MASK_MEM;
+ args->domain = bo->ttm_bo.mem.placement;
args->handle = handle;
args->offset = bo->ttm_bo.mem.start << PAGE_SHIFT;
exit:
diff --git a/drivers/gpu/drm/openchrome/openchrome_object.c b/drivers/gpu/drm/openchrome/openchrome_object.c
index 5cbd17524c67..da5a79607656 100644
--- a/drivers/gpu/drm/openchrome/openchrome_object.c
+++ b/drivers/gpu/drm/openchrome/openchrome_object.c
@@ -51,28 +51,28 @@ void openchrome_ttm_domain_to_placement(struct openchrome_bo *bo,
bo->placement.placement = bo->placements;
bo->placement.busy_placement = bo->placements;
- if (ttm_domain & TTM_PL_FLAG_SYSTEM) {
+ if (ttm_domain == TTM_PL_SYSTEM) {
bo->placements[i].fpfn = 0;
bo->placements[i].lpfn = 0;
- bo->placements[i].flags = TTM_PL_FLAG_CACHED |
- TTM_PL_FLAG_SYSTEM;
+ bo->placements[i].mem_type = TTM_PL_SYSTEM;
+ bo->placements[i].flags = TTM_PL_FLAG_CACHED;
i++;
}
- if (ttm_domain & TTM_PL_FLAG_TT) {
+ if (ttm_domain == TTM_PL_TT) {
bo->placements[i].fpfn = 0;
bo->placements[i].lpfn = 0;
- bo->placements[i].flags = TTM_PL_FLAG_CACHED |
- TTM_PL_FLAG_TT;
+ bo->placements[i].mem_type = TTM_PL_TT;
+ bo->placements[i].flags = TTM_PL_FLAG_CACHED;
i++;
}
- if (ttm_domain & TTM_PL_FLAG_VRAM) {
+ if (ttm_domain == TTM_PL_VRAM) {
bo->placements[i].fpfn = 0;
bo->placements[i].lpfn = 0;
+ bo->placements[i].mem_type = TTM_PL_VRAM;
bo->placements[i].flags = TTM_PL_FLAG_WC |
- TTM_PL_FLAG_UNCACHED |
- TTM_PL_FLAG_VRAM;
+ TTM_PL_FLAG_UNCACHED;
i++;
}
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index d42f436a28db..0ddb24828357 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -88,11 +88,11 @@ static void openchrome_bo_evict_flags(struct ttm_buffer_object *bo,
switch (bo->mem.mem_type) {
case TTM_PL_VRAM:
openchrome_ttm_domain_to_placement(driver_bo,
- TTM_PL_FLAG_VRAM);
+ TTM_PL_VRAM);
break;
default:
openchrome_ttm_domain_to_placement(driver_bo,
- TTM_PL_FLAG_SYSTEM);
+ TTM_PL_SYSTEM);
break;
}
commit af8d8e6a37bc09bfcadb46e4044898bf618b8db3
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:42:07 2020 -0700
drm/ttm: merge offset and base in ttm_bus_placement
Based on commit 54d04ea (drm/ttm: merge offset and base in
ttm_bus_placement).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_fb.c b/drivers/gpu/drm/openchrome/openchrome_fb.c
index 7e20a0726843..94ad1900c695 100644
--- a/drivers/gpu/drm/openchrome/openchrome_fb.c
+++ b/drivers/gpu/drm/openchrome/openchrome_fb.c
@@ -209,8 +209,8 @@ openchrome_fb_probe(struct drm_fb_helper *helper,
info->fbops = &via_fb_ops;
- info->fix.smem_start = openchrome_fb->bo->ttm_bo.mem.bus.base +
- openchrome_fb->bo->ttm_bo.mem.bus.offset;
+ info->fix.smem_start = openchrome_fb->bo->
+ ttm_bo.mem.bus.offset;
info->fix.smem_len = openchrome_fb->bo->ttm_bo.mem.num_pages <<
PAGE_SHIFT;
info->screen_base = ttm_kmap_obj_virtual(
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index 8541dd3593c2..d42f436a28db 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -123,8 +123,8 @@ static int openchrome_bo_io_mem_reserve(struct ttm_bo_device *bdev,
case TTM_PL_SYSTEM:
break;
case TTM_PL_VRAM:
- mem->bus.base = dev_private->vram_start;
- mem->bus.offset = mem->start << PAGE_SHIFT;
+ mem->bus.offset = dev_private->vram_start +
+ (mem->start << PAGE_SHIFT);
mem->bus.is_iomem = true;
break;
default:
commit 9955ca62a0afd4e132304d2d20c17f69bbf61032
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:39:01 2020 -0700
drm/ttm: init mem->bus in common code.
Based on commit 098754f (drm/ttm: init mem->bus in common code.).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index 7c6f77c38a79..8541dd3593c2 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -121,16 +121,9 @@ static int openchrome_bo_io_mem_reserve(struct ttm_bo_device *bdev,
switch (mem->mem_type) {
case TTM_PL_SYSTEM:
- mem->bus.addr = NULL;
- mem->bus.base = 0;
- mem->bus.size = mem->num_pages << PAGE_SHIFT;
- mem->bus.offset = 0;
- mem->bus.is_iomem = false;
break;
case TTM_PL_VRAM:
- mem->bus.addr = NULL;
mem->bus.base = dev_private->vram_start;
- mem->bus.size = mem->num_pages << PAGE_SHIFT;
mem->bus.offset = mem->start << PAGE_SHIFT;
mem->bus.is_iomem = true;
break;
commit b81adb8484ca0a47d2d054b79bc0e46c2105af62
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:38:38 2020 -0700
drm/ttm: rename ttm_mem_reg to ttm_resource.
Based on commit 2966141 (drm/ttm: rename ttm_mem_reg to ttm_resource.).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index b6421f7be406..7c6f77c38a79 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -111,7 +111,7 @@ static int openchrome_bo_verify_access(struct ttm_buffer_object *bo,
}
static int openchrome_bo_io_mem_reserve(struct ttm_bo_device *bdev,
- struct ttm_mem_reg *mem)
+ struct ttm_resource *mem)
{
struct openchrome_drm_private *dev_private = container_of(bdev,
struct openchrome_drm_private, bdev);
@@ -144,7 +144,7 @@ static int openchrome_bo_io_mem_reserve(struct ttm_bo_device *bdev,
}
static void openchrome_bo_io_mem_free(struct ttm_bo_device *bdev,
- struct ttm_mem_reg *mem)
+ struct ttm_resource *mem)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
commit 9c3bf6500f9d9d72fdb4150f417906dac5af789e
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:36:27 2020 -0700
drm/ttm: make ttm_range_man_init/takedown take type + args
Based on commit 3720589 (drm/ttm: make ttm_range_man_init/takedown
take type + args).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_object.c b/drivers/gpu/drm/openchrome/openchrome_object.c
index 57ee69f01ca7..5cbd17524c67 100644
--- a/drivers/gpu/drm/openchrome/openchrome_object.c
+++ b/drivers/gpu/drm/openchrome/openchrome_object.c
@@ -248,9 +248,6 @@ exit:
int openchrome_mm_init(struct openchrome_drm_private *dev_private)
{
struct drm_device *dev = dev_private->dev;
- struct ttm_mem_type_manager *man =
- ttm_manager_type(&dev_private->bdev.man,
- TTM_PL_VRAM);
int ret;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -275,7 +272,10 @@ int openchrome_mm_init(struct openchrome_drm_private *dev_private)
/*
* Initialize TTM range manager for VRAM management.
*/
- ret = ttm_range_man_init(&dev_private->bdev, man,
+ ret = ttm_range_man_init(&dev_private->bdev, TTM_PL_VRAM,
+ TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC,
+ TTM_PL_FLAG_WC,
+ false,
dev_private->vram_size >> PAGE_SHIFT);
if (ret) {
DRM_ERROR("Failed initializing TTM VRAM memory manager.\n");
@@ -291,9 +291,7 @@ void openchrome_mm_fini(struct openchrome_drm_private *dev_private)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- ttm_range_man_fini(&dev_private->bdev,
- ttm_manager_type(&dev_private->bdev.man,
- TTM_PL_VRAM));
+ ttm_range_man_fini(&dev_private->bdev, TTM_PL_VRAM);
ttm_bo_device_release(&dev_private->bdev);
drm_vma_offset_manager_destroy(&dev_private->vma_manager);
commit 424143475fe9ad831fe211c3ac1dd2d58bb83993
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:33:44 2020 -0700
drm/openchrome/ttm: use wrapper to access memory manager
Based on commit 47c0550 (drm/radeon/ttm: use wrapper to access memory
manager).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_object.c b/drivers/gpu/drm/openchrome/openchrome_object.c
index 532c0821f6d8..57ee69f01ca7 100644
--- a/drivers/gpu/drm/openchrome/openchrome_object.c
+++ b/drivers/gpu/drm/openchrome/openchrome_object.c
@@ -249,7 +249,8 @@ int openchrome_mm_init(struct openchrome_drm_private *dev_private)
{
struct drm_device *dev = dev_private->dev;
struct ttm_mem_type_manager *man =
- &dev_private->bdev.man[TTM_PL_VRAM];
+ ttm_manager_type(&dev_private->bdev.man,
+ TTM_PL_VRAM);
int ret;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -291,7 +292,8 @@ void openchrome_mm_fini(struct openchrome_drm_private *dev_private)
DRM_DEBUG_KMS("Entered %s.\n", __func__);
ttm_range_man_fini(&dev_private->bdev,
- &dev_private->bdev.man[TTM_PL_VRAM]);
+ ttm_manager_type(&dev_private->bdev.man,
+ TTM_PL_VRAM));
ttm_bo_device_release(&dev_private->bdev);
drm_vma_offset_manager_destroy(&dev_private->vma_manager);
commit b73e1ae9fee01c47a5b37119b318aeb6d32efa01
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:33:24 2020 -0700
drm/openchrome/ttm: use new takedown paths
Based on commit f0fe3f7 (drm/radeon/ttm: use new takedown paths).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_object.c b/drivers/gpu/drm/openchrome/openchrome_object.c
index f24d0a7a8927..532c0821f6d8 100644
--- a/drivers/gpu/drm/openchrome/openchrome_object.c
+++ b/drivers/gpu/drm/openchrome/openchrome_object.c
@@ -290,7 +290,8 @@ void openchrome_mm_fini(struct openchrome_drm_private *dev_private)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- ttm_bo_clean_mm(&dev_private->bdev, TTM_PL_VRAM);
+ ttm_range_man_fini(&dev_private->bdev,
+ &dev_private->bdev.man[TTM_PL_VRAM]);
ttm_bo_device_release(&dev_private->bdev);
drm_vma_offset_manager_destroy(&dev_private->vma_manager);
commit 6552905aefc1fec7fcdf35c0d231518551049586
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:32:51 2020 -0700
drm/openchrome: use new ttm man init path
Based on commit e33dc18 (drm/radeon: use new ttm man init path).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_object.c b/drivers/gpu/drm/openchrome/openchrome_object.c
index dae25e1583f9..f24d0a7a8927 100644
--- a/drivers/gpu/drm/openchrome/openchrome_object.c
+++ b/drivers/gpu/drm/openchrome/openchrome_object.c
@@ -248,6 +248,8 @@ exit:
int openchrome_mm_init(struct openchrome_drm_private *dev_private)
{
struct drm_device *dev = dev_private->dev;
+ struct ttm_mem_type_manager *man =
+ &dev_private->bdev.man[TTM_PL_VRAM];
int ret;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -270,9 +272,9 @@ int openchrome_mm_init(struct openchrome_drm_private *dev_private)
}
/*
- * Initialize TTM memory manager for VRAM management.
+ * Initialize TTM range manager for VRAM management.
*/
- ret = ttm_bo_init_mm(&dev_private->bdev, TTM_PL_VRAM,
+ ret = ttm_range_man_init(&dev_private->bdev, man,
dev_private->vram_size >> PAGE_SHIFT);
if (ret) {
DRM_ERROR("Failed initializing TTM VRAM memory manager.\n");
commit c363d8a39807cb55573db93b6728ca5b38091668
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:26:54 2020 -0700
drm/ttm: remove the init_mem_type callback
Based on commit 1a3fb59 (drm/ttm: remove the init_mem_type callback).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index 610548b298e4..b6421f7be406 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -73,35 +73,6 @@ static void openchrome_ttm_tt_destroy(struct ttm_bo_device *bdev,
kfree(tt);
}
-static int openchrome_bo_init_mem_type(struct ttm_bo_device *bdev,
- uint32_t type,
- struct ttm_mem_type_manager *man)
-{
- int ret = 0;
-
- DRM_DEBUG_KMS("Entered %s.\n", __func__);
-
- switch (type) {
- case TTM_PL_SYSTEM:
- man->available_caching = TTM_PL_FLAG_CACHED;
- man->default_caching = TTM_PL_FLAG_CACHED;
- break;
- case TTM_PL_VRAM:
- man->available_caching = TTM_PL_FLAG_UNCACHED |
- TTM_PL_FLAG_WC;
- man->default_caching = TTM_PL_FLAG_WC;
- man->func = &ttm_bo_manager_func;
- break;
- default:
- DRM_ERROR("Unsupported TTM memory type.\n");
- ret = -EINVAL;
- break;
- }
-
- DRM_DEBUG_KMS("Exiting %s.\n", __func__);
- return ret;
-}
-
static void openchrome_bo_evict_flags(struct ttm_buffer_object *bo,
struct ttm_placement *placement)
{
@@ -183,7 +154,6 @@ static void openchrome_bo_io_mem_free(struct ttm_bo_device *bdev,
struct ttm_bo_driver openchrome_bo_driver = {
.ttm_tt_create = openchrome_ttm_tt_create,
.ttm_tt_destroy = openchrome_ttm_tt_destroy,
- .init_mem_type = openchrome_bo_init_mem_type,
.eviction_valuable = ttm_bo_eviction_valuable,
.evict_flags = openchrome_bo_evict_flags,
.verify_access = openchrome_bo_verify_access,
commit eb407f49cbf1c10168ce4621404ace7f3f7a2113
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:25:45 2020 -0700
drm/ttm: remove TTM_MEMTYPE_FLAG_FIXED v2
Based on commit be1213a (drm/ttm: remove TTM_MEMTYPE_FLAG_FIXED v2).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index d17c788ebffb..610548b298e4 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -83,12 +83,10 @@ static int openchrome_bo_init_mem_type(struct ttm_bo_device *bdev,
switch (type) {
case TTM_PL_SYSTEM:
- man->flags = 0;
man->available_caching = TTM_PL_FLAG_CACHED;
man->default_caching = TTM_PL_FLAG_CACHED;
break;
case TTM_PL_VRAM:
- man->flags = TTM_MEMTYPE_FLAG_FIXED;
man->available_caching = TTM_PL_FLAG_UNCACHED |
TTM_PL_FLAG_WC;
man->default_caching = TTM_PL_FLAG_WC;
commit 07df055dd40e6f69519770a33456702df67bb496
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:19:43 2020 -0700
drm/openchrome: stop using TTM_MEMTYPE_FLAG_MAPPABLE
Based on commit 8401e2e (drm/radeon: stop using
TTM_MEMTYPE_FLAG_MAPPABLE).
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index efd73004e886..d17c788ebffb 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -83,13 +83,12 @@ static int openchrome_bo_init_mem_type(struct ttm_bo_device *bdev,
switch (type) {
case TTM_PL_SYSTEM:
- man->flags = TTM_MEMTYPE_FLAG_MAPPABLE;
+ man->flags = 0;
man->available_caching = TTM_PL_FLAG_CACHED;
man->default_caching = TTM_PL_FLAG_CACHED;
break;
case TTM_PL_VRAM:
- man->flags = TTM_MEMTYPE_FLAG_FIXED |
- TTM_MEMTYPE_FLAG_MAPPABLE;
+ man->flags = TTM_MEMTYPE_FLAG_FIXED;
man->available_caching = TTM_PL_FLAG_UNCACHED |
TTM_PL_FLAG_WC;
man->default_caching = TTM_PL_FLAG_WC;
@@ -147,16 +146,10 @@ static int openchrome_bo_io_mem_reserve(struct ttm_bo_device *bdev,
{
struct openchrome_drm_private *dev_private = container_of(bdev,
struct openchrome_drm_private, bdev);
- struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
int ret = 0;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- if (!(man->flags & TTM_MEMTYPE_FLAG_MAPPABLE)) {
- ret= -EINVAL;
- goto exit;
- }
-
switch (mem->mem_type) {
case TTM_PL_SYSTEM:
mem->bus.addr = NULL;
@@ -177,7 +170,6 @@ static int openchrome_bo_io_mem_reserve(struct ttm_bo_device *bdev,
break;
}
-exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return ret;
}
commit b0a41de3424c73ef9ae592a79d44026973f1b74c
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:19:23 2020 -0700
drm/openchrome: Add ttm_tt_create/destroy callbacks
Christian König, who is one of the TTM maintainers, suggested that
implementing ttm_tt_create/destroy callbacks of ttm_bo_driver struct
is mandatory. Not having them causes a null pointer crash with
drm-next 5.10 TTM code. The code added here was borrowed from
drm/drm_gem_vram_helper.c.
Suggested-by: Christian König <christian.koenig at amd.com>
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index ea1537ff7d28..efd73004e886 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -43,6 +43,36 @@
#include "openchrome_drv.h"
+static struct ttm_tt *openchrome_ttm_tt_create(
+ struct ttm_buffer_object *bo,
+ uint32_t page_flags)
+{
+ struct ttm_tt *tt;
+ int ret;
+
+ tt = kzalloc(sizeof(*tt), GFP_KERNEL);
+ if (!tt)
+ return NULL;
+
+ ret = ttm_tt_init(tt, bo, page_flags);
+ if (ret < 0)
+ goto err_ttm_tt_init;
+
+ return tt;
+
+err_ttm_tt_init:
+ kfree(tt);
+ return NULL;
+}
+
+static void openchrome_ttm_tt_destroy(struct ttm_bo_device *bdev,
+ struct ttm_tt *tt)
+{
+ ttm_tt_destroy_common(bdev, tt);
+ ttm_tt_fini(tt);
+ kfree(tt);
+}
+
static int openchrome_bo_init_mem_type(struct ttm_bo_device *bdev,
uint32_t type,
struct ttm_mem_type_manager *man)
@@ -161,6 +191,8 @@ static void openchrome_bo_io_mem_free(struct ttm_bo_device *bdev,
}
struct ttm_bo_driver openchrome_bo_driver = {
+ .ttm_tt_create = openchrome_ttm_tt_create,
+ .ttm_tt_destroy = openchrome_ttm_tt_destroy,
.init_mem_type = openchrome_bo_init_mem_type,
.eviction_valuable = ttm_bo_eviction_valuable,
.evict_flags = openchrome_bo_evict_flags,
commit 58aa61859d42ed7d1330055cfe4d7247b9a06414
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:15:33 2020 -0700
drm/openchrome: Forgot to call ttm_bo_clean_mm() when cleaning up
ttm_bo_clean_mm() should have been called inside openchrome_mm_fini().
openchrome_mm_init() calls ttm_bo_init_mm(), but openchrome_mm_fini()
was not calling ttm_bo_clean_mm().
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_object.c b/drivers/gpu/drm/openchrome/openchrome_object.c
index 3289bf7ce3f0..dae25e1583f9 100644
--- a/drivers/gpu/drm/openchrome/openchrome_object.c
+++ b/drivers/gpu/drm/openchrome/openchrome_object.c
@@ -288,6 +288,8 @@ void openchrome_mm_fini(struct openchrome_drm_private *dev_private)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
+ ttm_bo_clean_mm(&dev_private->bdev, TTM_PL_VRAM);
+
ttm_bo_device_release(&dev_private->bdev);
drm_vma_offset_manager_destroy(&dev_private->vma_manager);
commit f77fdfb91a439035f37890deffff17d2a2b50c52
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:12:43 2020 -0700
drm/openchrome: Base TTM VRAM base address on VRAM start address
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index 17124db4bc72..ea1537ff7d28 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -117,7 +117,6 @@ static int openchrome_bo_io_mem_reserve(struct ttm_bo_device *bdev,
{
struct openchrome_drm_private *dev_private = container_of(bdev,
struct openchrome_drm_private, bdev);
- struct drm_device *dev = dev_private->dev;
struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
int ret = 0;
@@ -138,12 +137,7 @@ static int openchrome_bo_io_mem_reserve(struct ttm_bo_device *bdev,
break;
case TTM_PL_VRAM:
mem->bus.addr = NULL;
- if (dev->pdev->device == PCI_DEVICE_ID_VIA_VX900_VGA) {
- mem->bus.base = pci_resource_start(dev->pdev, 2);
- } else {
- mem->bus.base = pci_resource_start(dev->pdev, 0);
- }
-
+ mem->bus.base = dev_private->vram_start;
mem->bus.size = mem->num_pages << PAGE_SHIFT;
mem->bus.offset = mem->start << PAGE_SHIFT;
mem->bus.is_iomem = true;
commit 9e184ca52b9673d31aa68a48e6f3dfa0bde02746
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:06:17 2020 -0700
drm/openchrome: Base fb_info struct’s size on the number of pages
This is for fixed screen size (fix.smem_len) and current screen size
(screen_size) members.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_fb.c b/drivers/gpu/drm/openchrome/openchrome_fb.c
index 1bb02c26e1f4..7e20a0726843 100644
--- a/drivers/gpu/drm/openchrome/openchrome_fb.c
+++ b/drivers/gpu/drm/openchrome/openchrome_fb.c
@@ -211,10 +211,12 @@ openchrome_fb_probe(struct drm_fb_helper *helper,
info->fix.smem_start = openchrome_fb->bo->ttm_bo.mem.bus.base +
openchrome_fb->bo->ttm_bo.mem.bus.offset;
- info->fix.smem_len = size;
+ info->fix.smem_len = openchrome_fb->bo->ttm_bo.mem.num_pages <<
+ PAGE_SHIFT;
info->screen_base = ttm_kmap_obj_virtual(
&openchrome_fb->bo->kmap, &is_iomem);
- info->screen_size = size;
+ info->screen_size = openchrome_fb->bo->ttm_bo.mem.num_pages <<
+ PAGE_SHIFT;
info->apertures->ranges[0].base = dev_private->vram_start;
info->apertures->ranges[0].size = dev_private->vram_size;
commit cd839a8a53d7cccec1a4c6b971d2e2bb946a13dd
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:03:20 2020 -0700
drm/openchrome: Obtain base and offset from TTM BO directly
Rather than via TTM BO pointed by bo member of kmap struct.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_fb.c b/drivers/gpu/drm/openchrome/openchrome_fb.c
index 5886cd943eb7..1bb02c26e1f4 100644
--- a/drivers/gpu/drm/openchrome/openchrome_fb.c
+++ b/drivers/gpu/drm/openchrome/openchrome_fb.c
@@ -209,8 +209,8 @@ openchrome_fb_probe(struct drm_fb_helper *helper,
info->fbops = &via_fb_ops;
- info->fix.smem_start = openchrome_fb->bo->kmap.bo->mem.bus.base +
- openchrome_fb->bo->kmap.bo->mem.bus.offset;
+ info->fix.smem_start = openchrome_fb->bo->ttm_bo.mem.bus.base +
+ openchrome_fb->bo->ttm_bo.mem.bus.offset;
info->fix.smem_len = size;
info->screen_base = ttm_kmap_obj_virtual(
&openchrome_fb->bo->kmap, &is_iomem);
commit 955151ab7339e294e82bbb359f9d46434e6c3a59
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 15:01:29 2020 -0700
drm/openchrome: Use ttm_kmap_obj_virtual() for screen_base
Use an address obtained from ttm_kmap_obj_virtual() for screen_base
member of fb_info struct.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_fb.c b/drivers/gpu/drm/openchrome/openchrome_fb.c
index cef8672beb84..5886cd943eb7 100644
--- a/drivers/gpu/drm/openchrome/openchrome_fb.c
+++ b/drivers/gpu/drm/openchrome/openchrome_fb.c
@@ -163,6 +163,7 @@ openchrome_fb_probe(struct drm_fb_helper *helper,
struct fb_info *info = helper->fbdev;
const struct drm_format_info *format_info;
struct drm_mode_fb_cmd2 mode_cmd;
+ bool is_iomem;
int size, cpp;
int ret = 0;
@@ -211,7 +212,8 @@ openchrome_fb_probe(struct drm_fb_helper *helper,
info->fix.smem_start = openchrome_fb->bo->kmap.bo->mem.bus.base +
openchrome_fb->bo->kmap.bo->mem.bus.offset;
info->fix.smem_len = size;
- info->screen_base = openchrome_fb->bo->kmap.virtual;
+ info->screen_base = ttm_kmap_obj_virtual(
+ &openchrome_fb->bo->kmap, &is_iomem);
info->screen_size = size;
info->apertures->ranges[0].base = dev_private->vram_start;
commit 2dbef428c659418347c59235575a3de53367dd51
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Oct 27 14:57:41 2020 -0700
drm/openchrome: Change fb_info struct aperture source
Use address and size obtained from PCI Configuration Space BAR
and detected VRAM size, respectively.
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 34302cd52082..3a6f3efbbc42 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -225,8 +225,8 @@ struct openchrome_drm_private {
struct openchrome_framebuffer *openchrome_fb;
u8 vram_type;
- unsigned long long vram_start;
- unsigned int vram_size;
+ resource_size_t vram_start;
+ resource_size_t vram_size;
int vram_mtrr;
unsigned long long mmio_base;
diff --git a/drivers/gpu/drm/openchrome/openchrome_fb.c b/drivers/gpu/drm/openchrome/openchrome_fb.c
index d36a42d484db..cef8672beb84 100644
--- a/drivers/gpu/drm/openchrome/openchrome_fb.c
+++ b/drivers/gpu/drm/openchrome/openchrome_fb.c
@@ -214,9 +214,8 @@ openchrome_fb_probe(struct drm_fb_helper *helper,
info->screen_base = openchrome_fb->bo->kmap.virtual;
info->screen_size = size;
- info->apertures->ranges[0].size = openchrome_fb->bo->kmap.bo->bdev->
- man[openchrome_fb->bo->kmap.bo->mem.mem_type].size;
- info->apertures->ranges[0].base = openchrome_fb->bo->kmap.bo->mem.bus.base;
+ info->apertures->ranges[0].base = dev_private->vram_start;
+ info->apertures->ranges[0].size = dev_private->vram_size;
drm_fb_helper_fill_info(info, helper, sizes);
goto exit;
More information about the openchrome-devel
mailing list