Home | History | Annotate | Download | only in i965
      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 "intel_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    drm_intel_bo *bo;
     69    uint32_t pitch; /**< in bytes */
     70    GLenum internal_format;
     71    uint32_t dri_format;
     72    GLuint format;
     73    uint32_t offset;
     74 
     75    /*
     76     * Need to save these here between calls to
     77     * image_from_names and calls to image_from_planar.
     78     */
     79    uint32_t strides[3];
     80    uint32_t offsets[3];
     81    struct intel_image_format *planar_format;
     82 
     83    /* particular miptree level */
     84    GLuint width;
     85    GLuint height;
     86    GLuint tile_x;
     87    GLuint tile_y;
     88    bool has_depthstencil;
     89 
     90    /** The image was created with EGL_EXT_image_dma_buf_import. */
     91    bool dma_buf_imported;
     92 
     93    /**
     94     * Provided by EGL_EXT_image_dma_buf_import.
     95     * \{
     96     */
     97    enum __DRIYUVColorSpace yuv_color_space;
     98    enum __DRISampleRange sample_range;
     99    enum __DRIChromaSiting horizontal_siting;
    100    enum __DRIChromaSiting vertical_siting;
    101    /* \} */
    102 
    103    void *data;
    104 };
    105 
    106 #ifdef __cplusplus
    107 }
    108 #endif
    109 
    110 #endif
    111