dri_common.h revision 9f464c52
1cdc920a0Smrg/*
2cdc920a0Smrg * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3cdc920a0Smrg * Copyright © 2008 Red Hat, Inc.
4cdc920a0Smrg *
5cdc920a0Smrg * Permission is hereby granted, free of charge, to any person obtaining a
6cdc920a0Smrg * copy of this software and associated documentation files (the "Soft-
7cdc920a0Smrg * ware"), to deal in the Software without restriction, including without
8cdc920a0Smrg * limitation the rights to use, copy, modify, merge, publish, distribute,
9cdc920a0Smrg * and/or sell copies of the Software, and to permit persons to whom the
10cdc920a0Smrg * Software is furnished to do so, provided that the above copyright
11cdc920a0Smrg * notice(s) and this permission notice appear in all copies of the Soft-
12cdc920a0Smrg * ware and that both the above copyright notice(s) and this permission
13cdc920a0Smrg * notice appear in supporting documentation.
14cdc920a0Smrg *
15cdc920a0Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16cdc920a0Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
17cdc920a0Smrg * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
18cdc920a0Smrg * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
19cdc920a0Smrg * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
20cdc920a0Smrg * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21cdc920a0Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22cdc920a0Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
23cdc920a0Smrg * MANCE OF THIS SOFTWARE.
24cdc920a0Smrg *
25cdc920a0Smrg * Except as contained in this notice, the name of a copyright holder shall
26cdc920a0Smrg * not be used in advertising or otherwise to promote the sale, use or
27cdc920a0Smrg * other dealings in this Software without prior written authorization of
28cdc920a0Smrg * the copyright holder.
29cdc920a0Smrg *
30cdc920a0Smrg * Authors:
31cdc920a0Smrg *   Kevin E. Martin <kevin@precisioninsight.com>
32cdc920a0Smrg *   Brian Paul <brian@precisioninsight.com>
33cdc920a0Smrg *   Kristian Høgsberg (krh@redhat.com)
34cdc920a0Smrg */
35cdc920a0Smrg
36cdc920a0Smrg#ifndef _DRI_COMMON_H
37cdc920a0Smrg#define _DRI_COMMON_H
38cdc920a0Smrg
393464ebd5Sriastradh#include <GL/internal/dri_interface.h>
40af69d88dSmrg#include <stdbool.h>
41af69d88dSmrg#include "loader.h"
4201e04c3fSmrg#include "util/macros.h" /* for PRINTFLIKE */
433464ebd5Sriastradh
44cdc920a0Smrgtypedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
45cdc920a0Smrg
46cdc920a0Smrgstruct __GLXDRIconfigPrivateRec
47cdc920a0Smrg{
483464ebd5Sriastradh   struct glx_config base;
49cdc920a0Smrg   const __DRIconfig *driConfig;
50cdc920a0Smrg};
51cdc920a0Smrg
523464ebd5Sriastradhextern struct glx_config *driConvertConfigs(const __DRIcoreExtension * core,
533464ebd5Sriastradh                                           struct glx_config * modes,
54cdc920a0Smrg                                           const __DRIconfig ** configs);
55cdc920a0Smrg
563464ebd5Sriastradhextern void driDestroyConfigs(const __DRIconfig **configs);
573464ebd5Sriastradh
583464ebd5Sriastradhextern __GLXDRIdrawable *
593464ebd5SriastradhdriFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable);
603464ebd5Sriastradh
613464ebd5Sriastradhextern void
623464ebd5SriastradhdriReleaseDrawables(struct glx_context *gc);
633464ebd5Sriastradh
64cdc920a0Smrgextern const __DRIsystemTimeExtension systemTimeExtension;
65cdc920a0Smrg
66af69d88dSmrgextern void dri_message(int level, const char *f, ...) PRINTFLIKE(2, 3);
67cdc920a0Smrg
68af69d88dSmrg#define InfoMessageF(...) dri_message(_LOADER_INFO, __VA_ARGS__)
69af69d88dSmrg#define ErrorMessageF(...) dri_message(_LOADER_WARNING, __VA_ARGS__)
70af69d88dSmrg#define CriticalErrorMessageF(...) dri_message(_LOADER_FATAL, __VA_ARGS__)
71cdc920a0Smrg
729f464c52Smayaextern const __DRIextension **driOpenDriver(const char *driverName,
739f464c52Smaya                                            void **out_driver_handle);
74af69d88dSmrg
75af69d88dSmrgextern bool
76af69d88dSmrgdri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
77af69d88dSmrg                         unsigned *major_ver, unsigned *minor_ver,
78af69d88dSmrg                         uint32_t *render_type, uint32_t *flags, unsigned *api,
7901e04c3fSmrg                         int *reset, int *release, unsigned *error);
80af69d88dSmrg
819f464c52Smayaextern bool
829f464c52Smayadri2_check_no_error(uint32_t flags, struct glx_context *share_context,
839f464c52Smaya                    int major, unsigned *error);
849f464c52Smaya
859f464c52Smaya
86cdc920a0Smrg#endif /* _DRI_COMMON_H */
87