xm_winsys_aub.c File Reference

Include dependency graph for xm_winsys_aub.c:

Go to the source code of this file.

Data Structures

struct  aub_buffer
struct  aub_pipe_winsys
struct  aub_brw_winsys

Defines

#define IWS_BATCHBUFFER_SIZE   1024

Functions

static struct aub_pipe_winsysaub_pipe_winsys (struct pipe_winsys *winsys)
static struct aub_bufferaub_bo (struct pipe_buffer *bo)
static struct pipe_bufferpipe_bo (struct aub_buffer *bo)
static void * aub_buffer_map (struct pipe_winsys *winsys, struct pipe_buffer *buf, unsigned flags)
static void aub_buffer_unmap (struct pipe_winsys *winsys, struct pipe_buffer *buf)
static void aub_buffer_destroy (struct pipe_winsys *winsys, struct pipe_buffer *buf)
void xmesa_buffer_subdata_aub (struct pipe_winsys *winsys, struct pipe_buffer *buf, unsigned long offset, unsigned long size, const void *data, unsigned aub_type, unsigned aub_sub_type)
void xmesa_commands_aub (struct pipe_winsys *winsys, unsigned *cmds, unsigned nr_dwords)
void xmesa_display_aub (struct pipe_surface *surface)
static struct pipe_bufferaub_buffer_create (struct pipe_winsys *winsys, unsigned alignment, unsigned usage, unsigned size)
static struct pipe_bufferaub_user_buffer_create (struct pipe_winsys *winsys, void *ptr, unsigned bytes)
static void aub_flush_frontbuffer (struct pipe_winsys *winsys, struct pipe_surface *surf, void *context_private)
static struct pipe_surfaceaub_i915_surface_alloc (struct pipe_winsys *winsys)
static unsigned round_up (unsigned n, unsigned multiple)
 Round n up to next multiple.
static int aub_i915_surface_alloc_storage (struct pipe_winsys *winsys, struct pipe_surface *surf, unsigned width, unsigned height, enum pipe_format format, unsigned flags, unsigned tex_usage)
static void aub_i915_surface_release (struct pipe_winsys *winsys, struct pipe_surface **s)
static const char * aub_get_name (struct pipe_winsys *winsys)
struct pipe_winsysxmesa_create_pipe_winsys_aub (void)
void xmesa_destroy_pipe_winsys_aub (struct pipe_winsys *winsys)
static struct aub_brw_winsysaub_brw_winsys (struct brw_winsys *sws)
static unsigned * aub_i965_batch_start (struct brw_winsys *sws, unsigned dwords, unsigned relocs)
static void aub_i965_batch_dword (struct brw_winsys *sws, unsigned dword)
static void aub_i965_batch_reloc (struct brw_winsys *sws, struct pipe_buffer *buf, unsigned access_flags, unsigned delta)
static unsigned aub_i965_get_buffer_offset (struct brw_winsys *sws, struct pipe_buffer *buf, unsigned access_flags)
static void aub_i965_batch_end (struct brw_winsys *sws)
static void aub_i965_batch_flush (struct brw_winsys *sws, struct pipe_fence_handle **fence)
static void aub_i965_buffer_subdata_typed (struct brw_winsys *winsys, struct pipe_buffer *buf, unsigned long offset, unsigned long size, const void *data, unsigned data_type)
struct pipe_contextxmesa_create_i965simple (struct pipe_winsys *winsys)
 Create i965 hardware rendering context.

Variables

static struct aub_pipe_winsysglobal_winsys = NULL


Define Documentation

#define IWS_BATCHBUFFER_SIZE   1024

Definition at line 378 of file xm_winsys_aub.c.


Function Documentation

static struct aub_buffer* aub_bo ( struct pipe_buffer bo  )  [static, read]

Definition at line 85 of file xm_winsys_aub.c.

00086 {
00087    return (struct aub_buffer *)bo;
00088 }

static struct aub_brw_winsys* aub_brw_winsys ( struct brw_winsys sws  )  [static, read]

Definition at line 396 of file xm_winsys_aub.c.

00397 {
00398    return (struct aub_brw_winsys *)sws;
00399 }

