xorg_tracker.h revision 23fe960be0d0d27fcd676534c692ab164f854acb
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 <exa.h>
43
44#ifdef DRM_MODE_FEATURE_DIRTYFB
45#include <damage.h>
46#endif
47
48#include "pipe/p_screen.h"
49#include "state_tracker/drm_api.h"
50
51#define DRV_ERROR(msg)	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg);
52
53typedef struct
54{
55    int lastInstance;
56    int refCount;
57    ScrnInfoPtr pScrn_1;
58    ScrnInfoPtr pScrn_2;
59} EntRec, *EntPtr;
60
61typedef struct _modesettingRec
62{
63    /* drm */
64    int fd;
65    unsigned fb_id;
66
67    /* X */
68    EntPtr entityPrivate;
69
70    int Chipset;
71    EntityInfoPtr pEnt;
72    struct pci_device *PciInfo;
73
74    Bool noAccel;
75    Bool SWCursor;
76    CloseScreenProcPtr CloseScreen;
77
78    /* Broken-out options. */
79    OptionInfoPtr Options;
80
81    unsigned int SaveGeneration;
82
83    void (*blockHandler)(int, pointer, pointer, pointer);
84    CreateScreenResourcesProcPtr createScreenResources;
85
86    /* gallium */
87    struct drm_api *api;
88    struct pipe_screen *screen;
89    struct pipe_context *ctx;
90    boolean d_depth_bits_last;
91    boolean ds_depth_bits_last;
92
93    /* exa */
94    void *exa;
95    Bool noEvict;
96
97#ifdef DRM_MODE_FEATURE_DIRTYFB
98    DamagePtr damage;
99#endif
100} modesettingRec, *modesettingPtr;
101
102#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
103
104
105/***********************************************************************
106 * xorg_exa.c
107 */
108struct pipe_texture *
109xorg_exa_get_texture(PixmapPtr pPixmap);
110
111unsigned
112xorg_exa_get_pixmap_handle(PixmapPtr pPixmap, unsigned *stride);
113
114int
115xorg_exa_set_displayed_usage(PixmapPtr pPixmap);
116
117int
118xorg_exa_set_shared_usage(PixmapPtr pPixmap);
119
120void *
121xorg_exa_init(ScrnInfoPtr pScrn);
122
123void
124xorg_exa_close(ScrnInfoPtr pScrn);
125
126
127/***********************************************************************
128 * xorg_dri2.c
129 */
130Bool
131driScreenInit(ScreenPtr pScreen);
132
133void
134driCloseScreen(ScreenPtr pScreen);
135
136
137/***********************************************************************
138 * xorg_crtc.c
139 */
140void
141crtc_init(ScrnInfoPtr pScrn);
142
143
144/***********************************************************************
145 * xorg_output.c
146 */
147void
148output_init(ScrnInfoPtr pScrn);
149
150
151#endif /* _XORG_TRACKER_H_ */
152