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
|
/*
* Copyright © 2010 Jerome Glisse <glisse@freedesktop.org>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "radeon_device.h"
#include "r600_winsys.h"
void radeon_atom_flush_cleanup(struct list_head *flushes)
{
struct radeon_atom_flush *i, *n;
list_for_each_entry_safe(i, n, flushes, list) {
list_del(&i->list);
kfree(i);
}
}
int radeon_atom_flush_add(struct list_head *flushes, struct radeon_bo *bo, u32 flags)
{
struct radeon_atom_flush *i;
list_for_each_entry(i, flushes, list) {
if (i->bo->handle == bo->handle) {
i->flags |= flags;
return 0;
}
}
i = kmalloc(sizeof(*i), GFP_KERNEL);
if (i == NULL)
return -ENOMEM;
i->bo = bo;
i->flags = flags;
list_add_tail(&i->list, flushes);
return 1;
}
int radeon_atom_emit_default(struct radeon_device *rdev, struct radeon_atom *atom,
void *data, struct radeon_ib *ib)
{
return radeon_ib_copy(ib, atom->pkts, atom->npkts);
}
struct radeon_bo *radeon_bo_lookup(struct radeon_device *rdev, u32 handle)
{
int i;
for (i = 0; i < rdev->nbo; i++) {
if (rdev->bo[i] && rdev->bo[i]->handle == handle) {
radeon_bo_ref(rdev->bo[i]);
return rdev->bo[i];
}
}
return NULL;
}
void radeon_device_set_bo_list(struct radeon_device *rdev, u32 nbo, struct radeon_bo **bo)
{
memcpy(rdev->bo, bo, sizeof(void*) * nbo);
rdev->nbo = nbo;
}
void radeon_atom_release(struct kref *kref)
{
struct radeon_atom *atom = container_of(kref, struct radeon_atom, kref);
int i;
for (i = 0; i < atom->nbo; i++) {
radeon_bo_unref(atom->bo[i]);
}
free(atom->state);
free(atom);
}
|