static struct pipe_buffer* aub_buffer_create ( struct pipe_winsys winsys,
unsigned  alignment,
unsigned  usage,
unsigned  size 
) [static, read]

Definition at line 202 of file xm_winsys_aub.c.

References align(), assert, AUB_BUF_START, aub_pipe_winsys(), CALLOC_STRUCT, aub_buffer::data, aub_buffer::offset, pipe_bo(), aub_pipe_winsys::pool, aub_buffer::refcount, aub_buffer::size, and aub_pipe_winsys::used.

00206 {
00207    struct aub_pipe_winsys *iws = aub_pipe_winsys(winsys);
00208    struct aub_buffer *sbo = CALLOC_STRUCT(aub_buffer);
00209 
00210    sbo->refcount = 1;
00211 
00212    /* Could reuse buffers that are not referenced in current
00213     * batchbuffer.  Can't do that atm, so always reallocate:
00214     */
00215    assert(iws->used + size < iws->size);
00216    sbo->data = iws->pool + iws->used;
00217    sbo->offset = AUB_BUF_START + iws->used;
00218    iws->used += align(size, 4096);
00219 
00220    sbo->size = size;
00221 
00222    return pipe_bo(sbo);
00223 }

static void aub_buffer_destroy ( struct pipe_winsys winsys,
struct pipe_buffer buf 
) [static]

Definition at line 138 of file xm_winsys_aub.c.

00140 {
00141    free(buf);
00142 }

static void* aub_buffer_map ( struct pipe_winsys winsys,
struct pipe_buffer buf,
unsigned  flags 
) [static]

Definition at line 99 of file xm_winsys_aub.c.

References assert, aub_bo(), aub_buffer::data, aub_buffer::dump_on_unmap, aub_buffer::map_count, and PIPE_BUFFER_USAGE_CPU_WRITE.

00102 {
00103    struct aub_buffer *sbo = aub_bo(buf);
00104 
00105    assert(sbo->data);
00106 
00107    if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
00108       sbo->dump_on_unmap = 1;
00109 
00110    sbo->map_count++;
00111    return sbo->data;
00112 }

static void aub_buffer_unmap ( struct pipe_winsys winsys,
struct pipe_buffer buf 
) [static]

Definition at line 114 of file xm_winsys_aub.c.

References aub_bo(), aub_pipe_winsys(), aub_pipe_winsys::aubfile, brw_aub_gtt_data(), aub_buffer::data, aub_buffer::dump_on_unmap, aub_buffer::map_count, aub_buffer::offset, and aub_buffer::size.

00116 {
00117    struct aub_pipe_winsys *iws = aub_pipe_winsys(winsys);
00118    struct aub_buffer *sbo = aub_bo(buf);
00119 
00120    sbo->map_count--;
00121 
00122    if (sbo->map_count == 0 &&
00123        sbo->dump_on_unmap) {
00124 
00125       sbo->dump_on_unmap = 0;
00126 
00127       brw_aub_gtt_data( iws->aubfile, 
00128                         sbo->offset,
00129                         sbo->data,
00130                         sbo->size,
00131                         0,
00132                         0);
00133    }
00134 }

static void aub_flush_frontbuffer ( struct pipe_winsys winsys,
struct pipe_surface surf,
void *  context_private 
) [static]

Definition at line 247 of file xm_winsys_aub.c.

References xmesa_display_aub().

00250 {
00251    xmesa_display_aub( surf );
00252 }

static const char* aub_get_name ( struct pipe_winsys winsys  )  [static]

Definition at line 320 of file xm_winsys_aub.c.

00321 {
00322    return "Aub/xlib";
00323 }

static struct pipe_surface* aub_i915_surface_alloc ( struct pipe_winsys winsys  )  [static, read]

Definition at line 255 of file xm_winsys_aub.c.

References CALLOC_STRUCT, pipe_surface::refcount, and pipe_surface::winsys.

00256 {
00257    struct pipe_surface *surf = CALLOC_STRUCT(pipe_surface);
00258    if (surf) {
00259       surf->refcount = 1;
00260       surf->winsys = winsys;
00261    }
00262    return surf;
00263 }

