mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2026-05-01 23:18:57 +02:00
nouveau: bump for 0.0.13
This commit is contained in:
parent
85b9f737db
commit
c65a343ed2
8 changed files with 115 additions and 64 deletions
|
|
@ -41,6 +41,17 @@ nouveau_bo_takedown(struct nouveau_device *dev)
|
|||
{
|
||||
}
|
||||
|
||||
static int
|
||||
nouveau_bo_info(struct nouveau_bo_priv *nvbo, struct drm_nouveau_gem_info *arg)
|
||||
{
|
||||
nvbo->handle = nvbo->base.handle = arg->handle;
|
||||
nvbo->domain = arg->domain;
|
||||
nvbo->size = nvbo->base.size = arg->size;
|
||||
nvbo->offset = arg->offset;
|
||||
nvbo->map_handle = arg->map_handle;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nouveau_bo_allocated(struct nouveau_bo_priv *nvbo)
|
||||
{
|
||||
|
|
@ -152,7 +163,8 @@ nouveau_bo_kalloc_nomm(struct nouveau_bo_priv *nvbo)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
nvbo->handle = req.map_handle;
|
||||
nvbo->handle =
|
||||
nvbo->map_handle = req.map_handle;
|
||||
nvbo->size = req.size;
|
||||
nvbo->offset = req.offset;
|
||||
if (req.flags & (NOUVEAU_MEM_AGP | NOUVEAU_MEM_PCI))
|
||||
|
|
@ -169,6 +181,7 @@ nouveau_bo_kalloc(struct nouveau_bo_priv *nvbo, struct nouveau_channel *chan)
|
|||
{
|
||||
struct nouveau_device_priv *nvdev = nouveau_device(nvbo->base.device);
|
||||
struct drm_nouveau_gem_new req;
|
||||
struct drm_nouveau_gem_info *info = &req.info;
|
||||
int ret;
|
||||
|
||||
if (nvbo->handle || (nvbo->flags & NOUVEAU_BO_PIN))
|
||||
|
|
@ -178,38 +191,36 @@ nouveau_bo_kalloc(struct nouveau_bo_priv *nvbo, struct nouveau_channel *chan)
|
|||
return nouveau_bo_kalloc_nomm(nvbo);
|
||||
|
||||
req.channel_hint = chan ? chan->id : 0;
|
||||
|
||||
req.size = nvbo->size;
|
||||
req.align = nvbo->align;
|
||||
|
||||
req.domain = 0;
|
||||
|
||||
info->size = nvbo->size;
|
||||
info->domain = 0;
|
||||
|
||||
if (nvbo->flags & NOUVEAU_BO_VRAM)
|
||||
req.domain |= NOUVEAU_GEM_DOMAIN_VRAM;
|
||||
|
||||
info->domain |= NOUVEAU_GEM_DOMAIN_VRAM;
|
||||
if (nvbo->flags & NOUVEAU_BO_GART)
|
||||
req.domain |= NOUVEAU_GEM_DOMAIN_GART;
|
||||
|
||||
if (nvbo->flags & NOUVEAU_BO_TILED) {
|
||||
req.domain |= NOUVEAU_GEM_DOMAIN_TILE;
|
||||
if (nvbo->flags & NOUVEAU_BO_ZTILE)
|
||||
req.domain |= NOUVEAU_GEM_DOMAIN_TILE_ZETA;
|
||||
}
|
||||
|
||||
if (!req.domain) {
|
||||
req.domain |= (NOUVEAU_GEM_DOMAIN_VRAM |
|
||||
info->domain |= NOUVEAU_GEM_DOMAIN_GART;
|
||||
if (!info->domain) {
|
||||
info->domain |= (NOUVEAU_GEM_DOMAIN_VRAM |
|
||||
NOUVEAU_GEM_DOMAIN_GART);
|
||||
}
|
||||
|
||||
if (nvbo->flags & NOUVEAU_BO_TILED) {
|
||||
info->domain |= NOUVEAU_GEM_DOMAIN_TILE;
|
||||
if (nvbo->flags & NOUVEAU_BO_ZTILE)
|
||||
info->domain |= NOUVEAU_GEM_DOMAIN_TILE_ZETA;
|
||||
}
|
||||
|
||||
if (nvbo->flags & NOUVEAU_BO_MAP)
|
||||
info->domain |= NOUVEAU_GEM_DOMAIN_MAPPABLE;
|
||||
|
||||
ret = drmCommandWriteRead(nvdev->fd, DRM_NOUVEAU_GEM_NEW,
|
||||
&req, sizeof(req));
|
||||
if (ret)
|
||||
return ret;
|
||||
nvbo->handle = nvbo->base.handle = req.handle;
|
||||
nvbo->size = req.size;
|
||||
nvbo->domain = req.domain;
|
||||
nvbo->offset = req.offset;
|
||||
|
||||
nouveau_bo_info(nvbo, &req.info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -232,25 +243,23 @@ static int
|
|||
nouveau_bo_kmap(struct nouveau_bo_priv *nvbo)
|
||||
{
|
||||
struct nouveau_device_priv *nvdev = nouveau_device(nvbo->base.device);
|
||||
struct drm_nouveau_gem_mmap req;
|
||||
int ret;
|
||||
|
||||
if (nvbo->map)
|
||||
return 0;
|
||||
|
||||
if (!nvbo->handle)
|
||||
if (!nvbo->map_handle)
|
||||
return -EINVAL;
|
||||
|
||||
if (!nvdev->mm_enabled)
|
||||
return nouveau_bo_kmap_nomm(nvbo);
|
||||
|
||||
req.handle = nvbo->handle;
|
||||
ret = drmCommandWriteRead(nvdev->fd, DRM_NOUVEAU_GEM_MMAP,
|
||||
&req, sizeof(req));
|
||||
if (ret)
|
||||
return ret;
|
||||
nvbo->map = mmap(0, nvbo->size, PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED, nvdev->fd, nvbo->map_handle);
|
||||
if (nvbo->map == MAP_FAILED) {
|
||||
nvbo->map = NULL;
|
||||
return -errno;
|
||||
}
|
||||
|
||||
nvbo->map = (void *)(unsigned long)req.vaddr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -337,6 +346,35 @@ nouveau_bo_fake(struct nouveau_device *dev, uint64_t offset, uint32_t flags,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nouveau_bo_wrap(struct nouveau_device *dev, uint32_t handle,
|
||||
struct nouveau_bo **bo)
|
||||
{
|
||||
struct nouveau_device_priv *nvdev = nouveau_device(dev);
|
||||
struct drm_nouveau_gem_info req;
|
||||
struct nouveau_bo_priv *nvbo;
|
||||
int ret;
|
||||
|
||||
if (!nvdev->mm_enabled)
|
||||
return -ENODEV;
|
||||
|
||||
ret = nouveau_bo_new(dev, 0, 0, 0, bo);
|
||||
if (ret)
|
||||
return ret;
|
||||
nvbo = nouveau_bo(*bo);
|
||||
|
||||
req.handle = handle;
|
||||
ret = drmCommandWriteRead(nvdev->fd, DRM_NOUVEAU_GEM_INFO,
|
||||
&req, sizeof(req));
|
||||
if (ret) {
|
||||
nouveau_bo_ref(NULL, bo);
|
||||
return ret;
|
||||
}
|
||||
|
||||
nouveau_bo_info(nvbo, &req);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nouveau_bo_handle_get(struct nouveau_bo *bo, uint32_t *handle)
|
||||
{
|
||||
|
|
@ -381,12 +419,12 @@ nouveau_bo_handle_ref(struct nouveau_device *dev, uint32_t handle,
|
|||
struct drm_gem_open req;
|
||||
int ret;
|
||||
|
||||
ret = nouveau_bo_new(dev, 0, 0, 0, bo);
|
||||
if (ret)
|
||||
return ret;
|
||||
nvbo = nouveau_bo(*bo);
|
||||
|
||||
if (!nvdev->mm_enabled) {
|
||||
ret = nouveau_bo_new(dev, 0, 0, 0, bo);
|
||||
if (ret)
|
||||
return ret;
|
||||
nvbo = nouveau_bo(*bo);
|
||||
|
||||
nvbo->handle = 0;
|
||||
nvbo->offset = handle;
|
||||
nvbo->domain = NOUVEAU_BO_VRAM;
|
||||
|
|
@ -401,8 +439,13 @@ nouveau_bo_handle_ref(struct nouveau_device *dev, uint32_t handle,
|
|||
return ret;
|
||||
}
|
||||
|
||||
nvbo->size = req.size;
|
||||
nvbo->handle = req.handle;
|
||||
ret = nouveau_bo_wrap(dev, req.handle, bo);
|
||||
if (ret) {
|
||||
nouveau_bo_ref(NULL, bo);
|
||||
return ret;
|
||||
}
|
||||
|
||||
nvbo = nouveau_bo(*bo);
|
||||
}
|
||||
|
||||
nvbo->base.handle = nvbo->handle;
|
||||
|
|
@ -507,12 +550,15 @@ nouveau_bo_wait(struct nouveau_bo *bo, int cpu_write)
|
|||
return nouveau_bo_wait_nomm(bo, cpu_write);
|
||||
|
||||
req.handle = nvbo->handle;
|
||||
ret = drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GEM_CPU_PREP,
|
||||
&req, sizeof(req));
|
||||
do {
|
||||
ret = drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GEM_CPU_PREP,
|
||||
&req, sizeof(req));
|
||||
} while (ret == -EAGAIN);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
nvbo->write_marker = 0;
|
||||
if (ret == 0)
|
||||
nvbo->write_marker = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -578,7 +624,7 @@ int
|
|||
nouveau_bo_validate_nomm(struct nouveau_bo_priv *nvbo, uint32_t flags)
|
||||
{
|
||||
struct nouveau_bo *new = NULL;
|
||||
uint32_t t_handle, t_domain, t_offset, t_size;
|
||||
uint32_t t_handle, t_domain, t_offset, t_size, t_maph;
|
||||
void *t_map;
|
||||
int ret;
|
||||
|
||||
|
|
@ -614,18 +660,21 @@ nouveau_bo_validate_nomm(struct nouveau_bo_priv *nvbo, uint32_t flags)
|
|||
}
|
||||
|
||||
t_handle = nvbo->handle;
|
||||
t_maph = nvbo->map_handle;
|
||||
t_domain = nvbo->domain;
|
||||
t_offset = nvbo->offset;
|
||||
t_size = nvbo->size;
|
||||
t_map = nvbo->map;
|
||||
|
||||
nvbo->handle = nouveau_bo(new)->handle;
|
||||
nvbo->map_handle = nouveau_bo(new)->map_handle;
|
||||
nvbo->domain = nouveau_bo(new)->domain;
|
||||
nvbo->offset = nouveau_bo(new)->offset;
|
||||
nvbo->size = nouveau_bo(new)->size;
|
||||
nvbo->map = nouveau_bo(new)->map;
|
||||
|
||||
nouveau_bo(new)->handle = t_handle;
|
||||
nouveau_bo(new)->map_handle = t_maph;
|
||||
nouveau_bo(new)->domain = t_domain;
|
||||
nouveau_bo(new)->offset = t_offset;
|
||||
nouveau_bo(new)->size = t_size;
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ int
|
|||
nouveau_bo_fake(struct nouveau_device *dev, uint64_t offset, uint32_t flags,
|
||||
uint32_t size, void *map, struct nouveau_bo **);
|
||||
|
||||
int
|
||||
nouveau_bo_wrap(struct nouveau_device *, uint32_t handle, struct nouveau_bo **);
|
||||
|
||||
int
|
||||
nouveau_bo_handle_get(struct nouveau_bo *, uint32_t *);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "nouveau_private.h"
|
||||
|
||||
#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 12
|
||||
#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 13
|
||||
#error nouveau_drm.h does not match expected patchlevel, update libdrm.
|
||||
#endif
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ nouveau_device_open_existing(struct nouveau_device **dev, int close,
|
|||
nouveau_device_close((void *)&nvdev);
|
||||
return ret;
|
||||
}
|
||||
nvdev->vram_aper_size = value;
|
||||
nvdev->base.vm_vram_size = value;
|
||||
|
||||
ret = nouveau_device_get_param(&nvdev->base,
|
||||
NOUVEAU_GETPARAM_AGP_SIZE, &value);
|
||||
|
|
@ -90,7 +90,7 @@ nouveau_device_open_existing(struct nouveau_device **dev, int close,
|
|||
nouveau_device_close((void *)&nvdev);
|
||||
return ret;
|
||||
}
|
||||
nvdev->gart_aper_size = value;
|
||||
nvdev->base.vm_gart_size = value;
|
||||
|
||||
ret = nouveau_bo_init(&nvdev->base);
|
||||
if (ret) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
struct nouveau_device {
|
||||
unsigned chipset;
|
||||
uint64_t vm_vram_base;
|
||||
uint64_t vm_vram_size;
|
||||
uint64_t vm_gart_size;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,9 +37,6 @@ struct nouveau_device_priv {
|
|||
int needs_close;
|
||||
|
||||
int mm_enabled;
|
||||
/*XXX: move to nouveau_device when interface gets bumped */
|
||||
uint64_t vram_aper_size;
|
||||
uint64_t gart_aper_size;
|
||||
};
|
||||
#define nouveau_device(n) ((struct nouveau_device_priv *)(n))
|
||||
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ struct nouveau_bo_priv {
|
|||
/* Kernel object */
|
||||
uint32_t global_handle;
|
||||
drm_handle_t handle;
|
||||
uint64_t map_handle;
|
||||
void *map;
|
||||
|
||||
/* Last known information from kernel on buffer status */
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef __NOUVEAU_DRM_H__
|
||||
#define __NOUVEAU_DRM_H__
|
||||
|
||||
#define NOUVEAU_DRM_HEADER_PATCHLEVEL 12
|
||||
#define NOUVEAU_DRM_HEADER_PATCHLEVEL 13
|
||||
|
||||
struct drm_nouveau_channel_alloc {
|
||||
uint32_t fb_ctxdma_handle;
|
||||
|
|
@ -153,17 +153,22 @@ struct drm_nouveau_setparam {
|
|||
#define NOUVEAU_GEM_DOMAIN_CPU (1 << 0)
|
||||
#define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1)
|
||||
#define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
|
||||
#define NOUVEAU_GEM_DOMAIN_NOMAP (1 << 3)
|
||||
#define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3)
|
||||
#define NOUVEAU_GEM_DOMAIN_TILE (1 << 30)
|
||||
#define NOUVEAU_GEM_DOMAIN_TILE_ZETA (1 << 31)
|
||||
|
||||
struct drm_nouveau_gem_new {
|
||||
uint64_t size;
|
||||
uint32_t channel_hint;
|
||||
uint32_t align;
|
||||
struct drm_nouveau_gem_info {
|
||||
uint32_t handle;
|
||||
uint32_t domain;
|
||||
uint32_t offset;
|
||||
uint64_t size;
|
||||
uint64_t offset;
|
||||
uint64_t map_handle;
|
||||
};
|
||||
|
||||
struct drm_nouveau_gem_new {
|
||||
struct drm_nouveau_gem_info info;
|
||||
uint32_t channel_hint;
|
||||
uint32_t align;
|
||||
};
|
||||
|
||||
struct drm_nouveau_gem_pushbuf_bo {
|
||||
|
|
@ -223,12 +228,6 @@ struct drm_nouveau_gem_unpin {
|
|||
uint32_t handle;
|
||||
};
|
||||
|
||||
struct drm_nouveau_gem_mmap {
|
||||
uint32_t handle;
|
||||
uint32_t pad;
|
||||
uint64_t vaddr;
|
||||
};
|
||||
|
||||
struct drm_nouveau_gem_cpu_prep {
|
||||
uint32_t handle;
|
||||
};
|
||||
|
|
@ -291,9 +290,9 @@ struct drm_nouveau_sarea {
|
|||
#define DRM_NOUVEAU_GEM_PUSHBUF_CALL 0x42
|
||||
#define DRM_NOUVEAU_GEM_PIN 0x43
|
||||
#define DRM_NOUVEAU_GEM_UNPIN 0x44
|
||||
#define DRM_NOUVEAU_GEM_MMAP 0x45
|
||||
#define DRM_NOUVEAU_GEM_CPU_PREP 0x46
|
||||
#define DRM_NOUVEAU_GEM_CPU_FINI 0x47
|
||||
#define DRM_NOUVEAU_GEM_TILE 0x48
|
||||
#define DRM_NOUVEAU_GEM_CPU_PREP 0x45
|
||||
#define DRM_NOUVEAU_GEM_CPU_FINI 0x46
|
||||
#define DRM_NOUVEAU_GEM_TILE 0x47
|
||||
#define DRM_NOUVEAU_GEM_INFO 0x48
|
||||
|
||||
#endif /* __NOUVEAU_DRM_H__ */
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#define DRIVER_MAJOR 0
|
||||
#define DRIVER_MINOR 0
|
||||
#define DRIVER_PATCHLEVEL 12
|
||||
#define DRIVER_PATCHLEVEL 13
|
||||
|
||||
#define NOUVEAU_FAMILY 0x0000FFFF
|
||||
#define NOUVEAU_FLAGS 0xFFFF0000
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue