i915g: Rename winsys prefix to i915_ from intel_
authorJakob Bornecrantz <wallbraker@gmail.com>
Thu, 25 Mar 2010 18:19:00 +0000 (19:19 +0100)
committerJakob Bornecrantz <wallbraker@gmail.com>
Thu, 25 Mar 2010 23:38:17 +0000 (00:38 +0100)
Since the winsys isn't shared with i965 and never will be

36 files changed:
SConstruct
src/gallium/drivers/i915/i915_batch.h
src/gallium/drivers/i915/i915_batchbuffer.h [new file with mode: 0644]
src/gallium/drivers/i915/i915_blit.c
src/gallium/drivers/i915/i915_blit.h
src/gallium/drivers/i915/i915_buffer.c
src/gallium/drivers/i915/i915_context.h
src/gallium/drivers/i915/i915_debug.c
src/gallium/drivers/i915/i915_debug.h
src/gallium/drivers/i915/i915_prim_vbuf.c
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/i915/i915_screen.h
src/gallium/drivers/i915/i915_state_emit.c
src/gallium/drivers/i915/i915_state_immediate.c
src/gallium/drivers/i915/i915_texture.c
src/gallium/drivers/i915/i915_winsys.h [new file with mode: 0644]
src/gallium/drivers/i915/intel_batchbuffer.h [deleted file]
src/gallium/drivers/i915/intel_winsys.h [deleted file]
src/gallium/targets/SConscript
src/gallium/targets/dri-i915/Makefile
src/gallium/targets/dri-i915/SConscript
src/gallium/targets/egl-i915/Makefile
src/gallium/targets/xorg-i915/Makefile
src/gallium/winsys/SConscript
src/gallium/winsys/i915/drm/Makefile
src/gallium/winsys/i915/drm/SConscript
src/gallium/winsys/i915/drm/i915_drm_api.c [new file with mode: 0644]
src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c [new file with mode: 0644]
src/gallium/winsys/i915/drm/i915_drm_buffer.c [new file with mode: 0644]
src/gallium/winsys/i915/drm/i915_drm_fence.c [new file with mode: 0644]
src/gallium/winsys/i915/drm/i915_drm_winsys.h [new file with mode: 0644]
src/gallium/winsys/i915/drm/intel_drm_api.c [deleted file]
src/gallium/winsys/i915/drm/intel_drm_batchbuffer.c [deleted file]
src/gallium/winsys/i915/drm/intel_drm_buffer.c [deleted file]
src/gallium/winsys/i915/drm/intel_drm_fence.c [deleted file]
src/gallium/winsys/i915/drm/intel_drm_winsys.h [deleted file]

index 6ed44ddd0677181de86101896643b6404dd879fc..2549a13fffaca4c55e573da9bdeca3a1472309fb 100644 (file)
@@ -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')))
 
index b813784723fc7d00e096a28fbd2a81421b388f32..f0086695d16f5cde235c71885f0c8d1885574d4b 100644 (file)
 #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/i915_batchbuffer.h b/src/gallium/drivers/i915/i915_batchbuffer.h
new file mode 100644 (file)
index 0000000..27ccaa6
--- /dev/null
@@ -0,0 +1,87 @@
+/**************************************************************************
+ *
+ * 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
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * 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.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * 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 I915_BATCHBUFFER_H
+#define I915_BATCHBUFFER_H
+
+#include "i915_winsys.h"
+
+static INLINE boolean
+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
+i915_winsys_batchbuffer_space(struct i915_winsys_batchbuffer *batch)
+{
+   return batch->size - (batch->ptr - batch->map);
+}
+
+static INLINE void
+i915_winsys_batchbuffer_dword(struct i915_winsys_batchbuffer *batch,
+                              unsigned dword)
+{
+   if (i915_winsys_batchbuffer_space(batch) < 4)
+      return;
+
+   *(unsigned *)batch->ptr = dword;
+   batch->ptr += 4;
+}
+
+static INLINE void
+i915_winsys_batchbuffer_write(struct i915_winsys_batchbuffer *batch,
+                       void *data,
+                       size_t size)
+{
+   if (i915_winsys_batchbuffer_space(batch) < size)
+      return;
+
+   memcpy(data, batch->ptr, size);
+   batch->ptr += size;
+}
+
+static INLINE int
+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
+i915_winsys_batchbuffer_flush(struct i915_winsys_batchbuffer *batch,
+                              struct pipe_fence_handle **fence)
+{
+   batch->iws->batchbuffer_flush(batch, fence);
+}
+
+#endif
index 83dfc3352881d6dc5dcb01d0c6b6d5585c6c6bb1..533fa81219b062d9158f9ee4c50020807867b172 100644 (file)
@@ -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);
 }
index 8ce3220cfd9cb8a8881ab5645a9018f06bd2818d..db576ed4c901564714bf55b6c1653ca9bdedb5c0 100644 (file)
@@ -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);
index 0f76a59e93aff69bf777bfcba7d17f519b0092e6..1247de320d456d7ef171a0f61032583ca86d84a8 100644 (file)
 #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 */
index 5348f62ca74ed09ae2b6eaba442f7214505b9e97..8df4dce86538c614a543039cb0084af5c7b5a43b 100644 (file)
@@ -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;
 
index 237654d26b2ec9e67656cbcc1306dd07356b8d15..663fac3055cf2c100724b29f8abb216345d4e27e 100644 (file)
@@ -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;
index 8f7484797de749f0d3f7bf40e821ade18ee7fa3a..67b8d9c2f6316ff9acf2424260e789a574d32866 100644 (file)
@@ -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 );
 
index cad4109ee6b1816b68d7e7b0752f31b62442edc3..df9e68af4fcd4fb882b885ddfb86b99250449315 100644 (file)
@@ -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;
index 48a39edad20ebfa8e1335e317572a28b1afb03ff..53ef6e50f6c9ea373b7a619fba01408c5222fa60 100644 (file)
@@ -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);
 
index 5126485caa7ec367bf192a521ebefc51b1092393..7f9e02fc0f6eb444a457808f792e1edf367c1654 100644 (file)
@@ -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;
index d79c1ca0b2cb4cf426a9dc219690eb3954b58b74..04a3924aaf711031f3e4512dca6ddde2d5355396 100644 (file)
@@ -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 */
                }
