Path: blob/21.2-virgl/src/gallium/frontends/dri/dri_screen.h
4565 views
/**************************************************************************1*2* Copyright 2009, VMware, Inc.3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/26/*27* Author: Keith Whitwell <[email protected]>28* Author: Jakob Bornecrantz <[email protected]>29*/3031#ifndef DRI_SCREEN_H32#define DRI_SCREEN_H3334#include "dri_util.h"3536#include "pipe/p_compiler.h"37#include "pipe/p_context.h"38#include "pipe/p_state.h"39#include "frontend/api.h"40#include "frontend/opencl_interop.h"41#include "os/os_thread.h"42#include "postprocess/filters.h"4344struct dri_context;45struct dri_drawable;46struct pipe_loader_device;4748struct dri_screen49{50/* st_api */51struct st_manager base;52struct st_api *st_api;5354/* on old libGL's invalidate doesn't get called as it should */55boolean broken_invalidate;5657/* dri */58__DRIscreen *sPriv;59boolean throttle;6061struct st_config_options options;6263/* Which postprocessing filters are enabled. */64unsigned pp_enabled[PP_FILTERS];6566/* drm */67int fd;68boolean can_share_buffer;6970struct pipe_loader_device *dev;7172/* gallium */73boolean d_depth_bits_last;74boolean sd_depth_bits_last;75boolean auto_fake_front;76boolean has_reset_status_query;77enum pipe_texture_target target;7879boolean swrast_no_present;8081/* hooks filled in by dri2 & drisw */82__DRIimage * (*lookup_egl_image)(struct dri_screen *ctx, void *handle);8384/* DRI exts that vary based on gallium pipe_screen caps. */85__DRIimageExtension image_extension;86__DRI2bufferDamageExtension buffer_damage_extension;8788/* DRI exts on this screen. Populated at init time based on device caps. */89const __DRIextension *screen_extensions[14];9091/* OpenCL interop */92mtx_t opencl_func_mutex;93opencl_dri_event_add_ref_t opencl_dri_event_add_ref;94opencl_dri_event_release_t opencl_dri_event_release;95opencl_dri_event_wait_t opencl_dri_event_wait;96opencl_dri_event_get_fence_t opencl_dri_event_get_fence;97};9899/** cast wrapper */100static inline struct dri_screen *101dri_screen(__DRIscreen * sPriv)102{103return (struct dri_screen *)sPriv->driverPrivate;104}105106struct __DRIimageRec {107struct pipe_resource *texture;108unsigned level;109unsigned layer;110uint32_t dri_format;111uint32_t dri_fourcc;112uint32_t dri_components;113unsigned use;114unsigned plane;115116void *loader_private;117118boolean imported_dmabuf;119/**120* Provided by EGL_EXT_image_dma_buf_import.121*/122enum __DRIYUVColorSpace yuv_color_space;123enum __DRISampleRange sample_range;124enum __DRIChromaSiting horizontal_siting;125enum __DRIChromaSiting vertical_siting;126127/* DRI loader screen */128__DRIscreen *sPriv;129};130131static inline boolean132dri_with_format(__DRIscreen * sPriv)133{134const __DRIdri2LoaderExtension *loader = sPriv->dri2.loader;135136return loader137&& (loader->base.version >= 3)138&& (loader->getBuffersWithFormat != NULL);139}140141void142dri_fill_st_visual(struct st_visual *stvis,143const struct dri_screen *screen,144const struct gl_config *mode);145146void147dri_init_options(struct dri_screen *screen);148149const __DRIconfig **150dri_init_screen_helper(struct dri_screen *screen,151struct pipe_screen *pscreen);152153void154dri_destroy_screen_helper(struct dri_screen * screen);155156void157dri_destroy_screen(__DRIscreen * sPriv);158159extern const struct __DriverAPIRec dri_kms_driver_api;160161extern const struct __DriverAPIRec galliumdrm_driver_api;162extern const __DRIextension *galliumdrm_driver_extensions[];163extern const struct __DriverAPIRec galliumsw_driver_api;164extern const __DRIextension *galliumsw_driver_extensions[];165extern const __DRIconfigOptionsExtension gallium_config_options;166167#endif168169/* vim: set sw=3 ts=8 sts=3 expandtab: */170171172