Back to index

libdrm  2.4.37
Classes | Defines | Functions
private.h File Reference
#include <xf86drm.h>
#include <xf86atomic.h>
#include "nouveau_drm.h"
#include "nouveau.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  nouveau_client_kref
struct  nouveau_client_priv
struct  nouveau_bo_priv
struct  nouveau_device_priv

Defines

#define dbg_on(lvl)   (0)
#define dbg(lvl, fmt, args...)
#define err(fmt, args...)   fprintf(stderr, "nouveau: "fmt, ##args)

Functions

static struct nouveau_client_privnouveau_client (struct nouveau_client *client)
static struct
drm_nouveau_gem_pushbuf_bo
cli_kref_get (struct nouveau_client *client, struct nouveau_bo *bo)
static struct nouveau_pushbufcli_push_get (struct nouveau_client *client, struct nouveau_bo *bo)
static void cli_kref_set (struct nouveau_client *client, struct nouveau_bo *bo, struct drm_nouveau_gem_pushbuf_bo *kref, struct nouveau_pushbuf *push)
static struct nouveau_bo_privnouveau_bo (struct nouveau_bo *bo)
static struct nouveau_device_privnouveau_device (struct nouveau_device *dev)
int nouveau_device_open_existing (struct nouveau_device **, int, int, drm_context_t)
int abi16_chan_nv04 (struct nouveau_object *)
int abi16_chan_nvc0 (struct nouveau_object *)
int abi16_engobj (struct nouveau_object *)
int abi16_ntfy (struct nouveau_object *)
void abi16_bo_info (struct nouveau_bo *, struct drm_nouveau_gem_info *)
int abi16_bo_init (struct nouveau_bo *, uint32_t alignment, union nouveau_bo_config *)

Class Documentation

struct nouveau_client_kref

Definition at line 23 of file private.h.

Collaboration diagram for nouveau_client_kref:
Class Members
struct drm_nouveau_gem_pushbuf_bo * kref
struct nouveau_pushbuf * push
struct nouveau_client_priv

Definition at line 28 of file private.h.

Collaboration diagram for nouveau_client_priv:
Class Members
struct nouveau_client_kref * kref
unsigned kref_nr
struct nouveau_bo_priv

Definition at line 79 of file private.h.

Class Members
uint32_t access
uint64_t map_handle
uint32_t name
atomic_t refcnt
struct nouveau_device_priv

Definition at line 94 of file private.h.

Class Members
uint32_t * client
int close
bool have_bo_usage
atomic_t lock
int nr_client

Define Documentation

#define dbg (   lvl,
  fmt,
  args... 
)

Definition at line 19 of file private.h.

#define dbg_on (   lvl)    (0)

Definition at line 18 of file private.h.

