dri_common.h revision 848b8605
1848b8605Smrg/*
2848b8605Smrg * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3848b8605Smrg * Copyright © 2008 Red Hat, Inc.
4848b8605Smrg *
5848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a
6848b8605Smrg * copy of this software and associated documentation files (the "Soft-
7848b8605Smrg * ware"), to deal in the Software without restriction, including without
8848b8605Smrg * limitation the rights to use, copy, modify, merge, publish, distribute,
9848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the
10848b8605Smrg * Software is furnished to do so, provided that the above copyright
11848b8605Smrg * notice(s) and this permission notice appear in all copies of the Soft-
12848b8605Smrg * ware and that both the above copyright notice(s) and this permission
13848b8605Smrg * notice appear in supporting documentation.
14848b8605Smrg *
15848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
17848b8605Smrg * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
18848b8605Smrg * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
19848b8605Smrg * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
20848b8605Smrg * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21848b8605Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22848b8605Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
23848b8605Smrg * MANCE OF THIS SOFTWARE.
24848b8605Smrg *
25848b8605Smrg * Except as contained in this notice, the name of a copyright holder shall
26848b8605Smrg * not be used in advertising or otherwise to promote the sale, use or
27848b8605Smrg * other dealings in this Software without prior written authorization of
28848b8605Smrg * the copyright holder.
29848b8605Smrg *
30848b8605Smrg * Authors:
31848b8605Smrg *   Kevin E. Martin <kevin@precisioninsight.com>
32848b8605Smrg *   Brian Paul <brian@precisioninsight.com>
33848b8605Smrg *   Kristian Høgsberg (krh@redhat.com)
34848b8605Smrg */
35848b8605Smrg
36848b8605Smrg#ifndef _DRI_COMMON_H
37848b8605Smrg#define _DRI_COMMON_H
38848b8605Smrg
39848b8605Smrg#include <GL/internal/dri_interface.h>
40848b8605Smrg#include <stdbool.h>
41848b8605Smrg#include "loader.h"
42848b8605Smrg
43848b8605Smrg#if (__GNUC__ >= 3)
44848b8605Smrg#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
45848b8605Smrg#else
46848b8605Smrg#define PRINTFLIKE(f, a)
47848b8605Smrg#endif
48848b8605Smrg
49848b8605Smrgtypedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
50848b8605Smrg
51848b8605Smrgstruct __GLXDRIconfigPrivateRec
52848b8605Smrg{
53848b8605Smrg   struct glx_config base;
54848b8605Smrg   const __DRIconfig *driConfig;
55848b8605Smrg};
56848b8605Smrg
57848b8605Smrgextern struct glx_config *driConvertConfigs(const __DRIcoreExtension * core,
58848b8605Smrg                                           struct glx_config * modes,
59848b8605Smrg                                           const __DRIconfig ** configs);
60848b8605Smrg
61848b8605Smrgextern void driDestroyConfigs(const __DRIconfig **configs);
62848b8605Smrg
63848b8605Smrgextern __GLXDRIdrawable *
64848b8605SmrgdriFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable);
65848b8605Smrg
66848b8605Smrgextern void
67848b8605SmrgdriReleaseDrawables(struct glx_context *gc);
68848b8605Smrg
69848b8605Smrgextern const __DRIsystemTimeExtension systemTimeExtension;
70848b8605Smrg
71848b8605Smrgextern void dri_message(int level, const char *f, ...) PRINTFLIKE(2, 3);
72848b8605Smrg
73848b8605Smrg#define InfoMessageF(...) dri_message(_LOADER_INFO, __VA_ARGS__)
74848b8605Smrg#define ErrorMessageF(...) dri_message(_LOADER_WARNING, __VA_ARGS__)
75848b8605Smrg#define CriticalErrorMessageF(...) dri_message(_LOADER_FATAL, __VA_ARGS__)
76848b8605Smrg
77848b8605Smrgextern void *driOpenDriver(const char *driverName);
78848b8605Smrg
79848b8605Smrgextern const __DRIextension **
80848b8605SmrgdriGetDriverExtensions(void *handle, const char *driver_name);
81848b8605Smrg
82848b8605Smrgextern bool
83848b8605Smrgdri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
84848b8605Smrg                         unsigned *major_ver, unsigned *minor_ver,
85848b8605Smrg                         uint32_t *render_type, uint32_t *flags, unsigned *api,
86848b8605Smrg                         int *reset, unsigned *error);
87848b8605Smrg
88848b8605Smrg#endif /* _DRI_COMMON_H */
89