static int aub_i915_surface_alloc_storage ( struct pipe_winsys winsys,
struct pipe_surface surf,
unsigned  width,
unsigned  height,
enum pipe_format  format,
unsigned  flags,
unsigned  tex_usage 
) [static]

Definition at line 276 of file xm_winsys_aub.c.

References assert, pipe_surface::block, pipe_surface::buffer, pipe_winsys::buffer_create, pipe_surface::format, pipe_surface::height, pipe_surface::nblocksx, pipe_surface::nblocksy, pf_get_block(), pf_get_nblocksx(), pf_get_nblocksy(), PIPE_BUFFER_USAGE_PIXEL, round_up(), pipe_format_block::size, pipe_surface::stride, pipe_surface::usage, and pipe_surface::width.

00282 {
00283    const unsigned alignment = 64;
00284 
00285    surf->width = width;
00286    surf->height = height;
00287    surf->format = format;
00288    pf_get_block(format, &surf->block);
00289    surf->nblocksx = pf_get_nblocksx(&surf->block, width);
00290    surf->nblocksy = pf_get_nblocksy(&surf->block, height);
00291    surf->stride = round_up(surf->nblocksx * surf->block.size, alignment);
00292    surf->usage = flags;
00293 
00294    assert(!surf->buffer);
00295    surf->buffer = winsys->buffer_create(winsys, alignment,
00296                                         PIPE_BUFFER_USAGE_PIXEL,
00297                                         surf->stride * surf->nblocksy);
00298     if(!surf->buffer)
00299        return -1;
00300 
00301    return 0;
00302 }

static void aub_i915_surface_release ( struct pipe_winsys winsys,
struct pipe_surface **  s 
) [static]

Definition at line 305 of file xm_winsys_aub.c.

References pipe_surface::buffer, pipe_surface::refcount, and winsys_buffer_reference().

00306 {
00307    struct pipe_surface *surf = *s;
00308    surf->refcount--;
00309    if (surf->refcount == 0) {
00310       if (surf->buffer)
00311          winsys_buffer_reference(winsys, &surf->buffer, NULL);
00312       free(surf);
00313    }
00314    *s = NULL;
00315 }

static void aub_i965_batch_dword ( struct brw_winsys sws,
unsigned  dword 
) [static]

Definition at line 418 of file xm_winsys_aub.c.

References assert, aub_brw_winsys(), aub_brw_winsys::batch_alloc, aub_brw_winsys::batch_data, and aub_brw_winsys::batch_nr.

00420 {
00421    struct aub_brw_winsys *iws = aub_brw_winsys(sws);
00422 
00423    assert(iws->batch_nr < iws->batch_alloc);
00424    iws->batch_data[iws->batch_nr++] = dword;
00425 }

static void aub_i965_batch_end ( struct brw_winsys sws  )  [static]

Definition at line 445 of file xm_winsys_aub.c.

References assert, aub_brw_winsys(), aub_brw_winsys::batch_alloc, and aub_brw_winsys::batch_nr.

00446 {
00447    struct aub_brw_winsys *iws = aub_brw_winsys(sws);
00448 
00449    assert(iws->batch_nr <= iws->batch_alloc);
00450    iws->batch_alloc = 0;
00451 }

static void aub_i965_batch_flush ( struct brw_winsys sws,
struct pipe_fence_handle **  fence 
) [static]

Definition at line 453 of file xm_winsys_aub.c.

References assert, aub_brw_winsys(), aub_brw_winsys::batch_data, aub_brw_winsys::batch_nr, aub_brw_winsys::batch_size, aub_brw_winsys::pipe_winsys, and xmesa_commands_aub().

00455 {
00456    struct aub_brw_winsys *iws = aub_brw_winsys(sws);
00457    assert(iws->batch_nr <= iws->batch_size);
00458 
00459    if (iws->batch_nr) {
00460       xmesa_commands_aub( iws->pipe_winsys,
00461                           iws->batch_data,
00462                           iws->batch_nr );
00463    }
00464 
00465    iws->batch_nr = 0;
00466 }

