aboutsummaryrefslogtreecommitdiff
path: root/radeon/radeon_cs.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-12-17 14:11:55 +1000
committerDave Airlie <airlied@redhat.com>2009-12-21 08:05:16 +1000
commit125994ab30d4f0f126c62fa741ec62a52d69d7a8 (patch)
treee641a13ec8e32c2322ebe1f1480581d58ad815e8 /radeon/radeon_cs.h
parentf1660c249198b5cc14ebbb75107da7bcb6972033 (diff)
radeon: straighten out the API insanity.
as Michel pointed out we are exposing too much info for these object for this to be maintainable going forward. This patch set minimises the exposed parts of the radeon_bo and radeon_cs objects to the piece necessary for ddx/mesa to operate at a decent speed. The major problem is mesa contains a legacy BO/CS managers which we still need to expose functionality to, and we really cannot change the API until we can drop the non-KMS codepaths. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'radeon/radeon_cs.h')
-rw-r--r--radeon/radeon_cs.h213
1 files changed, 54 insertions, 159 deletions
diff --git a/radeon/radeon_cs.h b/radeon/radeon_cs.h
index 1117a850..0954ca07 100644
--- a/radeon/radeon_cs.h
+++ b/radeon/radeon_cs.h
@@ -50,172 +50,41 @@ struct radeon_cs_reloc {
#define RADEON_CS_SPACE_OP_TO_BIG 1
#define RADEON_CS_SPACE_FLUSH 2
-struct radeon_cs_space_check {
- struct radeon_bo *bo;
- uint32_t read_domains;
- uint32_t write_domain;
- uint32_t new_accounted;
-};
-
-#define MAX_SPACE_BOS (32)
-
-struct radeon_cs_manager;
-
struct radeon_cs {
- struct radeon_cs_manager *csm;
- void *relocs;
- uint32_t *packets;
- unsigned crelocs;
- unsigned relocs_total_size;
- unsigned cdw;
- unsigned ndw;
- int section;
+ uint32_t *packets;
+ unsigned cdw;
+ unsigned ndw;
unsigned section_ndw;
unsigned section_cdw;
- const char *section_file;
- const char *section_func;
- int section_line;
- struct radeon_cs_space_check bos[MAX_SPACE_BOS];
- int bo_count;
- void (*space_flush_fn)(void *);
- void *space_flush_data;
-};
-
-/* cs functions */
-struct radeon_cs_funcs {
- struct radeon_cs *(*cs_create)(struct radeon_cs_manager *csm,
- uint32_t ndw);
- int (*cs_write_reloc)(struct radeon_cs *cs,
- struct radeon_bo *bo,
- uint32_t read_domain,
- uint32_t write_domain,
- uint32_t flags);
- int (*cs_begin)(struct radeon_cs *cs,
- uint32_t ndw,
- const char *file,
- const char *func,
- int line);
- int (*cs_end)(struct radeon_cs *cs,
- const char *file,
- const char *func,
- int line);
- int (*cs_emit)(struct radeon_cs *cs);
- int (*cs_destroy)(struct radeon_cs *cs);
- int (*cs_erase)(struct radeon_cs *cs);
- int (*cs_need_flush)(struct radeon_cs *cs);
- void (*cs_print)(struct radeon_cs *cs, FILE *file);
-};
-
-struct radeon_cs_manager {
- struct radeon_cs_funcs *funcs;
- int fd;
- int32_t vram_limit, gart_limit;
- int32_t vram_write_used, gart_write_used;
- int32_t read_used;
};
-static inline struct radeon_cs *radeon_cs_create(struct radeon_cs_manager *csm,
- uint32_t ndw)
-{
- return csm->funcs->cs_create(csm, ndw);
-}
-
-static inline int radeon_cs_write_reloc(struct radeon_cs *cs,
- struct radeon_bo *bo,
- uint32_t read_domain,
- uint32_t write_domain,
- uint32_t flags)
-{
- return cs->csm->funcs->cs_write_reloc(cs,
- bo,
- read_domain,
- write_domain,
- flags);
-}
-
-static inline int radeon_cs_begin(struct radeon_cs *cs,
- uint32_t ndw,
- const char *file,
- const char *func,
- int line)
-{
- return cs->csm->funcs->cs_begin(cs, ndw, file, func, line);
-}
-
-static inline int radeon_cs_end(struct radeon_cs *cs,
- const char *file,
- const char *func,
- int line)
-{
- return cs->csm->funcs->cs_end(cs, file, func, line);
-}
-
-static inline int radeon_cs_emit(struct radeon_cs *cs)
-{
- return cs->csm->funcs->cs_emit(cs);
-}
-
-static inline int radeon_cs_destroy(struct radeon_cs *cs)
-{
- return cs->csm->funcs->cs_destroy(cs);
-}
-
-static inline int radeon_cs_erase(struct radeon_cs *cs)
-{
- return cs->csm->funcs->cs_erase(cs);
-}
-
-static inline int radeon_cs_need_flush(struct radeon_cs *cs)
-{
- return cs->csm->funcs->cs_need_flush(cs);
-}
-
-static inline void radeon_cs_print(struct radeon_cs *cs, FILE *file)
-{
- cs->csm->funcs->cs_print(cs, file);
-}
-
-static inline void radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit)
-{
-
- if (domain == RADEON_GEM_DOMAIN_VRAM)
- cs->csm->vram_limit = limit;
- else
- cs->csm->gart_limit = limit;
-}
-
-static inline void radeon_cs_write_dword(struct radeon_cs *cs, uint32_t dword)
-{
- cs->packets[cs->cdw++] = dword;
- if (cs->section) {
- cs->section_cdw++;
- }
-}
-
-static inline void radeon_cs_write_qword(struct radeon_cs *cs, uint64_t qword)
-{
- memcpy(cs->packets + cs->cdw, &qword, sizeof(uint64_t));
- cs->cdw += 2;
- if (cs->section) {
- cs->section_cdw += 2;
- }
-}
-
-static inline void radeon_cs_write_table(struct radeon_cs *cs, void *data, uint32_t size)
-{
- memcpy(cs->packets + cs->cdw, data, size * 4);
- cs->cdw += size;
- if (cs->section) {
- cs->section_cdw += size;
- }
-}
+#define MAX_SPACE_BOS (32)
-static inline void radeon_cs_space_set_flush(struct radeon_cs *cs, void (*fn)(void *), void *data)
-{
- cs->space_flush_fn = fn;
- cs->space_flush_data = data;
-}
+struct radeon_cs_manager;
+extern struct radeon_cs *radeon_cs_create(struct radeon_cs_manager *csm,
+ uint32_t ndw);
+
+extern int radeon_cs_begin(struct radeon_cs *cs,
+ uint32_t ndw,
+ const char *file,
+ const char *func, int line);
+extern int radeon_cs_end(struct radeon_cs *cs,
+ const char *file,
+ const char *func,
+ int line);
+extern int radeon_cs_emit(struct radeon_cs *cs);
+extern int radeon_cs_destroy(struct radeon_cs *cs);
+extern int radeon_cs_erase(struct radeon_cs *cs);
+extern int radeon_cs_need_flush(struct radeon_cs *cs);
+extern void radeon_cs_print(struct radeon_cs *cs, FILE *file);
+extern void radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit);
+extern void radeon_cs_space_set_flush(struct radeon_cs *cs, void (*fn)(void *), void *data);
+extern int radeon_cs_write_reloc(struct radeon_cs *cs,
+ struct radeon_bo *bo,
+ uint32_t read_domain,
+ uint32_t write_domain,
+ uint32_t flags);
/*
* add a persistent BO to the list
@@ -243,4 +112,30 @@ int radeon_cs_space_check_with_bo(struct radeon_cs *cs,
uint32_t read_domains,
uint32_t write_domain);
+static inline void radeon_cs_write_dword(struct radeon_cs *cs, uint32_t dword)
+{
+ cs->packets[cs->cdw++] = dword;
+ if (cs->section_ndw) {
+ cs->section_cdw++;
+ }
+}
+
+static inline void radeon_cs_write_qword(struct radeon_cs *cs, uint64_t qword)
+{
+ memcpy(cs->packets + cs->cdw, &qword, sizeof(uint64_t));
+ cs->cdw += 2;
+ if (cs->section_ndw) {
+ cs->section_cdw += 2;
+ }
+}
+
+static inline void radeon_cs_write_table(struct radeon_cs *cs,
+ void *data, uint32_t size)
+{
+ memcpy(cs->packets + cs->cdw, data, size * 4);
+ cs->cdw += size;
+ if (cs->section_ndw) {
+ cs->section_cdw += size;
+ }
+}
#endif