1 /* 2 * Copyright 2006 VMware, Inc. 3 * All Rights Reserved. 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the 7 * "Software"), to deal in the Software without restriction, including 8 * without limitation the rights to use, copy, modify, merge, publish, 9 * distribute, sublicense, and/or sell copies of the Software, and to 10 * permit persons to whom the Software is furnished to do so, subject to 11 * the following conditions: 12 * 13 * The above copyright notice and this permission notice (including the 14 * next paragraph) shall be included in all copies or substantial portions 15 * of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 */ 25 26 #ifndef INTEL_IMAGE_H 27 #define INTEL_IMAGE_H 28 29 /** @file intel_image.h 30 * 31 * Structure definitions and prototypes for __DRIimage, the driver-private 32 * structure backing EGLImage or a drawable in DRI3. 33 * 34 * The __DRIimage is passed around the loader code (src/glx and src/egl), but 35 * it's opaque to that code and may only be accessed by loader extensions 36 * (mostly located in intel_screen.c). 37 */ 38 39 #include <stdbool.h> 40 #include <xf86drm.h> 41 42 #include "main/mtypes.h" 43 #include "brw_bufmgr.h" 44 #include <GL/internal/dri_interface.h> 45 46 #ifdef __cplusplus 47 extern "C" { 48 #endif 49 50 /** 51 * Used with images created with image_from_names 52 * to help support planar images. 53 */ 54 struct intel_image_format { 55 int fourcc; 56 int components; 57 int nplanes; 58 struct { 59 int buffer_index; 60 int width_shift; 61 int height_shift; 62 uint32_t dri_format; 63 int cpp; 64 } planes[3]; 65 }; 66 67 struct __DRIimageRec { 68 struct intel_screen *screen; 69 struct brw_bo *bo; 70 uint32_t pitch; /**< in bytes */ 71 GLenum internal_format; 72 uint32_t dri_format; 73 GLuint format; /**< mesa_format or mesa_array_format */ 74 uint64_t modifier; /**< fb modifier (fourcc) */ 75 uint32_t offset; 76 77 /* 78 * Need to save these here between calls to 79 * image_from_names and calls to image_from_planar. 80 */ 81 uint32_t strides[3]; 82 uint32_t offsets[3]; 83 const struct intel_image_format *planar_format; 84 85 /* particular miptree level */ 86 GLuint width; 87 GLuint height; 88 GLuint tile_x; 89 GLuint tile_y; 90 bool has_depthstencil; 91 92 /** The image was created with EGL_EXT_image_dma_buf_import. */ 93 bool dma_buf_imported; 94 95 /** Offset of the auxiliary compression surface in the bo. */ 96 uint32_t aux_offset; 97 98 /** Pitch of the auxiliary compression surface. */ 99 uint32_t aux_pitch; 100 101 /** Total size in bytes of the auxiliary compression surface. */ 102 uint32_t aux_size; 103 104 /** 105 * Provided by EGL_EXT_image_dma_buf_import. 106 * \{ 107 */ 108 enum __DRIYUVColorSpace yuv_color_space; 109 enum __DRISampleRange sample_range; 110 enum __DRIChromaSiting horizontal_siting; 111 enum __DRIChromaSiting vertical_siting; 112 /* \} */ 113 114 void *data; 115 }; 116 117 #ifdef __cplusplus 118 } 119 #endif 120 121 #endif 122