tr_screen.c File Reference

Include dependency graph for tr_screen.c:

Go to the source code of this file.

Functions

static const char * trace_screen_get_name (struct pipe_screen *_screen)
static const char * trace_screen_get_vendor (struct pipe_screen *_screen)
static int trace_screen_get_param (struct pipe_screen *_screen, int param)
static float trace_screen_get_paramf (struct pipe_screen *_screen, int param)
static boolean trace_screen_is_format_supported (struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, unsigned tex_usage, unsigned geom_flags)
static struct pipe_texturetrace_screen_texture_create (struct pipe_screen *_screen, const struct pipe_texture *templat)
static struct pipe_texturetrace_screen_texture_blanket (struct pipe_screen *_screen, const struct pipe_texture *templat, const unsigned *ppitch, struct pipe_buffer *buffer)
static void trace_screen_texture_release (struct pipe_screen *_screen, struct pipe_texture **ptexture)
static struct pipe_surfacetrace_screen_get_tex_surface (struct pipe_screen *_screen, struct pipe_texture *texture, unsigned face, unsigned level, unsigned zslice, unsigned usage)
static void trace_screen_tex_surface_release (struct pipe_screen *_screen, struct pipe_surface **psurface)
static void * trace_screen_surface_map (struct pipe_screen *_screen, struct pipe_surface *surface, unsigned flags)
static void trace_screen_surface_unmap (struct pipe_screen *_screen, struct pipe_surface *surface)
static void trace_screen_destroy (struct pipe_screen *_screen)
struct pipe_screentrace_screen_create (struct pipe_screen *screen)
struct trace_screentrace_screen (struct pipe_screen *screen)


Function Documentation

struct trace_screen* trace_screen ( struct pipe_screen screen  )  [read]

Definition at line 464 of file tr_screen.c.

References assert, pipe_screen::destroy, and trace_screen_destroy().

00465 {
00466    assert(screen);
00467    assert(screen->destroy == trace_screen_destroy);
00468    return (struct trace_screen *)screen;
00469 }

struct pipe_screen* trace_screen_create ( struct pipe_screen screen  )  [read]

Definition at line 409 of file tr_screen.c.

References trace_screen::base, CALLOC_STRUCT, pipe_screen::destroy, FREE, pipe_screen::get_name, pipe_screen::get_param, pipe_screen::get_paramf, pipe_screen::get_tex_surface, pipe_screen::get_vendor, pipe_screen::is_format_supported, trace_screen::screen, pipe_screen::surface_map, pipe_screen::surface_unmap, pipe_screen::tex_surface_release, pipe_screen::texture_blanket, pipe_screen::texture_create, pipe_screen::texture_release, trace_dump_arg_begin(), trace_dump_arg_end(), trace_dump_call_begin(), trace_dump_call_end(), trace_dump_ptr(), trace_dump_ret, trace_dump_trace_begin(), trace_dump_trace_end(), trace_screen_destroy(), trace_screen_get_name(), trace_screen_get_param(), trace_screen_get_paramf(), trace_screen_get_tex_surface(), trace_screen_get_vendor(), trace_screen_is_format_supported(), trace_screen_surface_map(), trace_screen_surface_unmap(), trace_screen_tex_surface_release(), trace_screen_texture_blanket(), trace_screen_texture_create(), trace_screen_texture_release(), trace_winsys_create(), and pipe_screen::winsys.

