summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPauli Nieminen <suokkos@gmail.com>2009-08-28 00:03:51 +0300
committerPauli Nieminen <suokkos@gmail.com>2009-08-29 04:54:29 +0300
commit0543f631c16bc4caed6e9dffe867d3f3580c042c (patch)
tree493874a6b078563580b567df7f9326b33b4f1628
parentf390f19de36bb7f68edbc12f62ec64d532aaf552 (diff)
libdrm_radeon: Clean up design.
Removed unnecessary variable from section. Automatic reallocation support was removed and instead will be replaced by explicity request for command buffer size change.
-rw-r--r--libdrm/radeon/radeon_cs.h21
-rw-r--r--libdrm/radeon/radeon_cs_gem.c29
2 files changed, 6 insertions, 44 deletions
diff --git a/libdrm/radeon/radeon_cs.h b/libdrm/radeon/radeon_cs.h
index 0f02e8d0..8eb12ba9 100644
--- a/libdrm/radeon/radeon_cs.h
+++ b/libdrm/radeon/radeon_cs.h
@@ -64,7 +64,6 @@ struct radeon_cs_manager;
struct radeon_cs_section {
unsigned ndw;
unsigned cdw;
- unsigned cs_sdw;
const char *file;
const char *func;
int line;
@@ -94,9 +93,6 @@ struct radeon_cs_funcs {
uint32_t read_domain,
uint32_t write_domain,
uint32_t flags);
- int (*cs_realloc)(struct radeon_cs *cs,
- uint32_t begin,
- uint32_t ndw);
int (*cs_emit)(struct radeon_cs *cs);
int (*cs_destroy)(struct radeon_cs *cs);
int (*cs_erase)(struct radeon_cs *cs);
@@ -143,11 +139,7 @@ static inline uint32_t __radeon_cs_alloc_section(struct radeon_cs *cs,
cs->cdw += ndw;
/* Handle cs overflow */
if (begin + ndw > cs->ndw) {
- /* Just for backward compability!
- We can't do realloc in parallel mode so this probably should be remoed. */
- int rv = cs->csm->funcs->cs_realloc(cs, begin, ndw);
- if (rv != 0)
- return (uint32_t)rv;
+ return (uint32_t)-ENOMEM;
}
return begin;
}
@@ -171,8 +163,6 @@ static inline int radeon_cs_begin(struct radeon_cs *cs,
return -EPIPE;
}
- section->ndw = ndw;
- section->cdw = 0;
section->file = file;
section->func = func;
section->line = line;
@@ -180,7 +170,8 @@ static inline int radeon_cs_begin(struct radeon_cs *cs,
if (begin > cs->ndw) {
return (int)begin;
}
- section->cs_sdw = begin;
+ section->ndw = begin + ndw;
+ section->cdw = begin;
return 0;
}
@@ -250,7 +241,7 @@ static inline void radeon_cs_write_dword(struct radeon_cs *cs,
struct radeon_cs_section *section,
uint32_t dword)
{
- cs->packets[section->cs_sdw + section->cdw] = dword;
+ cs->packets[section->cdw] = dword;
section->cdw++;
}
@@ -258,7 +249,7 @@ static inline void radeon_cs_write_qword(struct radeon_cs *cs,
struct radeon_cs_section *section,
uint64_t qword)
{
- memcpy(cs->packets + section->cs_sdw + section->cdw, &qword, sizeof(uint64_t));
+ memcpy(cs->packets + section->cdw, &qword, sizeof(uint64_t));
section->cdw += 2;
}
@@ -266,7 +257,7 @@ static inline void radeon_cs_write_table(struct radeon_cs *cs,
struct radeon_cs_section *section,
void *data, uint32_t size)
{
- memcpy(cs->packets + section->cs_sdw + section->cdw, data, size * 4);
+ memcpy(cs->packets + section->cdw, data, size * 4);
section->cdw += size;
}
diff --git a/libdrm/radeon/radeon_cs_gem.c b/libdrm/radeon/radeon_cs_gem.c
index 8af3005f..8028d244 100644
--- a/libdrm/radeon/radeon_cs_gem.c
+++ b/libdrm/radeon/radeon_cs_gem.c
@@ -205,34 +205,6 @@ static int cs_gem_write_reloc(struct radeon_cs *cs,
return 0;
}
-static int cs_gem_realloc(struct radeon_cs *cs,
- uint32_t begin,
- uint32_t ndw)
-{
- /* Untill there is no multithreaded access
- to cs we can omit locking. */
-
- if (begin + ndw > cs->ndw) {
- uint32_t tmp, *ptr;
-
- tmp = (cs->ndw + 1 + CS_ALIGNMENT) & (~CS_ALIGNMENT);
-
- if (tmp > CS_MAX_SIZE) {
- return -ENOMEM;
- }
-
- ptr = (uint32_t*)realloc(cs->packets, 4 * tmp);
- if (ptr == NULL) {
- return -ENOMEM;
- }
- cs->packets = ptr;
- cs->ndw = tmp;
- }
-
- return 0;
-
-}
-
static int cs_gem_emit(struct radeon_cs *cs)
{
struct cs_gem *csg = (struct cs_gem*)cs;
@@ -400,7 +372,6 @@ static void cs_gem_print(struct radeon_cs *cs, FILE *file)
static struct radeon_cs_funcs radeon_cs_gem_funcs = {
cs_gem_create,
cs_gem_write_reloc,
- cs_gem_realloc,
cs_gem_emit,
cs_gem_destroy,
cs_gem_erase,