Back to index

libdrm  2.4.37
Classes | Defines | Functions
radeon_cs.h File Reference
#include <stdint.h>
#include <string.h>
#include "drm.h"
#include "radeon_drm.h"
#include "radeon_bo.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  radeon_cs_reloc
struct  radeon_cs

Defines

#define RADEON_CS_SPACE_OK   0
#define RADEON_CS_SPACE_OP_TO_BIG   1
#define RADEON_CS_SPACE_FLUSH   2
#define MAX_SPACE_BOS   (32)

Functions

struct radeon_csradeon_cs_create (struct radeon_cs_manager *csm, uint32_t ndw)
int radeon_cs_begin (struct radeon_cs *cs, uint32_t ndw, const char *file, const char *func, int line)
int radeon_cs_end (struct radeon_cs *cs, const char *file, const char *func, int line)
int radeon_cs_emit (struct radeon_cs *cs)
int radeon_cs_destroy (struct radeon_cs *cs)
int radeon_cs_erase (struct radeon_cs *cs)
int radeon_cs_need_flush (struct radeon_cs *cs)
void radeon_cs_print (struct radeon_cs *cs, FILE *file)
void radeon_cs_set_limit (struct radeon_cs *cs, uint32_t domain, uint32_t limit)
void radeon_cs_space_set_flush (struct radeon_cs *cs, void(*fn)(void *), void *data)
int radeon_cs_write_reloc (struct radeon_cs *cs, struct radeon_bo *bo, uint32_t read_domain, uint32_t write_domain, uint32_t flags)
uint32_t radeon_cs_get_id (struct radeon_cs *cs)
void radeon_cs_space_add_persistent_bo (struct radeon_cs *cs, struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain)
void radeon_cs_space_reset_bos (struct radeon_cs *cs)
int radeon_cs_space_check (struct radeon_cs *cs)
int radeon_cs_space_check_with_bo (struct radeon_cs *cs, struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain)
static void radeon_cs_write_dword (struct radeon_cs *cs, uint32_t dword)
static void radeon_cs_write_qword (struct radeon_cs *cs, uint64_t qword)
static void radeon_cs_write_table (struct radeon_cs *cs, const void *data, uint32_t size)

Class Documentation

struct radeon_cs_reloc

Definition at line 41 of file radeon_cs.h.

Collaboration diagram for radeon_cs_reloc:
Class Members
struct radeon_bo * bo
uint32_t flags
uint32_t read_domain
uint32_t write_domain
struct radeon_cs

Definition at line 53 of file radeon_cs.h.

Class Members
unsigned cdw
unsigned ndw
uint32_t * packets
unsigned section_cdw
unsigned section_ndw

Define Documentation

#define MAX_SPACE_BOS   (32)

Definition at line 61 of file radeon_cs.h.

#define RADEON_CS_SPACE_FLUSH   2

Definition at line 51 of file radeon_cs.h.

#define RADEON_CS_SPACE_OK   0

Definition at line 49 of file radeon_cs.h.

#define RADEON_CS_SPACE_OP_TO_BIG   1

Definition at line 50 of file radeon_cs.h.


Function Documentation

int radeon_cs_begin ( struct radeon_cs cs,
uint32_t  ndw,
const char *  file,
const char *  func,
int  line 
)

Definition at line 27 of file radeon_cs.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    return csi->csm->funcs->cs_begin(csi, ndw, file, func, line);
}
struct radeon_cs* radeon_cs_create ( struct radeon_cs_manager csm,
uint32_t  ndw 
) [read]

Definition at line 6 of file radeon_cs.c.

{
    struct radeon_cs_int *csi = csm->funcs->cs_create(csm, ndw);
    return (struct radeon_cs *)csi;
}
int radeon_cs_destroy ( struct radeon_cs cs)

Definition at line 52 of file radeon_cs.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    return csi->csm->funcs->cs_destroy(csi);
}
int radeon_cs_emit ( struct radeon_cs cs)

Definition at line 46 of file radeon_cs.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    return csi->csm->funcs->cs_emit(csi);
}
int radeon_cs_end ( struct radeon_cs cs,
const char *  file,
const char *  func,
int  line 
)

Definition at line 37 of file radeon_cs.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    return csi->csm->funcs->cs_end(csi, file, func, line);
}
int radeon_cs_erase ( struct radeon_cs cs)

Definition at line 58 of file radeon_cs.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    return csi->csm->funcs->cs_erase(csi);
}
uint32_t radeon_cs_get_id ( struct radeon_cs cs)

Definition at line 92 of file radeon_cs.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    return csi->id;
}
int radeon_cs_need_flush ( struct radeon_cs cs)

Definition at line 64 of file radeon_cs.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    return csi->csm->funcs->cs_need_flush(csi);
}
void radeon_cs_print ( struct radeon_cs cs,
FILE *  file 
)

Definition at line 70 of file radeon_cs.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    csi->csm->funcs->cs_print(csi, file);
}
void radeon_cs_set_limit ( struct radeon_cs cs,
uint32_t  domain,
uint32_t  limit 
)

Definition at line 76 of file radeon_cs.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    if (domain == RADEON_GEM_DOMAIN_VRAM)
        csi->csm->vram_limit = limit;
    else
        csi->csm->gart_limit = limit;
}
void radeon_cs_space_add_persistent_bo ( struct radeon_cs cs,
struct radeon_bo bo,
uint32_t  read_domains,
uint32_t  write_domain 
)

Definition at line 164 of file radeon_cs_space.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
    int i;
    for (i = 0; i < csi->bo_count; i++) {
        if (csi->bos[i].bo == boi &&
            csi->bos[i].read_domains == read_domains &&
            csi->bos[i].write_domain == write_domain)
            return;
    }
    radeon_bo_ref(bo);
    i = csi->bo_count;
    csi->bos[i].bo = boi;
    csi->bos[i].read_domains = read_domains;
    csi->bos[i].write_domain = write_domain;
    csi->bos[i].new_accounted = 0;
    csi->bo_count++;

    assert(csi->bo_count < MAX_SPACE_BOS);
}

Here is the call graph for this function:

int radeon_cs_space_check ( struct radeon_cs cs)

Definition at line 227 of file radeon_cs_space.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    return radeon_cs_check_space_internal(csi, NULL);
}

Here is the call graph for this function:

int radeon_cs_space_check_with_bo ( struct radeon_cs cs,
struct radeon_bo bo,
uint32_t  read_domains,
uint32_t  write_domain 
)

Definition at line 206 of file radeon_cs_space.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
    struct radeon_cs_space_check temp_bo;

    int ret = 0;

    if (bo) {
        temp_bo.bo = boi;
        temp_bo.read_domains = read_domains;
        temp_bo.write_domain = write_domain;
        temp_bo.new_accounted = 0;
    }

    ret = radeon_cs_check_space_internal(csi, bo ? &temp_bo : NULL);
    return ret;
}

Here is the call graph for this function:

void radeon_cs_space_reset_bos ( struct radeon_cs cs)

Definition at line 233 of file radeon_cs_space.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    int i;
    for (i = 0; i < csi->bo_count; i++) {
        radeon_bo_unref((struct radeon_bo *)csi->bos[i].bo);
        csi->bos[i].bo = NULL;
        csi->bos[i].read_domains = 0;
        csi->bos[i].write_domain = 0;
        csi->bos[i].new_accounted = 0;
    }
    csi->bo_count = 0;
}

Here is the call graph for this function:

void radeon_cs_space_set_flush ( struct radeon_cs cs,
void(*)(void *)  fn,
void *  data 
)

Definition at line 85 of file radeon_cs.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
    csi->space_flush_fn = fn;
    csi->space_flush_data = data;
}
static void radeon_cs_write_dword ( struct radeon_cs cs,
uint32_t  dword 
) [inline, static]

Definition at line 115 of file radeon_cs.h.

{
    cs->packets[cs->cdw++] = dword;
    if (cs->section_ndw) {
        cs->section_cdw++;
    }
}

Here is the caller graph for this function:

static void radeon_cs_write_qword ( struct radeon_cs cs,
uint64_t  qword 
) [inline, static]

Definition at line 123 of file radeon_cs.h.

{
    memcpy(cs->packets + cs->cdw, &qword, sizeof(uint64_t));
    cs->cdw += 2;
    if (cs->section_ndw) {
        cs->section_cdw += 2;
    }
}
int radeon_cs_write_reloc ( struct radeon_cs cs,
struct radeon_bo bo,
uint32_t  read_domain,
uint32_t  write_domain,
uint32_t  flags 
)

Definition at line 12 of file radeon_cs.c.

{
    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;

    return csi->csm->funcs->cs_write_reloc(csi,
                                           bo,
                                           read_domain,
                                           write_domain,
                                           flags);
}
static void radeon_cs_write_table ( struct radeon_cs cs,
const void *  data,
uint32_t  size 
) [inline, static]

Definition at line 132 of file radeon_cs.h.

{
    memcpy(cs->packets + cs->cdw, data, size * 4);
    cs->cdw += size;
    if (cs->section_ndw) {
        cs->section_cdw += size;
    }
}