00410 {
00411    struct trace_screen *tr_scr;
00412    struct pipe_winsys *winsys;
00413    
00414    if(!screen)
00415       goto error1;
00416 
00417    if(!trace_dump_trace_begin())
00418       goto error1;
00419 
00420    tr_scr = CALLOC_STRUCT(trace_screen);
00421    if(!tr_scr)
00422       goto error2;
00423 
00424    winsys = trace_winsys_create(screen->winsys);
00425    if(!winsys)
00426       goto error3;
00427    
00428    tr_scr->base.winsys = winsys;
00429    tr_scr->base.destroy = trace_screen_destroy;
00430    tr_scr->base.get_name = trace_screen_get_name;
00431    tr_scr->base.get_vendor = trace_screen_get_vendor;
00432    tr_scr->base.get_param = trace_screen_get_param;
00433    tr_scr->base.get_paramf = trace_screen_get_paramf;
00434    tr_scr->base.is_format_supported = trace_screen_is_format_supported;
00435    tr_scr->base.texture_create = trace_screen_texture_create;
00436    tr_scr->base.texture_blanket = trace_screen_texture_blanket;
00437    tr_scr->base.texture_release = trace_screen_texture_release;
00438    tr_scr->base.get_tex_surface = trace_screen_get_tex_surface;
00439    tr_scr->base.tex_surface_release = trace_screen_tex_surface_release;
00440    tr_scr->base.surface_map = trace_screen_surface_map;
00441    tr_scr->base.surface_unmap = trace_screen_surface_unmap;
00442    
00443    tr_scr->screen = screen;
00444 
00445    trace_dump_call_begin("", "pipe_screen_create");
00446    trace_dump_arg_begin("winsys");
00447    trace_dump_ptr(screen->winsys);
00448    trace_dump_arg_end();
00449    trace_dump_ret(ptr, screen);
00450    trace_dump_call_end();
00451 
00452    return &tr_scr->base;
00453 
00454 error3:
00455    FREE(tr_scr);
00456 error2:
00457    trace_dump_trace_end();
00458 error1:
00459    return screen;
00460 }

static void trace_screen_destroy ( struct pipe_screen _screen  )  [static]

Definition at line 389 of file tr_screen.c.

References pipe_screen::destroy, FREE, trace_screen::screen, trace_dump_arg, trace_dump_call_begin(), trace_dump_call_end(), trace_dump_trace_end(), and trace_screen().

00390 {
00391    struct trace_screen *tr_scr = trace_screen(_screen);
00392    struct pipe_screen *screen = tr_scr->screen;
00393    
00394    trace_dump_call_begin("pipe_screen", "destroy");
00395    
00396    trace_dump_arg(ptr, screen);
00397 
00398    screen->destroy(screen);
00399    
00400    trace_dump_call_end();
00401 
00402    trace_dump_trace_end();
00403 
00404    FREE(tr_scr);
00405 }

static const char* trace_screen_get_name ( struct pipe_screen _screen  )  [static]

Definition at line 38 of file tr_screen.c.

References pipe_screen::get_name, trace_screen::screen, trace_dump_arg, trace_dump_call_begin(), trace_dump_call_end(), trace_dump_ret, and trace_screen().

00039 {
00040    struct trace_screen *tr_scr = trace_screen(_screen);
00041    struct pipe_screen *screen = tr_scr->screen;
00042    const char *result;
00043    
00044    trace_dump_call_begin("pipe_screen", "get_name");
00045    
00046    trace_dump_arg(ptr, screen);
00047 
00048    result = screen->get_name(screen);
00049    
00050    trace_dump_ret(string, result);
00051    
00052    trace_dump_call_end();
00053    
00054    return result;
00055 }

static int trace_screen_get_param ( struct pipe_screen _screen,
int  param 
) [static]

Definition at line 80 of file tr_screen.c.

References pipe_screen::get_param, trace_screen::screen, trace_dump_arg, trace_dump_call_begin(), trace_dump_call_end(), trace_dump_ret, and trace_screen().

00082 {
00083    struct trace_screen *tr_scr = trace_screen(_screen);
00084    struct pipe_screen *screen = tr_scr->screen;
00085    int result;
00086    
00087    trace_dump_call_begin("pipe_screen", "get_param");
00088    
00089    trace_dump_arg(ptr, screen);
00090    trace_dump_arg(int, param);
00091 
00092    result = screen->get_param(screen, param);
00093    
00094    trace_dump_ret(int, result);
00095    
00096    trace_dump_call_end();
00097    
00098    return result;
00099 }

static float trace_screen_get_paramf ( struct pipe_screen _screen,
int  param 
) [static]

Definition at line 103 of file tr_screen.c.

References pipe_screen::get_paramf, trace_screen::screen, trace_dump_arg, trace_dump_call_begin(), trace_dump_call_end(), trace_dump_ret, and trace_screen().

