mirror of https://gitlab.freedesktop.org/mesa/mesa
nouveau/winsys: Add back nouveau_ws_bo_new_tiled()
This reverts commit ce1cccea98
. In this
new version, we also add a query for whether or not tiled BOs are
supported by nouveau.ko.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24795>
This commit is contained in:
parent
03c4a46fe5
commit
3bb531d245
|
@ -10,6 +10,9 @@
|
|||
#include <sys/mman.h>
|
||||
#include <xf86drm.h>
|
||||
|
||||
#include "nvidia/classes/cl9097.h"
|
||||
#include "nvidia/classes/clc597.h"
|
||||
|
||||
static void
|
||||
bo_bind(struct nouveau_ws_device *dev,
|
||||
uint32_t handle, uint64_t addr,
|
||||
|
@ -174,9 +177,10 @@ nouveau_ws_bo_new_mapped(struct nouveau_ws_device *dev,
|
|||
}
|
||||
|
||||
static struct nouveau_ws_bo *
|
||||
nouveau_ws_bo_new_locked(struct nouveau_ws_device *dev,
|
||||
uint64_t size, uint64_t align,
|
||||
enum nouveau_ws_bo_flags flags)
|
||||
nouveau_ws_bo_new_tiled_locked(struct nouveau_ws_device *dev,
|
||||
uint64_t size, uint64_t align,
|
||||
uint8_t pte_kind, uint16_t tile_mode,
|
||||
enum nouveau_ws_bo_flags flags)
|
||||
{
|
||||
struct drm_nouveau_gem_new req = {};
|
||||
|
||||
|
@ -214,6 +218,9 @@ nouveau_ws_bo_new_locked(struct nouveau_ws_device *dev,
|
|||
if (flags & NOUVEAU_WS_BO_NO_SHARE)
|
||||
req.info.domain |= NOUVEAU_GEM_DOMAIN_NO_SHARE;
|
||||
|
||||
req.info.tile_flags = (uint32_t)pte_kind << 8;
|
||||
req.info.tile_mode = tile_mode;
|
||||
|
||||
req.info.size = size;
|
||||
req.align = align;
|
||||
|
||||
|
@ -251,19 +258,29 @@ fail_gem_new:
|
|||
}
|
||||
|
||||
struct nouveau_ws_bo *
|
||||
nouveau_ws_bo_new(struct nouveau_ws_device *dev,
|
||||
uint64_t size, uint64_t align,
|
||||
enum nouveau_ws_bo_flags flags)
|
||||
nouveau_ws_bo_new_tiled(struct nouveau_ws_device *dev,
|
||||
uint64_t size, uint64_t align,
|
||||
uint8_t pte_kind, uint16_t tile_mode,
|
||||
enum nouveau_ws_bo_flags flags)
|
||||
{
|
||||
struct nouveau_ws_bo *bo;
|
||||
|
||||
simple_mtx_lock(&dev->bos_lock);
|
||||
bo = nouveau_ws_bo_new_locked(dev, size, align, flags);
|
||||
bo = nouveau_ws_bo_new_tiled_locked(dev, size, align,
|
||||
pte_kind, tile_mode, flags);
|
||||
simple_mtx_unlock(&dev->bos_lock);
|
||||
|
||||
return bo;
|
||||
}
|
||||
|
||||
struct nouveau_ws_bo *
|
||||
nouveau_ws_bo_new(struct nouveau_ws_device *dev,
|
||||
uint64_t size, uint64_t align,
|
||||
enum nouveau_ws_bo_flags flags)
|
||||
{
|
||||
return nouveau_ws_bo_new_tiled(dev, size, align, 0, 0, flags);
|
||||
}
|
||||
|
||||
static struct nouveau_ws_bo *
|
||||
nouveau_ws_bo_from_dma_buf_locked(struct nouveau_ws_device *dev, int fd)
|
||||
{
|
||||
|
|
|
@ -68,6 +68,11 @@ struct nouveau_ws_bo *nouveau_ws_bo_new_mapped(struct nouveau_ws_device *,
|
|||
enum nouveau_ws_bo_flags,
|
||||
enum nouveau_ws_bo_map_flags map_flags,
|
||||
void **map_out);
|
||||
struct nouveau_ws_bo *nouveau_ws_bo_new_tiled(struct nouveau_ws_device *,
|
||||
uint64_t size, uint64_t align,
|
||||
uint8_t pte_kind,
|
||||
uint16_t tile_mode,
|
||||
enum nouveau_ws_bo_flags);
|
||||
struct nouveau_ws_bo *nouveau_ws_bo_from_dma_buf(struct nouveau_ws_device *,
|
||||
int fd);
|
||||
void nouveau_ws_bo_destroy(struct nouveau_ws_bo *);
|
||||
|
|
|
@ -455,3 +455,13 @@ nouveau_ws_device_timestamp(struct nouveau_ws_device *device)
|
|||
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
bool
|
||||
nouveau_ws_device_has_tiled_bo(struct nouveau_ws_device *device)
|
||||
{
|
||||
uint64_t has = 0;
|
||||
if (nouveau_ws_param(device->fd, NOUVEAU_GETPARAM_HAS_VMA_TILEMODE, &has))
|
||||
return false;
|
||||
|
||||
return has != 0;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ void nouveau_ws_device_destroy(struct nouveau_ws_device *);
|
|||
|
||||
uint64_t nouveau_ws_device_vram_used(struct nouveau_ws_device *);
|
||||
uint64_t nouveau_ws_device_timestamp(struct nouveau_ws_device *device);
|
||||
bool nouveau_ws_device_has_tiled_bo(struct nouveau_ws_device *device);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue