diff options
author | Jerome Glisse <jglisse@redhat.com> | 2010-01-24 22:37:42 +0100 |
---|---|---|
committer | Jerome Glisse <jglisse@redhat.com> | 2010-01-24 22:37:42 +0100 |
commit | 05590d95d51e29e58534028c323847c199efebe5 (patch) | |
tree | c7057a84afa4914d8b2e519fad885bc425404ff5 /radeon_device.h |
r600/r700: winsys standalone testing
This is a standalone KMS program for testing and building the r600
winsys API. It does run as root when no X is running, will only
work on non RV6XX (well might work on those but haven't tested).
Diffstat (limited to 'radeon_device.h')
-rw-r--r-- | radeon_device.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/radeon_device.h b/radeon_device.h new file mode 100644 index 0000000..2ac8f24 --- /dev/null +++ b/radeon_device.h @@ -0,0 +1,79 @@ +/* + * 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. + */ +#ifndef RADEON_DEVICE_H +#define RADEON_DEVICE_H + +#include "radeon.h" +#include "lwrapper.h" +#include "radeon_atom.h" + +struct radeon_device; +struct radeon_ib; +struct radeon_atom; + +/* R700 */ +struct r700_asic { + unsigned npipes; + unsigned nbanks; + unsigned group_bytes; + struct r600_atoms atoms; +}; + +union radeon_asic { + struct r700_asic r700; +}; + +/* Wrapper to make it looks like kernel *************************************/ +#define radeon_bo_size(bo) ((bo)->size) + +struct radeon_device { + struct radeon *radeon; + int fd; + union radeon_asic asic; +}; + +struct radeon_ib { + u32 *pkts; + u32 cpkts; + u32 length_dw; + u32 *relocs; + u32 crelocs; + u32 nrelocs; +}; + +extern u32 radeon_ib_reloc(struct radeon_ib *ib, struct radeon_bo *bo, u32 d); +extern int radeon_ib_get(struct radeon_device *rdev, struct radeon_ib **ib); +extern void radeon_ib_free(struct radeon_ib *ib); +extern int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib); + +static inline int radeon_ib_begin(struct radeon_ib *ib, u32 ndw) +{ + if ((ib->cpkts + ndw) > ib->length_dw) + return -ENOMEM; + return 0; +} + +static inline int radeon_ib_copy(struct radeon_ib *ib, u32 *pkts, u32 ndw) +{ + if ((ib->cpkts + ndw) > ib->length_dw) + return -ENOMEM; + memcpy(&ib->pkts[ib->cpkts], pkts, ndw * 4); + ib->cpkts += ndw; + return 0; +} + +#endif |