From 80c93e70f89fddd11d8dc754cd88500e2b12de97 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Tue, 23 Aug 2022 13:51:41 +0000 Subject: [PATCH] WIP: radeon: track down framebuffer mapping flags --- sys/external/bsd/drm2/dist/drm/radeon/radeon_fb.c | 1 + sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/sys/external/bsd/drm2/dist/drm/radeon/radeon_fb.c b/sys/external/bsd/drm2/dist/drm/radeon/radeon_fb.c index 6a6e19dbaf96..d199ea12608c 100644 --- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_fb.c +++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_fb.c @@ -256,6 +256,7 @@ static int radeonfb_create(struct drm_fb_helper *helper, } rbo = gem_to_radeon_bo(gobj); + printf("%s:%d: bo=%p\n", __func__, __LINE__, &rbo->tbo); #ifdef __NetBSD__ ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->fb, &mode_cmd, gobj); diff --git a/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c b/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c index 035c49a0fefd..9680c34bca05 100644 --- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c +++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c @@ -644,6 +644,8 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo, struct ttm_mem_reg *mem = &bo->mem; if (bo->mem.bus.addr) { + printf("%s:%d: bo=%p placement=0x%x premapped %p\n", + __func__, __LINE__, bo, mem->placement, bo->mem.bus.addr); map->bo_kmap_type = ttm_bo_map_premapped; map->virtual = (void *)(((u8 *)bo->mem.bus.addr) + offset); } else { @@ -657,6 +659,8 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo, addr = (bo->mem.bus.base + bo->mem.bus.offset + offset); if (ISSET(mem->placement, TTM_PL_FLAG_WC)) flags |= BUS_SPACE_MAP_PREFETCHABLE; + printf("%s:%d: bo=%p placement=0x%x bus_space_map flags=0x%x\n", + __func__, __LINE__, bo, mem->placement, flags); /* XXX errno NetBSD->Linux */ ret = -bus_space_map(bo->bdev->memt, addr, size, flags, &map->u.io.memh); @@ -698,6 +702,8 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, return ret; if (num_pages == 1 && (mem->placement & TTM_PL_FLAG_CACHED)) { + printf("%s:%d: bo=%p placement=0x%x kmap\n", + __func__, __LINE__, bo, mem->placement); /* * We're mapping a single page, and the desired * page protection is consistent with the bo. @@ -717,6 +723,8 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, * or to make the buffer object look contiguous. */ prot = ttm_io_prot(mem->placement, PAGE_KERNEL); + printf("%s:%d: bo=%p placement=0x%x vmap prot=0x%x\n", + __func__, __LINE__, bo, mem->placement, prot); map->bo_kmap_type = ttm_bo_map_vmap; map->virtual = vmap(ttm->pages + start_page, num_pages, 0, prot);