diff options
author | Corbin Simpson <MostAwesomeDude@gmail.com> | 2009-05-01 05:03:56 -0700 |
---|---|---|
committer | Corbin Simpson <MostAwesomeDude@gmail.com> | 2009-05-01 05:03:56 -0700 |
commit | d7f4ac9f34a72efe53a1a140557f1822afbadf16 (patch) | |
tree | 9a7a2ea4d378d8a8c6c533f9534ec161e987d039 | |
parent | a609f78cf688c97eda8cde3d876397e042fdb60d (diff) |
r300-gallium, radeon-winsys: Reorganize r300_winsys header, break ABI.
Make things more consistent, prepare for more function hooks.
-rw-r--r-- | src/gallium/drivers/r300/r300_cs.h | 18 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_winsys.h | 46 | ||||
-rw-r--r-- | src/gallium/winsys/drm/radeon/core/radeon_r300.c | 53 |
3 files changed, 70 insertions, 47 deletions
diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h index 5d9799dd72..82a3942248 100644 --- a/src/gallium/drivers/r300/r300_cs.h +++ b/src/gallium/drivers/r300/r300_cs.h @@ -49,27 +49,27 @@ #define CS_LOCALS(context) \ struct r300_winsys* cs_winsys = context->winsys; \ - struct radeon_cs* cs = cs_winsys->cs; \ int cs_count = 0; #define CHECK_CS(size) \ - cs_winsys->check_cs(cs, (size)) + cs_winsys->check_cs(cs_winsys, (size)) #define BEGIN_CS(size) do { \ CHECK_CS(size); \ debug_printf("r300: BEGIN_CS, count %d, in %s (%s:%d)\n", \ size, __FUNCTION__, __FILE__, __LINE__); \ - cs_winsys->begin_cs(cs, (size), __FILE__, __FUNCTION__, __LINE__); \ + cs_winsys->begin_cs(cs_winsys, (size), \ + __FILE__, __FUNCTION__, __LINE__); \ cs_count = size; \ } while (0) #define OUT_CS(value) do { \ - cs_winsys->write_cs_dword(cs, (value)); \ + cs_winsys->write_cs_dword(cs_winsys, (value)); \ cs_count--; \ } while (0) #define OUT_CS_32F(value) do { \ - cs_winsys->write_cs_dword(cs, fui(value)); \ + cs_winsys->write_cs_dword(cs_winsys, fui(value)); \ cs_count--; \ } while (0) @@ -97,7 +97,7 @@ bo, offset); \ assert(bo); \ OUT_CS(offset); \ - cs_winsys->write_cs_reloc(cs, bo, rd, wd, flags); \ + cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \ cs_count -= 2; \ } while (0) @@ -106,13 +106,13 @@ __LINE__); \ if (cs_count != 0) \ debug_printf("r300: Warning: cs_count off by %d\n", cs_count); \ - cs_winsys->end_cs(cs, __FILE__, __FUNCTION__, __LINE__); \ + cs_winsys->end_cs(cs_winsys, __FILE__, __FUNCTION__, __LINE__); \ } while (0) #define FLUSH_CS do { \ debug_printf("r300: FLUSH_CS in %s (%s:%d)\n\n", __FUNCTION__, __FILE__, \ __LINE__); \ - cs_winsys->flush_cs(cs); \ + cs_winsys->flush_cs(cs_winsys); \ } while (0) #define RADEON_ONE_REG_WR (1 << 15) @@ -138,7 +138,7 @@ assert(bo); \ OUT_CS(offset); \ OUT_CS(count); \ - cs_winsys->write_cs_reloc(cs, bo, rd, wd, flags); \ + cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \ cs_count -= 2; \ } while (0) diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index baa95282c3..393ba07012 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -35,8 +35,6 @@ extern "C" { #include "pipe/p_state.h" #include "pipe/internal/p_winsys_screen.h" -struct radeon_cs; - struct r300_winsys { /* Parent class */ struct pipe_winsys base; @@ -44,45 +42,45 @@ struct r300_winsys { /* Opaque Radeon-specific winsys object. */ void* radeon_winsys; + /* CS object. This is very much like Intel's batchbuffer. + * Fill it full of dwords and relocs and then submit. + * Repeat as needed. */ + struct radeon_cs* cs; + /* PCI ID */ uint32_t pci_id; /* GB pipe count */ uint32_t gb_pipes; - /* CS object. This is very much like Intel's batchbuffer. - * Fill it full of dwords and relocs and then submit. - * Repeat as needed. */ - struct radeon_cs* cs; - /* Check to see if there's room for commands. */ - boolean (*check_cs)(struct radeon_cs* cs, int size); + boolean (*check_cs)(struct r300_winsys* winsys, int size); /* Start a command emit. */ - void (*begin_cs)(struct radeon_cs* cs, - int size, - const char* file, - const char* function, - int line); + void (*begin_cs)(struct r300_winsys* winsys, + int size, + const char* file, + const char* function, + int line); /* Write a dword to the command buffer. */ - void (*write_cs_dword)(struct radeon_cs* cs, uint32_t dword); + void (*write_cs_dword)(struct r300_winsys* winsys, uint32_t dword); /* Write a relocated dword to the command buffer. */ - void (*write_cs_reloc)(struct radeon_cs* cs, - struct pipe_buffer* bo, - uint32_t rd, - uint32_t wd, - uint32_t flags); + void (*write_cs_reloc)(struct r300_winsys* winsys, + struct pipe_buffer* bo, + uint32_t rd, + uint32_t wd, + uint32_t flags); /* Finish a command emit. */ - void (*end_cs)(struct radeon_cs* cs, - const char* file, - const char* function, - int line); + void (*end_cs)(struct r300_winsys* winsys, + const char* file, + const char* function, + int line); /* Flush the CS. */ - void (*flush_cs)(struct radeon_cs* cs); + void (*flush_cs)(struct r300_winsys* winsys); }; struct pipe_context* r300_create_context(struct pipe_screen* screen, diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index adbf23ab51..929e4842cc 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -22,31 +22,56 @@ #include "radeon_r300.h" -static boolean radeon_r300_check_cs(struct radeon_cs* cs, int size) +static boolean radeon_r300_check_cs(struct r300_winsys* winsys, int size) { /* XXX check size here, lazy ass! */ + /* XXX also validate buffers */ return TRUE; } -static void radeon_r300_write_cs_reloc(struct radeon_cs* cs, - struct pipe_buffer* pbuffer, - uint32_t rd, - uint32_t wd, - uint32_t flags) +static void radeon_r300_begin_cs(struct r300_winsys* winsys, + int size, + const char* file, + const char* function, + int line) { - radeon_cs_write_reloc(cs, ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags); + radeon_cs_begin(winsys->cs, size, file, function, line); } -static void radeon_r300_flush_cs(struct radeon_cs* cs) +static void radeon_r300_write_cs_dword(struct r300_winsys* winsys, + uint32_t dword) +{ + radeon_cs_write_dword(winsys->cs, dword); +} + +static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys, + struct pipe_buffer* pbuffer, + uint32_t rd, + uint32_t wd, + uint32_t flags) +{ + radeon_cs_write_reloc(winsys->cs, + ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags); +} + +static void radeon_r300_end_cs(struct r300_winsys* winsys, + const char* file, + const char* function, + int line) +{ + radeon_cs_end(winsys->cs, file, function, line); +} + +static void radeon_r300_flush_cs(struct r300_winsys* winsys) { int retval = 0; - retval = radeon_cs_emit(cs); + retval = radeon_cs_emit(winsys->cs); if (retval) { debug_printf("radeon: Bad CS, dumping...\n"); - radeon_cs_print(cs, stderr); + radeon_cs_print(winsys->cs, stderr); } - radeon_cs_erase(cs); + radeon_cs_erase(winsys->cs); } /* Helper function to do the ioctls needed for setup and init. */ @@ -96,10 +121,10 @@ radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys) winsys->cs = radeon_cs_create(csm, 1024 * 64 / 4); winsys->check_cs = radeon_r300_check_cs; - winsys->begin_cs = radeon_cs_begin; - winsys->write_cs_dword = radeon_cs_write_dword; + winsys->begin_cs = radeon_r300_begin_cs; + winsys->write_cs_dword = radeon_r300_write_cs_dword; winsys->write_cs_reloc = radeon_r300_write_cs_reloc; - winsys->end_cs = radeon_cs_end; + winsys->end_cs = radeon_r300_end_cs; winsys->flush_cs = radeon_r300_flush_cs; memcpy(winsys, old_winsys, sizeof(struct radeon_winsys)); |