index d2c6f1514342a5d39da5c3d33538a17c6100ae91..8cec699285c6afe956aa5482836bcec9e94d81a3 100644 (file)
@@ -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 ||
index b252fb5330cc402faed2fa7981c2d1c0659475ff..8c405c2443e36147d7e5de211c301a530543fba6 100644 (file)
@@ -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/i915_winsys.h b/src/gallium/drivers/i915/i915_winsys.h
new file mode 100644 (file)
index 0000000..246e95b
--- /dev/null
@@ -0,0 +1,230 @@
+/**************************************************************************
+ *
+ * Copyright Â© 2009 Jakob Bornecrantz
+ *
+ * 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 without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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 NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 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 I915_WINSYS_H
+#define I915_WINSYS_H
+
+#include "pipe/p_compiler.h"
+
+struct i915_winsys;
+struct i915_winsys_buffer;
+struct i915_winsys_batchbuffer;
+struct pipe_texture;
+struct pipe_fence_handle;
+struct winsys_handle;
+
+enum i915_winsys_buffer_usage
+{
+   /* use on textures */
+   I915_USAGE_RENDER    = 0x01,
+   I915_USAGE_SAMPLER   = 0x02,
+   I915_USAGE_2D_TARGET = 0x04,
+   I915_USAGE_2D_SOURCE = 0x08,
+   /* use on vertex */
+   I915_USAGE_VERTEX    = 0x10
+};
+
+enum i915_winsys_buffer_type
+{
+   I915_NEW_TEXTURE,
+   I915_NEW_SCANOUT, /**< a texture used for scanning out from */
+   I915_NEW_VERTEX
+};
+
+enum i915_winsys_buffer_tile
+{
+   I915_TILE_NONE,
+   I915_TILE_X,
+   I915_TILE_Y
+};
+
+struct i915_winsys_batchbuffer {
+
+   struct i915_winsys *iws;
+
+   /**
+    * Values exported to speed up the writing the batchbuffer,
+    * instead of having to go trough a accesor function for
+    * each dword written.
+    */
+   /*{@*/
+   uint8_t *map;
+   uint8_t *ptr;
+   size_t size;
+
+   size_t relocs;
+   size_t max_relocs;
+   /*@}*/
+};
+
+struct i915_winsys {
+
+   /**
+    * Batchbuffer functions.
+    */
+   /*@{*/
+   /**
+    * Create a new batchbuffer.
+    */
+   struct i915_winsys_batchbuffer *
+      (*batchbuffer_create)(struct i915_winsys *iws);
+
+   /**
+    * Emit a relocation to a buffer.
+    * Target position in batchbuffer is the same as ptr.
+    *
+    * @batch
+    * @reloc buffer address to be inserted into target.
+    * @usage how is the hardware going to use the buffer.
+    * @offset add this to the reloc buffers address
+    * @target buffer where to write the address, null for batchbuffer.
+    */
+   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 i915_winsys_batchbuffer *batch,
+                             struct pipe_fence_handle **fence);
+
+   /**
+    * Destroy a batchbuffer.
+    */
+   void (*batchbuffer_destroy)(struct i915_winsys_batchbuffer *batch);
+   /*@}*/
+
+
+   /**
+    * Buffer functions.
+    */
+   /*@{*/
+   /**
+    * Create a buffer.
+    */
+   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.
+    * Used to implement pipe_screen::texture_from_handle.
+    * Also provides the stride information needed for the
+    * texture via the stride argument.
+    */
+   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 i915_winsys *iws,
+                                struct i915_winsys_buffer *buffer,
+                                struct winsys_handle *whandle,
+                                unsigned stride);
+
+   /**
+    * Fence a buffer with a fence reg.
+    * Not to be confused with pipe_fence_handle.
+    */
+   int (*buffer_set_fence_reg)(struct i915_winsys *iws,
+                               struct i915_winsys_buffer *buffer,
+                               unsigned stride,
+                               enum i915_winsys_buffer_tile tile);
+
+   /**
+    * Map a buffer.
+    */
+   void *(*buffer_map)(struct i915_winsys *iws,
+                       struct i915_winsys_buffer *buffer,
+                       boolean write);
+
+   /**
+    * Unmap a 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 i915_winsys *iws,
+                       struct i915_winsys_buffer *dst,
+                       size_t offset,
+                       size_t size,
+                       const void *data);
+
+   void (*buffer_destroy)(struct i915_winsys *iws,
+                          struct i915_winsys_buffer *buffer);
+   /*@}*/
+
+
+   /**
+    * Fence functions.
+    */
+   /*@{*/
+   /**
+    * Reference fence and set ptr to fence.
+    */
+   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 i915_winsys *iws,
+                          struct pipe_fence_handle *fence);
+
+   /**
+    * Wait on a fence to finish.
+    */
+   int (*fence_finish)(struct i915_winsys *iws,
+                       struct pipe_fence_handle *fence);
+   /*@}*/
+
+
+   /**
+    * Destroy the winsys.
+    */
+   void (*destroy)(struct i915_winsys *iws);
+};
+
+
+/**
+ * Create i915 pipe_screen.
+ */
+struct pipe_screen *i915_create_screen(struct i915_winsys *iws, unsigned pci_id);
+
+
+#endif
diff --git a/src/gallium/drivers/i915/intel_batchbuffer.h b/src/gallium/drivers/i915/intel_batchbuffer.h
deleted file mode 100644 (file)
index db12dfd..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/**************************************************************************
- * 
- * 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
- * without limitation the rights to use, copy, modify, merge, publish,
- * 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.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * 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
-
-#include "intel_winsys.h"
-
-static INLINE boolean
-intel_batchbuffer_check(struct intel_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)
-{
-   return batch->size - (batch->ptr - batch->map);
-}
-
-static INLINE void
-intel_batchbuffer_dword(struct intel_batchbuffer *batch,
-                        unsigned dword)
-{
-   if (intel_batchbuffer_space(batch) < 4)
-      return;
-
-   *(unsigned *)batch->ptr = dword;
-   batch->ptr += 4;
-}
-
-static INLINE void
-intel_batchbuffer_write(struct intel_batchbuffer *batch,
-                        void *data,
-                        size_t size)
-{
-   if (intel_batchbuffer_space(batch) < size)
-      return;
-
-   memcpy(data, batch->ptr, size);
-   batch->ptr += size;
-}
-
-static INLINE int
-intel_batchbuffer_reloc(struct intel_batchbuffer *batch,
-                        struct intel_buffer *buffer,
-                        enum intel_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)
-{
-   batch->iws->batchbuffer_flush(batch, fence);
-}
-
-#endif
diff --git a/src/gallium/drivers/i915/intel_winsys.h b/src/gallium/drivers/i915/intel_winsys.h
deleted file mode 100644 (file)
index 00fd0c1..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-/**************************************************************************
- *
- * Copyright Â© 2009 Jakob Bornecrantz
- *
- * 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 without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * 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 NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 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_WINSYS_H
-#define INTEL_WINSYS_H
-
-#include "pipe/p_compiler.h"
-
-struct intel_winsys;
-struct intel_buffer;
-struct intel_batchbuffer;
-struct pipe_texture;
-struct pipe_fence_handle;
-struct winsys_handle;
-
-enum intel_buffer_usage
-{
-   /* use on textures */
-   INTEL_USAGE_RENDER    = 0x01,
-   INTEL_USAGE_SAMPLER   = 0x02,
-   INTEL_USAGE_2D_TARGET = 0x04,
-   INTEL_USAGE_2D_SOURCE = 0x08,
-   /* use on vertex */
-   INTEL_USAGE_VERTEX    = 0x10
-};
-
-enum intel_buffer_type
-{
-   INTEL_NEW_TEXTURE,
-   INTEL_NEW_SCANOUT, /**< a texture used for scanning out from */
-   INTEL_NEW_VERTEX
-};
-
-enum intel_buffer_tile
-{
-   INTEL_TILE_NONE,
-   INTEL_TILE_X,
-   INTEL_TILE_Y
-};
-
-struct intel_batchbuffer {
-
-   struct intel_winsys *iws;
-
-   /**
-    * Values exported to speed up the writing the batchbuffer,
-    * instead of having to go trough a accesor function for
-    * each dword written.
-    */
-   /*{@*/
-   uint8_t *map;
-   uint8_t *ptr;
-   size_t size;
-
-   size_t relocs;
-   size_t max_relocs;
-   /*@}*/
-};
-
-struct intel_winsys {
-
-   /**
-    * Batchbuffer functions.
-    */
-   /*@{*/
-   /**
-    * Create a new batchbuffer.
-    */
-   struct intel_batchbuffer *(*batchbuffer_create)(struct intel_winsys *iws);
-
-   /**
-    * Emit a relocation to a buffer.
-    * Target position in batchbuffer is the same as ptr.
-    *
-    * @batch
-    * @reloc buffer address to be inserted into target.
-    * @usage how is the hardware going to use the buffer.
-    * @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,
-                            unsigned offset);
-
-   /**
-    * Flush a bufferbatch.
-    */
-   void (*batchbuffer_flush)(struct intel_batchbuffer *batch,
-                             struct pipe_fence_handle **fence);
-
-   /**
-    * Destroy a batchbuffer.
-    */
-   void (*batchbuffer_destroy)(struct intel_batchbuffer *batch);
-   /*@}*/
-
-
-   /**
-    * Buffer functions.
-    */
-   /*@{*/
-   /**
-    * Create a buffer.
-    */
-   struct intel_buffer *(*buffer_create)(struct intel_winsys *iws,
-                                         unsigned size, unsigned alignment,
-                                         enum intel_buffer_type type);
-
-   /**
-    * Creates a buffer from a handle.
-    * Used to implement pipe_screen::texture_from_handle.
-    * 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);
-
-   /**
-    * 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,
-                                struct winsys_handle *whandle,
-                                unsigned stride);
-
-   /**
-    * 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,
-                               unsigned stride,
-                               enum intel_buffer_tile tile);
-
-   /**
-    * Map a buffer.
-    */
-   void *(*buffer_map)(struct intel_winsys *iws,
-                       struct intel_buffer *buffer,
-                       boolean write);
-
-   /**
-    * Unmap a buffer.
-    */
-   void (*buffer_unmap)(struct intel_winsys *iws,
-                        struct intel_buffer *buffer);
-
-   /**
-    * Write to a buffer.
-    *
-    * Arguments follows pipe_buffer_write.
-    */
-   int (*buffer_write)(struct intel_winsys *iws,
-                       struct intel_buffer *dst,
-                       size_t offset,
-                       size_t size,
-                       const void *data);
-
-   void (*buffer_destroy)(struct intel_winsys *iws,
-                          struct intel_buffer *buffer);
-   /*@}*/
-
-
-   /**
-    * Fence functions.
-    */
-   /*@{*/
-   /**
-    * Reference fence and set ptr to fence.
-    */
-   void (*fence_reference)(struct intel_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,
-                          struct pipe_fence_handle *fence);
-
-   /**
-    * Wait on a fence to finish.
-    */
-   int (*fence_finish)(struct intel_winsys *iws,
-                       struct pipe_fence_handle *fence);
-   /*@}*/
-
-
-   /**
-    * Destroy the winsys.
-    */
-   void (*destroy)(struct intel_winsys *iws);
-};
-
-
-/**
- * Create i915 pipe_screen.
- */
-struct pipe_screen *i915_create_screen(struct intel_winsys *iws, unsigned pci_id);
-
-
-#endif
index 3864564688308ff633811fde3acbe64f7d29748f..a41496a5dd96a5bea0206d6d397ba07107553ae3 100644 (file)
@@ -62,7 +62,7 @@ if env['dri']:
                        'dri-vmwgfx/SConscript',
                ])
 
