1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "nv50_context.h"
#include "nv50_dma.h"
static ubyte *
nv50_region_map(struct pipe_context *pipe, struct pipe_region *region)
{
struct nv50_context *nv50 = (struct nv50_context *)pipe;
struct pipe_winsys *ws = nv50->pipe.winsys;
if (!region->map_refcount++) {
region->map = ws->buffer_map(ws, region->buffer,
PIPE_BUFFER_FLAG_WRITE |
PIPE_BUFFER_FLAG_READ);
}
return region->map;
}
static void
nv50_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
{
struct nv50_context *nv50 = (struct nv50_context *)pipe;
struct pipe_winsys *ws = nv50->pipe.winsys;
if (!--region->map_refcount) {
ws->buffer_unmap(ws, region->buffer);
region->map = NULL;
}
}
static void
nv50_region_data(struct pipe_context *pipe,
struct pipe_region *dst,
unsigned dst_offset,
unsigned dstx, unsigned dsty,
const void *src, unsigned src_pitch,
unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
struct nv50_context *nv50 = (struct nv50_context *)pipe;
struct nouveau_winsys *nvws = nv50->nvws;
nvws->region_data(nvws, dst, dst_offset, dstx, dsty,
src, src_pitch, srcx, srcy, width, height);
}
static void
nv50_region_copy(struct pipe_context *pipe, struct pipe_region *dst,
unsigned dst_offset, unsigned dstx, unsigned dsty,
struct pipe_region *src, unsigned src_offset,
unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
struct nv50_context *nv50 = (struct nv50_context *)pipe;
struct nouveau_winsys *nvws = nv50->nvws;
nvws->region_copy(nvws, dst, dst_offset, dstx, dsty,
src, src_offset, srcx, srcy, width, height);
}
static void
nv50_region_fill(struct pipe_context *pipe,
struct pipe_region *dst, unsigned dst_offset,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height, unsigned value)
{
struct nv50_context *nv50 = (struct nv50_context *)pipe;
struct nouveau_winsys *nvws = nv50->nvws;
nvws->region_fill(nvws, dst, dst_offset, dstx, dsty,
width, height, value);
}
void
nv50_init_region_functions(struct nv50_context *nv50)
{
nv50->pipe.region_map = nv50_region_map;
nv50->pipe.region_unmap = nv50_region_unmap;
nv50->pipe.region_data = nv50_region_data;
nv50->pipe.region_copy = nv50_region_copy;
nv50->pipe.region_fill = nv50_region_fill;
}
|