xorg_tracker.h revision 7d9af52bc59bfeb19d9bdb55258f4a830a1b0d04
1/*
2 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 *
26 * Author: Alan Hourihane <alanh@tungstengraphics.com>
27 * Author: Jakob Bornecrantz <wallbraker@gmail.com>
28 *
29 */
30
31#ifndef _XORG_TRACKER_H_
32#define _XORG_TRACKER_H_
33
34#include <stddef.h>
35#include <stdint.h>
36#include <errno.h>
37#include <drm.h>
38#include <xf86drm.h>
39#include <xf86drmMode.h>
40#include <xorg-server.h>
41#include <xf86.h>
42#include "xf86Crtc.h"
43#include <exa.h>
44
45#ifdef DRM_MODE_FEATURE_DIRTYFB
46#include <damage.h>
47#endif
48
49#include "pipe/p_screen.h"
50#include "state_tracker/drm_api.h"
51
52#define DRV_ERROR(msg)	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg);
53
54typedef struct
55{
56    int lastInstance;
57    int refCount;
58    ScrnInfoPtr pScrn_1;
59    ScrnInfoPtr pScrn_2;
60} EntRec, *EntPtr;
61
62typedef struct _modesettingRec
63{
64    /* drm */
65    int fd;
66    unsigned fb_id;
67
68    /* X */
69    EntPtr entityPrivate;
70
71    int Chipset;
72    EntityInfoPtr pEnt;
73    struct pci_device *PciInfo;
74
75    Bool noAccel;
76    Bool SWCursor;
77    CloseScreenProcPtr CloseScreen;
78
79    /* Broken-out options. */
80    OptionInfoPtr Options;
81
82    unsigned int SaveGeneration;
83
84    void (*blockHandler)(int, pointer, pointer, pointer);
85    CreateScreenResourcesProcPtr createScreenResources;
86
87    /* gallium */
88    struct drm_api *api;
89    struct pipe_screen *screen;
90    struct pipe_context *ctx;
91    boolean d_depth_bits_last;
92    boolean ds_depth_bits_last;
93
94    /* exa */
95    void *exa;
96    Bool noEvict;
97
98#ifdef DRM_MODE_FEATURE_DIRTYFB
99    DamagePtr damage;
100#endif
101} modesettingRec, *modesettingPtr;
102
103#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
104
105
106/***********************************************************************
107 * xorg_exa.c
108 */
109struct pipe_texture *
110xorg_exa_get_texture(PixmapPtr pPixmap);
111
112unsigned
113xorg_exa_get_pixmap_handle(PixmapPtr pPixmap, unsigned *stride);
114
115int
116xorg_exa_set_displayed_usage(PixmapPtr pPixmap);
117
118int
119xorg_exa_set_shared_usage(PixmapPtr pPixmap);
120
121void *
122xorg_exa_init(ScrnInfoPtr pScrn);
123
124void
125xorg_exa_close(ScrnInfoPtr pScrn);
126
127
128/***********************************************************************
129 * xorg_dri2.c
130 */
131Bool
132driScreenInit(ScreenPtr pScreen);
133
134void
135driCloseScreen(ScreenPtr pScreen);
136
137
138/***********************************************************************
139 * xorg_crtc.c
140 */
141void
142crtc_init(ScrnInfoPtr pScrn);
143
144void
145crtc_cursor_destroy(xf86CrtcPtr crtc);
146
147
148/***********************************************************************
149 * xorg_output.c
150 */
151void
152output_init(ScrnInfoPtr pScrn);
153
154
155#endif /* _XORG_TRACKER_H_ */
156