dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 7/9] drm/qxl: stop implementing init_mem_type
Date: Thu, 23 Jul 2020 17:17:08 +0200	[thread overview]
Message-ID: <20200723151710.3591-8-christian.koenig@amd.com> (raw)
In-Reply-To: <20200723151710.3591-1-christian.koenig@amd.com>

Instead just initialize the memory type parameters
before calling ttm_bo_init_mm.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/qxl/qxl_ttm.c | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index abb9fa4d80cf..852089d7f783 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -51,21 +51,6 @@ static struct qxl_device *qxl_get_qdev(struct ttm_bo_device *bdev)
 static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
 			     struct ttm_mem_type_manager *man)
 {
-	switch (type) {
-	case TTM_PL_SYSTEM:
-		/* System memory */
-		break;
-	case TTM_PL_VRAM:
-	case TTM_PL_PRIV:
-		/* "On-card" video ram */
-		man->func = &ttm_bo_manager_func;
-		man->available_caching = TTM_PL_MASK_CACHING;
-		man->default_caching = TTM_PL_FLAG_CACHED;
-		break;
-	default:
-		DRM_ERROR("Unsupported memory type %u\n", (unsigned int)type);
-		return -EINVAL;
-	}
 	return 0;
 }
 
@@ -238,6 +223,19 @@ static struct ttm_bo_driver qxl_bo_driver = {
 	.move_notify = &qxl_bo_move_notify,
 };
 
+static int qxl_ttm_init_mem_type(struct qxl_device *qdev,
+				 unsigned int type,
+				 uint64_t size)
+{
+	struct ttm_mem_type_manager *man = &qdev->mman.bdev.man[type];
+
+	man->func = &ttm_bo_manager_func;
+	man->available_caching = TTM_PL_MASK_CACHING;
+	man->default_caching = TTM_PL_FLAG_CACHED;
+
+	return ttm_bo_init_mm(&qdev->mman.bdev, type, size);
+}
+
 int qxl_ttm_init(struct qxl_device *qdev)
 {
 	int r;
@@ -255,14 +253,13 @@ int qxl_ttm_init(struct qxl_device *qdev)
 	}
 	/* NOTE: this includes the framebuffer (aka surface 0) */
 	num_io_pages = qdev->rom->ram_header_offset / PAGE_SIZE;
-	r = ttm_bo_init_mm(&qdev->mman.bdev, TTM_PL_VRAM,
-			   num_io_pages);
+	r = qxl_ttm_init_mem_type(qdev, TTM_PL_VRAM, num_io_pages);
 	if (r) {
 		DRM_ERROR("Failed initializing VRAM heap.\n");
 		return r;
 	}
-	r = ttm_bo_init_mm(&qdev->mman.bdev, TTM_PL_PRIV,
-			   qdev->surfaceram_size / PAGE_SIZE);
+	r = qxl_ttm_init_mem_type(qdev, TTM_PL_PRIV,
+				  qdev->surfaceram_size / PAGE_SIZE);
 	if (r) {
 		DRM_ERROR("Failed initializing Surfaces heap.\n");
 		return r;
-- 
2.17.1

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

  parent reply	other threads:[~2020-07-23 15:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 15:17 More TTM cleanups Christian König
2020-07-23 15:17 ` [PATCH 1/9] drm/ttm: initialize the system domain with defaults Christian König
2020-07-24  6:43   ` Thomas Zimmermann
2020-07-29  6:21     ` Dave Airlie
2020-07-29  6:23       ` Dave Airlie
2020-07-29  9:47         ` Christian König
2020-07-23 15:17 ` [PATCH 2/9] drm/ttm: remove TTM_MEMTYPE_FLAG_FIXED Christian König
2020-07-24  6:50   ` Thomas Zimmermann
2020-07-24  7:27     ` Christian König
2020-07-23 15:17 ` [PATCH 3/9] drm/radeon: stop implementing init_mem_type Christian König
2020-07-23 15:17 ` [PATCH 4/9] drm/amdgpu: " Christian König
2020-07-23 15:17 ` [PATCH 5/9] drm/vmwgfx: " Christian König
2020-07-23 15:17 ` [PATCH 6/9] drm/nouveau: " Christian König
2020-07-23 15:17 ` Christian König [this message]
2020-07-23 15:17 ` [PATCH 8/9] drm/vram-helper: " Christian König
2020-07-24  6:51   ` Thomas Zimmermann
2020-07-23 15:17 ` [PATCH 9/9] drm/ttm: remove the init_mem_type callback Christian König
2020-07-23 20:31   ` Alex Deucher
2020-07-24  6:51   ` Thomas Zimmermann
2020-07-30  9:00 [PATCH 1/9] drm/ttm: initialize the system domain with defaults v2 Christian König
2020-07-30  9:00 ` [PATCH 7/9] drm/qxl: stop implementing init_mem_type Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200723151710.3591-8-christian.koenig@amd.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).