1680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell/*
2680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * All Rights Reserved.
4680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell *
5680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
6680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * copy of this software and associated documentation files (the
7680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * "Software"), to deal in the Software without restriction, including
8680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * without limitation the rights to use, copy, modify, merge, publish,
9680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * distribute, sub license, and/or sell copies of the Software, and to
10680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * permit persons to whom the Software is furnished to do so, subject to
11680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * the following conditions:
12680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell *
13680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * The above copyright notice and this permission notice (including the
14680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * next paragraph) shall be included in all copies or substantial portions
15680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * of the Software.
16680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell *
17680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
21680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell */
25680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
266f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane/**
276f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * \file dri_util.h
286f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * DRI utility functions definitions.
296f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane *
306f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * This module acts as glue between GLX and the actual hardware driver.  A DRI
316f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * driver doesn't really \e have to use any of this - it's optional.  But, some
326f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * useful stuff is done here that otherwise would have to be duplicated in most
336f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * drivers.
346f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane *
356f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * Basically, these utility functions take care of some of the dirty details of
366f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * screen initialization, context creation, context binding, DRM setup, etc.
376f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane *
386f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * These functions are compiled into each DRI driver so libGL.so knows nothing
396f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * about them.
406f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane *
416f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * \sa dri_util.c.
426f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane *
436f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * \author Kevin E. Martin <kevin@precisioninsight.com>
446f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane * \author Brian Paul <brian@precisioninsight.com>
456f7ed99b306990f284f9d57c0b66efaa7f2277e1Alan Hourihane */
46680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
4778c076e6548f0bb44758d89ec434bcfddd902939George Sapountzis/**
4878c076e6548f0bb44758d89ec434bcfddd902939George Sapountzis * The following structs are shared between DRISW and DRI2, the DRISW structs
4978c076e6548f0bb44758d89ec434bcfddd902939George Sapountzis * are essentially base classes of the DRI2 structs. DRISW needs to compile on
5078c076e6548f0bb44758d89ec434bcfddd902939George Sapountzis * platforms without DRM, so keep the structs opaque to DRM.
5178c076e6548f0bb44758d89ec434bcfddd902939George Sapountzis */
5278c076e6548f0bb44758d89ec434bcfddd902939George Sapountzis
53680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell#ifndef _DRI_UTIL_H_
54680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell#define _DRI_UTIL_H_
55680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
56c39bf5e273a4995a279ae2af59fc29e06ab47e29Ian Romanick#include <GL/gl.h>
577192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis#include <GL/internal/dri_interface.h>
58a7a9a91d7b28e5b5faed509d00f0f951e3136b1bKristian Høgsberg#include "main/mtypes.h"
597192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis#include "xmlconfig.h"
60e1a7f31c2b47e053ad70f5c4c519e294c273724cIan Romanick
6164106d0d9aeefa6974317042b6bc3e5eaabac5a2Kristian Høgsberg/**
62ac3e838fa748c8c8a6ffc04d1ab13da71f75f103Kristian Høgsberg * Extensions.
63ac3e838fa748c8c8a6ffc04d1ab13da71f75f103Kristian Høgsberg */
64e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsbergextern const __DRIcoreExtension driCoreExtension;
6578c076e6548f0bb44758d89ec434bcfddd902939George Sapountzisextern const __DRIswrastExtension driSWRastExtension;
6639a0e4e7de379a182c1544fa24d5cb2a7687ec72Kristian Høgsbergextern const __DRIdri2Extension driDRI2Extension;
67234286c0f8b7d30ed49223c648d4c73c1a517ab3Jesse Barnesextern const __DRI2configQueryExtension dri2ConfigQueryExtension;
68ac3e838fa748c8c8a6ffc04d1ab13da71f75f103Kristian Høgsberg
69ac3e838fa748c8c8a6ffc04d1ab13da71f75f103Kristian Høgsberg/**
70680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * Driver callback functions.
71680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell *
72680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * Each DRI driver must have one of these structures with all the pointers set
73680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * to appropriate functions within the driver.
74680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell *
75680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * When glXCreateContext() is called, for example, it'll call a helper function
76680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * dri_util.c which in turn will jump through the \a CreateContext pointer in
77680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * this structure.
78680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell */
79680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwellstruct __DriverAPIRec {
807192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis    const __DRIconfig **(*InitScreen) (__DRIscreen * priv);
817192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis
82e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg    void (*DestroyScreen)(__DRIscreen *driScrnPriv);
83680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
84a7a9a91d7b28e5b5faed509d00f0f951e3136b1bKristian Høgsberg    GLboolean (*CreateContext)(gl_api api,
857192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis                               const struct gl_config *glVis,
867192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis                               __DRIcontext *driContextPriv,
87e532b6288f01b63d8d8ba8c8dc08292967e65490Ian Romanick			       unsigned major_version,
88e532b6288f01b63d8d8ba8c8dc08292967e65490Ian Romanick			       unsigned minor_version,
89e532b6288f01b63d8d8ba8c8dc08292967e65490Ian Romanick			       uint32_t flags,
90e532b6288f01b63d8d8ba8c8dc08292967e65490Ian Romanick			       unsigned *error,
91680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell                               void *sharedContextPrivate);
92680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
93e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg    void (*DestroyContext)(__DRIcontext *driContextPriv);
94680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
95e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg    GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv,
96e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg                              __DRIdrawable *driDrawPriv,
97d3491e775fb07f891463b2185d74bbad62f3ed24Kristian Høgsberg                              const struct gl_config *glVis,
98680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell                              GLboolean pixmapBuffer);
997192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis
100e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg    void (*DestroyBuffer)(__DRIdrawable *driDrawPriv);
101680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
1027192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis    void (*SwapBuffers)(__DRIdrawable *driDrawPriv);
1037192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis
104e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg    GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv,
105e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg                             __DRIdrawable *driDrawPriv,
106e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg                             __DRIdrawable *driReadPriv);
107680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
108e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg    GLboolean (*UnbindContext)(__DRIcontext *driContextPriv);
109e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg
1101b8ef9416bf3a4d2d47fcf9935063af57da2975dBenjamin Franzke    __DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate,
1117192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis                                    unsigned int attachment,
1127192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis                                    unsigned int format,
1137192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis                                    int width, int height);
1147192c37294964b3f6e1551469f161593ec8f851dGeorge Sapountzis
1151b8ef9416bf3a4d2d47fcf9935063af57da2975dBenjamin Franzke    void (*ReleaseBuffer) (__DRIscreen *screenPrivate, __DRIbuffer *buffer);
116680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell};
117680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
118e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsbergextern const struct __DriverAPIRec driDriverAPI;
119e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg
120680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
121680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell/**
12296bd41b315ce2943df2e59656fb200fedb866412George Sapountzis * Per-screen private driver information.
123680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell */
12496bd41b315ce2943df2e59656fb200fedb866412George Sapountzisstruct __DRIscreenRec {
125680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell    /**
12696bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * Current screen's number
127680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell     */
12896bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    int myNum;
129680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
130680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell    /**
13196bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * File descriptor returned when the kernel device driver is opened.
13296bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     *
13396bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * Used to:
13496bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     *   - authenticate client to kernel
13596bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     *   - map the frame buffer, SAREA, etc.
13696bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     *   - close the kernel device driver
137680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell     */
13896bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    int fd;
139680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
140680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell    /**
14196bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * DRM (kernel module) version information.
142e438a36d8379d2ccb06aab2fa53fb52ae100198cGeorge Sapountzis     */
14396bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    __DRIversion drm_version;
144e438a36d8379d2ccb06aab2fa53fb52ae100198cGeorge Sapountzis
145e438a36d8379d2ccb06aab2fa53fb52ae100198cGeorge Sapountzis    /**
14696bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * Device-dependent private information (not stored in the SAREA).
14796bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     *
14896bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * This pointer is never touched by the DRI layer.
149e438a36d8379d2ccb06aab2fa53fb52ae100198cGeorge Sapountzis     */
15096bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    void *driverPrivate;
151e438a36d8379d2ccb06aab2fa53fb52ae100198cGeorge Sapountzis
15296bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    void *loaderPrivate;
153680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
15496bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    const __DRIextension **extensions;
155680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
15696bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    const __DRIswrastLoaderExtension *swrast_loader;
157680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
158925b901ba313a3ddd7567eca088951be39414430Kristian Høgsberg    struct {
15996bd41b315ce2943df2e59656fb200fedb866412George Sapountzis	/* Flag to indicate that this is a DRI2 screen.  Many of the above
16096bd41b315ce2943df2e59656fb200fedb866412George Sapountzis	 * fields will not be valid or initializaed in that case. */
16196bd41b315ce2943df2e59656fb200fedb866412George Sapountzis	__DRIdri2LoaderExtension *loader;
16296bd41b315ce2943df2e59656fb200fedb866412George Sapountzis	__DRIimageLookupExtension *image;
16396bd41b315ce2943df2e59656fb200fedb866412George Sapountzis	__DRIuseInvalidateExtension *useInvalidate;
164925b901ba313a3ddd7567eca088951be39414430Kristian Høgsberg    } dri2;
16596bd41b315ce2943df2e59656fb200fedb866412George Sapountzis
16696bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    driOptionCache optionInfo;
16796bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    driOptionCache optionCache;
16896bd41b315ce2943df2e59656fb200fedb866412George Sapountzis
16996bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    unsigned int api_mask;
170680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell};
171680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
172680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell/**
173680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell * Per-context private driver information.
174680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell */
175e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsbergstruct __DRIcontextRec {
176680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell    /**
177680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell     * Device driver's private context data.  This structure is opaque.
178680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell     */
179680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell    void *driverPrivate;
180680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
181680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell    /**
182e438a36d8379d2ccb06aab2fa53fb52ae100198cGeorge Sapountzis     * The loaders's private context data.  This structure is opaque.
183e438a36d8379d2ccb06aab2fa53fb52ae100198cGeorge Sapountzis     */
184e438a36d8379d2ccb06aab2fa53fb52ae100198cGeorge Sapountzis    void *loaderPrivate;
185e438a36d8379d2ccb06aab2fa53fb52ae100198cGeorge Sapountzis
186e438a36d8379d2ccb06aab2fa53fb52ae100198cGeorge Sapountzis    /**
1877b1ff326071658d5bd6e7feb2ad78d0e0209211dIan Romanick     * Pointer to drawable currently bound to this context for drawing.
188680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell     */
189e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg    __DRIdrawable *driDrawablePriv;
190680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
191680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell    /**
1927b1ff326071658d5bd6e7feb2ad78d0e0209211dIan Romanick     * Pointer to drawable currently bound to this context for reading.
1937b1ff326071658d5bd6e7feb2ad78d0e0209211dIan Romanick     */
194e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg    __DRIdrawable *driReadablePriv;
1957b1ff326071658d5bd6e7feb2ad78d0e0209211dIan Romanick
1967b1ff326071658d5bd6e7feb2ad78d0e0209211dIan Romanick    /**
197680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell     * Pointer to screen on which this context was created.
198680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell     */
199e82dd8c6e1fa2fff5b960de26961080ba5e9651dKristian Høgsberg    __DRIscreen *driScreenPriv;
20093931d9e684cd5a5659c3f28f8da7294ac174542Kristian Høgsberg
201d449627829e1a4a3250a1a723af2f4e3cd5fd194Kristian Høgsberg    struct {
202d449627829e1a4a3250a1a723af2f4e3cd5fd194Kristian Høgsberg	int draw_stamp;
203d449627829e1a4a3250a1a723af2f4e3cd5fd194Kristian Høgsberg	int read_stamp;
204d449627829e1a4a3250a1a723af2f4e3cd5fd194Kristian Høgsberg    } dri2;
205680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell};
206680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
207680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell/**
20896bd41b315ce2943df2e59656fb200fedb866412George Sapountzis * Per-drawable private DRI driver information.
209680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell */
21096bd41b315ce2943df2e59656fb200fedb866412George Sapountzisstruct __DRIdrawableRec {
211680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell    /**
21296bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * Driver's private drawable information.
21396bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     *
21496bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * This structure is opaque.
215680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell     */
21696bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    void *driverPrivate;
217680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
218680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell    /**
21996bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * Private data from the loader.  We just hold on to it and pass
22096bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * it back when calling into loader provided functions.
221680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell     */
22296bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    void *loaderPrivate;
223680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
224680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell    /**
22596bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * Pointer to context to which this drawable is currently bound.
226875a757ddd103722cfe9a2b21035024aa5a23d32George Sapountzis     */
22796bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    __DRIcontext *driContextPriv;
228875a757ddd103722cfe9a2b21035024aa5a23d32George Sapountzis
229875a757ddd103722cfe9a2b21035024aa5a23d32George Sapountzis    /**
23096bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * Pointer to screen on which this drawable was created.
231680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell     */
23296bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    __DRIscreen *driScreenPriv;
233875a757ddd103722cfe9a2b21035024aa5a23d32George Sapountzis
23496bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    /**
23596bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * Reference count for number of context's currently bound to this
23696bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * drawable.
23796bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     *
23896bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * Once it reaches zero, the drawable can be destroyed.
23996bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     *
24096bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * \note This behavior will change with GLX 1.3.
24196bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     */
24296bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    int refcount;
243875a757ddd103722cfe9a2b21035024aa5a23d32George Sapountzis
24496bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    /**
24596bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * Last value of the stamp.
24696bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     *
24796bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * If this differs from the value stored at __DRIdrawable::dri2.stamp,
24896bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * then the drawable information has been modified by the X server, and the
24996bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * drawable information (below) should be retrieved from the X server.
25096bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     */
25196bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    unsigned int lastStamp;
252875a757ddd103722cfe9a2b21035024aa5a23d32George Sapountzis
25396bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    int w, h;
254680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
25596bd41b315ce2943df2e59656fb200fedb866412George Sapountzis    /**
25696bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     * Drawable timestamp.  Increased when the loader calls invalidate.
25796bd41b315ce2943df2e59656fb200fedb866412George Sapountzis     */
2587da5705b090d9c97a9b765d786c5e89afe9d1f25Kristian Høgsberg    struct {
25996bd41b315ce2943df2e59656fb200fedb866412George Sapountzis	unsigned int stamp;
2607da5705b090d9c97a9b765d786c5e89afe9d1f25Kristian Høgsberg    } dri2;
261680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell};
262680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell
26361d26bc82e7c4100acfb551cbb0ba9d84bbc4ba5Francisco Jerezextern void
26461d26bc82e7c4100acfb551cbb0ba9d84bbc4ba5Francisco Jerezdri2InvalidateDrawable(__DRIdrawable *drawable);
26561d26bc82e7c4100acfb551cbb0ba9d84bbc4ba5Francisco Jerez
266c467db4cc765965bd347cf5b91aec39b831273ecKristian Høgsbergextern void
267c467db4cc765965bd347cf5b91aec39b831273ecKristian HøgsbergdriUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv);
268c467db4cc765965bd347cf5b91aec39b831273ecKristian Høgsberg
269680ec7f85158eae58fd5ab56da8c66a645883cb0Keith Whitwell#endif /* _DRI_UTIL_H_ */
270