0cae7119a9a75db8369d7f8e528c766ad1155125
[mesa.git] / src / mesa / drivers / dri / i965 / intel_image.h
1 /**************************************************************************
2 *
3 * Copyright 2006 VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #ifndef INTEL_IMAGE_H
29 #define INTEL_IMAGE_H
30
31 /** @file intel_image.h
32 *
33 * Structure definitions and prototypes for __DRIimage, the driver-private
34 * structure backing EGLImage or a drawable in DRI3.
35 *
36 * The __DRIimage is passed around the loader code (src/glx and src/egl), but
37 * it's opaque to that code and may only be accessed by loader extensions
38 * (mostly located in intel_screen.c).
39 */
40
41 #include <stdbool.h>
42 #include <xf86drm.h>
43
44 #include "main/mtypes.h"
45 #include "intel_bufmgr.h"
46 #include <GL/internal/dri_interface.h>
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51
52 /**
53 * Used with images created with image_from_names
54 * to help support planar images.
55 */
56 struct intel_image_format {
57 int fourcc;
58 int components;
59 int nplanes;
60 struct {
61 int buffer_index;
62 int width_shift;
63 int height_shift;
64 uint32_t dri_format;
65 int cpp;
66 } planes[3];
67 };
68
69 struct __DRIimageRec {
70 drm_intel_bo *bo;
71 uint32_t pitch; /**< in bytes */
72 GLenum internal_format;
73 uint32_t dri_format;
74 GLuint format;
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 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 /**
93 * Provided by EGL_EXT_image_dma_buf_import.
94 *
95 * The flag is set in order to restrict the use of the image later on.
96 *
97 * See intel_image_target_texture_2d()
98 */
99 bool dma_buf_imported;
100 enum __DRIYUVColorSpace yuv_color_space;
101 enum __DRISampleRange sample_range;
102 enum __DRIChromaSiting horizontal_siting;
103 enum __DRIChromaSiting vertical_siting;
104
105 void *data;
106 };
107
108 #ifdef __cplusplus
109 }
110 #endif
111
112 #endif