static void aub_i965_batch_reloc ( struct brw_winsys sws,
struct pipe_buffer buf,
unsigned  access_flags,
unsigned  delta 
) [static]

Definition at line 427 of file xm_winsys_aub.c.

References assert, aub_bo(), aub_brw_winsys(), aub_brw_winsys::batch_alloc, aub_brw_winsys::batch_data, aub_brw_winsys::batch_nr, and aub_buffer::offset.

00431 {
00432    struct aub_brw_winsys *iws = aub_brw_winsys(sws);
00433 
00434    assert(iws->batch_nr < iws->batch_alloc);
00435    iws->batch_data[iws->batch_nr++] = aub_bo(buf)->offset + delta;
00436 }

static unsigned* aub_i965_batch_start ( struct brw_winsys sws,
unsigned  dwords,
unsigned  relocs 
) [static]

Definition at line 405 of file xm_winsys_aub.c.

References aub_brw_winsys(), aub_brw_winsys::batch_alloc, aub_brw_winsys::batch_nr, and aub_brw_winsys::batch_size.

00408 {
00409    struct aub_brw_winsys *iws = aub_brw_winsys(sws);
00410 
00411    if (iws->batch_size < iws->batch_nr + dwords)
00412       return NULL;
00413 
00414    iws->batch_alloc = iws->batch_nr + dwords;
00415    return (void *)1;                    /* not a valid pointer! */
00416 }

static void aub_i965_buffer_subdata_typed ( struct brw_winsys winsys,
struct pipe_buffer buf,
unsigned long  offset,
unsigned long  size,
const void *  data,
unsigned  data_type 
) [static]

Definition at line 470 of file xm_winsys_aub.c.

References assert, aub_brw_winsys(), BRW_CC_UNIT, BRW_CC_VP, BRW_CLIP_PROG, BRW_CLIP_UNIT, BRW_CLIP_VP, BRW_CONSTANT_BUFFER, BRW_GS_PROG, BRW_GS_UNIT, BRW_SAMPLER, BRW_SAMPLER_DEFAULT_COLOR, BRW_SF_PROG, BRW_SF_UNIT, BRW_SF_VP, BRW_SS_SURF_BIND, BRW_SS_SURFACE, BRW_VS_PROG, BRW_VS_UNIT, BRW_WM_PROG, BRW_WM_UNIT, DW_CONSTANT_URB_ENTRY, DW_GENERAL_STATE, DW_SURFACE_STATE, DWGS_CLIPPER_STATE, DWGS_CLIPPER_VIEWPORT_STATE, DWGS_COLOR_CALC_STATE, DWGS_COLOR_CALC_VIEWPORT_STATE, DWGS_GEOMETRY_SHADER_STATE, DWGS_KERNEL_INSTRUCTIONS, DWGS_SAMPLER_DEFAULT_COLOR, DWGS_SAMPLER_STATE, DWGS_STRIPS_FANS_STATE, DWGS_STRIPS_FANS_VIEWPORT_STATE, DWGS_VERTEX_SHADER_STATE, DWGS_WINDOWER_IZ_STATE, DWSS_BINDING_TABLE_STATE, DWSS_SURFACE_STATE, aub_brw_winsys::pipe_winsys, and xmesa_buffer_subdata_aub().

