2 * Copyright 2008 Ben Skeggs
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 #include "nv50_context.h"
24 #include "pipe/p_defines.h"
25 #include "pipe/internal/p_winsys_screen.h"
26 #include "pipe/p_inlines.h"
28 #include "util/u_tile.h"
31 nv50_surface_copy(struct pipe_context
*pipe
, boolean flip
,
32 struct pipe_surface
*dest
, unsigned destx
, unsigned desty
,
33 struct pipe_surface
*src
, unsigned srcx
, unsigned srcy
,
34 unsigned width
, unsigned height
)
36 struct nv50_context
*nv50
= (struct nv50_context
*)pipe
;
37 struct nouveau_winsys
*nvws
= nv50
->screen
->nvws
;
42 nvws
->surface_copy(nvws
, dest
, destx
, desty
--, src
,
43 srcx
, srcy
++, width
, 1);
46 nvws
->surface_copy(nvws
, dest
, destx
, desty
, src
, srcx
, srcy
,
52 nv50_surface_fill(struct pipe_context
*pipe
, struct pipe_surface
*dest
,
53 unsigned destx
, unsigned desty
, unsigned width
,
54 unsigned height
, unsigned value
)
56 struct nv50_context
*nv50
= (struct nv50_context
*)pipe
;
57 struct nouveau_winsys
*nvws
= nv50
->screen
->nvws
;
59 nvws
->surface_fill(nvws
, dest
, destx
, desty
, width
, height
, value
);
63 nv50_surface_map(struct pipe_screen
*screen
, struct pipe_surface
*ps
,
66 struct pipe_winsys
*ws
= screen
->winsys
;
68 return ws
->buffer_map(ws
, ps
->buffer
, flags
);
72 nv50_surface_unmap(struct pipe_screen
*pscreen
, struct pipe_surface
*ps
)
74 struct pipe_winsys
*ws
= pscreen
->winsys
;
76 ws
->buffer_unmap(ws
, ps
->buffer
);
80 nv50_init_surface_functions(struct nv50_context
*nv50
)
82 nv50
->pipe
.surface_copy
= nv50_surface_copy
;
83 nv50
->pipe
.surface_fill
= nv50_surface_fill
;
87 nv50_surface_init_screen_functions(struct pipe_screen
*pscreen
)
89 pscreen
->surface_map
= nv50_surface_map
;
90 pscreen
->surface_unmap
= nv50_surface_unmap
;