Path: blob/21.2-virgl/src/glx/dri_common_interop.c
4558 views
/*1* Copyright © 2013 Intel Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER20* DEALINGS IN THE SOFTWARE.21*/2223#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)2425#include "glxclient.h"26#include "glx_error.h"27#include "GL/internal/dri_interface.h"28#include "dri2_priv.h"29#if defined(HAVE_DRI3)30#include "dri3_priv.h"31#endif32#include "GL/mesa_glinterop.h"3334_X_HIDDEN int35dri2_interop_query_device_info(struct glx_context *ctx,36struct mesa_glinterop_device_info *out)37{38struct dri2_screen *psc = (struct dri2_screen*)ctx->psc;39struct dri2_context *drictx = (struct dri2_context*)ctx;4041if (!psc->interop)42return MESA_GLINTEROP_UNSUPPORTED;4344return psc->interop->query_device_info(drictx->driContext, out);45}4647_X_HIDDEN int48dri2_interop_export_object(struct glx_context *ctx,49struct mesa_glinterop_export_in *in,50struct mesa_glinterop_export_out *out)51{52struct dri2_screen *psc = (struct dri2_screen*)ctx->psc;53struct dri2_context *drictx = (struct dri2_context*)ctx;5455if (!psc->interop)56return MESA_GLINTEROP_UNSUPPORTED;5758return psc->interop->export_object(drictx->driContext, in, out);59}6061#if defined(HAVE_DRI3)6263_X_HIDDEN int64dri3_interop_query_device_info(struct glx_context *ctx,65struct mesa_glinterop_device_info *out)66{67struct dri3_screen *psc = (struct dri3_screen*)ctx->psc;68struct dri3_context *drictx = (struct dri3_context*)ctx;6970if (!psc->interop)71return MESA_GLINTEROP_UNSUPPORTED;7273return psc->interop->query_device_info(drictx->driContext, out);74}7576_X_HIDDEN int77dri3_interop_export_object(struct glx_context *ctx,78struct mesa_glinterop_export_in *in,79struct mesa_glinterop_export_out *out)80{81struct dri3_screen *psc = (struct dri3_screen*)ctx->psc;82struct dri3_context *drictx = (struct dri3_context*)ctx;8384if (!psc->interop)85return MESA_GLINTEROP_UNSUPPORTED;8687return psc->interop->export_object(drictx->driContext, in, out);88}8990#endif /* HAVE_DRI3 */91#endif /* defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) */929394