1 /**************************************************************************
3 * Copyright 2009 Ben Skeggs
4 * Copyright 2009 Younes Manton
5 * Copyright 2010 Luca Barbieri
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
20 * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * The above copyright notice and this permission notice (including the
26 * next paragraph) shall be included in all copies or substantial portions
29 **************************************************************************/
31 /* this code has no Mesa or Gallium dependency and can be reused in the classic Mesa driver or DDX */
36 struct nv04_2d_context
;
37 struct nouveau_channel
;
40 // NOTE: all functions taking this as a parameter will CLOBBER it (except for ->bo)
42 struct nouveau_bo
* bo
;
44 unsigned pitch
; // 0 -> swizzled
45 unsigned bpps
; // bpp shift (0, 1, 2; 3, 4 for fp/compressed)
51 nv04_memcpy(struct nv04_2d_context
*ctx
,
52 struct nouveau_bo
* dstbo
, int dstoff
,
53 struct nouveau_bo
* srcbo
, int srcoff
,
57 nv04_region_begin(struct nv04_region
* rgn
, unsigned w
, unsigned h
);
60 nv04_region_end(struct nv04_region
* rgn
, unsigned w
, unsigned h
);
63 nv04_2d_context_takedown(struct nv04_2d_context
*pctx
);
65 struct nv04_2d_context
*
66 nv04_2d_context_init(struct nouveau_channel
* chan
);
69 nv04_region_copy_cpu(struct nv04_region
* dst
, struct nv04_region
* src
, int w
, int h
);
72 nv04_region_fill_cpu(struct nv04_region
* dst
, int w
, int h
, unsigned value
);
75 nv04_region_copy_2d(struct nv04_2d_context
*ctx
,
76 struct nv04_region
* dst
, struct nv04_region
* src
,
78 int cs2d_format
, int sifm_format
,
79 int dst_to_gpu
, int src_on_gpu
);
82 nv04_region_fill_2d(struct nv04_2d_context
*ctx
,
83 struct nv04_region
*dst
,