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 float scaling_factor; 66 }; 67 68 struct __DRIimageRec { 69 struct intel_screen *screen; 70 struct brw_bo *bo; 71 uint32_t pitch; /**< in bytes */ 72 GLenum internal_format; 73 uint32_t dri_format; 74 GLuint format; /**< mesa_format or mesa_array_format */ 75 uint64_t modifier; /**< fb modifier (fourcc) */ 76 uint32_t offset; 77 78 /* 79 * Need to save these here between calls to 80 * image_from_names and calls to image_from_planar. 81 */ 82 uint32_t strides[3]; 83 uint32_t offsets[3]; 84 const struct intel_image_format *planar_format; 85 86 /* particular miptree level */ 87 GLuint width; 88 GLuint height; 89 GLuint tile_x; 90 GLuint tile_y; 91 bool has_depthstencil; 92 bool imported_dmabuf; 93 94 /** Offset of the auxiliary compression surface in the bo. */ 95 uint32_t aux_offset; 96 97 /** Pitch of the auxiliary compression surface. */ 98 uint32_t aux_pitch; 99 100 /** Total size in bytes of the auxiliary compression surface. */ 101 uint32_t aux_size; 102 103 /** 104 * Provided by EGL_EXT_image_dma_buf_import. 105 * \{ 106 */ 107 enum __DRIYUVColorSpace yuv_color_space; 108 enum __DRISampleRange sample_range; 109 enum __DRIChromaSiting horizontal_siting; 110 enum __DRIChromaSiting vertical_siting; 111 /* \} */ 112 113 void *data; 114 }; 115 116 #ifdef __cplusplus 117 } 118 #endif 119 120 #endif 121