Skip to content

Commit 8ef963b

Browse files
nirmoyChristianKoenigAMD
authored andcommitted
drm/qxl: don't use ttm bo->offset
This patch removes slot->gpu_offset which is not required as VRAM and PRIV slot are in separate PCI bar. This patch also removes unused qxl_bo_gpu_offset() Signed-off-by: Nirmoy Das <[email protected]> Acked-by: Christian König <[email protected]> Acked-by: Gerd Hoffmann <[email protected]> Signed-off-by: Christian König <[email protected]> Link: https://patchwork.freedesktop.org/patch/372934/
1 parent a0e4a29 commit 8ef963b

File tree

4 files changed

+4
-21
lines changed

4 files changed

+4
-21
lines changed

drivers/gpu/drm/qxl/qxl_drv.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ struct qxl_memslot {
134134
uint64_t start_phys_addr;
135135
uint64_t size;
136136
uint64_t high_bits;
137-
uint64_t gpu_offset;
138137
};
139138

140139
enum {
@@ -307,10 +306,9 @@ qxl_bo_physical_address(struct qxl_device *qdev, struct qxl_bo *bo,
307306
(bo->tbo.mem.mem_type == TTM_PL_VRAM)
308307
? &qdev->main_slot : &qdev->surfaces_slot;
309308

310-
WARN_ON_ONCE((bo->tbo.offset & slot->gpu_offset) != slot->gpu_offset);
309+
/* TODO - need to hold one of the locks to read bo->tbo.mem.start */
311310

312-
/* TODO - need to hold one of the locks to read tbo.offset */
313-
return slot->high_bits | (bo->tbo.offset - slot->gpu_offset + offset);
311+
return slot->high_bits | ((bo->tbo.mem.start << PAGE_SHIFT) + offset);
314312
}
315313

316314
/* qxl_display.c */

drivers/gpu/drm/qxl/qxl_kms.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,10 @@ static void setup_slot(struct qxl_device *qdev,
8787
high_bits <<= (64 - (qdev->rom->slot_gen_bits + qdev->rom->slot_id_bits));
8888
slot->high_bits = high_bits;
8989

90-
DRM_INFO("slot %d (%s): base 0x%08lx, size 0x%08lx, gpu_offset 0x%lx\n",
90+
DRM_INFO("slot %d (%s): base 0x%08lx, size 0x%08lx\n",
9191
slot->index, slot->name,
9292
(unsigned long)slot->start_phys_addr,
93-
(unsigned long)slot->size,
94-
(unsigned long)slot->gpu_offset);
93+
(unsigned long)slot->size);
9594
}
9695

9796
void qxl_reinit_memslots(struct qxl_device *qdev)

drivers/gpu/drm/qxl/qxl_object.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ static inline void qxl_bo_unreserve(struct qxl_bo *bo)
4848
ttm_bo_unreserve(&bo->tbo);
4949
}
5050

51-
static inline u64 qxl_bo_gpu_offset(struct qxl_bo *bo)
52-
{
53-
return bo->tbo.offset;
54-
}
55-
5651
static inline unsigned long qxl_bo_size(struct qxl_bo *bo)
5752
{
5853
return bo->tbo.num_pages << PAGE_SHIFT;

drivers/gpu/drm/qxl/qxl_ttm.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ static struct qxl_device *qxl_get_qdev(struct ttm_bo_device *bdev)
5151
static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
5252
struct ttm_mem_type_manager *man)
5353
{
54-
struct qxl_device *qdev = qxl_get_qdev(bdev);
55-
unsigned int gpu_offset_shift =
56-
64 - (qdev->rom->slot_gen_bits + qdev->rom->slot_id_bits + 8);
57-
struct qxl_memslot *slot;
58-
5954
switch (type) {
6055
case TTM_PL_SYSTEM:
6156
/* System memory */
@@ -66,11 +61,7 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
6661
case TTM_PL_VRAM:
6762
case TTM_PL_PRIV:
6863
/* "On-card" video ram */
69-
slot = (type == TTM_PL_VRAM) ?
70-
&qdev->main_slot : &qdev->surfaces_slot;
71-
slot->gpu_offset = (uint64_t)type << gpu_offset_shift;
7264
man->func = &ttm_bo_manager_func;
73-
man->gpu_offset = slot->gpu_offset;
7465
man->flags = TTM_MEMTYPE_FLAG_FIXED |
7566
TTM_MEMTYPE_FLAG_MAPPABLE;
7667
man->available_caching = TTM_PL_MASK_CACHING;

0 commit comments

Comments
 (0)