#define err (   fmt,
  args... 
)    fprintf(stderr, "nouveau: "fmt, ##args)

Definition at line 21 of file private.h.


Function Documentation

void abi16_bo_info ( struct nouveau_bo ,
struct drm_nouveau_gem_info  
)

Definition at line 113 of file abi16.c.

{
       struct nouveau_bo_priv *nvbo = nouveau_bo(bo);

       nvbo->map_handle = info->map_handle;
       bo->handle = info->handle;
       bo->size = info->size;
       bo->offset = info->offset;

       bo->flags = 0;
       if (info->domain & NOUVEAU_GEM_DOMAIN_VRAM)
              bo->flags |= NOUVEAU_BO_VRAM;
       if (info->domain & NOUVEAU_GEM_DOMAIN_GART)
              bo->flags |= NOUVEAU_BO_GART;
       if (!(info->tile_flags & NOUVEAU_GEM_TILE_NONCONTIG))
              bo->flags |= NOUVEAU_BO_CONTIG;
       if (nvbo->map_handle)
              bo->flags |= NOUVEAU_BO_MAP;

       if (bo->device->chipset >= 0xc0) {
              bo->config.nvc0.memtype   = (info->tile_flags & 0xff00) >> 8;
              bo->config.nvc0.tile_mode = info->tile_mode;
       } else
       if (bo->device->chipset >= 0x80 || bo->device->chipset == 0x50) {
              bo->config.nv50.memtype   = (info->tile_flags & 0x07f00) >> 8 |
                                       (info->tile_flags & 0x30000) >> 9;
              bo->config.nv50.tile_mode = info->tile_mode << 4;
       } else {
              bo->config.nv04.surf_flags = info->tile_flags & 7;
              bo->config.nv04.surf_pitch = info->tile_mode;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int abi16_bo_init ( struct nouveau_bo ,
uint32_t  alignment,
union nouveau_bo_config  
)

Definition at line 147 of file abi16.c.

{
       struct nouveau_device *dev = bo->device;
       struct drm_nouveau_gem_new req = {};
       struct drm_nouveau_gem_info *info = &req.info;
       int ret;

       if (bo->flags & NOUVEAU_BO_VRAM)
              info->domain |= NOUVEAU_GEM_DOMAIN_VRAM;
       if (bo->flags & NOUVEAU_BO_GART)
              info->domain |= NOUVEAU_GEM_DOMAIN_GART;
       if (!info->domain)
              info->domain |= NOUVEAU_GEM_DOMAIN_VRAM |
                            NOUVEAU_GEM_DOMAIN_GART;

       if (bo->flags & NOUVEAU_BO_MAP)
              info->domain |= NOUVEAU_GEM_DOMAIN_MAPPABLE;

       if (!(bo->flags & NOUVEAU_BO_CONTIG))
              info->tile_flags = NOUVEAU_GEM_TILE_NONCONTIG;

       info->size = bo->size;
       req.align = alignment;

       if (config) {
              if (dev->chipset >= 0xc0) {
                     info->tile_flags = (config->nvc0.memtype & 0xff) << 8;
                     info->tile_mode  = config->nvc0.tile_mode;
              } else
              if (dev->chipset >= 0x80 || dev->chipset == 0x50) {
                     info->tile_flags = (config->nv50.memtype & 0x07f) << 8 |
                                      (config->nv50.memtype & 0x180) << 9;
                     info->tile_mode  = config->nv50.tile_mode >> 4;
              } else {
                     info->tile_flags = config->nv04.surf_flags & 7;
                     info->tile_mode  = config->nv04.surf_pitch;
              }
       }

       if (!nouveau_device(dev)->have_bo_usage)
              info->tile_flags &= 0x0000ff00;

       ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_GEM_NEW,
                              &req, sizeof(req));
       if (ret == 0)
              abi16_bo_info(bo, &req.info);
       return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int abi16_chan_nv04 ( struct nouveau_object )

Definition at line 31 of file abi16.c.

{
       struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
       struct nv04_fifo *nv04 = obj->data;
       struct drm_nouveau_channel_alloc req = {nv04->vram, nv04->gart};
       int ret;

       ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
                              &req, sizeof(req));
       if (ret)
              return ret;

       nv04->base.channel = req.channel;
       nv04->base.pushbuf = req.pushbuf_domains;
       nv04->notify = req.notifier_handle;
       nv04->base.object->handle = req.channel;
       nv04->base.object->length = sizeof(*nv04);
       return 0;
}

Here is the caller graph for this function:

int abi16_chan_nvc0 ( struct nouveau_object )

Definition at line 52 of file abi16.c.

{
       struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
       struct drm_nouveau_channel_alloc req = {};
       struct nvc0_fifo *nvc0 = obj->data;
       int ret;

       ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
                              &req, sizeof(req));
       if (ret)
              return ret;

       nvc0->base.channel = req.channel;
       nvc0->base.pushbuf = req.pushbuf_domains;
       nvc0->notify = req.notifier_handle;
       nvc0->base.object->handle = req.channel;
       nvc0->base.object->length = sizeof(*nvc0);
       return 0;
}

Here is the caller graph for this function:

int abi16_engobj ( struct nouveau_object )

Definition at line 73 of file abi16.c.

{
       struct drm_nouveau_grobj_alloc req = {
              obj->parent->handle, obj->handle, obj->oclass
       };
       struct nouveau_device *dev;
       int ret;

       dev = nouveau_object_find(obj, NOUVEAU_DEVICE_CLASS);
       ret = drmCommandWrite(dev->fd, DRM_NOUVEAU_GROBJ_ALLOC,
                           &req, sizeof(req));
       if (ret)
              return ret;

       obj->length = sizeof(struct nouveau_object *);
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int abi16_ntfy ( struct nouveau_object )

Definition at line 92 of file abi16.c.

{
       struct nv04_notify *ntfy = obj->data;
       struct drm_nouveau_notifierobj_alloc req = {
              obj->parent->handle, ntfy->object->handle, ntfy->length
       };
       struct nouveau_device *dev;
       int ret;

       dev = nouveau_object_find(obj, NOUVEAU_DEVICE_CLASS);
       ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_NOTIFIEROBJ_ALLOC,
                              &req, sizeof(req));
       if (ret)
              return ret;

       ntfy->offset = req.offset;
       ntfy->object->length = sizeof(*ntfy);
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct drm_nouveau_gem_pushbuf_bo* cli_kref_get ( struct nouveau_client client,
struct nouveau_bo bo 
) [static, read]

Definition at line 41 of file private.h.

{
       struct nouveau_client_priv *pcli = nouveau_client(client);
       struct drm_nouveau_gem_pushbuf_bo *kref = NULL;
       if (pcli->kref_nr > bo->handle)
              kref = pcli->kref[bo->handle].kref;
       return kref;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void cli_kref_set ( struct nouveau_client client,
struct nouveau_bo bo,
struct drm_nouveau_gem_pushbuf_bo kref,
struct nouveau_pushbuf push 
) [inline, static]

Definition at line 61 of file private.h.

{
       struct nouveau_client_priv *pcli = nouveau_client(client);
       if (pcli->kref_nr <= bo->handle) {
              pcli->kref = realloc(pcli->kref,
                                 sizeof(*pcli->kref) * bo->handle * 2);
              while (pcli->kref_nr < bo->handle * 2) {
                     pcli->kref[pcli->kref_nr].kref = NULL;
                     pcli->kref[pcli->kref_nr].push = NULL;
                     pcli->kref_nr++;
              }
       }
       pcli->kref[bo->handle].kref = kref;
       pcli->kref[bo->handle].push = push;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct nouveau_pushbuf* cli_push_get ( struct nouveau_client client,
struct nouveau_bo bo 
) [static, read]

Definition at line 51 of file private.h.

{
       struct nouveau_client_priv *pcli = nouveau_client(client);
       struct nouveau_pushbuf *push = NULL;
       if (pcli->kref_nr > bo->handle)
              push = pcli->kref[bo->handle].push;
       return push;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct nouveau_bo_priv* nouveau_bo ( struct nouveau_bo bo) [static, read]

Definition at line 89 of file private.h.

{
       return (struct nouveau_bo_priv *)bo;
}

Here is the caller graph for this function:

static struct nouveau_client_priv* nouveau_client ( struct nouveau_client client) [static, read]

Definition at line 35 of file private.h.

{
       return (struct nouveau_client_priv *)client;
}

Here is the caller graph for this function:

static struct nouveau_device_priv* nouveau_device ( struct nouveau_device dev) [static, read]

Definition at line 105 of file private.h.

{
       return (struct nouveau_device_priv *)dev;
}

Here is the caller graph for this function:

int nouveau_device_open_existing ( struct nouveau_device **  ,
int  ,
int  ,
drm_context_t   
)

Definition at line 65 of file nouveau.c.

{
       return -EACCES;
}