00105 {
00106    struct trace_screen *tr_scr = trace_screen(_screen);
00107    struct pipe_screen *screen = tr_scr->screen;
00108    float result;
00109    
00110    trace_dump_call_begin("pipe_screen", "get_paramf");
00111    
00112    trace_dump_arg(ptr, screen);
00113    trace_dump_arg(int, param);
00114 
00115    result = screen->get_paramf(screen, param);
00116    
00117    trace_dump_ret(float, result);
00118    
00119    trace_dump_call_end();
00120    
00121    return result;
00122 }

static struct pipe_surface* trace_screen_get_tex_surface ( struct pipe_screen _screen,
struct pipe_texture texture,
unsigned  face,
unsigned  level,
unsigned  zslice,
unsigned  usage 
) [static, read]

Definition at line 245 of file tr_screen.c.

References assert, pipe_screen::get_tex_surface, pipe_texture::screen, trace_screen::screen, trace_texture::texture, trace_dump_arg, trace_dump_call_begin(), trace_dump_call_end(), trace_dump_ret, trace_screen(), trace_surface_create(), and trace_texture().

00250 {
00251    struct trace_screen *tr_scr = trace_screen(_screen);
00252    struct pipe_screen *screen = tr_scr->screen;
00253    struct trace_texture *tr_tex;
00254    struct pipe_surface *result;
00255    
00256    assert(texture);
00257    tr_tex = trace_texture(tr_scr, texture);
00258    texture = tr_tex->texture;
00259    assert(texture->screen == screen);
00260    
00261    trace_dump_call_begin("pipe_screen", "get_tex_surface");
00262    
00263    trace_dump_arg(ptr, screen);
00264    trace_dump_arg(ptr, texture);
00265    trace_dump_arg(uint, face);
00266    trace_dump_arg(uint, level);
00267    trace_dump_arg(uint, zslice);
00268    trace_dump_arg(uint, usage);
00269 
00270    result = screen->get_tex_surface(screen, texture, face, level, zslice, usage);
00271 
00272    trace_dump_ret(ptr, result);
00273    
00274    trace_dump_call_end();
00275    
00276    result = trace_surface_create(tr_tex, result);
00277 
00278    return result;
00279 }

static const char* trace_screen_get_vendor ( struct pipe_screen _screen  )  [static]

Definition at line 59 of file tr_screen.c.

References pipe_screen::get_vendor, trace_screen::screen, trace_dump_arg, trace_dump_call_begin(), trace_dump_call_end(), trace_dump_ret, and trace_screen().

00060 {
00061    struct trace_screen *tr_scr = trace_screen(_screen);
00062    struct pipe_screen *screen = tr_scr->screen;
00063    const char *result;
00064    
00065    trace_dump_call_begin("pipe_screen", "get_vendor");
00066    
00067    trace_dump_arg(ptr, screen);
00068   
00069    result = screen->get_vendor(screen);
00070    
00071    trace_dump_ret(string, result);
00072    
00073    trace_dump_call_end();
00074    
00075    return result;
00076 }

static boolean trace_screen_is_format_supported ( struct pipe_screen _screen,
enum pipe_format  format,
enum pipe_texture_target  target,
unsigned  tex_usage,
unsigned  geom_flags 
) [static]

Definition at line 126 of file tr_screen.c.

References pipe_screen::is_format_supported, trace_screen::screen, trace_dump_arg, trace_dump_call_begin(), trace_dump_call_end(), trace_dump_ret, and trace_screen().

00131 {
00132    struct trace_screen *tr_scr = trace_screen(_screen);
00133    struct pipe_screen *screen = tr_scr->screen;
00134    boolean result;
00135    
00136    trace_dump_call_begin("pipe_screen", "is_format_supported");
00137    
00138    trace_dump_arg(ptr, screen);
00139    trace_dump_arg(format, format);
00140    trace_dump_arg(int, target);
00141    trace_dump_arg(uint, tex_usage);
00142    trace_dump_arg(uint, geom_flags);
00143 
00144    result = screen->is_format_supported(screen, format, target, tex_usage, geom_flags);
00145    
00146    trace_dump_ret(bool, result);
00147    
00148    trace_dump_call_end();
00149    
00150    return result;
00151 }

