1/*
2 * Copyright 2005 Eric Anholt
3 * Copyright 2005 Benjamin Herrenschmidt
4 * Copyright 2008 Advanced Micro Devices, Inc.
5 * All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the next
15 * paragraph) shall be included in all copies or substantial portions of the
16 * Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE.
25 *
26 * Authors:
27 *    Eric Anholt <anholt@FreeBSD.org>
28 *    Zack Rusin <zrusin@trolltech.com>
29 *    Benjamin Herrenschmidt <benh@kernel.crashing.org>
30 *    Alex Deucher <alexander.deucher@amd.com>
31 *    Matthias Hopf <mhopf@suse.de>
32 */
33#ifndef RADEON_EXA_SHARED_H
34
35#define RADEON_EXA_SHARED_H
36
37extern PixmapPtr RADEONGetDrawablePixmap(DrawablePtr pDrawable);
38
39extern void RADEONVlineHelperClear(ScrnInfoPtr pScrn);
40extern void RADEONVlineHelperSet(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2);
41extern Bool RADEONValidPM(uint32_t pm, int bpp);
42extern Bool RADEONCheckBPP(int bpp);
43extern PixmapPtr RADEONSolidPixmap(ScreenPtr pScreen, uint32_t solid);
44
45#define RADEON_TRACE_FALL 0
46#define RADEON_TRACE_DRAW 0
47
48#if RADEON_TRACE_FALL
49#define RADEON_FALLBACK(x)     		\
50do {					\
51	ErrorF("%s: ", __FUNCTION__);	\
52	ErrorF x;			\
53	return FALSE;			\
54} while (0)
55#else
56#define RADEON_FALLBACK(x) return FALSE
57#endif
58
59#if RADEON_TRACE_DRAW
60#define TRACE do { ErrorF("TRACE: %s\n", __FUNCTION__); } while(0)
61#else
62#define TRACE
63#endif
64
65#ifdef XF86DRM_MODE
66static inline void radeon_add_pixmap(struct radeon_cs *cs, PixmapPtr pPix, int read_domains, int write_domain)
67{
68    struct radeon_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix);
69
70    radeon_cs_space_add_persistent_bo(cs, driver_priv->bo, read_domains, write_domain);
71}
72
73extern void radeon_ib_discard(ScrnInfoPtr pScrn);
74#endif /* XF86DRM_MODE */
75
76extern int radeon_cp_start(ScrnInfoPtr pScrn);
77extern void radeon_vb_no_space(ScrnInfoPtr pScrn, struct radeon_vbo_object *vbo, int vert_size);
78extern void radeon_vbo_done_composite(PixmapPtr pDst);
79
80#endif
81