-       if 'intel' in env['winsys']:
+       if 'i915' in env['winsys']:
                SConscript([
                        'dri-i915/SConscript',
                ])
index 822d4b57bbba607313b472469af435094388ad98..50a8e11e17c8ae23ba1517157a766313856e3a09 100644 (file)
@@ -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 \
index 8d4ecefbe1bba160c8b7eec75235917978c57fea..f6d1f93478388dbff9f510de874762fc35e9c5e1 100644 (file)
@@ -10,7 +10,7 @@ env.ParseConfig('pkg-config --cflags --libs libdrm_intel')
 
 env.Prepend(LIBS = [
     st_dri,
-    inteldrm,
+    i915drm,
     i915,
     trace,
     mesa,
index 6c2fc14d70fe290df0937c05c66214d95c7ab863..efaf7b0bef98a8f93c0b903a4366a6207e8e4361 100644 (file)
@@ -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
index e2cffcd70b35970df6c72b4c101a66689f8556d9..52a9e97b409bf5b536b3b992fb09f728d0d7e227 100644 (file)
@@ -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 \
index 90ca693eb68ea2dfe4a42b3809b73fb5dcd2329b..3e7052c0e6f4484d5cb09c6c37a18472ec7709ca 100644 (file)
@@ -16,7 +16,7 @@ if env['dri']:
                        'svga/drm/SConscript',
                ])
 
-       if 'intel' in env['winsys']:
+       if 'i915' in env['winsys']:
                SConscript([
                        'i915/drm/SConscript',
                ])
index 4aac3309aa767f2e80f060d43a5d495b6d03ad67..a67b9e8a528e6796a2780df9ba3f556942410060 100644 (file)
@@ -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)
 