static void* trace_screen_surface_map ( struct pipe_screen _screen,
struct pipe_surface surface,
unsigned  flags 
) [static]

Definition at line 319 of file tr_screen.c.

References assert, trace_surface::map, PIPE_BUFFER_USAGE_CPU_WRITE, trace_screen::screen, trace_surface::surface, pipe_screen::surface_map, pipe_surface::texture, trace_screen(), trace_surface(), and trace_texture().

00322 {
00323    struct trace_screen *tr_scr = trace_screen(_screen);
00324    struct pipe_screen *screen = tr_scr->screen;
00325    struct trace_texture *tr_tex;
00326    struct trace_surface *tr_surf;
00327    void *map;
00328    
00329    tr_tex = trace_texture(tr_scr, surface->texture);
00330    tr_surf = trace_surface(tr_tex, surface);
00331    surface = tr_surf->surface;
00332 
00333    map = screen->surface_map(screen, surface, flags);
00334    if(map) {
00335       if(flags & PIPE_BUFFER_USAGE_CPU_WRITE) {
00336          assert(!tr_surf->map);
00337          tr_surf->map = map;
00338       }
00339    }
00340    
00341    return map;
00342 }

static void trace_screen_surface_unmap ( struct pipe_screen _screen,
struct pipe_surface surface 
) [static]

Definition at line 346 of file tr_screen.c.

References trace_surface::map, pipe_surface::nblocksy, trace_screen::screen, pipe_surface::stride, trace_surface::surface, pipe_screen::surface_unmap, pipe_surface::texture, trace_dump_arg, trace_dump_arg_begin(), trace_dump_arg_end(), trace_dump_bytes(), trace_dump_call_begin(), trace_dump_call_end(), trace_dump_uint(), trace_screen(), trace_surface(), and trace_texture().

00348 {
00349    struct trace_screen *tr_scr = trace_screen(_screen);
00350    struct pipe_screen *screen = tr_scr->screen;
00351    struct trace_texture *tr_tex;
00352    struct trace_surface *tr_surf;
00353    
00354    tr_tex = trace_texture(tr_scr, surface->texture);
00355    tr_surf = trace_surface(tr_tex, surface);
00356    surface = tr_surf->surface;
00357    
00358    if(tr_surf->map) {
00359       size_t size = surface->nblocksy * surface->stride;
00360       
00361       trace_dump_call_begin("pipe_winsys", "surface_write");
00362       
00363       trace_dump_arg(ptr, screen);
00364       
00365       trace_dump_arg(ptr, surface);
00366       
00367       trace_dump_arg_begin("data");
00368       trace_dump_bytes(tr_surf->map, size);
00369       trace_dump_arg_end();
00370 
00371       trace_dump_arg_begin("stride");
00372       trace_dump_uint(surface->stride);
00373       trace_dump_arg_end();
00374 
00375       trace_dump_arg_begin("size");
00376       trace_dump_uint(size);
00377       trace_dump_arg_end();
00378    
00379       trace_dump_call_end();
00380 
00381       tr_surf->map = NULL;
00382    }
00383 
00384    screen->surface_unmap(screen, surface);
00385 }

static void trace_screen_tex_surface_release ( struct pipe_screen _screen,
struct pipe_surface **  psurface 
) [static]

Definition at line 283 of file tr_screen.c.

References assert, trace_screen::screen, trace_surface::surface, trace_dump_arg, trace_dump_call_begin(), trace_dump_call_end(), trace_screen(), trace_surface(), trace_surface_destroy(), and trace_texture().

00285 {
00286    struct trace_screen *tr_scr = trace_screen(_screen);
00287    struct pipe_screen *screen = tr_scr->screen;
00288    struct trace_texture *tr_tex;
00289    struct trace_surface *tr_surf;
00290    struct pipe_surface *surface;
00291    
00292    assert(psurface);
00293    if(*psurface) {
00294       tr_tex = trace_texture(tr_scr, (*psurface)->texture);
00295       tr_surf = trace_surface(tr_tex, *psurface);
00296       surface = tr_surf->surface;
00297    }
00298    else
00299       surface = NULL;
00300    
00301    if (*psurface) {
00302       if (!--(*psurface)->refcount) {
00303          trace_dump_call_begin("pipe_screen", "tex_surface_destroy");
00304          
00305          trace_dump_arg(ptr, screen);
00306          trace_dump_arg(ptr, surface);
00307 
00308          trace_surface_destroy(tr_tex, *psurface);
00309 
00310          trace_dump_call_end();
00311       }
00312    
00313       *psurface = NULL;
00314    }
00315 }