00476 {
00477    struct aub_brw_winsys *iws = aub_brw_winsys(winsys);
00478    unsigned aub_type = DW_GENERAL_STATE;
00479    unsigned aub_sub_type;
00480 
00481    switch (data_type) {
00482    case BRW_CC_VP:
00483       aub_sub_type = DWGS_COLOR_CALC_VIEWPORT_STATE;
00484       break;
00485    case BRW_CC_UNIT:
00486       aub_sub_type = DWGS_COLOR_CALC_STATE;
00487       break;
00488    case BRW_WM_PROG:
00489       aub_sub_type = DWGS_KERNEL_INSTRUCTIONS;
00490       break;
00491    case BRW_SAMPLER_DEFAULT_COLOR:
00492       aub_sub_type = DWGS_SAMPLER_DEFAULT_COLOR;
00493       break;
00494    case BRW_SAMPLER:
00495       aub_sub_type = DWGS_SAMPLER_STATE;
00496       break;
00497    case BRW_WM_UNIT:
00498       aub_sub_type = DWGS_WINDOWER_IZ_STATE;
00499       break;
00500    case BRW_SF_PROG:
00501       aub_sub_type = DWGS_KERNEL_INSTRUCTIONS;
00502       break;
00503    case BRW_SF_VP:
00504       aub_sub_type = DWGS_STRIPS_FANS_VIEWPORT_STATE;
00505       break;
00506    case BRW_SF_UNIT:
00507       aub_sub_type = DWGS_STRIPS_FANS_STATE;
00508       break;
00509    case BRW_VS_UNIT:
00510       aub_sub_type = DWGS_VERTEX_SHADER_STATE;
00511       break;
00512    case BRW_VS_PROG:
00513       aub_sub_type = DWGS_KERNEL_INSTRUCTIONS;
00514       break;
00515    case BRW_GS_UNIT:
00516       aub_sub_type = DWGS_GEOMETRY_SHADER_STATE;
00517       break;
00518    case BRW_GS_PROG:
00519       aub_sub_type = DWGS_KERNEL_INSTRUCTIONS;
00520       break;
00521    case BRW_CLIP_VP:
00522       aub_sub_type = DWGS_CLIPPER_VIEWPORT_STATE;
00523       break;
00524    case BRW_CLIP_UNIT:
00525       aub_sub_type = DWGS_CLIPPER_STATE;
00526       break;
00527    case BRW_CLIP_PROG:
00528       aub_sub_type = DWGS_KERNEL_INSTRUCTIONS;
00529       break;
00530    case BRW_SS_SURFACE:
00531       aub_type = DW_SURFACE_STATE;
00532       aub_sub_type = DWSS_SURFACE_STATE; 
00533       break;
00534    case BRW_SS_SURF_BIND:
00535       aub_type = DW_SURFACE_STATE;
00536       aub_sub_type = DWSS_BINDING_TABLE_STATE; 
00537       break;
00538    case BRW_CONSTANT_BUFFER:
00539       aub_type = DW_CONSTANT_URB_ENTRY;
00540       aub_sub_type = 0; 
00541       break;
00542 
00543    default:
00544       assert(0);
00545       break;
00546    }
00547 
00548    xmesa_buffer_subdata_aub( iws->pipe_winsys,
00549                              buf,
00550                              offset,
00551                              size,
00552                              data,
00553                              aub_type,
00554                              aub_sub_type );
00555 }

static unsigned aub_i965_get_buffer_offset ( struct brw_winsys sws,
struct pipe_buffer buf,
unsigned  access_flags 
) [static]

Definition at line 438 of file xm_winsys_aub.c.

References aub_bo(), and aub_buffer::offset.

00441 {
00442    return aub_bo(buf)->offset;
00443 }

static struct aub_pipe_winsys* aub_pipe_winsys ( struct pipe_winsys winsys  )  [static, read]

Definition at line 77 of file xm_winsys_aub.c.

00078 {
00079    return (struct aub_pipe_winsys *)winsys;
00080 }

static struct pipe_buffer* aub_user_buffer_create ( struct pipe_winsys winsys,
void *  ptr,
unsigned  bytes 
) [static, read]

Definition at line 227 of file xm_winsys_aub.c.

References aub_bo(), aub_buffer_create(), aub_buffer::data, pipe_bo(), and aub_buffer::size.

00228 {
00229    struct aub_buffer *sbo;
00230 
00231    /* Lets hope this is meant for upload, not as a result!  
00232     */
00233    sbo = aub_bo(aub_buffer_create( winsys, 0, 0, 0 ));
00234 
00235    sbo->data = ptr;
00236    sbo->size = bytes;
00237 
00238    return pipe_bo(sbo);
00239 }

static struct pipe_buffer* pipe_bo ( struct aub_buffer bo  )  [static, read]

Definition at line 91 of file xm_winsys_aub.c.

00092 {
00093    return (struct pipe_buffer *)bo;
00094 }

static unsigned round_up ( unsigned  n,
unsigned  multiple 
) [static]