index b47b8add83759588037bf4039c6be2085270d18e..ba29ac72fe754e283b5bc33e6d5ab970437b1696 100644 (file)
@@ -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/i915_drm_api.c b/src/gallium/winsys/i915/drm/i915_drm_api.c
new file mode 100644 (file)
index 0000000..6bb0aec
--- /dev/null
@@ -0,0 +1,109 @@
+#include <stdio.h>
+
+#include "state_tracker/drm_api.h"
+
+#include "i915_drm_winsys.h"
+#include "util/u_memory.h"
+
+#include "i915/i915_context.h"
+#include "i915/i915_screen.h"
+
+#include "trace/tr_drm.h"
+
+/*
+ * Helper functions
+ */
+
+
+static void
+i915_drm_get_device_id(unsigned int *device_id)
+{
+   char path[512];
+   FILE *file;
+   void *shutup_gcc;
+
+   /*
+    * FIXME: Fix this up to use a drm ioctl or whatever.
+    */
+
+   snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device");
+   file = fopen(path, "r");
+   if (!file) {
+      return;
+   }
+
+   shutup_gcc = fgets(path, sizeof(path), file);
+   (void) shutup_gcc;
+   sscanf(path, "%x", device_id);
+   fclose(file);
+}
+
+static void
+i915_drm_winsys_destroy(struct i915_winsys *iws)
+{
+   struct i915_drm_winsys *idws = i915_drm_winsys(iws);
+
+   drm_intel_bufmgr_destroy(idws->pools.gem);
+
+   FREE(idws);
+}
+
+static struct pipe_screen *
+i915_drm_create_screen(struct drm_api *api, int drmFD,
+                       struct drm_create_screen_arg *arg)
+{
+   struct i915_drm_winsys *idws;
+   unsigned int deviceID;
+
+   if (arg != NULL) {
+      switch(arg->mode) {
+      case DRM_CREATE_NORMAL:
+         break;
+      default:
+         return NULL;
+      }
+   }
+
+   idws = CALLOC_STRUCT(i915_drm_winsys);
+   if (!idws)
+      return NULL;
+
+   i915_drm_get_device_id(&deviceID);
+
+   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 = 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);
+
+   idws->dump_cmd = debug_get_bool_option("INTEL_DUMP_CMD", FALSE);
+
+   return i915_create_screen(&idws->base, deviceID);
+}
+
+static void
+destroy(struct drm_api *api)
+{
+
+}
+
+struct drm_api intel_drm_api =
+{
+   .name = "i915",
+   .driver_name = "i915",
+   .create_screen = i915_drm_create_screen,
+   .destroy = destroy,
+};
+
+struct drm_api *
+drm_api_create()
+{
+   return trace_drm_create(&intel_drm_api);
+}
diff --git a/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
new file mode 100644 (file)
index 0000000..102f59d
--- /dev/null
@@ -0,0 +1,244 @@
+
+#include "i915_drm_winsys.h"
+#include "util/u_memory.h"
+
+#include "i915_drm.h"
+
+#define BATCH_RESERVED 16
+
+#define INTEL_DEFAULT_RELOCS 100
+#define INTEL_MAX_RELOCS 400
+
+#define INTEL_BATCH_NO_CLIPRECTS 0x1
+#define INTEL_BATCH_CLIPRECTS    0x2
+
+#undef INTEL_RUN_SYNC
+#undef INTEL_MAP_BATCHBUFFER
+#undef INTEL_MAP_GTT
+#define INTEL_ALWAYS_FLUSH
+
+struct i915_drm_batchbuffer
+{
+   struct i915_winsys_batchbuffer base;
+
+   size_t actual_size;
+
+   drm_intel_bo *bo;
+};
+
+static INLINE struct i915_drm_batchbuffer *
+i915_drm_batchbuffer(struct i915_winsys_batchbuffer *batch)
+{
+   return (struct i915_drm_batchbuffer *)batch;
+}
+
+static void
+i915_drm_batchbuffer_reset(struct i915_drm_batchbuffer *batch)
+{
+   struct i915_drm_winsys *idws = i915_drm_winsys(batch->base.iws);
+   int ret;
+
+   if (batch->bo)
+      drm_intel_bo_unreference(batch->bo);
+   batch->bo = drm_intel_bo_alloc(idws->pools.gem,
+                                  "gallium3d_batchbuffer",
+                                  batch->actual_size,
+                                  4096);
+
+#ifdef INTEL_MAP_BATCHBUFFER
+#ifdef INTEL_MAP_GTT
+   ret = drm_intel_gem_bo_map_gtt(batch->bo);
+#else
+   ret = drm_intel_bo_map(batch->bo, TRUE);
+#endif
+   assert(ret == 0);
+   batch->base.map = batch->bo->virtual;
+#else
+   (void)ret;
+#endif
+
+   memset(batch->base.map, 0, batch->actual_size);
+   batch->base.ptr = batch->base.map;
+   batch->base.size = batch->actual_size - BATCH_RESERVED;
+   batch->base.relocs = 0;
+}
+
+static struct i915_winsys_batchbuffer *
+i915_drm_batchbuffer_create(struct i915_winsys *iws)
+{
+   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;
+
+#ifdef INTEL_MAP_BATCHBUFFER
+   batch->base.map = NULL;
+#else
+   batch->base.map = MALLOC(batch->actual_size);
+#endif
+   batch->base.ptr = NULL;
+   batch->base.size = 0;
+
+   batch->base.relocs = 0;
+   batch->base.max_relocs = 300;/*INTEL_DEFAULT_RELOCS;*/
+
+   batch->base.iws = iws;
+
+   i915_drm_batchbuffer_reset(batch);
+
+   return &batch->base;
+}
+
+static int
+i915_drm_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch,
+                            struct i915_winsys_buffer *buffer,
+                            enum i915_winsys_buffer_usage usage,
+                            unsigned pre_add)
+{
+   struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch);
+   unsigned write_domain = 0;
+   unsigned read_domain = 0;
+   unsigned offset;
+   int ret = 0;
+
+   assert(batch->base.relocs < batch->base.max_relocs);
+
+   if (usage == I915_USAGE_SAMPLER) {
+      write_domain = 0;
+      read_domain = I915_GEM_DOMAIN_SAMPLER;
+
+   } else if (usage == I915_USAGE_RENDER) {
+      write_domain = I915_GEM_DOMAIN_RENDER;
+      read_domain = I915_GEM_DOMAIN_RENDER;
+
+   } else if (usage == I915_USAGE_2D_TARGET) {
+      write_domain = I915_GEM_DOMAIN_RENDER;
+      read_domain = I915_GEM_DOMAIN_RENDER;
+
+   } else if (usage == I915_USAGE_2D_SOURCE) {
+      write_domain = 0;
+      read_domain = I915_GEM_DOMAIN_RENDER;
+
+   } else if (usage == I915_USAGE_VERTEX) {
+      write_domain = 0;
+      read_domain = I915_GEM_DOMAIN_VERTEX;
+
+   } else {
+      assert(0);
+      return -1;
+   }
+
+   offset = (unsigned)(batch->base.ptr - batch->base.map);
+
+   ret = drm_intel_bo_emit_reloc(batch->bo, offset,
+                                 intel_bo(buffer), pre_add,
+                                 read_domain,
+                                 write_domain);
+
+   ((uint32_t*)batch->base.ptr)[0] = intel_bo(buffer)->offset + pre_add;
+   batch->base.ptr += 4;
+
+   if (!ret)
+      batch->base.relocs++;
+
+   return ret;
+}
+
+static void
+i915_drm_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch,
+                            struct pipe_fence_handle **fence)
+{
+   struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch);
+   unsigned used = 0;
+   int ret = 0;
+   int i;
+
+   assert(i915_winsys_batchbuffer_space(ibatch) >= 0);
+
+   used = batch->base.ptr - batch->base.map;
+   assert((used & 3) == 0);
+
+
+#ifdef INTEL_ALWAYS_FLUSH
+   /* MI_FLUSH | FLUSH_MAP_CACHE */
+   i915_winsys_batchbuffer_dword(ibatch, (0x4<<23)|(1<<0));
+   used += 4;
+#endif
+
+   if ((used & 4) == 0) {
+      /* MI_NOOP */
+      i915_winsys_batchbuffer_dword(ibatch, 0);
+   }
+   /* MI_BATCH_BUFFER_END */
+   i915_winsys_batchbuffer_dword(ibatch, (0xA<<23));
+
+   used = batch->base.ptr - batch->base.map;
+   assert((used & 4) == 0);
+
+#ifdef INTEL_MAP_BATCHBUFFER
+#ifdef INTEL_MAP_GTT
+   drm_intel_gem_bo_unmap_gtt(batch->bo);
+#else
+   drm_intel_bo_unmap(batch->bo);
+#endif
+#else
+   drm_intel_bo_subdata(batch->bo, 0, used, batch->base.map);
+#endif
+
+   /* Do the sending to HW */
+   ret = drm_intel_bo_exec(batch->bo, used, NULL, 0, 0);
+   assert(ret == 0);
+
+   if (i915_drm_winsys(ibatch->iws)->dump_cmd) {
+      unsigned *ptr;
+      drm_intel_bo_map(batch->bo, FALSE);
+      ptr = (unsigned*)batch->bo->virtual;
+
+      debug_printf("%s:\n", __func__);
+      for (i = 0; i < used / 4; i++, ptr++) {
+         debug_printf("\t%08x:    %08x\n", i*4, *ptr);
+      }
+
+      drm_intel_bo_unmap(batch->bo);
+   } else {
+#ifdef INTEL_RUN_SYNC
+      drm_intel_bo_map(batch->bo, FALSE);
+      drm_intel_bo_unmap(batch->bo);
+#endif
+   }
+
+   if (fence) {
+      ibatch->iws->fence_reference(ibatch->iws, fence, NULL);
+
+#ifdef INTEL_RUN_SYNC
+      /* we run synced to GPU so just pass null */
+      (*fence) = i915_drm_fence_create(NULL);
+#else
+      (*fence) = i915_drm_fence_create(batch->bo);
+#endif
+   }
+
+   i915_drm_batchbuffer_reset(batch);
+}
+
+static void
+i915_drm_batchbuffer_destroy(struct i915_winsys_batchbuffer *ibatch)
+{
+   struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch);
+
+   if (batch->bo)
+      drm_intel_bo_unreference(batch->bo);
+
+#ifndef INTEL_MAP_BATCHBUFFER
+   FREE(batch->base.map);
+#endif
+   FREE(batch);
+}
+
+void i915_drm_winsys_init_batchbuffer_functions(struct i915_drm_winsys *idws)
+{
+   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/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
new file mode 100644 (file)
index 0000000..3bd8502
--- /dev/null
@@ -0,0 +1,217 @@
+
+#include "state_tracker/drm_api.h"
+#include "i915_drm_winsys.h"
+#include "util/u_memory.h"
+
+#include "i915_drm.h"
+
+static struct i915_winsys_buffer *
+i915_drm_buffer_create(struct i915_winsys *iws,
+                        unsigned size, unsigned alignment,
+                        enum i915_winsys_buffer_type type)
+{
+   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;
+
+   if (!buf)
+      return NULL;
+
+   buf->magic = 0xDEAD1337;
+   buf->flinked = FALSE;
+   buf->flink = 0;
+   buf->map_gtt = FALSE;
+
+   if (type == I915_NEW_TEXTURE) {
+      name = "gallium3d_texture";
+      pool = idws->pools.gem;
+   } else if (type == I915_NEW_VERTEX) {
+      name = "gallium3d_vertex";
+      pool = idws->pools.gem;
+      buf->map_gtt = TRUE;
+   } else if (type == I915_NEW_SCANOUT) {
+      name = "gallium3d_scanout";
+      pool = idws->pools.gem;
+      buf->map_gtt = TRUE;
+   } else {
+      assert(0);
+      name = "gallium3d_unknown";
+      pool = idws->pools.gem;
+   }
+
+   buf->bo = drm_intel_bo_alloc(pool, name, size, alignment);
+
+   if (!buf->bo)
+      goto err;
+
+   return (struct i915_winsys_buffer *)buf;
+
+err:
+   assert(0);
+   FREE(buf);
+   return NULL;
+}
+
+static struct i915_winsys_buffer *
+i915_drm_buffer_from_handle(struct i915_winsys *iws,
+                             struct winsys_handle *whandle,
+                             unsigned *stride)
+{
+   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)
+      return NULL;
+
+   buf->magic = 0xDEAD1337;
+   buf->bo = drm_intel_bo_gem_create_from_name(idws->pools.gem, "gallium3d_from_handle", whandle->handle);
+   buf->flinked = TRUE;
+   buf->flink = whandle->handle;
+
+   if (!buf->bo)
+      goto err;
+
+   drm_intel_bo_get_tiling(buf->bo, &tile, &swizzle);
+   if (tile != I915_TILE_NONE)
+      buf->map_gtt = TRUE;
+
+   *stride = whandle->stride;
+
+   return (struct i915_winsys_buffer *)buf;
+
+err:
+   FREE(buf);
+   return NULL;
+}
+
+static boolean
+i915_drm_buffer_get_handle(struct i915_winsys *iws,
+                            struct i915_winsys_buffer *buffer,
+                            struct winsys_handle *whandle,
+                            unsigned stride)
+{
+   struct i915_drm_buffer *buf = i915_drm_buffer(buffer);
+
+   if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
+      if (!buf->flinked) {
+         if (drm_intel_bo_flink(buf->bo, &buf->flink))
+            return FALSE;
+         buf->flinked = TRUE;
+      }
+
+      whandle->handle = buf->flink;
+   } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
+      whandle->handle = buf->bo->handle;
+   } else {
+      assert(!"unknown usage");
+      return FALSE;
+   }
+
+   whandle->stride = stride;
+   return TRUE;
+}
+
+static int
+i915_drm_buffer_set_fence_reg(struct i915_winsys *iws,
+                               struct i915_winsys_buffer *buffer,
+                               unsigned stride,
+                               enum i915_winsys_buffer_tile tile)
+{
+   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 != I915_TILE_NONE) {
+      assert(buf->map_count == 0);
+      buf->map_gtt = TRUE;
+   }
+
+   return drm_intel_bo_set_tiling(buf->bo, &tile, stride);
+}
+
+static void *
+i915_drm_buffer_map(struct i915_winsys *iws,
+                     struct i915_winsys_buffer *buffer,
+                     boolean write)
+{
+   struct i915_drm_buffer *buf = i915_drm_buffer(buffer);
+   drm_intel_bo *bo = intel_bo(buffer);
+   int ret = 0;
+
+   assert(bo);
+
+   if (buf->map_count)
+      goto out;
+
+   if (buf->map_gtt)
+      ret = drm_intel_gem_bo_map_gtt(bo);
+   else
+      ret = drm_intel_bo_map(bo, write);
+
+   buf->ptr = bo->virtual;
+
+   assert(ret == 0);
+out:
+   if (ret)
+      return NULL;
+
+   buf->map_count++;
+   return buf->ptr;
+}
+
+static void
+i915_drm_buffer_unmap(struct i915_winsys *iws,
+                       struct i915_winsys_buffer *buffer)
+{
+   struct i915_drm_buffer *buf = i915_drm_buffer(buffer);
+
+   if (--buf->map_count)
+      return;
+
+   if (buf->map_gtt)
+      drm_intel_gem_bo_unmap_gtt(intel_bo(buffer));
+   else
+      drm_intel_bo_unmap(intel_bo(buffer));
+}
+
+static int
+i915_drm_buffer_write(struct i915_winsys *iws,
+                       struct i915_winsys_buffer *buffer,
+                       size_t offset,
+                       size_t size,
+                       const void *data)
+{
+   struct i915_drm_buffer *buf = i915_drm_buffer(buffer);
+
+   return drm_intel_bo_subdata(buf->bo, offset, size, (void*)data);
+}
+
+static void
+i915_drm_buffer_destroy(struct i915_winsys *iws,
+                         struct i915_winsys_buffer *buffer)
+{
+   drm_intel_bo_unreference(intel_bo(buffer));
+
+#ifdef DEBUG
+   i915_drm_buffer(buffer)->magic = 0;
+   i915_drm_buffer(buffer)->bo = NULL;
+#endif
+
+   FREE(buffer);
+}
+
+void
+i915_drm_winsys_init_buffer_functions(struct i915_drm_winsys *idws)
+{
+   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/i915_drm_fence.c b/src/gallium/winsys/i915/drm/i915_drm_fence.c
new file mode 100644 (file)
index 0000000..30ebf48
--- /dev/null
@@ -0,0 +1,83 @@
+
+#include "i915_drm_winsys.h"
+#include "util/u_memory.h"
+#include "util/u_atomic.h"
+#include "util/u_inlines.h"
+
+/**
+ * Because gem does not have fence's we have to create our own fences.
+ *
+ * They work by keeping the batchbuffer around and checking if that has
+ * been idled. If bo is NULL fence has expired.
+ */
+struct i915_drm_fence
+{
+   struct pipe_reference reference;
+   drm_intel_bo *bo;
+};
+
+
+struct pipe_fence_handle *
+i915_drm_fence_create(drm_intel_bo *bo)
+{
+   struct i915_drm_fence *fence = CALLOC_STRUCT(i915_drm_fence);
+
+   pipe_reference_init(&fence->reference, 1);
+   /* bo is null if fence already expired */
+   if (bo) {
+      drm_intel_bo_reference(bo);
+      fence->bo = bo;
+   }
+
+   return (struct pipe_fence_handle *)fence;
+}
+
+static void
+i915_drm_fence_reference(struct i915_winsys *iws,
+                          struct pipe_fence_handle **ptr,
+                          struct pipe_fence_handle *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 i915_drm_fence *)(*ptr))->reference, &f->reference)) {
+      if (old->bo)
+         drm_intel_bo_unreference(old->bo);
+      FREE(old);
+   }
+   *ptr = fence;
+}
+
+static int
+i915_drm_fence_signalled(struct i915_winsys *iws,
+                          struct pipe_fence_handle *fence)
+{
+   assert(0);
+
+   return 0;
+}
+
+static int
+i915_drm_fence_finish(struct i915_winsys *iws,
+                       struct pipe_fence_handle *fence)
+{
+   struct i915_drm_fence *f = (struct i915_drm_fence *)fence;
+
+   /* fence already expired */
+   if (!f->bo)
+      return 0;
+
+   drm_intel_bo_wait_rendering(f->bo);
+   drm_intel_bo_unreference(f->bo);
+   f->bo = NULL;
+
+   return 0;
+}
+
+void
+i915_drm_winsys_init_fence_functions(struct i915_drm_winsys *idws)
+{
+   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 (file)
index 0000000..217c4a7
--- /dev/null
@@ -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_api.c b/src/gallium/winsys/i915/drm/intel_drm_api.c
deleted file mode 100644 (file)
index e3b980a..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-#include <stdio.h>
-
-#include "state_tracker/drm_api.h"
-
-#include "intel_drm_winsys.h"
-#include "util/u_memory.h"
-
-#include "i915/i915_context.h"
-#include "i915/i915_screen.h"
-
-#include "trace/tr_drm.h"
-
-/*
- * Helper functions
- */
-
-
-static void
-intel_drm_get_device_id(unsigned int *device_id)
-{
-   char path[512];
-   FILE *file;
-   void *shutup_gcc;
-
-   /*
-    * FIXME: Fix this up to use a drm ioctl or whatever.
-    */
-
-   snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device");
-   file = fopen(path, "r");
-   if (!file) {
-      return;
-   }
-
-   shutup_gcc = fgets(path, sizeof(path), file);
-   (void) shutup_gcc;
-   sscanf(path, "%x", device_id);
-   fclose(file);
-}
-
-static void
-intel_drm_winsys_destroy(struct intel_winsys *iws)
-{
-   struct intel_drm_winsys *idws = intel_drm_winsys(iws);
-
-   drm_intel_bufmgr_destroy(idws->pools.gem);
-
-   FREE(idws);
-}
-
-static struct pipe_screen *
-intel_drm_create_screen(struct drm_api *api, int drmFD,
-                        struct drm_create_screen_arg *arg)
-{
-   struct intel_drm_winsys *idws;
-   unsigned int deviceID;
-
-   if (arg != NULL) {
-      switch(arg->mode) {
-      case DRM_CREATE_NORMAL:
-         break;
-      default:
-         return NULL;
-      }
-   }
-
-   idws = CALLOC_STRUCT(intel_drm_winsys);
-   if (!idws)
-      return NULL;
-
-   intel_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);
-
-   idws->fd = drmFD;
-   idws->id = deviceID;
-   idws->max_batch_size = 16 * 4096;
-
-   idws->base.destroy = intel_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);
-
-   idws->dump_cmd = debug_get_bool_option("INTEL_DUMP_CMD", FALSE);
-
-   return i915_create_screen(&idws->base, deviceID);
-}
-
-static void
-destroy(struct drm_api *api)
-{
-
-}
-
-struct drm_api intel_drm_api =
-{
-   .name = "i915",
-   .driver_name = "i915",
-   .create_screen = intel_drm_create_screen,
-   .destroy = destroy,
-};
-
-struct drm_api *
-drm_api_create()
-{
-   return trace_drm_create(&intel_drm_api);
-}
diff --git a/src/gallium/winsys/i915/drm/intel_drm_batchbuffer.c b/src/gallium/winsys/i915/drm/intel_drm_batchbuffer.c
deleted file mode 100644 (file)
index 5b4dafc..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
-
-#include "intel_drm_winsys.h"
-#include "util/u_memory.h"
-
-#include "i915_drm.h"
-
-#define BATCH_RESERVED 16
-
-#define INTEL_DEFAULT_RELOCS 100
-#define INTEL_MAX_RELOCS 400
-
-#define INTEL_BATCH_NO_CLIPRECTS 0x1
-#define INTEL_BATCH_CLIPRECTS    0x2
-
-#undef INTEL_RUN_SYNC
-#undef INTEL_MAP_BATCHBUFFER
-#undef INTEL_MAP_GTT
-#define INTEL_ALWAYS_FLUSH
-
-struct intel_drm_batchbuffer
-{
-   struct intel_batchbuffer base;
-
-   size_t actual_size;
-
-   drm_intel_bo *bo;
-};
-
-static INLINE struct intel_drm_batchbuffer *
-intel_drm_batchbuffer(struct intel_batchbuffer *batch)
-{
-   return (struct intel_drm_batchbuffer *)batch;
-}
-
-static void
-intel_drm_batchbuffer_reset(struct intel_drm_batchbuffer *batch)
-{
-   struct intel_drm_winsys *idws = intel_drm_winsys(batch->base.iws);
-   int ret;
-
-   if (batch->bo)
-      drm_intel_bo_unreference(batch->bo);
-   batch->bo = drm_intel_bo_alloc(idws->pools.gem,
-                                  "gallium3d_batchbuffer",
-                                  batch->actual_size,
-                                  4096);
-
-#ifdef INTEL_MAP_BATCHBUFFER
-#ifdef INTEL_MAP_GTT
-   ret = drm_intel_gem_bo_map_gtt(batch->bo);
-#else
-   ret = drm_intel_bo_map(batch->bo, TRUE);
-#endif
-   assert(ret == 0);
-   batch->base.map = batch->bo->virtual;
-#else
-   (void)ret;
-#endif
-
-   memset(batch->base.map, 0, batch->actual_size);
-   batch->base.ptr = batch->base.map;
-   batch->base.size = batch->actual_size - BATCH_RESERVED;
-   batch->base.relocs = 0;
-}
-
-static struct intel_batchbuffer *
-intel_drm_batchbuffer_create(struct intel_winsys *iws)
-{
-   struct intel_drm_winsys *idws = intel_drm_winsys(iws);
-   struct intel_drm_batchbuffer *batch = CALLOC_STRUCT(intel_drm_batchbuffer);
-
-   batch->actual_size = idws->max_batch_size;
-
-#ifdef INTEL_MAP_BATCHBUFFER
-   batch->base.map = NULL;
-#else
-   batch->base.map = MALLOC(batch->actual_size);
-#endif
-   batch->base.ptr = NULL;
-   batch->base.size = 0;
-
-   batch->base.relocs = 0;
-   batch->base.max_relocs = 300;/*INTEL_DEFAULT_RELOCS;*/
-
-   batch->base.iws = iws;
-
-   intel_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,
-                            unsigned pre_add)
-{
-   struct intel_drm_batchbuffer *batch = intel_drm_batchbuffer(ibatch);
-   unsigned write_domain = 0;
-   unsigned read_domain = 0;
-   unsigned offset;
-   int ret = 0;
-
-   assert(batch->base.relocs < batch->base.max_relocs);
-
-   if (usage == INTEL_USAGE_SAMPLER) {
-      write_domain = 0;
-      read_domain = I915_GEM_DOMAIN_SAMPLER;
-
-   } else if (usage == INTEL_USAGE_RENDER) {
-      write_domain = I915_GEM_DOMAIN_RENDER;
-      read_domain = I915_GEM_DOMAIN_RENDER;
-
-   } else if (usage == INTEL_USAGE_2D_TARGET) {
-      write_domain = I915_GEM_DOMAIN_RENDER;
-      read_domain = I915_GEM_DOMAIN_RENDER;
-
-   } else if (usage == INTEL_USAGE_2D_SOURCE) {
-      write_domain = 0;
-      read_domain = I915_GEM_DOMAIN_RENDER;
-
-   } else if (usage == INTEL_USAGE_VERTEX) {
-      write_domain = 0;
-      read_domain = I915_GEM_DOMAIN_VERTEX;
-
-   } else {
-      assert(0);
-      return -1;
-   }
-
-   offset = (unsigned)(batch->base.ptr - batch->base.map);
-
-   ret = drm_intel_bo_emit_reloc(batch->bo, offset,
-                                 intel_bo(buffer), pre_add,
-                                 read_domain,
-                                 write_domain);
-
-   ((uint32_t*)batch->base.ptr)[0] = intel_bo(buffer)->offset + pre_add;
-   batch->base.ptr += 4;
-
-   if (!ret)
-      batch->base.relocs++;
-
-   return ret;
-}
-
-static void
-intel_drm_batchbuffer_flush(struct intel_batchbuffer *ibatch,
-                            struct pipe_fence_handle **fence)
-{
-   struct intel_drm_batchbuffer *batch = intel_drm_batchbuffer(ibatch);
-   unsigned used = 0;
-   int ret = 0;
-   int i;
-
-   assert(intel_batchbuffer_space(ibatch) >= 0);
-
-   used = batch->base.ptr - batch->base.map;
-   assert((used & 3) == 0);
-
-
-#ifdef INTEL_ALWAYS_FLUSH
-   /* MI_FLUSH | FLUSH_MAP_CACHE */
-   intel_batchbuffer_dword(ibatch, (0x4<<23)|(1<<0));
-   used += 4;
-#endif
-
-   if ((used & 4) == 0) {
-      /* MI_NOOP */
-      intel_batchbuffer_dword(ibatch, 0);
-   }
-   /* MI_BATCH_BUFFER_END */
-   intel_batchbuffer_dword(ibatch, (0xA<<23));
-
-   used = batch->base.ptr - batch->base.map;
-   assert((used & 4) == 0);
-
-#ifdef INTEL_MAP_BATCHBUFFER
-#ifdef INTEL_MAP_GTT
-   drm_intel_gem_bo_unmap_gtt(batch->bo);
-#else
-   drm_intel_bo_unmap(batch->bo);
-#endif
-#else
-   drm_intel_bo_subdata(batch->bo, 0, used, batch->base.map);
-#endif
-
-   /* Do the sending to HW */
-   ret = drm_intel_bo_exec(batch->bo, used, NULL, 0, 0);
-   assert(ret == 0);
-
-   if (intel_drm_winsys(ibatch->iws)->dump_cmd) {
-      unsigned *ptr;
-      drm_intel_bo_map(batch->bo, FALSE);
-      ptr = (unsigned*)batch->bo->virtual;
-
-      debug_printf("%s:\n", __func__);
-      for (i = 0; i < used / 4; i++, ptr++) {
-         debug_printf("\t%08x:    %08x\n", i*4, *ptr);
-      }
-
-      drm_intel_bo_unmap(batch->bo);
-   } else {
-#ifdef INTEL_RUN_SYNC
-      drm_intel_bo_map(batch->bo, FALSE);
-      drm_intel_bo_unmap(batch->bo);
-#endif
-   }
-
-   if (fence) {
-      ibatch->iws->fence_reference(ibatch->iws, fence, NULL);
-
-#ifdef INTEL_RUN_SYNC
-      /* we run synced to GPU so just pass null */
-      (*fence) = intel_drm_fence_create(NULL);
-#else
-      (*fence) = intel_drm_fence_create(batch->bo);
-#endif
-   }
-
-   intel_drm_batchbuffer_reset(batch);
-}
-
-static void
-intel_drm_batchbuffer_destroy(struct intel_batchbuffer *ibatch)
-{
-   struct intel_drm_batchbuffer *batch = intel_drm_batchbuffer(ibatch);
-
-   if (batch->bo)
-      drm_intel_bo_unreference(batch->bo);
-
-#ifndef INTEL_MAP_BATCHBUFFER
-   FREE(batch->base.map);
-#endif
-   FREE(batch);
-}
-
-void intel_drm_winsys_init_batchbuffer_functions(struct intel_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;
-}
diff --git a/src/gallium/winsys/i915/drm/intel_drm_buffer.c b/src/gallium/winsys/i915/drm/intel_drm_buffer.c
deleted file mode 100644 (file)
index cb4f92a..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-
-#include "state_tracker/drm_api.h"
-#include "intel_drm_winsys.h"
-#include "util/u_memory.h"
-
-#include "i915_drm.h"
-
-static struct intel_buffer *
-intel_drm_buffer_create(struct intel_winsys *iws,
-                        unsigned size, unsigned alignment,
-                        enum intel_buffer_type type)
-{
-   struct intel_drm_buffer *buf = CALLOC_STRUCT(intel_drm_buffer);
-   struct intel_drm_winsys *idws = intel_drm_winsys(iws);
-   drm_intel_bufmgr *pool;
-   char *name;
-
-   if (!buf)
-      return NULL;
-
-   buf->magic = 0xDEAD1337;
-   buf->flinked = FALSE;
-   buf->flink = 0;
-   buf->map_gtt = FALSE;
-
-   if (type == INTEL_NEW_TEXTURE) {
-      name = "gallium3d_texture";
-      pool = idws->pools.gem;
-   } else if (type == INTEL_NEW_VERTEX) {
-      name = "gallium3d_vertex";
-      pool = idws->pools.gem;
-      buf->map_gtt = TRUE;
-   } else if (type == INTEL_NEW_SCANOUT) {
-      name = "gallium3d_scanout";
-      pool = idws->pools.gem;
-      buf->map_gtt = TRUE;
-   } else {
-      assert(0);
-      name = "gallium3d_unknown";
-      pool = idws->pools.gem;
-   }
-
-   buf->bo = drm_intel_bo_alloc(pool, name, size, alignment);
-
-   if (!buf->bo)
-      goto err;
-
-   return (struct intel_buffer *)buf;
-
-err:
-   assert(0);
-   FREE(buf);
-   return NULL;
-}
-
-static struct intel_buffer *
-intel_drm_buffer_from_handle(struct intel_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);
-   uint32_t tile = 0, swizzle = 0;
-
-   if (!buf)
-      return NULL;
-
-   buf->magic = 0xDEAD1337;
-   buf->bo = drm_intel_bo_gem_create_from_name(idws->pools.gem, "gallium3d_from_handle", whandle->handle);
-   buf->flinked = TRUE;
-   buf->flink = whandle->handle;
-
-   if (!buf->bo)
-      goto err;
-
-   drm_intel_bo_get_tiling(buf->bo, &tile, &swizzle);
-   if (tile != INTEL_TILE_NONE)
-      buf->map_gtt = TRUE;
-
-   *stride = whandle->stride;
-
-   return (struct intel_buffer *)buf;
-
-err:
-   FREE(buf);
-   return NULL;
-}
-
-static boolean
-intel_drm_buffer_get_handle(struct intel_winsys *iws,
-                            struct intel_buffer *buffer,
-                            struct winsys_handle *whandle,
-                            unsigned stride)
-{
-   struct intel_drm_buffer *buf = intel_drm_buffer(buffer);
-
-   if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
-      if (!buf->flinked) {
-         if (drm_intel_bo_flink(buf->bo, &buf->flink))
-            return FALSE;
-         buf->flinked = TRUE;
-      }
-
-      whandle->handle = buf->flink;
-   } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
-      whandle->handle = buf->bo->handle;
-   } else {
-      assert(!"unknown usage");
-      return FALSE;
-   }
-
-   whandle->stride = stride;
-   return TRUE;
-}
-
-static int
-intel_drm_buffer_set_fence_reg(struct intel_winsys *iws,
-                               struct intel_buffer *buffer,
-                               unsigned stride,
-                               enum intel_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);
-
-   if (tile != INTEL_TILE_NONE) {
-      assert(buf->map_count == 0);
-      buf->map_gtt = TRUE;
-   }
-
-   return drm_intel_bo_set_tiling(buf->bo, &tile, stride);
-}
-
-static void *
-intel_drm_buffer_map(struct intel_winsys *iws,
-                     struct intel_buffer *buffer,
-                     boolean write)
-{
-   struct intel_drm_buffer *buf = intel_drm_buffer(buffer);
-   drm_intel_bo *bo = intel_bo(buffer);
-   int ret = 0;
-
-   assert(bo);
-
-   if (buf->map_count)
-      goto out;
-
-   if (buf->map_gtt)
-      ret = drm_intel_gem_bo_map_gtt(bo);
-   else
-      ret = drm_intel_bo_map(bo, write);
-
-   buf->ptr = bo->virtual;
-
-   assert(ret == 0);
-out:
-   if (ret)
-      return NULL;
-
-   buf->map_count++;
-   return buf->ptr;
-}
-
-static void
-intel_drm_buffer_unmap(struct intel_winsys *iws,
-                       struct intel_buffer *buffer)
-{
-   struct intel_drm_buffer *buf = intel_drm_buffer(buffer);
-
-   if (--buf->map_count)
-      return;
-
-   if (buf->map_gtt)
-      drm_intel_gem_bo_unmap_gtt(intel_bo(buffer));
-   else
-      drm_intel_bo_unmap(intel_bo(buffer));
-}
-
-static int
-intel_drm_buffer_write(struct intel_winsys *iws,
-                       struct intel_buffer *buffer,
-                       size_t offset,
-                       size_t size,
-                       const void *data)
-{
-   struct intel_drm_buffer *buf = intel_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)
-{
-   drm_intel_bo_unreference(intel_bo(buffer));
-
-#ifdef DEBUG
-   intel_drm_buffer(buffer)->magic = 0;
-   intel_drm_buffer(buffer)->bo = NULL;
-#endif
-
-   FREE(buffer);
-}
-
-void
-intel_drm_winsys_init_buffer_functions(struct intel_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;
-}
diff --git a/src/gallium/winsys/i915/drm/intel_drm_fence.c b/src/gallium/winsys/i915/drm/intel_drm_fence.c
deleted file mode 100644 (file)
index 102faed..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-
-#include "intel_drm_winsys.h"
-#include "util/u_memory.h"
-#include "util/u_atomic.h"
-#include "util/u_inlines.h"
-
-/**
- * Because gem does not have fence's we have to create our own fences.
- *
- * 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 pipe_reference reference;
-   drm_intel_bo *bo;
-};
-
-
-struct pipe_fence_handle *
-intel_drm_fence_create(drm_intel_bo *bo)
-{
-   struct intel_drm_fence *fence = CALLOC_STRUCT(intel_drm_fence);
-
-   pipe_reference_init(&fence->reference, 1);
-   /* bo is null if fence already expired */
-   if (bo) {
-      drm_intel_bo_reference(bo);
-      fence->bo = bo;
-   }
-
-   return (struct pipe_fence_handle *)fence;
-}
-
-static void
-intel_drm_fence_reference(struct intel_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;
-
-   if (pipe_reference(&((struct intel_drm_fence *)(*ptr))->reference, &f->reference)) {
-      if (old->bo)
-         drm_intel_bo_unreference(old->bo);
-      FREE(old);
-   }
-   *ptr = fence;
-}
-
-static int
-intel_drm_fence_signalled(struct intel_winsys *iws,
-                          struct pipe_fence_handle *fence)
-{
-   assert(0);
-
-   return 0;
-}
-
-static int
-intel_drm_fence_finish(struct intel_winsys *iws,
-                       struct pipe_fence_handle *fence)
-{
-   struct intel_drm_fence *f = (struct intel_drm_fence *)fence;
-
-   /* fence already expired */
-   if (!f->bo)
-      return 0;
-
-   drm_intel_bo_wait_rendering(f->bo);
-   drm_intel_bo_unreference(f->bo);
-   f->bo = NULL;
-
-   return 0;
-}
-
-void
-intel_drm_winsys_init_fence_functions(struct intel_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;
-}
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 (file)
index 9786ee9..0000000
+++ /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