1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/************************************************************************** 2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright 2009, VMware, Inc. 4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * All Rights Reserved. 5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining a 7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * copy of this software and associated documentation files (the 8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * "Software"), to deal in the Software without restriction, including 9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * without limitation the rights to use, copy, modify, merge, publish, 10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * distribute, sub license, and/or sell copies of the Software, and to 11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * permit persons to whom the Software is furnished to do so, subject to 12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the following conditions: 13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice (including the 15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * next paragraph) shall be included in all copies or substantial portions 16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * of the Software. 17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org **************************************************************************/ 27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* 28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Author: Keith Whitwell <keithw@vmware.com> 29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Author: Jakob Bornecrantz <wallbraker@gmail.com> 30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef DRI_SCREEN_H 33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define DRI_SCREEN_H 34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "dri_util.h" 36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "xmlconfig.h" 37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_compiler.h" 39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_context.h" 40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_state.h" 41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "state_tracker/st_api.h" 42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct dri_context; 44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct dri_drawable; 45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct dri_screen 47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* st_api */ 49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct st_manager base; 50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct st_api *st_api; 51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* on old libGL's invalidate doesn't get called as it should */ 53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org boolean broken_invalidate; 54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* dri */ 56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org __DRIscreen *sPriv; 57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int default_throttle_frames; 58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Configuration cache with default values for all contexts 61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org driOptionCache optionCache; 63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* drm */ 65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int fd; 66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* gallium */ 68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org boolean d_depth_bits_last; 69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org boolean sd_depth_bits_last; 70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org boolean auto_fake_front; 71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org enum pipe_texture_target target; 72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* hooks filled in by dri2 & drisw */ 74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org __DRIimage * (*lookup_egl_image)(struct dri_screen *ctx, void *handle); 75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}; 76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** cast wrapper */ 78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE struct dri_screen * 79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgdri_screen(__DRIscreen * sPriv) 80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return (struct dri_screen *)sPriv->driverPrivate; 82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct __DRIimageRec { 85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct pipe_resource *texture; 86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned level; 87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned layer; 88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t dri_format; 89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t dri_components; 90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void *loader_private; 92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}; 93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef __NOT_HAVE_DRM_H 95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE boolean 97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgdri_with_format(__DRIscreen * sPriv) 98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org const __DRIdri2LoaderExtension *loader = sPriv->dri2.loader; 100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return loader 102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org && (loader->base.version >= 3) 103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org && (loader->getBuffersWithFormat != NULL); 104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 105f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 106f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#else 107f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 108f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE boolean 109f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgdri_with_format(__DRIscreen * sPriv) 110f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 111f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return TRUE; 112f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 113f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 114f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif 115f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 116f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid 117f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgdri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen, 118f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org const struct gl_config *mode); 119f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 120f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconst __DRIconfig ** 121f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgdri_init_screen_helper(struct dri_screen *screen, 122f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct pipe_screen *pscreen, 123f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned pixel_bits); 124f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 125f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid 126f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgdri_destroy_screen_helper(struct dri_screen * screen); 127f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 128f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid 129f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgdri_destroy_screen(__DRIscreen * sPriv); 130f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 131f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif 132f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 133f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* vim: set sw=3 ts=8 sts=3 expandtab: */ 134