Blame va/va_drmcommon.h

Packit Service 9402ce
/*
Packit Service 9402ce
 * va_drmcommon.h - Common utilities for DRM-based drivers
Packit Service 9402ce
 *
Packit Service 9402ce
 * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
Packit Service 9402ce
 *
Packit Service 9402ce
 * Permission is hereby granted, free of charge, to any person obtaining a
Packit Service 9402ce
 * copy of this software and associated documentation files (the
Packit Service 9402ce
 * "Software"), to deal in the Software without restriction, including
Packit Service 9402ce
 * without limitation the rights to use, copy, modify, merge, publish,
Packit Service 9402ce
 * distribute, sub license, and/or sell copies of the Software, and to
Packit Service 9402ce
 * permit persons to whom the Software is furnished to do so, subject to
Packit Service 9402ce
 * the following conditions:
Packit Service 9402ce
 * 
Packit Service 9402ce
 * The above copyright notice and this permission notice (including the
Packit Service 9402ce
 * next paragraph) shall be included in all copies or substantial portions
Packit Service 9402ce
 * of the Software.
Packit Service 9402ce
 * 
Packit Service 9402ce
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Packit Service 9402ce
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit Service 9402ce
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
Packit Service 9402ce
 * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
Packit Service 9402ce
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
Packit Service 9402ce
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
Packit Service 9402ce
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Packit Service 9402ce
 */
Packit Service 9402ce
Packit Service 9402ce
#ifndef VA_DRM_COMMON_H
Packit Service 9402ce
#define VA_DRM_COMMON_H
Packit Service 9402ce
Packit Service 9402ce
#include <stdint.h>
Packit Service 9402ce
Packit Service 9402ce
Packit Service 9402ce
/** \brief DRM authentication type. */
Packit Service 9402ce
enum {
Packit Service 9402ce
    /** \brief Disconnected. */
Packit Service 9402ce
    VA_DRM_AUTH_NONE    = 0,
Packit Service 9402ce
    /**
Packit Service 9402ce
     * \brief Connected. Authenticated with DRI1 protocol.
Packit Service 9402ce
     *
Packit Service 9402ce
     * @deprecated
Packit Service 9402ce
     * This is a deprecated authentication type. All DRI-based drivers have
Packit Service 9402ce
     * been migrated to use the DRI2 protocol. Newly written drivers shall
Packit Service 9402ce
     * use DRI2 protocol only, or a custom authentication means. e.g. opt
Packit Service 9402ce
     * for authenticating on the VA driver side, instead of libva side.
Packit Service 9402ce
     */
Packit Service 9402ce
    VA_DRM_AUTH_DRI1    = 1,
Packit Service 9402ce
    /**
Packit Service 9402ce
     * \brief Connected. Authenticated with DRI2 protocol.
Packit Service 9402ce
     *
Packit Service 9402ce
     * This is only useful to VA/X11 drivers. The libva-x11 library provides
Packit Service 9402ce
     * a helper function VA_DRI2Authenticate() for authenticating the
Packit Service 9402ce
     * connection. However, DRI2 conformant drivers don't need to call that
Packit Service 9402ce
     * function since authentication happens on the libva side, implicitly.
Packit Service 9402ce
     */
Packit Service 9402ce
    VA_DRM_AUTH_DRI2    = 2,
Packit Service 9402ce
    /**
Packit Service 9402ce
     * \brief Connected. Authenticated with some alternate raw protocol.
Packit Service 9402ce
     *
Packit Service 9402ce
     * This authentication mode is mainly used in non-VA/X11 drivers.
Packit Service 9402ce
     * Authentication happens through some alternative method, at the
Packit Service 9402ce
     * discretion of the VA driver implementation.
Packit Service 9402ce
     */
Packit Service 9402ce
    VA_DRM_AUTH_CUSTOM  = 3
Packit Service 9402ce
};
Packit Service 9402ce
Packit Service 9402ce
/** \brief Base DRM state. */
Packit Service 9402ce
struct drm_state {
Packit Service 9402ce
    /** \brief DRM connection descriptor. */
Packit Service 9402ce
    int         fd;
Packit Service 9402ce
    /** \brief DRM authentication type. */
Packit Service 9402ce
    int         auth_type;
Packit Service 9402ce
    /** \brief Reserved bytes for future use, must be zero */
Packit Service 9402ce
    int         va_reserved[8];
Packit Service 9402ce
};
Packit Service 9402ce
Packit Service 9402ce
/** \brief Kernel DRM buffer memory type.  */
Packit Service 9402ce
#define VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM		0x10000000
Packit Service 9402ce
/** \brief DRM PRIME memory type (old version)
Packit Service 9402ce
 *
Packit Service 9402ce
 * This supports only single objects with restricted memory layout.
Packit Service 9402ce
 * Used with VASurfaceAttribExternalBuffers.
Packit Service 9402ce
 */
