1 #include "pipe/p_defines.h"
2 #include "pipe/p_winsys.h"
4 #include "nv40_context.h"
8 nv40_region_map(struct pipe_context
*pipe
, struct pipe_region
*region
)
10 struct nv40_context
*nv40
= (struct nv40_context
*)pipe
;
11 struct pipe_winsys
*ws
= nv40
->pipe
.winsys
;
13 if (!region
->map_refcount
++) {
14 region
->map
= ws
->buffer_map(ws
, region
->buffer
,
15 PIPE_BUFFER_FLAG_WRITE
|
16 PIPE_BUFFER_FLAG_READ
);
23 nv40_region_unmap(struct pipe_context
*pipe
, struct pipe_region
*region
)
25 struct nv40_context
*nv40
= (struct nv40_context
*)pipe
;
26 struct pipe_winsys
*ws
= nv40
->pipe
.winsys
;
28 if (!--region
->map_refcount
) {
29 ws
->buffer_unmap(ws
, region
->buffer
);
35 nv40_region_data(struct pipe_context
*pipe
,
36 struct pipe_region
*dst
,
38 unsigned dstx
, unsigned dsty
,
39 const void *src
, unsigned src_pitch
,
40 unsigned srcx
, unsigned srcy
, unsigned width
, unsigned height
)
42 struct nv40_context
*nv40
= (struct nv40_context
*)pipe
;
43 struct nouveau_winsys
*nvws
= nv40
->nvws
;
45 nvws
->region_data(nvws
->nv
, dst
, dst_offset
, dstx
, dsty
,
46 src
, src_pitch
, srcx
, srcy
, width
, height
);
51 nv40_region_copy(struct pipe_context
*pipe
, struct pipe_region
*dst
,
52 unsigned dst_offset
, unsigned dstx
, unsigned dsty
,
53 struct pipe_region
*src
, unsigned src_offset
,
54 unsigned srcx
, unsigned srcy
, unsigned width
, unsigned height
)
56 struct nv40_context
*nv40
= (struct nv40_context
*)pipe
;
57 struct nouveau_winsys
*nvws
= nv40
->nvws
;
59 nvws
->region_copy(nvws
->nv
, dst
, dst_offset
, dstx
, dsty
,
60 src
, src_offset
, srcx
, srcy
, width
, height
);
64 nv40_region_fill(struct pipe_context
*pipe
,
65 struct pipe_region
*dst
, unsigned dst_offset
,
66 unsigned dstx
, unsigned dsty
,
67 unsigned width
, unsigned height
, unsigned value
)
69 struct nv40_context
*nv40
= (struct nv40_context
*)pipe
;
70 struct nouveau_winsys
*nvws
= nv40
->nvws
;
72 nvws
->region_fill(nvws
->nv
, dst
, dst_offset
, dstx
, dsty
,
73 width
, height
, value
);
77 nv40_init_region_functions(struct nv40_context
*nv40
)
79 nv40
->pipe
.region_map
= nv40_region_map
;
80 nv40
->pipe
.region_unmap
= nv40_region_unmap
;
81 nv40
->pipe
.region_data
= nv40_region_data
;
82 nv40
->pipe
.region_copy
= nv40_region_copy
;
83 nv40
->pipe
.region_fill
= nv40_region_fill
;