static struct pipe_texture* trace_screen_texture_blanket ( struct pipe_screen _screen,
const struct pipe_texture templat,
const unsigned *  ppitch,
struct pipe_buffer buffer 
) [static, read]

Definition at line 180 of file tr_screen.c.

References trace_screen::screen, pipe_screen::texture_blanket, trace_dump_arg, trace_dump_call_begin(), trace_dump_call_end(), trace_dump_ret, trace_screen(), and trace_texture_create().

00184 {
00185    struct trace_screen *tr_scr = trace_screen(_screen);
00186    struct pipe_screen *screen = tr_scr->screen;
00187    unsigned pitch = *ppitch;
00188    struct pipe_texture *result;
00189 
00190    trace_dump_call_begin("pipe_screen", "texture_blanket");
00191 
00192    trace_dump_arg(ptr, screen);
00193    trace_dump_arg(template, templat);
00194    trace_dump_arg(uint, pitch);
00195    trace_dump_arg(ptr, buffer);
00196 
00197    result = screen->texture_blanket(screen, templat, ppitch, buffer);
00198    
00199    trace_dump_ret(ptr, result);
00200    
00201    trace_dump_call_end();
00202    
00203    result = trace_texture_create(tr_scr, result);
00204    
00205    return result;
00206 }

static struct pipe_texture* trace_screen_texture_create ( struct pipe_screen _screen,
const struct pipe_texture templat 
) [static, read]

Definition at line 155 of file tr_screen.c.

References trace_screen::screen, pipe_screen::texture_create, trace_dump_arg, trace_dump_call_begin(), trace_dump_call_end(), trace_dump_ret, trace_screen(), and trace_texture_create().

00157 {
00158    struct trace_screen *tr_scr = trace_screen(_screen);
00159    struct pipe_screen *screen = tr_scr->screen;
00160    struct pipe_texture *result;
00161    
00162    trace_dump_call_begin("pipe_screen", "texture_create");
00163 
00164    trace_dump_arg(ptr, screen);
00165    trace_dump_arg(template, templat);
00166 
00167    result = screen->texture_create(screen, templat);
00168    
00169    trace_dump_ret(ptr, result);
00170    
00171    trace_dump_call_end();
00172    
00173    result = trace_texture_create(tr_scr, result);
00174    
00175    return result;
00176 }

static void trace_screen_texture_release ( struct pipe_screen _screen,
struct pipe_texture **  ptexture 
) [static]

Definition at line 210 of file tr_screen.c.

References assert, pipe_texture::screen, trace_screen::screen, trace_texture::texture, trace_dump_arg, trace_dump_call_begin(), trace_dump_call_end(), trace_screen(), trace_texture(), and trace_texture_destroy().

00212 {
00213    struct trace_screen *tr_scr = trace_screen(_screen);
00214    struct pipe_screen *screen = tr_scr->screen;
00215    struct trace_texture *tr_tex;
00216    struct pipe_texture *texture;
00217    
00218    assert(ptexture);
00219    if(*ptexture) {
00220       tr_tex = trace_texture(tr_scr, *ptexture);
00221       texture = tr_tex->texture;
00222       assert(texture->screen == screen);
00223    }
00224    else
00225       texture = NULL;
00226    
00227    if (*ptexture) {
00228       if (!--(*ptexture)->refcount) {
00229          trace_dump_call_begin("pipe_screen", "texture_destroy");
00230          
00231          trace_dump_arg(ptr, screen);
00232          trace_dump_arg(ptr, texture);
00233          
00234          trace_texture_destroy(tr_scr, *ptexture);
00235          
00236          trace_dump_call_end();
00237       }
00238    
00239       *ptexture = NULL;
00240    }
00241 }


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