Packit Service 9402ce
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME		0x20000000
Packit Service 9402ce
/** \brief DRM PRIME memory type
Packit Service 9402ce
 *
Packit Service 9402ce
 * Used with VADRMPRIMESurfaceDescriptor.
Packit Service 9402ce
 */
Packit Service 9402ce
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2		0x40000000
Packit Service 9402ce
Packit Service 9402ce
/**
Packit Service 9402ce
 * \brief External buffer descriptor for a DRM PRIME surface.
Packit Service 9402ce
 *
Packit Service 9402ce
 * For export, call vaExportSurfaceHandle() with mem_type set to
Packit Service 9402ce
 * VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and pass a pointer to an
Packit Service 9402ce
 * instance of this structure to fill.
Packit Service 9402ce
 * If VA_EXPORT_SURFACE_SEPARATE_LAYERS is specified on export, each
Packit Service 9402ce
 * layer will contain exactly one plane.  For example, an NV12
Packit Service 9402ce
 * surface will be exported as two layers, one of DRM_FORMAT_R8 and
Packit Service 9402ce
 * one of DRM_FORMAT_GR88.
Packit Service 9402ce
 * If VA_EXPORT_SURFACE_COMPOSED_LAYERS is specified on export,
Packit Service 9402ce
 * there will be exactly one layer.
Packit Service 9402ce
 *
Packit Service 9402ce
 * For import, call vaCreateSurfaces() with the MemoryType attribute
Packit Service 9402ce
 * set to VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and the
Packit Service 9402ce
 * ExternalBufferDescriptor attribute set to point to an array of
Packit Service 9402ce
 * num_surfaces instances of this structure.
Packit Service 9402ce
 * The number of planes which need to be provided for a given layer
Packit Service 9402ce
 * is dependent on both the format and the format modifier used for
Packit Service 9402ce
 * the objects containing it.  For example, the format DRM_FORMAT_RGBA
Packit Service 9402ce
 * normally requires one plane, but with the format modifier
Packit Service 9402ce
 * I915_FORMAT_MOD_Y_TILED_CCS it requires two planes - the first
Packit Service 9402ce
 * being the main data plane and the second containing the color
Packit Service 9402ce
 * control surface.
Packit Service 9402ce
 * Note that a given driver may only support a subset of possible
Packit Service 9402ce
 * representations of a particular format.  For example, it may only
Packit Service 9402ce
 * support NV12 surfaces when they are contained within a single DRM
Packit Service 9402ce
 * object, and therefore fail to create such surfaces if the two
Packit Service 9402ce
 * planes are in different DRM objects.
Packit Service 9402ce
 */
Packit Service 9402ce
typedef struct _VADRMPRIMESurfaceDescriptor {
Packit Service 9402ce
    /** Pixel format fourcc of the whole surface (VA_FOURCC_*). */
Packit Service 9402ce
    uint32_t fourcc;
Packit Service 9402ce
    /** Width of the surface in pixels. */
Packit Service 9402ce
    uint32_t width;
Packit Service 9402ce
    /** Height of the surface in pixels. */
Packit Service 9402ce
    uint32_t height;
Packit Service 9402ce
    /** Number of distinct DRM objects making up the surface. */
Packit Service 9402ce
    uint32_t num_objects;
Packit Service 9402ce
    /** Description of each object. */
Packit Service 9402ce
    struct {
Packit Service 9402ce
        /** DRM PRIME file descriptor for this object. */
Packit Service 9402ce
        int fd;
Packit Service 9402ce
        /** Total size of this object (may include regions which are
Packit Service 9402ce
         *  not part of the surface). */
Packit Service 9402ce
        uint32_t size;
Packit Service 9402ce
        /** Format modifier applied to this object. */
Packit Service 9402ce
        uint64_t drm_format_modifier;
Packit Service 9402ce
    } objects[4];
Packit Service 9402ce
    /** Number of layers making up the surface. */
Packit Service 9402ce
    uint32_t num_layers;
Packit Service 9402ce
    /** Description of each layer in the surface. */
Packit Service 9402ce
    struct {
Packit Service 9402ce
        /** DRM format fourcc of this layer (DRM_FOURCC_*). */
Packit Service 9402ce
        uint32_t drm_format;
Packit Service 9402ce
        /** Number of planes in this layer. */
Packit Service 9402ce
        uint32_t num_planes;
Packit Service 9402ce
        /** Index in the objects array of the object containing each
Packit Service 9402ce
         *  plane. */
Packit Service 9402ce
        uint32_t object_index[4];
Packit Service 9402ce
        /** Offset within the object of each plane. */
Packit Service 9402ce
        uint32_t offset[4];
Packit Service 9402ce
        /** Pitch of each plane. */
Packit Service 9402ce
        uint32_t pitch[4];
Packit Service 9402ce
    } layers[4];
Packit Service 9402ce
} VADRMPRIMESurfaceDescriptor;
Packit Service 9402ce
Packit Service 9402ce
Packit Service 9402ce
#endif /* VA_DRM_COMMON_H */