dri3_priv.h revision 01e04c3f
1af69d88dSmrg/*
2af69d88dSmrg * Copyright © 2013 Keith Packard
3af69d88dSmrg *
4af69d88dSmrg * Permission to use, copy, modify, distribute, and sell this software and its
5af69d88dSmrg * documentation for any purpose is hereby granted without fee, provided that
6af69d88dSmrg * the above copyright notice appear in all copies and that both that copyright
7af69d88dSmrg * notice and this permission notice appear in supporting documentation, and
8af69d88dSmrg * that the name of the copyright holders not be used in advertising or
9af69d88dSmrg * publicity pertaining to distribution of the software without specific,
10af69d88dSmrg * written prior permission.  The copyright holders make no representations
11af69d88dSmrg * about the suitability of this software for any purpose.  It is provided "as
12af69d88dSmrg * is" without express or implied warranty.
13af69d88dSmrg *
14af69d88dSmrg * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15af69d88dSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16af69d88dSmrg * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17af69d88dSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18af69d88dSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19af69d88dSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20af69d88dSmrg * OF THIS SOFTWARE.
21af69d88dSmrg */
22af69d88dSmrg
23af69d88dSmrg/* This file was derived from dri2_priv.h which carries the following
24af69d88dSmrg * copyright:
25af69d88dSmrg *
26af69d88dSmrg * Copyright © 2008 Red Hat, Inc.
27af69d88dSmrg *
28af69d88dSmrg * Permission is hereby granted, free of charge, to any person obtaining a
29af69d88dSmrg * copy of this software and associated documentation files (the "Soft-
30af69d88dSmrg * ware"), to deal in the Software without restriction, including without
31af69d88dSmrg * limitation the rights to use, copy, modify, merge, publish, distribute,
32af69d88dSmrg * and/or sell copies of the Software, and to permit persons to whom the
33af69d88dSmrg * Software is furnished to do so, provided that the above copyright
34af69d88dSmrg * notice(s) and this permission notice appear in all copies of the Soft-
35af69d88dSmrg * ware and that both the above copyright notice(s) and this permission
36af69d88dSmrg * notice appear in supporting documentation.
37af69d88dSmrg *
38af69d88dSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
39af69d88dSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
40af69d88dSmrg * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
41af69d88dSmrg * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
42af69d88dSmrg * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
43af69d88dSmrg * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
44af69d88dSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
45af69d88dSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
46af69d88dSmrg * MANCE OF THIS SOFTWARE.
47af69d88dSmrg *
48af69d88dSmrg * Except as contained in this notice, the name of a copyright holder shall
49af69d88dSmrg * not be used in advertising or otherwise to promote the sale, use or
50af69d88dSmrg * other dealings in this Software without prior written authorization of
51af69d88dSmrg * the copyright holder.
52af69d88dSmrg *
53af69d88dSmrg * Authors:
54af69d88dSmrg *   Kristian Høgsberg (krh@redhat.com)
55af69d88dSmrg */
56af69d88dSmrg
57af69d88dSmrg#include <xcb/xcb.h>
58af69d88dSmrg#include <xcb/dri3.h>
59af69d88dSmrg#include <xcb/present.h>
60af69d88dSmrg#include <xcb/sync.h>
61af69d88dSmrg
6201e04c3fSmrg#include "loader_dri3_helper.h"
6301e04c3fSmrg
64af69d88dSmrg/* From xmlpool/options.h, user exposed so should be stable */
65af69d88dSmrg#define DRI_CONF_VBLANK_NEVER 0
66af69d88dSmrg#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1
67af69d88dSmrg#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
68af69d88dSmrg#define DRI_CONF_VBLANK_ALWAYS_SYNC 3
69af69d88dSmrg
70af69d88dSmrgstruct dri3_display
71af69d88dSmrg{
72af69d88dSmrg   __GLXDRIdisplay base;
73af69d88dSmrg
74af69d88dSmrg   const __DRIextension **loader_extensions;
75af69d88dSmrg
76af69d88dSmrg   /* DRI3 bits */
77af69d88dSmrg   int dri3Major;
78af69d88dSmrg   int dri3Minor;
79af69d88dSmrg
80af69d88dSmrg   /* Present bits */
81af69d88dSmrg   int hasPresent;
82af69d88dSmrg   int presentMajor;
83af69d88dSmrg   int presentMinor;
84af69d88dSmrg};
85af69d88dSmrg
86af69d88dSmrgstruct dri3_screen {
87af69d88dSmrg   struct glx_screen base;
88af69d88dSmrg
89af69d88dSmrg   __DRIscreen *driScreen;
90af69d88dSmrg   __GLXDRIscreen vtable;
91af69d88dSmrg
92af69d88dSmrg   const __DRIimageExtension *image;
93af69d88dSmrg   const __DRIimageDriverExtension *image_driver;
94af69d88dSmrg   const __DRIcoreExtension *core;
95af69d88dSmrg   const __DRI2flushExtension *f;
96af69d88dSmrg   const __DRI2configQueryExtension *config;
97af69d88dSmrg   const __DRItexBufferExtension *texBuffer;
98af69d88dSmrg   const __DRI2rendererQueryExtension *rendererQuery;
9901e04c3fSmrg   const __DRI2interopExtension *interop;
100af69d88dSmrg   const __DRIconfig **driver_configs;
101af69d88dSmrg
102af69d88dSmrg   void *driver;
103af69d88dSmrg   int fd;
10401e04c3fSmrg   bool is_different_gpu;
10501e04c3fSmrg
10601e04c3fSmrg   int show_fps_interval;
107af69d88dSmrg
10801e04c3fSmrg   struct loader_dri3_extensions loader_dri3_ext;
109af69d88dSmrg};
110af69d88dSmrg
111af69d88dSmrgstruct dri3_context
112af69d88dSmrg{
113af69d88dSmrg   struct glx_context base;
114af69d88dSmrg   __DRIcontext *driContext;
115af69d88dSmrg};
116af69d88dSmrg
117af69d88dSmrgstruct dri3_drawable {
118af69d88dSmrg   __GLXDRIdrawable base;
11901e04c3fSmrg   struct loader_dri3_drawable loader_drawable;
120af69d88dSmrg   int swap_interval;
121af69d88dSmrg
12201e04c3fSmrg   /* LIBGL_SHOW_FPS support */
12301e04c3fSmrg   uint64_t previous_ust;
12401e04c3fSmrg   unsigned frames;
12501e04c3fSmrg};
126af69d88dSmrg
127af69d88dSmrg
12801e04c3fSmrg_X_HIDDEN int
12901e04c3fSmrgdri3_query_renderer_integer(struct glx_screen *base, int attribute,
13001e04c3fSmrg                            unsigned int *value);
131af69d88dSmrg
13201e04c3fSmrg_X_HIDDEN int
13301e04c3fSmrgdri3_query_renderer_string(struct glx_screen *base, int attribute,
13401e04c3fSmrg                           const char **value);
135af69d88dSmrg
13601e04c3fSmrg_X_HIDDEN int
13701e04c3fSmrgdri3_interop_query_device_info(struct glx_context *ctx,
13801e04c3fSmrg                               struct mesa_glinterop_device_info *out);
139af69d88dSmrg
14001e04c3fSmrg_X_HIDDEN int
14101e04c3fSmrgdri3_interop_export_object(struct glx_context *ctx,
14201e04c3fSmrg                           struct mesa_glinterop_export_in *in,
14301e04c3fSmrg                           struct mesa_glinterop_export_out *out);
144