Round n up to next multiple.

Definition at line 270 of file xm_winsys_aub.c.

00271 {
00272    return (n + multiple - 1) & ~(multiple - 1);
00273 }

void xmesa_buffer_subdata_aub ( struct pipe_winsys winsys,
struct pipe_buffer buf,
unsigned long  offset,
unsigned long  size,
const void *  data,
unsigned  aub_type,
unsigned  aub_sub_type 
)

Definition at line 145 of file xm_winsys_aub.c.

References assert, aub_bo(), aub_pipe_winsys(), aub_pipe_winsys::aubfile, brw_aub_gtt_data(), aub_buffer::data, aub_buffer::offset, and aub_buffer::size.

00152 {
00153    struct aub_pipe_winsys *iws = aub_pipe_winsys(winsys);
00154    struct aub_buffer *sbo = aub_bo(buf);
00155 
00156    assert(sbo->size > offset + size);
00157    memcpy(sbo->data + offset, data, size);
00158 
00159    brw_aub_gtt_data( iws->aubfile, 
00160                      sbo->offset + offset,
00161                      sbo->data + offset,
00162                      size,
00163                      aub_type,
00164                      aub_sub_type );
00165 }

void xmesa_commands_aub ( struct pipe_winsys winsys,
unsigned *  cmds,
unsigned  nr_dwords 
)

Definition at line 167 of file xm_winsys_aub.c.

References align(), assert, AUB_BUF_START, aub_pipe_winsys(), aub_pipe_winsys::aubfile, brw_aub_gtt_cmds(), aub_pipe_winsys::size, and aub_pipe_winsys::used.

00170 {
00171    struct aub_pipe_winsys *iws = aub_pipe_winsys(winsys);
00172    unsigned size = nr_dwords * 4;
00173 
00174    assert(iws->used + size < iws->size);
00175 
00176    brw_aub_gtt_cmds( iws->aubfile, 
00177                      AUB_BUF_START + iws->used,
00178                      cmds,
00179                      nr_dwords * sizeof(int) );
00180 
00181    iws->used += align(size, 4096);
00182 }

struct pipe_context* xmesa_create_i965simple ( struct pipe_winsys winsys  )  [read]

Create i965 hardware rendering context.

Definition at line 561 of file xm_winsys_aub.c.

References aub_i965_batch_dword(), aub_i965_batch_end(), aub_i965_batch_flush(), aub_i965_batch_reloc(), aub_i965_batch_start(), aub_i965_buffer_subdata_typed(), aub_i965_get_buffer_offset(), brw_winsys::batch_dword, brw_winsys::batch_end, brw_winsys::batch_flush, brw_winsys::batch_reloc, aub_brw_winsys::batch_size, brw_winsys::batch_start, brw_create(), brw_create_screen(), brw_winsys::buffer_subdata_typed, CALLOC_STRUCT, brw_winsys::get_buffer_offset, IWS_BATCHBUFFER_SIZE, aub_brw_winsys::pipe_winsys, and aub_brw_winsys::winsys.

00562 {
00563    struct aub_brw_winsys *iws = CALLOC_STRUCT( aub_brw_winsys );
00564    struct pipe_screen *screen = brw_create_screen(winsys, 0/* XXX pci_id */);
00565    
00566    /* Fill in this struct with callbacks that i965simple will need to
00567     * communicate with the window system, buffer manager, etc. 
00568     */
00569    iws->winsys.batch_start = aub_i965_batch_start;
00570    iws->winsys.batch_dword = aub_i965_batch_dword;
00571    iws->winsys.batch_reloc = aub_i965_batch_reloc;
00572    iws->winsys.batch_end = aub_i965_batch_end;
00573    iws->winsys.batch_flush = aub_i965_batch_flush;
00574    iws->winsys.buffer_subdata_typed = aub_i965_buffer_subdata_typed;
00575    iws->winsys.get_buffer_offset = aub_i965_get_buffer_offset;
00576 
00577    iws->pipe_winsys = winsys;
00578 
00579    iws->batch_size = IWS_BATCHBUFFER_SIZE;
00580 
00581    /* Create the i965simple context:
00582     */
00583    return brw_create( screen,
00584                       &iws->winsys,
00585                       0 );
00586 }

