diff options
30 files changed, 354 insertions, 351 deletions
diff --git a/SConstruct b/SConstruct index 6ed44ddd06..2549a13fff 100644 --- a/SConstruct +++ b/SConstruct @@ -52,7 +52,7 @@ opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statet opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers, ['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'identity', 'llvmpipe'])) opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys, - ['xlib', 'vmware', 'intel', 'i965', 'gdi', 'radeon'])) + ['xlib', 'vmware', 'i915', 'i965', 'gdi', 'radeon'])) opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0'))) diff --git a/src/gallium/drivers/i915/i915_batch.h b/src/gallium/drivers/i915/i915_batch.h index b813784723..f0086695d1 100644 --- a/src/gallium/drivers/i915/i915_batch.h +++ b/src/gallium/drivers/i915/i915_batch.h @@ -28,19 +28,19 @@ #ifndef I915_BATCH_H #define I915_BATCH_H -#include "intel_batchbuffer.h" +#include "i915_batchbuffer.h" #define BEGIN_BATCH(dwords, relocs) \ - (intel_batchbuffer_check(i915->batch, dwords, relocs)) + (i915_winsys_batchbuffer_check(i915->batch, dwords, relocs)) #define OUT_BATCH(dword) \ - intel_batchbuffer_dword(i915->batch, dword) + i915_winsys_batchbuffer_dword(i915->batch, dword) #define OUT_RELOC(buf, usage, offset) \ - intel_batchbuffer_reloc(i915->batch, buf, usage, offset) + i915_winsys_batchbuffer_reloc(i915->batch, buf, usage, offset) #define FLUSH_BATCH(fence) do { \ - intel_batchbuffer_flush(i915->batch, fence); \ + i915_winsys_batchbuffer_flush(i915->batch, fence); \ i915->hardware_dirty = ~0; \ } while (0) diff --git a/src/gallium/drivers/i915/intel_batchbuffer.h b/src/gallium/drivers/i915/i915_batchbuffer.h index db12dfd2ac..27ccaa6b1f 100644 --- a/src/gallium/drivers/i915/intel_batchbuffer.h +++ b/src/gallium/drivers/i915/i915_batchbuffer.h @@ -1,8 +1,8 @@ /************************************************************************** - * + * * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -10,11 +10,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -22,34 +22,34 @@ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * **************************************************************************/ -#ifndef INTEL_BATCH_H -#define INTEL_BATCH_H +#ifndef I915_BATCHBUFFER_H +#define I915_BATCHBUFFER_H -#include "intel_winsys.h" +#include "i915_winsys.h" static INLINE boolean -intel_batchbuffer_check(struct intel_batchbuffer *batch, - size_t dwords, - size_t relocs) +i915_winsys_batchbuffer_check(struct i915_winsys_batchbuffer *batch, + size_t dwords, + size_t relocs) { return dwords * 4 <= batch->size - (batch->ptr - batch->map) && relocs <= (batch->max_relocs - batch->relocs); } static INLINE size_t -intel_batchbuffer_space(struct intel_batchbuffer *batch) +i915_winsys_batchbuffer_space(struct i915_winsys_batchbuffer *batch) { return batch->size - (batch->ptr - batch->map); } static INLINE void -intel_batchbuffer_dword(struct intel_batchbuffer *batch, - unsigned dword) +i915_winsys_batchbuffer_dword(struct i915_winsys_batchbuffer *batch, + unsigned dword) { - if (intel_batchbuffer_space(batch) < 4) + if (i915_winsys_batchbuffer_space(batch) < 4) return; *(unsigned *)batch->ptr = dword; @@ -57,11 +57,11 @@ intel_batchbuffer_dword(struct intel_batchbuffer *batch, } static INLINE void -intel_batchbuffer_write(struct intel_batchbuffer *batch, - void *data, - size_t size) +i915_winsys_batchbuffer_write(struct i915_winsys_batchbuffer *batch, + void *data, + size_t size) { - if (intel_batchbuffer_space(batch) < size) + if (i915_winsys_batchbuffer_space(batch) < size) return; memcpy(data, batch->ptr, size); @@ -69,17 +69,17 @@ intel_batchbuffer_write(struct intel_batchbuffer *batch, } static INLINE int -intel_batchbuffer_reloc(struct intel_batchbuffer *batch, - struct intel_buffer *buffer, - enum intel_buffer_usage usage, - size_t offset) +i915_winsys_batchbuffer_reloc(struct i915_winsys_batchbuffer *batch, + struct i915_winsys_buffer *buffer, + enum i915_winsys_buffer_usage usage, + size_t offset) { return batch->iws->batchbuffer_reloc(batch, buffer, usage, offset); } static INLINE void -intel_batchbuffer_flush(struct intel_batchbuffer *batch, - struct pipe_fence_handle **fence) +i915_winsys_batchbuffer_flush(struct i915_winsys_batchbuffer *batch, + struct pipe_fence_handle **fence) { batch->iws->batchbuffer_flush(batch, fence); } diff --git a/src/gallium/drivers/i915/i915_blit.c b/src/gallium/drivers/i915/i915_blit.c index 83dfc33528..533fa81219 100644 --- a/src/gallium/drivers/i915/i915_blit.c +++ b/src/gallium/drivers/i915/i915_blit.c @@ -37,7 +37,7 @@ void i915_fill_blit(struct i915_context *i915, unsigned cpp, unsigned short dst_pitch, - struct intel_buffer *dst_buffer, + struct i915_winsys_buffer *dst_buffer, unsigned dst_offset, short x, short y, short w, short h, @@ -77,7 +77,7 @@ i915_fill_blit(struct i915_context *i915, OUT_BATCH(BR13); OUT_BATCH((y << 16) | x); OUT_BATCH(((y + h) << 16) | (x + w)); - OUT_RELOC(dst_buffer, INTEL_USAGE_2D_TARGET, dst_offset); + OUT_RELOC(dst_buffer, I915_USAGE_2D_TARGET, dst_offset); OUT_BATCH(color); FLUSH_BATCH(NULL); } @@ -87,10 +87,10 @@ i915_copy_blit(struct i915_context *i915, unsigned do_flip, unsigned cpp, unsigned short src_pitch, - struct intel_buffer *src_buffer, + struct i915_winsys_buffer *src_buffer, unsigned src_offset, unsigned short dst_pitch, - struct intel_buffer *dst_buffer, + struct i915_winsys_buffer *dst_buffer, unsigned dst_offset, short src_x, short src_y, short dst_x, short dst_y, @@ -143,9 +143,9 @@ i915_copy_blit(struct i915_context *i915, OUT_BATCH(BR13); OUT_BATCH((dst_y << 16) | dst_x); OUT_BATCH((dst_y2 << 16) | dst_x2); - OUT_RELOC(dst_buffer, INTEL_USAGE_2D_TARGET, dst_offset); + OUT_RELOC(dst_buffer, I915_USAGE_2D_TARGET, dst_offset); OUT_BATCH((src_y << 16) | src_x); OUT_BATCH(((int) src_pitch & 0xffff)); - OUT_RELOC(src_buffer, INTEL_USAGE_2D_SOURCE, src_offset); + OUT_RELOC(src_buffer, I915_USAGE_2D_SOURCE, src_offset); FLUSH_BATCH(NULL); } diff --git a/src/gallium/drivers/i915/i915_blit.h b/src/gallium/drivers/i915/i915_blit.h index 8ce3220cfd..db576ed4c9 100644 --- a/src/gallium/drivers/i915/i915_blit.h +++ b/src/gallium/drivers/i915/i915_blit.h @@ -34,10 +34,10 @@ extern void i915_copy_blit(struct i915_context *i915, unsigned do_flip, unsigned cpp, unsigned short src_pitch, - struct intel_buffer *src_buffer, + struct i915_winsys_buffer *src_buffer, unsigned src_offset, unsigned short dst_pitch, - struct intel_buffer *dst_buffer, + struct i915_winsys_buffer *dst_buffer, unsigned dst_offset, short srcx, short srcy, short dstx, short dsty, @@ -46,7 +46,7 @@ extern void i915_copy_blit(struct i915_context *i915, extern void i915_fill_blit(struct i915_context *i915, unsigned cpp, unsigned short dst_pitch, - struct intel_buffer *dst_buffer, + struct i915_winsys_buffer *dst_buffer, unsigned dst_offset, short x, short y, short w, short h, unsigned color); diff --git a/src/gallium/drivers/i915/i915_buffer.c b/src/gallium/drivers/i915/i915_buffer.c index 0f76a59e93..1247de320d 100644 --- a/src/gallium/drivers/i915/i915_buffer.c +++ b/src/gallium/drivers/i915/i915_buffer.c @@ -28,13 +28,13 @@ #include "i915_screen.h" #include "i915_buffer.h" -struct intel_buffer; +struct i915_winsys_buffer; struct i915_buffer { struct pipe_buffer base; - struct intel_buffer *ibuf; /** hw buffer */ + struct i915_winsys_buffer *ibuf; /** hw buffer */ void *data; /**< user and malloc data */ boolean own; /**< we own the data incase of malloc */ diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index 5348f62ca7..8df4dce865 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -38,9 +38,9 @@ #include "tgsi/tgsi_scan.h" -struct intel_winsys; -struct intel_buffer; -struct intel_batchbuffer; +struct i915_winsys; +struct i915_winsys_buffer; +struct i915_winsys_batchbuffer; #define I915_TEX_UNITS 8 @@ -219,14 +219,14 @@ struct i915_texture { /* The data is held here: */ - struct intel_buffer *buffer; + struct i915_winsys_buffer *buffer; }; struct i915_context { struct pipe_context base; - struct intel_winsys *iws; + struct i915_winsys *iws; struct draw_context *draw; @@ -257,10 +257,10 @@ struct i915_context unsigned num_fragment_sampler_views; unsigned num_vertex_buffers; - struct intel_batchbuffer *batch; + struct i915_winsys_batchbuffer *batch; /** Vertex buffer */ - struct intel_buffer *vbo; + struct i915_winsys_buffer *vbo; size_t vbo_offset; unsigned vbo_flushed; diff --git a/src/gallium/drivers/i915/i915_debug.c b/src/gallium/drivers/i915/i915_debug.c index 237654d26b..663fac3055 100644 --- a/src/gallium/drivers/i915/i915_debug.c +++ b/src/gallium/drivers/i915/i915_debug.c @@ -863,7 +863,7 @@ static boolean i915_debug_packet( struct debug_stream *stream ) void -i915_dump_batchbuffer( struct intel_batchbuffer *batch ) +i915_dump_batchbuffer( struct i915_winsys_batchbuffer *batch ) { struct debug_stream stream; unsigned *start = (unsigned*)batch->map; diff --git a/src/gallium/drivers/i915/i915_debug.h b/src/gallium/drivers/i915/i915_debug.h index 8f7484797d..67b8d9c2f6 100644 --- a/src/gallium/drivers/i915/i915_debug.h +++ b/src/gallium/drivers/i915/i915_debug.h @@ -104,9 +104,9 @@ I915_DBG( #endif -struct intel_batchbuffer; +struct i915_winsys_batchbuffer; -void i915_dump_batchbuffer( struct intel_batchbuffer *i915 ); +void i915_dump_batchbuffer( struct i915_winsys_batchbuffer *i915 ); void i915_debug_init( struct i915_context *i915 ); diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c index cad4109ee6..df9e68af4f 100644 --- a/src/gallium/drivers/i915/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915/i915_prim_vbuf.c @@ -76,7 +76,7 @@ struct i915_vbuf_render { unsigned fallback; /* Stuff for the vbo */ - struct intel_buffer *vbo; + struct i915_winsys_buffer *vbo; size_t vbo_size; /**< current size of allocated buffer */ size_t vbo_alloc_size; /**< minimum buffer size to allocate */ size_t vbo_offset; @@ -141,7 +141,7 @@ static void i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size) { struct i915_context *i915 = i915_render->i915; - struct intel_winsys *iws = i915->iws; + struct i915_winsys *iws = i915->iws; if (i915_render->vbo) { #ifdef VBUF_USE_FIFO @@ -172,7 +172,7 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size) if (i915_render->vbo_size != i915_render->pool_buffer_size) { i915_render->pool_not_used = TRUE; i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size, 64, - INTEL_NEW_VERTEX); + I915_NEW_VERTEX); } else { i915_render->pool_not_used = FALSE; @@ -185,7 +185,7 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size) } #else i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size, - 64, INTEL_NEW_VERTEX); + 64, I915_NEW_VERTEX); #endif } @@ -225,7 +225,7 @@ i915_vbuf_render_map_vertices(struct vbuf_render *render) { struct i915_vbuf_render *i915_render = i915_vbuf_render(render); struct i915_context *i915 = i915_render->i915; - struct intel_winsys *iws = i915->iws; + struct i915_winsys *iws = i915->iws; if (i915->vbo_flushed) debug_printf("%s bad vbo flush occured stalling on hw\n", __FUNCTION__); @@ -246,7 +246,7 @@ i915_vbuf_render_unmap_vertices(struct vbuf_render *render, { struct i915_vbuf_render *i915_render = i915_vbuf_render(render); struct i915_context *i915 = i915_render->i915; - struct intel_winsys *iws = i915->iws; + struct i915_winsys *iws = i915->iws; i915_render->vbo_max_used = MAX2(i915_render->vbo_max_used, i915_render->vertex_size * (max_index + 1)); #ifdef VBUF_MAP_BUFFER @@ -621,7 +621,7 @@ static struct vbuf_render * i915_vbuf_render_create(struct i915_context *i915) { struct i915_vbuf_render *i915_render = CALLOC_STRUCT(i915_vbuf_render); - struct intel_winsys *iws = i915->iws; + struct i915_winsys *iws = i915->iws; int i; i915_render->i915 = i915; @@ -662,7 +662,7 @@ i915_vbuf_render_create(struct i915_context *i915) for (i = 0; i < 6; i++) u_fifo_add(i915_render->pool_fifo, iws->buffer_create(iws, i915_render->pool_buffer_size, 64, - INTEL_NEW_VERTEX)); + I915_NEW_VERTEX)); #else (void)i; (void)iws; diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 48a39edad2..53ef6e50f6 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -35,7 +35,7 @@ #include "i915_screen.h" #include "i915_buffer.h" #include "i915_texture.h" -#include "intel_winsys.h" +#include "i915_winsys.h" /* @@ -260,7 +260,7 @@ i915_destroy_screen(struct pipe_screen *screen) * Create a new i915_screen object */ struct pipe_screen * -i915_create_screen(struct intel_winsys *iws, uint pci_id) +i915_create_screen(struct i915_winsys *iws, uint pci_id) { struct i915_screen *is = CALLOC_STRUCT(i915_screen); diff --git a/src/gallium/drivers/i915/i915_screen.h b/src/gallium/drivers/i915/i915_screen.h index 5126485caa..7f9e02fc0f 100644 --- a/src/gallium/drivers/i915/i915_screen.h +++ b/src/gallium/drivers/i915/i915_screen.h @@ -32,7 +32,7 @@ #include "pipe/p_screen.h" -struct intel_winsys; +struct i915_winsys; /** @@ -42,7 +42,7 @@ struct i915_screen { struct pipe_screen base; - struct intel_winsys *iws; + struct i915_winsys *iws; boolean is_i945; uint pci_id; diff --git a/src/gallium/drivers/i915/i915_state_emit.c b/src/gallium/drivers/i915/i915_state_emit.c index d79c1ca0b2..04a3924aaf 100644 --- a/src/gallium/drivers/i915/i915_state_emit.c +++ b/src/gallium/drivers/i915/i915_state_emit.c @@ -182,7 +182,7 @@ i915_emit_hardware_state(struct i915_context *i915 ) if(i915->vbo) OUT_RELOC(i915->vbo, - INTEL_USAGE_VERTEX, + I915_USAGE_VERTEX, i915->current.immediate[I915_IMMEDIATE_S0]); else /* FIXME: we should not do this */ @@ -226,7 +226,7 @@ i915_emit_hardware_state(struct i915_context *i915 ) ctile); OUT_RELOC(tex->buffer, - INTEL_USAGE_RENDER, + I915_USAGE_RENDER, cbuf_surface->offset); } @@ -250,7 +250,7 @@ i915_emit_hardware_state(struct i915_context *i915 ) ztile); OUT_RELOC(tex->buffer, - INTEL_USAGE_RENDER, + I915_USAGE_RENDER, depth_surface->offset); } @@ -291,13 +291,13 @@ i915_emit_hardware_state(struct i915_context *i915 ) for (unit = 0; unit < I915_TEX_UNITS; unit++) { if (enabled & (1 << unit)) { struct i915_texture *texture = (struct i915_texture *)i915->fragment_sampler_views[unit]->texture; - struct intel_buffer *buf = texture->buffer; + struct i915_winsys_buffer *buf = texture->buffer; uint offset = 0; assert(buf); count++; - OUT_RELOC(buf, INTEL_USAGE_SAMPLER, offset); + OUT_RELOC(buf, I915_USAGE_SAMPLER, offset); OUT_BATCH(i915->current.texbuffer[unit][0]); /* MS3 */ OUT_BATCH(i915->current.texbuffer[unit][1]); /* MS4 */ } diff --git a/src/gallium/drivers/i915/i915_state_immediate.c b/src/gallium/drivers/i915/i915_state_immediate.c index d2c6f15143..8cec699285 100644 --- a/src/gallium/drivers/i915/i915_state_immediate.c +++ b/src/gallium/drivers/i915/i915_state_immediate.c @@ -52,11 +52,11 @@ static void upload_S0S1(struct i915_context *i915) { unsigned LIS0, LIS1; - /* INTEL_NEW_VBO */ + /* I915_NEW_VBO */ /* TODO: re-use vertex buffers here? */ LIS0 = i915->vbo_offset; - /* INTEL_NEW_VERTEX_SIZE -- do this where the vertex size is calculated! + /* I915_NEW_VERTEX_SIZE -- do this where the vertex size is calculated! */ { unsigned vertex_size = i915->current.vertex_info.size; @@ -65,7 +65,7 @@ static void upload_S0S1(struct i915_context *i915) (vertex_size << 16)); } - /* INTEL_NEW_VBO */ + /* I915_NEW_VBO */ /* TODO: use a vertex generation number to track vbo changes */ if (1 || i915->current.immediate[I915_IMMEDIATE_S0] != LIS0 || diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c index b252fb5330..8c405c2443 100644 --- a/src/gallium/drivers/i915/i915_texture.c +++ b/src/gallium/drivers/i915/i915_texture.c @@ -41,7 +41,7 @@ #include "i915_context.h" #include "i915_texture.h" #include "i915_screen.h" -#include "intel_winsys.h" +#include "i915_winsys.h" /* @@ -162,7 +162,7 @@ i915_scanout_layout(struct i915_texture *tex) if (pt->width0 >= 240) { tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0)); tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8); - tex->hw_tiled = INTEL_TILE_X; + tex->hw_tiled = I915_TILE_X; } else if (pt->width0 == 64 && pt->height0 == 64) { tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0)); tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8); @@ -200,7 +200,7 @@ i915_display_target_layout(struct i915_texture *tex) tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0)); tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8); - tex->hw_tiled = INTEL_TILE_X; + tex->hw_tiled = I915_TILE_X; debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, pt->width0, pt->height0, util_format_get_blocksize(pt->format), @@ -617,7 +617,7 @@ i915_texture_create(struct pipe_screen *screen, const struct pipe_texture *templat) { struct i915_screen *is = i915_screen(screen); - struct intel_winsys *iws = is->iws; + struct i915_winsys *iws = is->iws; struct i915_texture *tex = CALLOC_STRUCT(i915_texture); size_t tex_size; unsigned buf_usage = 0; @@ -643,9 +643,9 @@ i915_texture_create(struct pipe_screen *screen, /* for scanouts and cursors, cursors arn't scanouts */ if (templat->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT && templat->width0 != 64) - buf_usage = INTEL_NEW_SCANOUT; + buf_usage = I915_NEW_SCANOUT; else - buf_usage = INTEL_NEW_TEXTURE; + buf_usage = I915_NEW_TEXTURE; tex->buffer = iws->buffer_create(iws, tex_size, 64, buf_usage); if (!tex->buffer) @@ -653,7 +653,7 @@ i915_texture_create(struct pipe_screen *screen, /* setup any hw fences */ if (tex->hw_tiled) { - assert(tex->sw_tiled == INTEL_TILE_NONE); + assert(tex->sw_tiled == I915_TILE_NONE); iws->buffer_set_fence_reg(iws, tex->buffer, tex->stride, tex->hw_tiled); } @@ -679,8 +679,8 @@ i915_texture_from_handle(struct pipe_screen * screen, { struct i915_screen *is = i915_screen(screen); struct i915_texture *tex; - struct intel_winsys *iws = is->iws; - struct intel_buffer *buffer; + struct i915_winsys *iws = is->iws; + struct i915_winsys_buffer *buffer; unsigned stride; assert(screen); @@ -719,7 +719,7 @@ i915_texture_get_handle(struct pipe_screen * screen, { struct i915_screen *is = i915_screen(screen); struct i915_texture *tex = (struct i915_texture *)texture; - struct intel_winsys *iws = is->iws; + struct i915_winsys *iws = is->iws; return iws->buffer_get_handle(iws, tex->buffer, whandle, tex->stride); } @@ -729,7 +729,7 @@ static void i915_texture_destroy(struct pipe_texture *pt) { struct i915_texture *tex = (struct i915_texture *)pt; - struct intel_winsys *iws = i915_screen(pt->screen)->iws; + struct i915_winsys *iws = i915_screen(pt->screen)->iws; uint i; /* @@ -841,7 +841,7 @@ i915_transfer_map(struct pipe_context *pipe, struct pipe_transfer *transfer) { struct i915_texture *tex = (struct i915_texture *)transfer->texture; - struct intel_winsys *iws = i915_screen(tex->base.screen)->iws; + struct i915_winsys *iws = i915_screen(tex->base.screen)->iws; char *map; boolean write = FALSE; enum pipe_format format = tex->base.format; @@ -863,7 +863,7 @@ i915_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *transfer) { struct i915_texture *tex = (struct i915_texture *)transfer->texture; - struct intel_winsys *iws = i915_screen(tex->base.screen)->iws; + struct i915_winsys *iws = i915_screen(tex->base.screen)->iws; iws->buffer_unmap(iws, tex->buffer); } diff --git a/src/gallium/drivers/i915/intel_winsys.h b/src/gallium/drivers/i915/i915_winsys.h index 00fd0c1efe..246e95b00d 100644 --- a/src/gallium/drivers/i915/intel_winsys.h +++ b/src/gallium/drivers/i915/i915_winsys.h @@ -23,46 +23,46 @@ * **************************************************************************/ -#ifndef INTEL_WINSYS_H -#define INTEL_WINSYS_H +#ifndef I915_WINSYS_H +#define I915_WINSYS_H #include "pipe/p_compiler.h" -struct intel_winsys; -struct intel_buffer; -struct intel_batchbuffer; +struct i915_winsys; +struct i915_winsys_buffer; +struct i915_winsys_batchbuffer; struct pipe_texture; struct pipe_fence_handle; struct winsys_handle; -enum intel_buffer_usage +enum i915_winsys_buffer_usage { /* use on textures */ - INTEL_USAGE_RENDER = 0x01, - INTEL_USAGE_SAMPLER = 0x02, - INTEL_USAGE_2D_TARGET = 0x04, - INTEL_USAGE_2D_SOURCE = 0x08, + I915_USAGE_RENDER = 0x01, + I915_USAGE_SAMPLER = 0x02, + I915_USAGE_2D_TARGET = 0x04, + I915_USAGE_2D_SOURCE = 0x08, /* use on vertex */ - INTEL_USAGE_VERTEX = 0x10 + I915_USAGE_VERTEX = 0x10 }; -enum intel_buffer_type +enum i915_winsys_buffer_type { - INTEL_NEW_TEXTURE, - INTEL_NEW_SCANOUT, /**< a texture used for scanning out from */ - INTEL_NEW_VERTEX + I915_NEW_TEXTURE, + I915_NEW_SCANOUT, /**< a texture used for scanning out from */ + I915_NEW_VERTEX }; -enum intel_buffer_tile +enum i915_winsys_buffer_tile { - INTEL_TILE_NONE, - INTEL_TILE_X, - INTEL_TILE_Y + I915_TILE_NONE, + I915_TILE_X, + I915_TILE_Y }; -struct intel_batchbuffer { +struct i915_winsys_batchbuffer { - struct intel_winsys *iws; + struct i915_winsys *iws; /** * Values exported to speed up the writing the batchbuffer, @@ -79,7 +79,7 @@ struct intel_batchbuffer { /*@}*/ }; -struct intel_winsys { +struct i915_winsys { /** * Batchbuffer functions. @@ -88,7 +88,8 @@ struct intel_winsys { /** * Create a new batchbuffer. */ - struct intel_batchbuffer *(*batchbuffer_create)(struct intel_winsys *iws); + struct i915_winsys_batchbuffer * + (*batchbuffer_create)(struct i915_winsys *iws); /** * Emit a relocation to a buffer. @@ -100,21 +101,21 @@ struct intel_winsys { * @offset add this to the reloc buffers address * @target buffer where to write the address, null for batchbuffer. */ - int (*batchbuffer_reloc)(struct intel_batchbuffer *batch, - struct intel_buffer *reloc, - enum intel_buffer_usage usage, + int (*batchbuffer_reloc)(struct i915_winsys_batchbuffer *batch, + struct i915_winsys_buffer *reloc, + enum i915_winsys_buffer_usage usage, unsigned offset); /** * Flush a bufferbatch. */ - void (*batchbuffer_flush)(struct intel_batchbuffer *batch, + void (*batchbuffer_flush)(struct i915_winsys_batchbuffer *batch, struct pipe_fence_handle **fence); /** * Destroy a batchbuffer. */ - void (*batchbuffer_destroy)(struct intel_batchbuffer *batch); + void (*batchbuffer_destroy)(struct i915_winsys_batchbuffer *batch); /*@}*/ @@ -125,9 +126,10 @@ struct intel_winsys { /** * Create a buffer. */ - struct intel_buffer *(*buffer_create)(struct intel_winsys *iws, - unsigned size, unsigned alignment, - enum intel_buffer_type type); + struct i915_winsys_buffer * + (*buffer_create)(struct i915_winsys *iws, + unsigned size, unsigned alignment, + enum i915_winsys_buffer_type type); /** * Creates a buffer from a handle. @@ -135,16 +137,17 @@ struct intel_winsys { * Also provides the stride information needed for the * texture via the stride argument. */ - struct intel_buffer *(*buffer_from_handle)(struct intel_winsys *iws, - struct winsys_handle *whandle, - unsigned *stride); + struct i915_winsys_buffer * + (*buffer_from_handle)(struct i915_winsys *iws, + struct winsys_handle *whandle, + unsigned *stride); /** * Used to implement pipe_screen::texture_get_handle. * The winsys might need the stride information. */ - boolean (*buffer_get_handle)(struct intel_winsys *iws, - struct intel_buffer *buffer, + boolean (*buffer_get_handle)(struct i915_winsys *iws, + struct i915_winsys_buffer *buffer, struct winsys_handle *whandle, unsigned stride); @@ -152,37 +155,37 @@ struct intel_winsys { * Fence a buffer with a fence reg. * Not to be confused with pipe_fence_handle. */ - int (*buffer_set_fence_reg)(struct intel_winsys *iws, - struct intel_buffer *buffer, + int (*buffer_set_fence_reg)(struct i915_winsys *iws, + struct i915_winsys_buffer *buffer, unsigned stride, - enum intel_buffer_tile tile); + enum i915_winsys_buffer_tile tile); /** * Map a buffer. */ - void *(*buffer_map)(struct intel_winsys *iws, - struct intel_buffer *buffer, + void *(*buffer_map)(struct i915_winsys *iws, + struct i915_winsys_buffer *buffer, boolean write); /** * Unmap a buffer. */ - void (*buffer_unmap)(struct intel_winsys *iws, - struct intel_buffer *buffer); + void (*buffer_unmap)(struct i915_winsys *iws, + struct i915_winsys_buffer *buffer); /** * Write to a buffer. * * Arguments follows pipe_buffer_write. */ - int (*buffer_write)(struct intel_winsys *iws, - struct intel_buffer *dst, + int (*buffer_write)(struct i915_winsys *iws, + struct i915_winsys_buffer *dst, size_t offset, size_t size, const void *data); - void (*buffer_destroy)(struct intel_winsys *iws, - struct intel_buffer *buffer); + void (*buffer_destroy)(struct i915_winsys *iws, + struct i915_winsys_buffer *buffer); /*@}*/ @@ -193,20 +196,20 @@ struct intel_winsys { /** * Reference fence and set ptr to fence. */ - void (*fence_reference)(struct intel_winsys *iws, + void (*fence_reference)(struct i915_winsys *iws, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence); /** * Check if a fence has finished. */ - int (*fence_signalled)(struct intel_winsys *iws, + int (*fence_signalled)(struct i915_winsys *iws, struct pipe_fence_handle *fence); /** * Wait on a fence to finish. */ - int (*fence_finish)(struct intel_winsys *iws, + int (*fence_finish)(struct i915_winsys *iws, struct pipe_fence_handle *fence); /*@}*/ @@ -214,14 +217,14 @@ struct intel_winsys { /** * Destroy the winsys. */ - void (*destroy)(struct intel_winsys *iws); + void (*destroy)(struct i915_winsys *iws); }; /** * Create i915 pipe_screen. */ -struct pipe_screen *i915_create_screen(struct intel_winsys *iws, unsigned pci_id); +struct pipe_screen *i915_create_screen(struct i915_winsys *iws, unsigned pci_id); #endif diff --git a/src/gallium/targets/SConscript b/src/gallium/targets/SConscript index 3864564688..a41496a5dd 100644 --- a/src/gallium/targets/SConscript +++ b/src/gallium/targets/SConscript @@ -62,7 +62,7 @@ if env['dri']: 'dri-vmwgfx/SConscript', ]) - if 'intel' in env['winsys']: + if 'i915' in env['winsys']: SConscript([ 'dri-i915/SConscript', ]) diff --git a/src/gallium/targets/dri-i915/Makefile b/src/gallium/targets/dri-i915/Makefile index 822d4b57bb..50a8e11e17 100644 --- a/src/gallium/targets/dri-i915/Makefile +++ b/src/gallium/targets/dri-i915/Makefile @@ -5,7 +5,7 @@ LIBNAME = i915_dri.so PIPE_DRIVERS = \ $(TOP)/src/gallium/state_trackers/dri/drm/libdridrm.a \ - $(TOP)/src/gallium/winsys/i915/drm/libinteldrm.a \ + $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(TOP)/src/gallium/drivers/identity/libidentity.a \ diff --git a/src/gallium/targets/dri-i915/SConscript b/src/gallium/targets/dri-i915/SConscript index 8d4ecefbe1..f6d1f93478 100644 --- a/src/gallium/targets/dri-i915/SConscript +++ b/src/gallium/targets/dri-i915/SConscript @@ -10,7 +10,7 @@ env.ParseConfig('pkg-config --cflags --libs libdrm_intel') env.Prepend(LIBS = [ st_dri, - inteldrm, + i915drm, i915, trace, mesa, diff --git a/src/gallium/targets/egl-i915/Makefile b/src/gallium/targets/egl-i915/Makefile index 6c2fc14d70..efaf7b0bef 100644 --- a/src/gallium/targets/egl-i915/Makefile +++ b/src/gallium/targets/egl-i915/Makefile @@ -6,7 +6,7 @@ EGL_DRIVER_SOURCES = dummy.c EGL_DRIVER_LIBS = -ldrm_intel EGL_DRIVER_PIPES = \ - $(TOP)/src/gallium/winsys/i915/drm/libinteldrm.a \ + $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ $(TOP)/src/gallium/drivers/i915/libi915.a diff --git a/src/gallium/targets/xorg-i915/Makefile b/src/gallium/targets/xorg-i915/Makefile index e2cffcd70b..52a9e97b40 100644 --- a/src/gallium/targets/xorg-i915/Makefile +++ b/src/gallium/targets/xorg-i915/Makefile @@ -17,7 +17,7 @@ INCLUDES = \ LIBS = \ $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \ - $(TOP)/src/gallium/winsys/i915/drm/libinteldrm.a \ + $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \ $(TOP)/src/gallium/drivers/i915/libi915.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ diff --git a/src/gallium/winsys/SConscript b/src/gallium/winsys/SConscript index 90ca693eb6..3e7052c0e6 100644 --- a/src/gallium/winsys/SConscript +++ b/src/gallium/winsys/SConscript @@ -16,7 +16,7 @@ if env['dri']: 'svga/drm/SConscript', ]) - if 'intel' in env['winsys']: + if 'i915' in env['winsys']: SConscript([ 'i915/drm/SConscript', ]) diff --git a/src/gallium/winsys/i915/drm/Makefile b/src/gallium/winsys/i915/drm/Makefile index 4aac3309aa..a67b9e8a52 100644 --- a/src/gallium/winsys/i915/drm/Makefile +++ b/src/gallium/winsys/i915/drm/Makefile @@ -1,13 +1,13 @@ TOP = ../../../../.. include $(TOP)/configs/current -LIBNAME = inteldrm +LIBNAME = i915drm C_SOURCES = \ - intel_drm_batchbuffer.c \ - intel_drm_buffer.c \ - intel_drm_fence.c \ - intel_drm_api.c + i915_drm_batchbuffer.c \ + i915_drm_buffer.c \ + i915_drm_fence.c \ + i915_drm_api.c LIBRARY_INCLUDES = $(shell pkg-config libdrm --cflags-only-I) diff --git a/src/gallium/winsys/i915/drm/SConscript b/src/gallium/winsys/i915/drm/SConscript index b47b8add83..ba29ac72fe 100644 --- a/src/gallium/winsys/i915/drm/SConscript +++ b/src/gallium/winsys/i915/drm/SConscript @@ -2,16 +2,16 @@ Import('*') env = env.Clone() -inteldrm_sources = [ - 'intel_drm_api.c', - 'intel_drm_batchbuffer.c', - 'intel_drm_buffer.c', - 'intel_drm_fence.c', +i915drm_sources = [ + 'i915_drm_api.c', + 'i915_drm_batchbuffer.c', + 'i915_drm_buffer.c', + 'i915_drm_fence.c', ] -inteldrm = env.ConvenienceLibrary( - target ='inteldrm', - source = inteldrm_sources, +i915drm = env.ConvenienceLibrary( + target ='i915drm', + source = i915drm_sources, ) -Export('inteldrm') +Export('i915drm') diff --git a/src/gallium/winsys/i915/drm/intel_drm_api.c b/src/gallium/winsys/i915/drm/i915_drm_api.c index e3b980a832..6bb0aec1a6 100644 --- a/src/gallium/winsys/i915/drm/intel_drm_api.c +++ b/src/gallium/winsys/i915/drm/i915_drm_api.c @@ -2,7 +2,7 @@ #include "state_tracker/drm_api.h" -#include "intel_drm_winsys.h" +#include "i915_drm_winsys.h" #include "util/u_memory.h" #include "i915/i915_context.h" @@ -16,7 +16,7 @@ static void -intel_drm_get_device_id(unsigned int *device_id) +i915_drm_get_device_id(unsigned int *device_id) { char path[512]; FILE *file; @@ -39,9 +39,9 @@ intel_drm_get_device_id(unsigned int *device_id) } static void -intel_drm_winsys_destroy(struct intel_winsys *iws) +i915_drm_winsys_destroy(struct i915_winsys *iws) { - struct intel_drm_winsys *idws = intel_drm_winsys(iws); + struct i915_drm_winsys *idws = i915_drm_winsys(iws); drm_intel_bufmgr_destroy(idws->pools.gem); @@ -49,10 +49,10 @@ intel_drm_winsys_destroy(struct intel_winsys *iws) } static struct pipe_screen * -intel_drm_create_screen(struct drm_api *api, int drmFD, - struct drm_create_screen_arg *arg) +i915_drm_create_screen(struct drm_api *api, int drmFD, + struct drm_create_screen_arg *arg) { - struct intel_drm_winsys *idws; + struct i915_drm_winsys *idws; unsigned int deviceID; if (arg != NULL) { @@ -64,21 +64,21 @@ intel_drm_create_screen(struct drm_api *api, int drmFD, } } - idws = CALLOC_STRUCT(intel_drm_winsys); + idws = CALLOC_STRUCT(i915_drm_winsys); if (!idws) return NULL; - intel_drm_get_device_id(&deviceID); + i915_drm_get_device_id(&deviceID); - intel_drm_winsys_init_batchbuffer_functions(idws); - intel_drm_winsys_init_buffer_functions(idws); - intel_drm_winsys_init_fence_functions(idws); + i915_drm_winsys_init_batchbuffer_functions(idws); + i915_drm_winsys_init_buffer_functions(idws); + i915_drm_winsys_init_fence_functions(idws); idws->fd = drmFD; idws->id = deviceID; idws->max_batch_size = 16 * 4096; - idws->base.destroy = intel_drm_winsys_destroy; + idws->base.destroy = i915_drm_winsys_destroy; idws->pools.gem = drm_intel_bufmgr_gem_init(idws->fd, idws->max_batch_size); drm_intel_bufmgr_gem_enable_reuse(idws->pools.gem); @@ -98,7 +98,7 @@ struct drm_api intel_drm_api = { .name = "i915", .driver_name = "i915", - .create_screen = intel_drm_create_screen, + .create_screen = i915_drm_create_screen, .destroy = destroy, }; diff --git a/src/gallium/winsys/i915/drm/intel_drm_batchbuffer.c b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c index 5b4dafc8e4..102f59dc54 100644 --- a/src/gallium/winsys/i915/drm/intel_drm_batchbuffer.c +++ b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c @@ -1,5 +1,5 @@ -#include "intel_drm_winsys.h" +#include "i915_drm_winsys.h" #include "util/u_memory.h" #include "i915_drm.h" @@ -17,25 +17,25 @@ #undef INTEL_MAP_GTT #define INTEL_ALWAYS_FLUSH -struct intel_drm_batchbuffer +struct i915_drm_batchbuffer { - struct intel_batchbuffer base; + struct i915_winsys_batchbuffer base; size_t actual_size; drm_intel_bo *bo; }; -static INLINE struct intel_drm_batchbuffer * -intel_drm_batchbuffer(struct intel_batchbuffer *batch) +static INLINE struct i915_drm_batchbuffer * +i915_drm_batchbuffer(struct i915_winsys_batchbuffer *batch) { - return (struct intel_drm_batchbuffer *)batch; + return (struct i915_drm_batchbuffer *)batch; } static void -intel_drm_batchbuffer_reset(struct intel_drm_batchbuffer *batch) +i915_drm_batchbuffer_reset(struct i915_drm_batchbuffer *batch) { - struct intel_drm_winsys *idws = intel_drm_winsys(batch->base.iws); + struct i915_drm_winsys *idws = i915_drm_winsys(batch->base.iws); int ret; if (batch->bo) @@ -63,11 +63,11 @@ intel_drm_batchbuffer_reset(struct intel_drm_batchbuffer *batch) batch->base.relocs = 0; } -static struct intel_batchbuffer * -intel_drm_batchbuffer_create(struct intel_winsys *iws) +static struct i915_winsys_batchbuffer * +i915_drm_batchbuffer_create(struct i915_winsys *iws) { - struct intel_drm_winsys *idws = intel_drm_winsys(iws); - struct intel_drm_batchbuffer *batch = CALLOC_STRUCT(intel_drm_batchbuffer); + struct i915_drm_winsys *idws = i915_drm_winsys(iws); + struct i915_drm_batchbuffer *batch = CALLOC_STRUCT(i915_drm_batchbuffer); batch->actual_size = idws->max_batch_size; @@ -84,18 +84,18 @@ intel_drm_batchbuffer_create(struct intel_winsys *iws) batch->base.iws = iws; - intel_drm_batchbuffer_reset(batch); + i915_drm_batchbuffer_reset(batch); return &batch->base; } static int -intel_drm_batchbuffer_reloc(struct intel_batchbuffer *ibatch, - struct intel_buffer *buffer, - enum intel_buffer_usage usage, +i915_drm_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch, + struct i915_winsys_buffer *buffer, + enum i915_winsys_buffer_usage usage, unsigned pre_add) { - struct intel_drm_batchbuffer *batch = intel_drm_batchbuffer(ibatch); + struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch); unsigned write_domain = 0; unsigned read_domain = 0; unsigned offset; @@ -103,23 +103,23 @@ intel_drm_batchbuffer_reloc(struct intel_batchbuffer *ibatch, assert(batch->base.relocs < batch->base.max_relocs); - if (usage == INTEL_USAGE_SAMPLER) { + if (usage == I915_USAGE_SAMPLER) { write_domain = 0; read_domain = I915_GEM_DOMAIN_SAMPLER; - } else if (usage == INTEL_USAGE_RENDER) { + } else if (usage == I915_USAGE_RENDER) { write_domain = I915_GEM_DOMAIN_RENDER; read_domain = I915_GEM_DOMAIN_RENDER; - } else if (usage == INTEL_USAGE_2D_TARGET) { + } else if (usage == I915_USAGE_2D_TARGET) { write_domain = I915_GEM_DOMAIN_RENDER; read_domain = I915_GEM_DOMAIN_RENDER; - } else if (usage == INTEL_USAGE_2D_SOURCE) { + } else if (usage == I915_USAGE_2D_SOURCE) { write_domain = 0; read_domain = I915_GEM_DOMAIN_RENDER; - } else if (usage == INTEL_USAGE_VERTEX) { + } else if (usage == I915_USAGE_VERTEX) { write_domain = 0; read_domain = I915_GEM_DOMAIN_VERTEX; @@ -145,15 +145,15 @@ intel_drm_batchbuffer_reloc(struct intel_batchbuffer *ibatch, } static void -intel_drm_batchbuffer_flush(struct intel_batchbuffer *ibatch, +i915_drm_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch, struct pipe_fence_handle **fence) { - struct intel_drm_batchbuffer *batch = intel_drm_batchbuffer(ibatch); + struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch); unsigned used = 0; int ret = 0; int i; - assert(intel_batchbuffer_space(ibatch) >= 0); + assert(i915_winsys_batchbuffer_space(ibatch) >= 0); used = batch->base.ptr - batch->base.map; assert((used & 3) == 0); @@ -161,16 +161,16 @@ intel_drm_batchbuffer_flush(struct intel_batchbuffer *ibatch, #ifdef INTEL_ALWAYS_FLUSH /* MI_FLUSH | FLUSH_MAP_CACHE */ - intel_batchbuffer_dword(ibatch, (0x4<<23)|(1<<0)); + i915_winsys_batchbuffer_dword(ibatch, (0x4<<23)|(1<<0)); used += 4; #endif if ((used & 4) == 0) { /* MI_NOOP */ - intel_batchbuffer_dword(ibatch, 0); + i915_winsys_batchbuffer_dword(ibatch, 0); } /* MI_BATCH_BUFFER_END */ - intel_batchbuffer_dword(ibatch, (0xA<<23)); + i915_winsys_batchbuffer_dword(ibatch, (0xA<<23)); used = batch->base.ptr - batch->base.map; assert((used & 4) == 0); @@ -189,7 +189,7 @@ intel_drm_batchbuffer_flush(struct intel_batchbuffer *ibatch, ret = drm_intel_bo_exec(batch->bo, used, NULL, 0, 0); assert(ret == 0); - if (intel_drm_winsys(ibatch->iws)->dump_cmd) { + if (i915_drm_winsys(ibatch->iws)->dump_cmd) { unsigned *ptr; drm_intel_bo_map(batch->bo, FALSE); ptr = (unsigned*)batch->bo->virtual; @@ -212,19 +212,19 @@ intel_drm_batchbuffer_flush(struct intel_batchbuffer *ibatch, #ifdef INTEL_RUN_SYNC /* we run synced to GPU so just pass null */ - (*fence) = intel_drm_fence_create(NULL); + (*fence) = i915_drm_fence_create(NULL); #else - (*fence) = intel_drm_fence_create(batch->bo); + (*fence) = i915_drm_fence_create(batch->bo); #endif } - intel_drm_batchbuffer_reset(batch); + i915_drm_batchbuffer_reset(batch); } static void -intel_drm_batchbuffer_destroy(struct intel_batchbuffer *ibatch) +i915_drm_batchbuffer_destroy(struct i915_winsys_batchbuffer *ibatch) { - struct intel_drm_batchbuffer *batch = intel_drm_batchbuffer(ibatch); + struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch); if (batch->bo) drm_intel_bo_unreference(batch->bo); @@ -235,10 +235,10 @@ intel_drm_batchbuffer_destroy(struct intel_batchbuffer *ibatch) FREE(batch); } -void intel_drm_winsys_init_batchbuffer_functions(struct intel_drm_winsys *idws) +void i915_drm_winsys_init_batchbuffer_functions(struct i915_drm_winsys *idws) { - idws->base.batchbuffer_create = intel_drm_batchbuffer_create; - idws->base.batchbuffer_reloc = intel_drm_batchbuffer_reloc; - idws->base.batchbuffer_flush = intel_drm_batchbuffer_flush; - idws->base.batchbuffer_destroy = intel_drm_batchbuffer_destroy; + idws->base.batchbuffer_create = i915_drm_batchbuffer_create; + idws->base.batchbuffer_reloc = i915_drm_batchbuffer_reloc; + idws->base.batchbuffer_flush = i915_drm_batchbuffer_flush; + idws->base.batchbuffer_destroy = i915_drm_batchbuffer_destroy; } diff --git a/src/gallium/winsys/i915/drm/intel_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c index cb4f92a3b1..3bd85026b2 100644 --- a/src/gallium/winsys/i915/drm/intel_drm_buffer.c +++ b/src/gallium/winsys/i915/drm/i915_drm_buffer.c @@ -1,17 +1,17 @@ #include "state_tracker/drm_api.h" -#include "intel_drm_winsys.h" +#include "i915_drm_winsys.h" #include "util/u_memory.h" #include "i915_drm.h" -static struct intel_buffer * -intel_drm_buffer_create(struct intel_winsys *iws, +static struct i915_winsys_buffer * +i915_drm_buffer_create(struct i915_winsys *iws, unsigned size, unsigned alignment, - enum intel_buffer_type type) + enum i915_winsys_buffer_type type) { - struct intel_drm_buffer *buf = CALLOC_STRUCT(intel_drm_buffer); - struct intel_drm_winsys *idws = intel_drm_winsys(iws); + struct i915_drm_buffer *buf = CALLOC_STRUCT(i915_drm_buffer); + struct i915_drm_winsys *idws = i915_drm_winsys(iws); drm_intel_bufmgr *pool; char *name; @@ -23,14 +23,14 @@ intel_drm_buffer_create(struct intel_winsys *iws, buf->flink = 0; buf->map_gtt = FALSE; - if (type == INTEL_NEW_TEXTURE) { + if (type == I915_NEW_TEXTURE) { name = "gallium3d_texture"; pool = idws->pools.gem; - } else if (type == INTEL_NEW_VERTEX) { + } else if (type == I915_NEW_VERTEX) { name = "gallium3d_vertex"; pool = idws->pools.gem; buf->map_gtt = TRUE; - } else if (type == INTEL_NEW_SCANOUT) { + } else if (type == I915_NEW_SCANOUT) { name = "gallium3d_scanout"; pool = idws->pools.gem; buf->map_gtt = TRUE; @@ -45,7 +45,7 @@ intel_drm_buffer_create(struct intel_winsys *iws, if (!buf->bo) goto err; - return (struct intel_buffer *)buf; + return (struct i915_winsys_buffer *)buf; err: assert(0); @@ -53,13 +53,13 @@ err: return NULL; } -static struct intel_buffer * -intel_drm_buffer_from_handle(struct intel_winsys *iws, +static struct i915_winsys_buffer * +i915_drm_buffer_from_handle(struct i915_winsys *iws, struct winsys_handle *whandle, unsigned *stride) { - struct intel_drm_winsys *idws = intel_drm_winsys(iws); - struct intel_drm_buffer *buf = CALLOC_STRUCT(intel_drm_buffer); + struct i915_drm_winsys *idws = i915_drm_winsys(iws); + struct i915_drm_buffer *buf = CALLOC_STRUCT(i915_drm_buffer); uint32_t tile = 0, swizzle = 0; if (!buf) @@ -74,12 +74,12 @@ intel_drm_buffer_from_handle(struct intel_winsys *iws, goto err; drm_intel_bo_get_tiling(buf->bo, &tile, &swizzle); - if (tile != INTEL_TILE_NONE) + if (tile != I915_TILE_NONE) buf->map_gtt = TRUE; *stride = whandle->stride; - return (struct intel_buffer *)buf; + return (struct i915_winsys_buffer *)buf; err: FREE(buf); @@ -87,12 +87,12 @@ err: } static boolean -intel_drm_buffer_get_handle(struct intel_winsys *iws, - struct intel_buffer *buffer, +i915_drm_buffer_get_handle(struct i915_winsys *iws, + struct i915_winsys_buffer *buffer, struct winsys_handle *whandle, unsigned stride) { - struct intel_drm_buffer *buf = intel_drm_buffer(buffer); + struct i915_drm_buffer *buf = i915_drm_buffer(buffer); if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) { if (!buf->flinked) { @@ -114,17 +114,17 @@ intel_drm_buffer_get_handle(struct intel_winsys *iws, } static int -intel_drm_buffer_set_fence_reg(struct intel_winsys *iws, - struct intel_buffer *buffer, +i915_drm_buffer_set_fence_reg(struct i915_winsys *iws, + struct i915_winsys_buffer *buffer, unsigned stride, - enum intel_buffer_tile tile) + enum i915_winsys_buffer_tile tile) { - struct intel_drm_buffer *buf = intel_drm_buffer(buffer); - assert(I915_TILING_NONE == INTEL_TILE_NONE); - assert(I915_TILING_X == INTEL_TILE_X); - assert(I915_TILING_Y == INTEL_TILE_Y); + struct i915_drm_buffer *buf = i915_drm_buffer(buffer); + assert(I915_TILING_NONE == I915_TILE_NONE); + assert(I915_TILING_X == I915_TILE_X); + assert(I915_TILING_Y == I915_TILE_Y); - if (tile != INTEL_TILE_NONE) { + if (tile != I915_TILE_NONE) { assert(buf->map_count == 0); buf->map_gtt = TRUE; } @@ -133,11 +133,11 @@ intel_drm_buffer_set_fence_reg(struct intel_winsys *iws, } static void * -intel_drm_buffer_map(struct intel_winsys *iws, - struct intel_buffer *buffer, +i915_drm_buffer_map(struct i915_winsys *iws, + struct i915_winsys_buffer *buffer, boolean write) { - struct intel_drm_buffer *buf = intel_drm_buffer(buffer); + struct i915_drm_buffer *buf = i915_drm_buffer(buffer); drm_intel_bo *bo = intel_bo(buffer); int ret = 0; @@ -163,10 +163,10 @@ out: } static void -intel_drm_buffer_unmap(struct intel_winsys *iws, - struct intel_buffer *buffer) +i915_drm_buffer_unmap(struct i915_winsys *iws, + struct i915_winsys_buffer *buffer) { - struct intel_drm_buffer *buf = intel_drm_buffer(buffer); + struct i915_drm_buffer *buf = i915_drm_buffer(buffer); if (--buf->map_count) return; @@ -178,40 +178,40 @@ intel_drm_buffer_unmap(struct intel_winsys *iws, } static int -intel_drm_buffer_write(struct intel_winsys *iws, - struct intel_buffer *buffer, +i915_drm_buffer_write(struct i915_winsys *iws, + struct i915_winsys_buffer *buffer, size_t offset, size_t size, const void *data) { - struct intel_drm_buffer *buf = intel_drm_buffer(buffer); + struct i915_drm_buffer *buf = i915_drm_buffer(buffer); return drm_intel_bo_subdata(buf->bo, offset, size, (void*)data); } static void -intel_drm_buffer_destroy(struct intel_winsys *iws, - struct intel_buffer *buffer) +i915_drm_buffer_destroy(struct i915_winsys *iws, + struct i915_winsys_buffer *buffer) { drm_intel_bo_unreference(intel_bo(buffer)); #ifdef DEBUG - intel_drm_buffer(buffer)->magic = 0; - intel_drm_buffer(buffer)->bo = NULL; + i915_drm_buffer(buffer)->magic = 0; + i915_drm_buffer(buffer)->bo = NULL; #endif FREE(buffer); } void -intel_drm_winsys_init_buffer_functions(struct intel_drm_winsys *idws) +i915_drm_winsys_init_buffer_functions(struct i915_drm_winsys *idws) { - idws->base.buffer_create = intel_drm_buffer_create; - idws->base.buffer_from_handle = intel_drm_buffer_from_handle; - idws->base.buffer_get_handle = intel_drm_buffer_get_handle; - idws->base.buffer_set_fence_reg = intel_drm_buffer_set_fence_reg; - idws->base.buffer_map = intel_drm_buffer_map; - idws->base.buffer_unmap = intel_drm_buffer_unmap; - idws->base.buffer_write = intel_drm_buffer_write; - idws->base.buffer_destroy = intel_drm_buffer_destroy; + idws->base.buffer_create = i915_drm_buffer_create; + idws->base.buffer_from_handle = i915_drm_buffer_from_handle; + idws->base.buffer_get_handle = i915_drm_buffer_get_handle; + idws->base.buffer_set_fence_reg = i915_drm_buffer_set_fence_reg; + idws->base.buffer_map = i915_drm_buffer_map; + idws->base.buffer_unmap = i915_drm_buffer_unmap; + idws->base.buffer_write = i915_drm_buffer_write; + idws->base.buffer_destroy = i915_drm_buffer_destroy; } diff --git a/src/gallium/winsys/i915/drm/intel_drm_fence.c b/src/gallium/winsys/i915/drm/i915_drm_fence.c index 102faedfea..30ebf4835e 100644 --- a/src/gallium/winsys/i915/drm/intel_drm_fence.c +++ b/src/gallium/winsys/i915/drm/i915_drm_fence.c @@ -1,5 +1,5 @@ -#include "intel_drm_winsys.h" +#include "i915_drm_winsys.h" #include "util/u_memory.h" #include "util/u_atomic.h" #include "util/u_inlines.h" @@ -10,7 +10,7 @@ * They work by keeping the batchbuffer around and checking if that has * been idled. If bo is NULL fence has expired. */ -struct intel_drm_fence +struct i915_drm_fence { struct pipe_reference reference; drm_intel_bo *bo; @@ -18,9 +18,9 @@ struct intel_drm_fence struct pipe_fence_handle * -intel_drm_fence_create(drm_intel_bo *bo) +i915_drm_fence_create(drm_intel_bo *bo) { - struct intel_drm_fence *fence = CALLOC_STRUCT(intel_drm_fence); + struct i915_drm_fence *fence = CALLOC_STRUCT(i915_drm_fence); pipe_reference_init(&fence->reference, 1); /* bo is null if fence already expired */ @@ -33,14 +33,14 @@ intel_drm_fence_create(drm_intel_bo *bo) } static void -intel_drm_fence_reference(struct intel_winsys *iws, +i915_drm_fence_reference(struct i915_winsys *iws, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) { - struct intel_drm_fence *old = (struct intel_drm_fence *)*ptr; - struct intel_drm_fence *f = (struct intel_drm_fence *)fence; + struct i915_drm_fence *old = (struct i915_drm_fence *)*ptr; + struct i915_drm_fence *f = (struct i915_drm_fence *)fence; - if (pipe_reference(&((struct intel_drm_fence *)(*ptr))->reference, &f->reference)) { + if (pipe_reference(&((struct i915_drm_fence *)(*ptr))->reference, &f->reference)) { if (old->bo) drm_intel_bo_unreference(old->bo); FREE(old); @@ -49,7 +49,7 @@ intel_drm_fence_reference(struct intel_winsys *iws, } static int -intel_drm_fence_signalled(struct intel_winsys *iws, +i915_drm_fence_signalled(struct i915_winsys *iws, struct pipe_fence_handle *fence) { assert(0); @@ -58,10 +58,10 @@ intel_drm_fence_signalled(struct intel_winsys *iws, } static int -intel_drm_fence_finish(struct intel_winsys *iws, +i915_drm_fence_finish(struct i915_winsys *iws, struct pipe_fence_handle *fence) { - struct intel_drm_fence *f = (struct intel_drm_fence *)fence; + struct i915_drm_fence *f = (struct i915_drm_fence *)fence; /* fence already expired */ if (!f->bo) @@ -75,9 +75,9 @@ intel_drm_fence_finish(struct intel_winsys *iws, } void -intel_drm_winsys_init_fence_functions(struct intel_drm_winsys *idws) +i915_drm_winsys_init_fence_functions(struct i915_drm_winsys *idws) { - idws->base.fence_reference = intel_drm_fence_reference; - idws->base.fence_signalled = intel_drm_fence_signalled; - idws->base.fence_finish = intel_drm_fence_finish; + idws->base.fence_reference = i915_drm_fence_reference; + idws->base.fence_signalled = i915_drm_fence_signalled; + idws->base.fence_finish = i915_drm_fence_finish; } diff --git a/src/gallium/winsys/i915/drm/i915_drm_winsys.h b/src/gallium/winsys/i915/drm/i915_drm_winsys.h new file mode 100644 index 0000000000..217c4a7eaf --- /dev/null +++ b/src/gallium/winsys/i915/drm/i915_drm_winsys.h @@ -0,0 +1,77 @@ + +#ifndef INTEL_DRM_WINSYS_H +#define INTEL_DRM_WINSYS_H + +#include "i915/i915_batchbuffer.h" + +#include "drm.h" +#include "intel_bufmgr.h" + + +/* + * Winsys + */ + + +struct i915_drm_winsys +{ + struct i915_winsys base; + + boolean dump_cmd; + + int fd; /**< Drm file discriptor */ + + unsigned id; + + size_t max_batch_size; + + struct { + drm_intel_bufmgr *gem; + } pools; +}; + +static INLINE struct i915_drm_winsys * +i915_drm_winsys(struct i915_winsys *iws) +{ + return (struct i915_drm_winsys *)iws; +} + +struct i915_drm_winsys * i915_drm_winsys_create(int fd, unsigned pci_id); +struct pipe_fence_handle * i915_drm_fence_create(drm_intel_bo *bo); + +void i915_drm_winsys_init_batchbuffer_functions(struct i915_drm_winsys *idws); +void i915_drm_winsys_init_buffer_functions(struct i915_drm_winsys *idws); +void i915_drm_winsys_init_fence_functions(struct i915_drm_winsys *idws); + + +/* + * Buffer + */ + + +struct i915_drm_buffer { + unsigned magic; + + drm_intel_bo *bo; + + void *ptr; + unsigned map_count; + boolean map_gtt; + + boolean flinked; + unsigned flink; +}; + +static INLINE struct i915_drm_buffer * +i915_drm_buffer(struct i915_winsys_buffer *buffer) +{ + return (struct i915_drm_buffer *)buffer; +} + +static INLINE drm_intel_bo * +intel_bo(struct i915_winsys_buffer *buffer) +{ + return i915_drm_buffer(buffer)->bo; +} + +#endif diff --git a/src/gallium/winsys/i915/drm/intel_drm_winsys.h b/src/gallium/winsys/i915/drm/intel_drm_winsys.h deleted file mode 100644 index 9786ee9365..0000000000 --- a/src/gallium/winsys/i915/drm/intel_drm_winsys.h +++ /dev/null @@ -1,77 +0,0 @@ - -#ifndef INTEL_DRM_WINSYS_H -#define INTEL_DRM_WINSYS_H - -#include "i915/intel_batchbuffer.h" - -#include "drm.h" -#include "intel_bufmgr.h" - - -/* - * Winsys - */ - - -struct intel_drm_winsys -{ - struct intel_winsys base; - - boolean dump_cmd; - - int fd; /**< Drm file discriptor */ - - unsigned id; - - size_t max_batch_size; - - struct { - drm_intel_bufmgr *gem; - } pools; -}; - -static INLINE struct intel_drm_winsys * -intel_drm_winsys(struct intel_winsys *iws) -{ - return (struct intel_drm_winsys *)iws; -} - -struct intel_drm_winsys * intel_drm_winsys_create(int fd, unsigned pci_id); -struct pipe_fence_handle * intel_drm_fence_create(drm_intel_bo *bo); - -void intel_drm_winsys_init_batchbuffer_functions(struct intel_drm_winsys *idws); -void intel_drm_winsys_init_buffer_functions(struct intel_drm_winsys *idws); -void intel_drm_winsys_init_fence_functions(struct intel_drm_winsys *idws); - - -/* - * Buffer - */ - - -struct intel_drm_buffer { - unsigned magic; - - drm_intel_bo *bo; - - void *ptr; - unsigned map_count; - boolean map_gtt; - - boolean flinked; - unsigned flink; -}; - -static INLINE struct intel_drm_buffer * -intel_drm_buffer(struct intel_buffer *buffer) -{ - return (struct intel_drm_buffer *)buffer; -} - -static INLINE drm_intel_bo * -intel_bo(struct intel_buffer *buffer) -{ - return intel_drm_buffer(buffer)->bo; -} - -#endif |