17ec681f3Smrg/************************************************************************** 27ec681f3Smrg * 37ec681f3Smrg * Copyright 2009, VMware, Inc. 47ec681f3Smrg * All Rights Reserved. 57ec681f3Smrg * 67ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 77ec681f3Smrg * copy of this software and associated documentation files (the 87ec681f3Smrg * "Software"), to deal in the Software without restriction, including 97ec681f3Smrg * without limitation the rights to use, copy, modify, merge, publish, 107ec681f3Smrg * distribute, sub license, and/or sell copies of the Software, and to 117ec681f3Smrg * permit persons to whom the Software is furnished to do so, subject to 127ec681f3Smrg * the following conditions: 137ec681f3Smrg * 147ec681f3Smrg * The above copyright notice and this permission notice (including the 157ec681f3Smrg * next paragraph) shall be included in all copies or substantial portions 167ec681f3Smrg * of the Software. 177ec681f3Smrg * 187ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 197ec681f3Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 207ec681f3Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 217ec681f3Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 227ec681f3Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 237ec681f3Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 247ec681f3Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 257ec681f3Smrg * 267ec681f3Smrg **************************************************************************/ 277ec681f3Smrg/* 287ec681f3Smrg * Author: Keith Whitwell <keithw@vmware.com> 297ec681f3Smrg * Author: Jakob Bornecrantz <wallbraker@gmail.com> 307ec681f3Smrg */ 317ec681f3Smrg 327ec681f3Smrg#ifndef DRI_SCREEN_H 337ec681f3Smrg#define DRI_SCREEN_H 347ec681f3Smrg 357ec681f3Smrg#include "dri_util.h" 367ec681f3Smrg 377ec681f3Smrg#include "pipe/p_compiler.h" 387ec681f3Smrg#include "pipe/p_context.h" 397ec681f3Smrg#include "pipe/p_state.h" 407ec681f3Smrg#include "frontend/api.h" 417ec681f3Smrg#include "frontend/opencl_interop.h" 427ec681f3Smrg#include "os/os_thread.h" 437ec681f3Smrg#include "postprocess/filters.h" 447ec681f3Smrg 457ec681f3Smrgstruct dri_context; 467ec681f3Smrgstruct dri_drawable; 477ec681f3Smrgstruct pipe_loader_device; 487ec681f3Smrg 497ec681f3Smrgstruct dri_screen 507ec681f3Smrg{ 517ec681f3Smrg /* st_api */ 527ec681f3Smrg struct st_manager base; 537ec681f3Smrg struct st_api *st_api; 547ec681f3Smrg 557ec681f3Smrg /* on old libGL's invalidate doesn't get called as it should */ 567ec681f3Smrg boolean broken_invalidate; 577ec681f3Smrg 587ec681f3Smrg /* dri */ 597ec681f3Smrg __DRIscreen *sPriv; 607ec681f3Smrg boolean throttle; 617ec681f3Smrg 627ec681f3Smrg struct st_config_options options; 637ec681f3Smrg 647ec681f3Smrg /* Which postprocessing filters are enabled. */ 657ec681f3Smrg unsigned pp_enabled[PP_FILTERS]; 667ec681f3Smrg 677ec681f3Smrg /* drm */ 687ec681f3Smrg int fd; 697ec681f3Smrg boolean can_share_buffer; 707ec681f3Smrg 717ec681f3Smrg struct pipe_loader_device *dev; 727ec681f3Smrg 737ec681f3Smrg /* gallium */ 747ec681f3Smrg boolean d_depth_bits_last; 757ec681f3Smrg boolean sd_depth_bits_last; 767ec681f3Smrg boolean auto_fake_front; 777ec681f3Smrg boolean has_reset_status_query; 787ec681f3Smrg enum pipe_texture_target target; 797ec681f3Smrg 807ec681f3Smrg boolean swrast_no_present; 817ec681f3Smrg 827ec681f3Smrg /* hooks filled in by dri2 & drisw */ 837ec681f3Smrg __DRIimage * (*lookup_egl_image)(struct dri_screen *ctx, void *handle); 847ec681f3Smrg boolean (*validate_egl_image)(struct dri_screen *ctx, void *handle); 857ec681f3Smrg __DRIimage * (*lookup_egl_image_validated)(struct dri_screen *ctx, void *handle); 867ec681f3Smrg 877ec681f3Smrg /* DRI exts that vary based on gallium pipe_screen caps. */ 887ec681f3Smrg __DRIimageExtension image_extension; 897ec681f3Smrg __DRI2bufferDamageExtension buffer_damage_extension; 907ec681f3Smrg 917ec681f3Smrg /* DRI exts on this screen. Populated at init time based on device caps. */ 927ec681f3Smrg const __DRIextension *screen_extensions[14]; 937ec681f3Smrg 947ec681f3Smrg /* OpenCL interop */ 957ec681f3Smrg mtx_t opencl_func_mutex; 967ec681f3Smrg opencl_dri_event_add_ref_t opencl_dri_event_add_ref; 977ec681f3Smrg opencl_dri_event_release_t opencl_dri_event_release; 987ec681f3Smrg opencl_dri_event_wait_t opencl_dri_event_wait; 997ec681f3Smrg opencl_dri_event_get_fence_t opencl_dri_event_get_fence; 1007ec681f3Smrg}; 1017ec681f3Smrg 1027ec681f3Smrg/** cast wrapper */ 1037ec681f3Smrgstatic inline struct dri_screen * 1047ec681f3Smrgdri_screen(__DRIscreen * sPriv) 1057ec681f3Smrg{ 1067ec681f3Smrg return (struct dri_screen *)sPriv->driverPrivate; 1077ec681f3Smrg} 1087ec681f3Smrg 1097ec681f3Smrgstruct __DRIimageRec { 1107ec681f3Smrg struct pipe_resource *texture; 1117ec681f3Smrg unsigned level; 1127ec681f3Smrg unsigned layer; 1137ec681f3Smrg uint32_t dri_format; 1147ec681f3Smrg uint32_t dri_fourcc; 1157ec681f3Smrg uint32_t dri_components; 1167ec681f3Smrg unsigned use; 1177ec681f3Smrg unsigned plane; 1187ec681f3Smrg 1197ec681f3Smrg void *loader_private; 1207ec681f3Smrg 1217ec681f3Smrg boolean imported_dmabuf; 1227ec681f3Smrg /** 1237ec681f3Smrg * Provided by EGL_EXT_image_dma_buf_import. 1247ec681f3Smrg */ 1257ec681f3Smrg enum __DRIYUVColorSpace yuv_color_space; 1267ec681f3Smrg enum __DRISampleRange sample_range; 1277ec681f3Smrg enum __DRIChromaSiting horizontal_siting; 1287ec681f3Smrg enum __DRIChromaSiting vertical_siting; 1297ec681f3Smrg 1307ec681f3Smrg /* DRI loader screen */ 1317ec681f3Smrg __DRIscreen *sPriv; 1327ec681f3Smrg}; 1337ec681f3Smrg 1347ec681f3Smrgstatic inline boolean 1357ec681f3Smrgdri_with_format(__DRIscreen * sPriv) 1367ec681f3Smrg{ 1377ec681f3Smrg const __DRIdri2LoaderExtension *loader = sPriv->dri2.loader; 1387ec681f3Smrg 1397ec681f3Smrg return loader 1407ec681f3Smrg && (loader->base.version >= 3) 1417ec681f3Smrg && (loader->getBuffersWithFormat != NULL); 1427ec681f3Smrg} 1437ec681f3Smrg 1447ec681f3Smrgvoid 1457ec681f3Smrgdri_fill_st_visual(struct st_visual *stvis, 1467ec681f3Smrg const struct dri_screen *screen, 1477ec681f3Smrg const struct gl_config *mode); 1487ec681f3Smrg 1497ec681f3Smrgvoid 1507ec681f3Smrgdri_init_options(struct dri_screen *screen); 1517ec681f3Smrg 1527ec681f3Smrgconst __DRIconfig ** 1537ec681f3Smrgdri_init_screen_helper(struct dri_screen *screen, 1547ec681f3Smrg struct pipe_screen *pscreen); 1557ec681f3Smrg 1567ec681f3Smrgvoid 1577ec681f3Smrgdri_destroy_screen_helper(struct dri_screen * screen); 1587ec681f3Smrg 1597ec681f3Smrgvoid 1607ec681f3Smrgdri_destroy_screen(__DRIscreen * sPriv); 1617ec681f3Smrg 1627ec681f3Smrgextern const struct __DriverAPIRec dri_kms_driver_api; 1637ec681f3Smrg 1647ec681f3Smrgextern const struct __DriverAPIRec galliumdrm_driver_api; 1657ec681f3Smrgextern const __DRIextension *galliumdrm_driver_extensions[]; 1667ec681f3Smrgextern const struct __DriverAPIRec galliumsw_driver_api; 1677ec681f3Smrgextern const __DRIextension *galliumsw_driver_extensions[]; 1687ec681f3Smrgextern const __DRIconfigOptionsExtension gallium_config_options; 1697ec681f3Smrg 1707ec681f3Smrg#endif 1717ec681f3Smrg 1727ec681f3Smrg/* vim: set sw=3 ts=8 sts=3 expandtab: */ 173