1*61046927SAndroid Build Coastguard Worker /* 2*61046927SAndroid Build Coastguard Worker * Copyright © 2013 Keith Packard 3*61046927SAndroid Build Coastguard Worker * 4*61046927SAndroid Build Coastguard Worker * Permission to use, copy, modify, distribute, and sell this software and its 5*61046927SAndroid Build Coastguard Worker * documentation for any purpose is hereby granted without fee, provided that 6*61046927SAndroid Build Coastguard Worker * the above copyright notice appear in all copies and that both that copyright 7*61046927SAndroid Build Coastguard Worker * notice and this permission notice appear in supporting documentation, and 8*61046927SAndroid Build Coastguard Worker * that the name of the copyright holders not be used in advertising or 9*61046927SAndroid Build Coastguard Worker * publicity pertaining to distribution of the software without specific, 10*61046927SAndroid Build Coastguard Worker * written prior permission. The copyright holders make no representations 11*61046927SAndroid Build Coastguard Worker * about the suitability of this software for any purpose. It is provided "as 12*61046927SAndroid Build Coastguard Worker * is" without express or implied warranty. 13*61046927SAndroid Build Coastguard Worker * 14*61046927SAndroid Build Coastguard Worker * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15*61046927SAndroid Build Coastguard Worker * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16*61046927SAndroid Build Coastguard Worker * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17*61046927SAndroid Build Coastguard Worker * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18*61046927SAndroid Build Coastguard Worker * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19*61046927SAndroid Build Coastguard Worker * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 20*61046927SAndroid Build Coastguard Worker * OF THIS SOFTWARE. 21*61046927SAndroid Build Coastguard Worker */ 22*61046927SAndroid Build Coastguard Worker 23*61046927SAndroid Build Coastguard Worker /* This file was derived from dri2_priv.h which carries the following 24*61046927SAndroid Build Coastguard Worker * copyright: 25*61046927SAndroid Build Coastguard Worker * 26*61046927SAndroid Build Coastguard Worker * Copyright © 2008 Red Hat, Inc. 27*61046927SAndroid Build Coastguard Worker * 28*61046927SAndroid Build Coastguard Worker * Permission is hereby granted, free of charge, to any person obtaining a 29*61046927SAndroid Build Coastguard Worker * copy of this software and associated documentation files (the "Soft- 30*61046927SAndroid Build Coastguard Worker * ware"), to deal in the Software without restriction, including without 31*61046927SAndroid Build Coastguard Worker * limitation the rights to use, copy, modify, merge, publish, distribute, 32*61046927SAndroid Build Coastguard Worker * and/or sell copies of the Software, and to permit persons to whom the 33*61046927SAndroid Build Coastguard Worker * Software is furnished to do so, provided that the above copyright 34*61046927SAndroid Build Coastguard Worker * notice(s) and this permission notice appear in all copies of the Soft- 35*61046927SAndroid Build Coastguard Worker * ware and that both the above copyright notice(s) and this permission 36*61046927SAndroid Build Coastguard Worker * notice appear in supporting documentation. 37*61046927SAndroid Build Coastguard Worker * 38*61046927SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 39*61046927SAndroid Build Coastguard Worker * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 40*61046927SAndroid Build Coastguard Worker * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY 41*61046927SAndroid Build Coastguard Worker * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN 42*61046927SAndroid Build Coastguard Worker * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- 43*61046927SAndroid Build Coastguard Worker * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 44*61046927SAndroid Build Coastguard Worker * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 45*61046927SAndroid Build Coastguard Worker * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- 46*61046927SAndroid Build Coastguard Worker * MANCE OF THIS SOFTWARE. 47*61046927SAndroid Build Coastguard Worker * 48*61046927SAndroid Build Coastguard Worker * Except as contained in this notice, the name of a copyright holder shall 49*61046927SAndroid Build Coastguard Worker * not be used in advertising or otherwise to promote the sale, use or 50*61046927SAndroid Build Coastguard Worker * other dealings in this Software without prior written authorization of 51*61046927SAndroid Build Coastguard Worker * the copyright holder. 52*61046927SAndroid Build Coastguard Worker * 53*61046927SAndroid Build Coastguard Worker * Authors: 54*61046927SAndroid Build Coastguard Worker * Kristian Høgsberg ([email protected]) 55*61046927SAndroid Build Coastguard Worker */ 56*61046927SAndroid Build Coastguard Worker 57*61046927SAndroid Build Coastguard Worker #include <xcb/xcb.h> 58*61046927SAndroid Build Coastguard Worker #include <xcb/dri3.h> 59*61046927SAndroid Build Coastguard Worker #include <xcb/present.h> 60*61046927SAndroid Build Coastguard Worker #include <xcb/sync.h> 61*61046927SAndroid Build Coastguard Worker 62*61046927SAndroid Build Coastguard Worker #include "loader_dri3_helper.h" 63*61046927SAndroid Build Coastguard Worker #include "mesa_interface.h" 64*61046927SAndroid Build Coastguard Worker 65*61046927SAndroid Build Coastguard Worker struct dri3_screen { 66*61046927SAndroid Build Coastguard Worker struct glx_screen base; 67*61046927SAndroid Build Coastguard Worker 68*61046927SAndroid Build Coastguard Worker /* DRI screen is created for display GPU in case of prime gpu offloading. 69*61046927SAndroid Build Coastguard Worker * This screen is used to allocate linear_buffer from 70*61046927SAndroid Build Coastguard Worker * display GPU space in dri3_alloc_render_buffer() function. 71*61046927SAndroid Build Coastguard Worker * In case of not gpu offloading driScreenDisplayGPU will be assigned with 72*61046927SAndroid Build Coastguard Worker * base.frontend_screen. 73*61046927SAndroid Build Coastguard Worker * In case of prime gpu offloading if display and render driver names are different 74*61046927SAndroid Build Coastguard Worker * (potentially not compatible), driScreenDisplayGPU will be NULL but 75*61046927SAndroid Build Coastguard Worker * fd_display_gpu will still hold fd for display driver. 76*61046927SAndroid Build Coastguard Worker */ 77*61046927SAndroid Build Coastguard Worker __DRIscreen *driScreenDisplayGPU; 78*61046927SAndroid Build Coastguard Worker 79*61046927SAndroid Build Coastguard Worker /* fd of the GPU used for rendering. */ 80*61046927SAndroid Build Coastguard Worker int fd_render_gpu; 81*61046927SAndroid Build Coastguard Worker /* fd of the GPU used for display. If the same GPU is used for display 82*61046927SAndroid Build Coastguard Worker * and rendering, then fd_render_gpu == fd_display_gpu (no need to use 83*61046927SAndroid Build Coastguard Worker * os_same_file_description). 84*61046927SAndroid Build Coastguard Worker */ 85*61046927SAndroid Build Coastguard Worker int fd_display_gpu; 86*61046927SAndroid Build Coastguard Worker bool prefer_back_buffer_reuse; 87*61046927SAndroid Build Coastguard Worker }; 88*61046927SAndroid Build Coastguard Worker 89*61046927SAndroid Build Coastguard Worker struct dri3_drawable { 90*61046927SAndroid Build Coastguard Worker __GLXDRIdrawable base; 91*61046927SAndroid Build Coastguard Worker struct loader_dri3_drawable loader_drawable; 92*61046927SAndroid Build Coastguard Worker 93*61046927SAndroid Build Coastguard Worker /* LIBGL_SHOW_FPS support */ 94*61046927SAndroid Build Coastguard Worker uint64_t previous_ust; 95*61046927SAndroid Build Coastguard Worker unsigned frames; 96*61046927SAndroid Build Coastguard Worker }; 97