/*1* Copyright © 2013 Keith Packard2*3* Permission to use, copy, modify, distribute, and sell this software and its4* documentation for any purpose is hereby granted without fee, provided that5* the above copyright notice appear in all copies and that both that copyright6* notice and this permission notice appear in supporting documentation, and7* that the name of the copyright holders not be used in advertising or8* publicity pertaining to distribution of the software without specific,9* written prior permission. The copyright holders make no representations10* about the suitability of this software for any purpose. It is provided "as11* is" without express or implied warranty.12*13* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,14* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO15* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR16* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,17* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER18* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE19* OF THIS SOFTWARE.20*/2122/* This file was derived from dri2_priv.h which carries the following23* copyright:24*25* Copyright © 2008 Red Hat, Inc.26*27* Permission is hereby granted, free of charge, to any person obtaining a28* copy of this software and associated documentation files (the "Soft-29* ware"), to deal in the Software without restriction, including without30* limitation the rights to use, copy, modify, merge, publish, distribute,31* and/or sell copies of the Software, and to permit persons to whom the32* Software is furnished to do so, provided that the above copyright33* notice(s) and this permission notice appear in all copies of the Soft-34* ware and that both the above copyright notice(s) and this permission35* notice appear in supporting documentation.36*37* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS38* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-39* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY40* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN41* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-42* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,43* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER44* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-45* MANCE OF THIS SOFTWARE.46*47* Except as contained in this notice, the name of a copyright holder shall48* not be used in advertising or otherwise to promote the sale, use or49* other dealings in this Software without prior written authorization of50* the copyright holder.51*52* Authors:53* Kristian Høgsberg ([email protected])54*/5556#include <xcb/xcb.h>57#include <xcb/dri3.h>58#include <xcb/present.h>59#include <xcb/sync.h>6061#include "loader_dri3_helper.h"6263/* From driconf.h, user exposed so should be stable */64#define DRI_CONF_VBLANK_NEVER 065#define DRI_CONF_VBLANK_DEF_INTERVAL_0 166#define DRI_CONF_VBLANK_DEF_INTERVAL_1 267#define DRI_CONF_VBLANK_ALWAYS_SYNC 36869struct dri3_display70{71__GLXDRIdisplay base;7273const __DRIextension **loader_extensions;7475/* DRI3 bits */76int dri3Major;77int dri3Minor;7879/* Present bits */80int hasPresent;81int presentMajor;82int presentMinor;83};8485struct dri3_screen {86struct glx_screen base;8788__DRIscreen *driScreen;89__GLXDRIscreen vtable;9091/* DRI screen is created for display GPU in case of prime.92* This screen is used to allocate linear_buffer from93* display GPU space in dri3_alloc_render_buffer() function.94*/95__DRIscreen *driScreenDisplayGPU;9697const __DRIimageExtension *image;98const __DRIimageDriverExtension *image_driver;99const __DRIcoreExtension *core;100const __DRI2flushExtension *f;101const __DRI2configQueryExtension *config;102const __DRItexBufferExtension *texBuffer;103const __DRI2rendererQueryExtension *rendererQuery;104const __DRI2interopExtension *interop;105const __DRIconfig **driver_configs;106107void *driver;108int fd;109bool is_different_gpu;110111/* fd for display GPU in case of prime */112int fd_display_gpu;113114int show_fps_interval;115116struct loader_dri3_extensions loader_dri3_ext;117};118119struct dri3_context120{121struct glx_context base;122__DRIcontext *driContext;123};124125struct dri3_drawable {126__GLXDRIdrawable base;127struct loader_dri3_drawable loader_drawable;128129/* LIBGL_SHOW_FPS support */130uint64_t previous_ust;131unsigned frames;132};133134135_X_HIDDEN int136dri3_query_renderer_integer(struct glx_screen *base, int attribute,137unsigned int *value);138139_X_HIDDEN int140dri3_query_renderer_string(struct glx_screen *base, int attribute,141const char **value);142143_X_HIDDEN int144dri3_interop_query_device_info(struct glx_context *ctx,145struct mesa_glinterop_device_info *out);146147_X_HIDDEN int148dri3_interop_export_object(struct glx_context *ctx,149struct mesa_glinterop_export_in *in,150struct mesa_glinterop_export_out *out);151152153