Re: [PATCH 1/2] drm/ttm: init mem->bus in common code.

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

 



I've totally missed those and still don't see any reference in any inbox to the original mail or patch #2 in this series.

But this patch at least looks like it makes a lot of sense.

BTW: Does anybody know why we separate base and offset here? That distinction seems to be superfluous as well.

Christian.

Am 11.08.20 um 10:02 schrieb Dave Airlie:
(cc'ing Christian, just in case he misses them). 2 small cleanups.

On Tue, 11 Aug 2020 at 17:47, Dave Airlie <airlied@xxxxxxxxx> wrote:
From: Dave Airlie <airlied@xxxxxxxxxx>

The drivers all do the same thing here.

Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 6 ------
  drivers/gpu/drm/drm_gem_vram_helper.c      | 6 ------
  drivers/gpu/drm/nouveau/nouveau_bo.c       | 6 ------
  drivers/gpu/drm/qxl/qxl_ttm.c              | 6 ------
  drivers/gpu/drm/radeon/radeon_ttm.c        | 6 ------
  drivers/gpu/drm/ttm/ttm_bo_util.c          | 5 +++++
  drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 6 ------
  7 files changed, 5 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 67d2eef2f9eb..324abf7a3cba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -751,12 +751,6 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso
         struct amdgpu_device *adev = amdgpu_ttm_adev(bdev);
         struct drm_mm_node *mm_node = mem->mm_node;

-       mem->bus.addr = NULL;
-       mem->bus.offset = 0;
-       mem->bus.size = mem->num_pages << PAGE_SHIFT;
-       mem->bus.base = 0;
-       mem->bus.is_iomem = false;
-
         switch (mem->mem_type) {
         case TTM_PL_SYSTEM:
                 /* system memory */
diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
index b410930d94a0..545a877406f4 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -1038,14 +1038,8 @@ static int bo_driver_io_mem_reserve(struct ttm_bo_device *bdev,
  {
         struct drm_vram_mm *vmm = drm_vram_mm_of_bdev(bdev);

-       mem->bus.addr = NULL;
-       mem->bus.size = mem->num_pages << PAGE_SHIFT;
-
         switch (mem->mem_type) {
         case TTM_PL_SYSTEM:     /* nothing to do */
-               mem->bus.offset = 0;
-               mem->bus.base = 0;
-               mem->bus.is_iomem = false;
                 break;
         case TTM_PL_VRAM:
                 mem->bus.offset = mem->start << PAGE_SHIFT;
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 604a74323696..7cfe3898ce62 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1380,12 +1380,6 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resource *reg)
         struct nvkm_device *device = nvxx_device(&drm->client.device);
         struct nouveau_mem *mem = nouveau_mem(reg);

-       reg->bus.addr = NULL;
-       reg->bus.offset = 0;
-       reg->bus.size = reg->num_pages << PAGE_SHIFT;
-       reg->bus.base = 0;
-       reg->bus.is_iomem = false;
-
         switch (reg->mem_type) {
         case TTM_PL_SYSTEM:
                 /* System memory */
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index b1ea984f143a..c55ac31f5476 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -75,12 +75,6 @@ int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
  {
         struct qxl_device *qdev = qxl_get_qdev(bdev);

-       mem->bus.addr = NULL;
-       mem->bus.offset = 0;
-       mem->bus.size = mem->num_pages << PAGE_SHIFT;
-       mem->bus.base = 0;
-       mem->bus.is_iomem = false;
-
         switch (mem->mem_type) {
         case TTM_PL_SYSTEM:
                 /* system memory */
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 3355b69b13d1..1f1e025b9f06 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -380,12 +380,6 @@ static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso
  {
         struct radeon_device *rdev = radeon_get_rdev(bdev);

-       mem->bus.addr = NULL;
-       mem->bus.offset = 0;
-       mem->bus.size = mem->num_pages << PAGE_SHIFT;
-       mem->bus.base = 0;
-       mem->bus.is_iomem = false;
-
         switch (mem->mem_type) {
         case TTM_PL_SYSTEM:
                 /* system memory */
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 496158acd5b9..023f0a2d07c9 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -138,6 +138,11 @@ int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
         if (!bdev->driver->io_mem_reserve)
                 return 0;

+       mem->bus.addr = NULL;
+       mem->bus.offset = 0;
+       mem->bus.size = mem->num_pages << PAGE_SHIFT;
+       mem->bus.base = 0;
+       mem->bus.is_iomem = false;
  retry:
         ret = bdev->driver->io_mem_reserve(bdev, mem);
         if (ret == -ENOSPC) {
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
index 69e7e7fe2a4c..6ae4a856241b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
@@ -717,12 +717,6 @@ static int vmw_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resourc
  {
         struct vmw_private *dev_priv = container_of(bdev, struct vmw_private, bdev);

-       mem->bus.addr = NULL;
-       mem->bus.is_iomem = false;
-       mem->bus.offset = 0;
-       mem->bus.size = mem->num_pages << PAGE_SHIFT;
-       mem->bus.base = 0;
-
         switch (mem->mem_type) {
         case TTM_PL_SYSTEM:
         case VMW_PL_GMR:
--
2.27.0

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

_______________________________________________
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