struct pipe_winsys* xmesa_create_pipe_winsys_aub ( void   )  [read]

Definition at line 326 of file xm_winsys_aub.c.

References assert, AUB_BUF_SIZE, aub_buffer_create(), aub_buffer_destroy(), aub_buffer_map(), aub_buffer_unmap(), aub_flush_frontbuffer(), aub_get_name(), aub_i915_surface_alloc(), aub_i915_surface_alloc_storage(), aub_i915_surface_release(), aub_user_buffer_create(), aub_pipe_winsys::aubfile, brw_aubfile_create(), pipe_winsys::buffer_create, pipe_winsys::buffer_destroy, pipe_winsys::buffer_map, pipe_winsys::buffer_unmap, CALLOC_STRUCT, pipe_winsys::flush_frontbuffer, pipe_winsys::get_name, aub_pipe_winsys::pool, aub_pipe_winsys::size, pipe_winsys::surface_alloc, pipe_winsys::surface_alloc_storage, pipe_winsys::surface_release, pipe_winsys::user_buffer_create, and aub_pipe_winsys::winsys.

00327 {
00328    struct aub_pipe_winsys *iws = CALLOC_STRUCT( aub_pipe_winsys );
00329    
00330    /* Fill in this struct with callbacks that pipe will need to
00331     * communicate with the window system, buffer manager, etc. 
00332     *
00333     * Pipe would be happy with a malloc based memory manager, but
00334     * the SwapBuffers implementation in this winsys driver requires
00335     * that rendering be done to an appropriate _DriBufferObject.  
00336     */
00337    iws->winsys.buffer_create = aub_buffer_create;
00338    iws->winsys.user_buffer_create = aub_user_buffer_create;
00339    iws->winsys.buffer_map = aub_buffer_map;
00340    iws->winsys.buffer_unmap = aub_buffer_unmap;
00341    iws->winsys.buffer_destroy = aub_buffer_destroy;
00342    iws->winsys.flush_frontbuffer = aub_flush_frontbuffer;
00343    iws->winsys.get_name = aub_get_name;
00344 
00345    iws->winsys.surface_alloc = aub_i915_surface_alloc;
00346    iws->winsys.surface_alloc_storage = aub_i915_surface_alloc_storage;
00347    iws->winsys.surface_release = aub_i915_surface_release;
00348 
00349    iws->aubfile = brw_aubfile_create();
00350    iws->size = AUB_BUF_SIZE;
00351    iws->pool = malloc(AUB_BUF_SIZE);
00352 
00353    /* HACK: static copy of this pointer:
00354     */
00355    assert(global_winsys == NULL);
00356    global_winsys = iws;
00357 
00358    return &iws->winsys;
00359 }

void xmesa_destroy_pipe_winsys_aub ( struct pipe_winsys winsys  ) 

Definition at line 363 of file xm_winsys_aub.c.

References aub_pipe_winsys(), aub_pipe_winsys::aubfile, brw_aub_destroy(), and aub_pipe_winsys::pool.

00365 {
00366    struct aub_pipe_winsys *iws = aub_pipe_winsys(winsys);
00367    brw_aub_destroy(iws->aubfile);
00368    free(iws->pool);
00369    free(iws);
00370 }

void xmesa_display_aub ( struct pipe_surface surface  ) 

Definition at line 187 of file xm_winsys_aub.c.

References aub_bo(), aub_pipe_winsys::aubfile, brw_aub_dump_bmp(), pipe_surface::buffer, and aub_buffer::offset.

00189 {
00190 //   struct aub_pipe_winsys *iws = aub_pipe_winsys(winsys);
00191    brw_aub_dump_bmp( global_winsys->aubfile, 
00192                      surface,
00193                      aub_bo(surface->buffer)->offset );
00194 }


Variable Documentation

struct aub_pipe_winsys* global_winsys = NULL [static]

Definition at line 185 of file xm_winsys_aub.c.


Generated on Tue Sep 29 06:25:50 2009 for Gallium3D by  doxygen 1.5.4