• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2013 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
25 
26 #include "glxclient.h"
27 #include "glx_error.h"
28 #include "dri_interface.h"
29 #include "dri2_priv.h"
30 #if defined(HAVE_DRI3)
31 #include "dri3_priv.h"
32 #endif
33 #include "GL/mesa_glinterop.h"
34 
35 _X_HIDDEN int
dri2_interop_query_device_info(struct glx_context * ctx,struct mesa_glinterop_device_info * out)36 dri2_interop_query_device_info(struct glx_context *ctx,
37                                struct mesa_glinterop_device_info *out)
38 {
39    struct dri2_screen *psc = (struct dri2_screen*)ctx->psc;
40    struct dri2_context *drictx = (struct dri2_context*)ctx;
41 
42    if (!psc->interop)
43       return MESA_GLINTEROP_UNSUPPORTED;
44 
45    return psc->interop->query_device_info(drictx->driContext, out);
46 }
47 
48 _X_HIDDEN int
dri2_interop_export_object(struct glx_context * ctx,struct mesa_glinterop_export_in * in,struct mesa_glinterop_export_out * out)49 dri2_interop_export_object(struct glx_context *ctx,
50                            struct mesa_glinterop_export_in *in,
51                            struct mesa_glinterop_export_out *out)
52 {
53    struct dri2_screen *psc = (struct dri2_screen*)ctx->psc;
54    struct dri2_context *drictx = (struct dri2_context*)ctx;
55 
56    if (!psc->interop)
57       return MESA_GLINTEROP_UNSUPPORTED;
58 
59    return psc->interop->export_object(drictx->driContext, in, out);
60 }
61 
62 #if defined(HAVE_DRI3)
63 
64 _X_HIDDEN int
dri3_interop_query_device_info(struct glx_context * ctx,struct mesa_glinterop_device_info * out)65 dri3_interop_query_device_info(struct glx_context *ctx,
66                                struct mesa_glinterop_device_info *out)
67 {
68    struct dri3_screen *psc = (struct dri3_screen*)ctx->psc;
69    struct dri3_context *drictx = (struct dri3_context*)ctx;
70 
71    if (!psc->interop)
72       return MESA_GLINTEROP_UNSUPPORTED;
73 
74    return psc->interop->query_device_info(drictx->driContext, out);
75 }
76 
77 _X_HIDDEN int
dri3_interop_export_object(struct glx_context * ctx,struct mesa_glinterop_export_in * in,struct mesa_glinterop_export_out * out)78 dri3_interop_export_object(struct glx_context *ctx,
79                            struct mesa_glinterop_export_in *in,
80                            struct mesa_glinterop_export_out *out)
81 {
82    struct dri3_screen *psc = (struct dri3_screen*)ctx->psc;
83    struct dri3_context *drictx = (struct dri3_context*)ctx;
84 
85    if (!psc->interop)
86       return MESA_GLINTEROP_UNSUPPORTED;
87 
88    return psc->interop->export_object(drictx->driContext, in, out);
89 }
90 
91 #endif /* HAVE_DRI3 */
92 #endif /* defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) */
93