1 /* Cairo - a vector graphics library with display and print output
2  *
3  * Copyright © 2009 Chris Wilson
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it either under the terms of the GNU Lesser General Public
7  * License version 2.1 as published by the Free Software Foundation
8  * (the "LGPL") or, at your option, under the terms of the Mozilla
9  * Public License Version 1.1 (the "MPL"). If you do not alter this
10  * notice, a recipient may use your version of this file under either
11  * the MPL or the LGPL.
12  *
13  * You should have received a copy of the LGPL along with this library
14  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
16  * You should have received a copy of the MPL along with this library
17  * in the file COPYING-MPL-1.1
18  *
19  * The contents of this file are subject to the Mozilla Public License
20  * Version 1.1 (the "License"); you may not use this file except in
21  * compliance with the License. You may obtain a copy of the License at
22  * http://www.mozilla.org/MPL/
23  *
24  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
25  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
26  * the specific language governing rights and limitations.
27  *
28  */
29 
30 #ifndef CAIRO_DRM_RADEON_PRIVATE_H
31 #define CAIRO_DRM_RADEON_PRIVATE_H
32 
33 #include "cairo-compiler-private.h"
34 #include "cairo-types-private.h"
35 #include "cairo-drm-private.h"
36 #include "cairo-freelist-private.h"
37 
38 typedef struct _radeon_bo {
39     cairo_drm_bo_t base;
40 
41     void *virtual;
42 
43     cairo_bool_t in_batch;
44     uint32_t read_domains;
45     uint32_t write_domain;
46 } radeon_bo_t;
47 
48 typedef struct _radeon_device {
49     cairo_drm_device_t base;
50     cairo_freepool_t bo_pool;
51 
52     uint64_t vram_limit;
53     uint64_t gart_limit;
54 } radeon_device_t;
55 
56 cairo_private cairo_status_t
57 radeon_device_init (radeon_device_t *device, int fd);
58 
59 cairo_private void
60 radeon_device_fini (radeon_device_t *device);
61 
62 cairo_private cairo_bool_t
63 radeon_info (int fd,
64              uint64_t *gart_size,
65 	     uint64_t *vram_size);
66 
67 cairo_private void
68 radeon_bo_write (const radeon_device_t *dev,
69 	         radeon_bo_t *bo,
70 		 unsigned long offset,
71 		 unsigned long size,
72 		 const void *data);
73 
74 cairo_private void
75 radeon_bo_read (const radeon_device_t *dev,
76 	        radeon_bo_t *bo,
77 	        unsigned long offset,
78 		unsigned long size,
79 		void *data);
80 
81 cairo_private void
82 radeon_bo_wait (const radeon_device_t *dev, radeon_bo_t *bo);
83 
84 cairo_private void *
85 radeon_bo_map (const radeon_device_t *dev, radeon_bo_t *bo);
86 
87 cairo_private void
88 radeon_bo_unmap (radeon_bo_t *bo);
89 
90 cairo_private cairo_drm_bo_t *
91 radeon_bo_create (radeon_device_t *dev,
92 		  uint32_t size,
93 		  uint32_t initial_domain);
94 
95 cairo_private cairo_drm_bo_t *
96 radeon_bo_create_for_name (radeon_device_t *dev, uint32_t name);
97 
98 cairo_private cairo_surface_t *
99 radeon_bo_get_image (const radeon_device_t *device,
100 	             radeon_bo_t *bo,
101 		     const cairo_drm_surface_t *surface);
102 
103 #endif /* CAIRO_DRM_RADEON_PRIVATE_H */
104