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"
42b8e80941Smrg#include "util/macros.h" /* for PRINTFLIKE */
43848b8605Smrg
44848b8605Smrgtypedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
45848b8605Smrg
46848b8605Smrgstruct __GLXDRIconfigPrivateRec
47848b8605Smrg{
48848b8605Smrg   struct glx_config base;
49848b8605Smrg   const __DRIconfig *driConfig;
50848b8605Smrg};
51848b8605Smrg
52848b8605Smrgextern struct glx_config *driConvertConfigs(const __DRIcoreExtension * core,
53848b8605Smrg                                           struct glx_config * modes,
54848b8605Smrg                                           const __DRIconfig ** configs);
55848b8605Smrg
56848b8605Smrgextern void driDestroyConfigs(const __DRIconfig **configs);
57848b8605Smrg
58848b8605Smrgextern __GLXDRIdrawable *
59848b8605SmrgdriFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable);
60848b8605Smrg
61848b8605Smrgextern void
62848b8605SmrgdriReleaseDrawables(struct glx_context *gc);
63848b8605Smrg
64848b8605Smrgextern const __DRIsystemTimeExtension systemTimeExtension;
65848b8605Smrg
66848b8605Smrgextern void dri_message(int level, const char *f, ...) PRINTFLIKE(2, 3);
67848b8605Smrg
68848b8605Smrg#define InfoMessageF(...) dri_message(_LOADER_INFO, __VA_ARGS__)
69848b8605Smrg#define ErrorMessageF(...) dri_message(_LOADER_WARNING, __VA_ARGS__)
70848b8605Smrg#define CriticalErrorMessageF(...) dri_message(_LOADER_FATAL, __VA_ARGS__)
71848b8605Smrg
72b8e80941Smrgextern const __DRIextension **driOpenDriver(const char *driverName,
73b8e80941Smrg                                            void **out_driver_handle);
74848b8605Smrg
75848b8605Smrgextern bool
76848b8605Smrgdri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
77848b8605Smrg                         unsigned *major_ver, unsigned *minor_ver,
78848b8605Smrg                         uint32_t *render_type, uint32_t *flags, unsigned *api,
79b8e80941Smrg                         int *reset, int *release, unsigned *error);
80b8e80941Smrg
81b8e80941Smrgextern bool
82b8e80941Smrgdri2_check_no_error(uint32_t flags, struct glx_context *share_context,
83b8e80941Smrg                    int major, unsigned *error);
84b8e80941Smrg
85848b8605Smrg
86848b8605Smrg#endif /* _DRI_COMMON_H */
87