~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/gallium/drivers/nvc0/nvc0_resource.h

  • Committer: Package Import Robot
  • Author(s): Robert Hooker
  • Date: 2012-02-02 12:05:48 UTC
  • mfrom: (1.7.1) (3.3.27 sid)
  • Revision ID: package-import@ubuntu.com-20120202120548-nvkma85jq0h4coix
Tags: 8.0~rc2-0ubuntu4
Drop drisearchdir handling, it is no longer needed with multiarch
and dri-alternates being removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#ifndef __NVC0_RESOURCE_H__
3
3
#define __NVC0_RESOURCE_H__
4
4
 
5
 
#include "util/u_transfer.h"
6
 
#include "util/u_double_list.h"
7
 
#define NOUVEAU_NVC0
8
 
#include "nouveau/nouveau_winsys.h"
9
 
#include "nouveau/nouveau_fence.h"
10
 
#include "nouveau/nouveau_buffer.h"
11
 
#undef NOUVEAU_NVC0
 
5
#include "nv50/nv50_resource.h"
 
6
 
 
7
#define NVC0_RESOURCE_FLAG_VIDEO (NOUVEAU_RESOURCE_FLAG_DRV_PRIV << 0)
 
8
 
 
9
 
 
10
#define NVC0_TILE_SHIFT_X(m) ((((m) >> 0) & 0xf) + 6)
 
11
#define NVC0_TILE_SHIFT_Y(m) ((((m) >> 4) & 0xf) + 3)
 
12
#define NVC0_TILE_SHIFT_Z(m) ((((m) >> 8) & 0xf) + 0)
 
13
 
 
14
#define NVC0_TILE_SIZE_X(m) (64 << (((m) >> 0) & 0xf))
 
15
#define NVC0_TILE_SIZE_Y(m) ( 8 << (((m) >> 4) & 0xf))
 
16
#define NVC0_TILE_SIZE_Z(m) ( 1 << (((m) >> 8) & 0xf))
 
17
 
 
18
/* it's ok to mask only in the end because max value is 3 * 5 */
 
19
 
 
20
#define NVC0_TILE_SIZE_2D(m) ((64 * 8) << (((m) + ((m) >> 4)) & 0xf))
 
21
 
 
22
#define NVC0_TILE_SIZE(m) ((64 * 8) << (((m) + ((m) >> 4) + ((m) >> 8)) & 0xf))
 
23
 
12
24
 
13
25
void
14
26
nvc0_init_resource_functions(struct pipe_context *pcontext);
16
28
void
17
29
nvc0_screen_init_resource_functions(struct pipe_screen *pscreen);
18
30
 
19
 
#define NVC0_TILE_DIM_SHIFT(m, d) (((m) >> (d * 4)) & 0xf)
20
 
 
21
 
#define NVC0_TILE_PITCH(m)  (64 << NVC0_TILE_DIM_SHIFT(m, 0))
22
 
#define NVC0_TILE_HEIGHT(m) ( 8 << NVC0_TILE_DIM_SHIFT(m, 1))
23
 
#define NVC0_TILE_DEPTH(m)  ( 1 << NVC0_TILE_DIM_SHIFT(m, 2))
24
 
 
25
 
#define NVC0_TILE_SIZE_2D(m) (((64 * 8) <<                     \
26
 
                               NVC0_TILE_DIM_SHIFT(m, 0)) <<   \
27
 
                              NVC0_TILE_DIM_SHIFT(m, 1))
28
 
 
29
 
#define NVC0_TILE_SIZE(m) (NVC0_TILE_SIZE_2D(m) << NVC0_TILE_DIM_SHIFT(m, 2))
30
 
 
31
 
struct nvc0_miptree_level {
32
 
   uint32_t offset;
33
 
   uint32_t pitch;
34
 
   uint32_t tile_mode;
35
 
};
36
 
 
37
 
#define NVC0_MAX_TEXTURE_LEVELS 16
38
 
 
39
 
struct nvc0_miptree {
40
 
   struct nv04_resource base;
41
 
   struct nvc0_miptree_level level[NVC0_MAX_TEXTURE_LEVELS];
42
 
   uint32_t total_size;
43
 
   uint32_t layer_stride;
44
 
   boolean layout_3d; /* TRUE if layer count varies with mip level */
45
 
};
46
 
 
47
 
static INLINE struct nvc0_miptree *
48
 
nvc0_miptree(struct pipe_resource *pt)
49
 
{
50
 
   return (struct nvc0_miptree *)pt;
51
 
}
52
 
 
53
31
/* Internal functions:
54
32
 */
55
33
struct pipe_resource *
56
34
nvc0_miptree_create(struct pipe_screen *pscreen,
57
35
                    const struct pipe_resource *tmp);
58
36
 
59
 
struct pipe_resource *
60
 
nvc0_miptree_from_handle(struct pipe_screen *pscreen,
61
 
                         const struct pipe_resource *template,
62
 
                         struct winsys_handle *whandle);
 
37
const struct u_resource_vtbl nvc0_miptree_vtbl;
63
38
 
64
39
struct pipe_surface *
65
40
nvc0_miptree_surface_new(struct pipe_context *,
66
41
                         struct pipe_resource *,
67
42
                         const struct pipe_surface *templ);
68
43
 
69
 
void
70
 
nvc0_miptree_surface_del(struct pipe_context *, struct pipe_surface *);
 
44
unsigned
 
45
nvc0_mt_zslice_offset(const struct nv50_miptree *, unsigned l, unsigned z);
71
46
 
72
 
uint32_t
73
 
nvc0_miptree_zslice_offset(struct nvc0_miptree *, unsigned l, unsigned z);
 
47
struct pipe_transfer *
 
48
nvc0_miptree_transfer_new(struct pipe_context *pcontext,
 
49
                          struct pipe_resource *pt,
 
50
                          unsigned level,
 
51
                          unsigned usage,
 
52
                          const struct pipe_box *box);
 
53
void
 
54
nvc0_miptree_transfer_del(struct pipe_context *pcontext,
 
55
                          struct pipe_transfer *ptx);
 
56
void *
 
57
nvc0_miptree_transfer_map(struct pipe_context *pcontext,
 
58
                          struct pipe_transfer *ptx);
 
59
void
 
60
nvc0_miptree_transfer_unmap(struct pipe_context *pcontext,
 
61
                            struct pipe_transfer *ptx);
74
62
 
75
63
#endif