replace common qcom sources with samsung ones
This commit is contained in:
450
qcom/opensource/display/libgbm/inc/gbm.h
Normal file
450
qcom/opensource/display/libgbm/inc/gbm.h
Normal file
@@ -0,0 +1,450 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Not a Contribution.
|
||||
*
|
||||
* Copyright (c) 2017, 2021 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright © 2011 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Benjamin Franzke <benjaminfranzke@googlemail.com>
|
||||
*/
|
||||
|
||||
#ifndef _GBM_H_
|
||||
#define _GBM_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define __GBM__ 1
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* \file gbm.h
|
||||
* \brief Generic Buffer Manager
|
||||
*/
|
||||
|
||||
struct gbm_device;
|
||||
struct gbm_bo;
|
||||
struct gbm_surface;
|
||||
|
||||
/**
|
||||
* \mainpage The Generic Buffer Manager
|
||||
*
|
||||
* This module provides an abstraction that the caller can use to request a
|
||||
* buffer from the underlying memory management system for the platform.
|
||||
*
|
||||
* This allows the creation of portable code whilst still allowing access to
|
||||
* the underlying memory manager.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstraction representing the handle to a buffer allocated by the
|
||||
* manager
|
||||
*/
|
||||
union gbm_bo_handle {
|
||||
void *ptr;
|
||||
int32_t s32;
|
||||
uint32_t u32;
|
||||
int64_t s64;
|
||||
uint64_t u64;
|
||||
};
|
||||
|
||||
/** Format of the allocated buffer */
|
||||
enum gbm_bo_format {
|
||||
/** RGB with 8 bits per channel in a 32 bit value */
|
||||
GBM_BO_FORMAT_XRGB8888,
|
||||
/** ARGB with 8 bits per channel in a 32 bit value */
|
||||
GBM_BO_FORMAT_ARGB8888
|
||||
};
|
||||
|
||||
#define __gbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
|
||||
((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
|
||||
|
||||
#define GBM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */
|
||||
|
||||
/* color index */
|
||||
#define GBM_FORMAT_C8 __gbm_fourcc_code('C', '8', ' ', ' ') /* [7:0] C */
|
||||
|
||||
/* 8 bpp Red */
|
||||
#define GBM_FORMAT_R8 __gbm_fourcc_code('R', '8', ' ', ' ') /* [7:0] R */
|
||||
|
||||
/* 16 bpp Red */
|
||||
#define GBM_FORMAT_R16 __gbm_fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */
|
||||
|
||||
/* 16 bpp RG */
|
||||
#define GBM_FORMAT_RG88 __gbm_fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */
|
||||
|
||||
/* 32 bpp RG */
|
||||
#define GBM_FORMAT_RG1616 __gbm_fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */
|
||||
|
||||
/* 8 bpp RGB */
|
||||
#define GBM_FORMAT_RGB332 __gbm_fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */
|
||||
#define GBM_FORMAT_BGR233 __gbm_fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */
|
||||
|
||||
/* 16 bpp RGB */
|
||||
#define GBM_FORMAT_XRGB4444 __gbm_fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */
|
||||
#define GBM_FORMAT_XBGR4444 __gbm_fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */
|
||||
#define GBM_FORMAT_RGBX4444 __gbm_fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */
|
||||
#define GBM_FORMAT_BGRX4444 __gbm_fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */
|
||||
|
||||
#define GBM_FORMAT_ARGB4444 __gbm_fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */
|
||||
#define GBM_FORMAT_ABGR4444 __gbm_fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */
|
||||
#define GBM_FORMAT_RGBA4444 __gbm_fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */
|
||||
#define GBM_FORMAT_BGRA4444 __gbm_fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */
|
||||
|
||||
#define GBM_FORMAT_XRGB1555 __gbm_fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */
|
||||
#define GBM_FORMAT_XBGR1555 __gbm_fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */
|
||||
#define GBM_FORMAT_RGBX5551 __gbm_fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */
|
||||
#define GBM_FORMAT_BGRX5551 __gbm_fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */
|
||||
|
||||
#define GBM_FORMAT_ARGB1555 __gbm_fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */
|
||||
#define GBM_FORMAT_ABGR1555 __gbm_fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */
|
||||
#define GBM_FORMAT_RGBA5551 __gbm_fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */
|
||||
#define GBM_FORMAT_BGRA5551 __gbm_fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */
|
||||
|
||||
#define GBM_FORMAT_RGB565 __gbm_fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */
|
||||
#define GBM_FORMAT_BGR565 __gbm_fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */
|
||||
|
||||
/* 24 bpp RGB */
|
||||
#define GBM_FORMAT_RGB888 __gbm_fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */
|
||||
#define GBM_FORMAT_BGR888 __gbm_fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */
|
||||
|
||||
/* 32 bpp RGB */
|
||||
#define GBM_FORMAT_XRGB8888 __gbm_fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */
|
||||
#define GBM_FORMAT_XBGR8888 __gbm_fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */
|
||||
#define GBM_FORMAT_RGBX8888 __gbm_fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */
|
||||
#define GBM_FORMAT_BGRX8888 __gbm_fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */
|
||||
|
||||
#define GBM_FORMAT_ARGB8888 __gbm_fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */
|
||||
#define GBM_FORMAT_ABGR8888 __gbm_fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */
|
||||
#define GBM_FORMAT_RGBA8888 __gbm_fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */
|
||||
#define GBM_FORMAT_BGRA8888 __gbm_fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */
|
||||
|
||||
#define GBM_FORMAT_XRGB2101010 __gbm_fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */
|
||||
#define GBM_FORMAT_XBGR2101010 __gbm_fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */
|
||||
#define GBM_FORMAT_RGBX1010102 __gbm_fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */
|
||||
#define GBM_FORMAT_BGRX1010102 __gbm_fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */
|
||||
|
||||
#define GBM_FORMAT_ARGB2101010 __gbm_fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */
|
||||
#define GBM_FORMAT_ABGR2101010 __gbm_fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */
|
||||
#define GBM_FORMAT_RGBA1010102 __gbm_fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
|
||||
#define GBM_FORMAT_BGRA1010102 __gbm_fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
|
||||
|
||||
/* packed YCbCr */
|
||||
#define GBM_FORMAT_YUYV __gbm_fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
|
||||
#define GBM_FORMAT_YVYU __gbm_fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
|
||||
#define GBM_FORMAT_UYVY __gbm_fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */
|
||||
#define GBM_FORMAT_VYUY __gbm_fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
|
||||
|
||||
#define GBM_FORMAT_AYUV __gbm_fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
|
||||
|
||||
/*
|
||||
* 2 plane YCbCr
|
||||
* index 0 = Y plane, [7:0] Y
|
||||
* index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
|
||||
* or
|
||||
* index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
|
||||
*/
|
||||
#define GBM_FORMAT_NV12 __gbm_fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */
|
||||
#define GBM_FORMAT_NV21 __gbm_fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */
|
||||
#define GBM_FORMAT_NV16 __gbm_fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */
|
||||
#define GBM_FORMAT_NV61 __gbm_fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */
|
||||
|
||||
/*
|
||||
* 3 plane YCbCr
|
||||
* index 0: Y plane, [7:0] Y
|
||||
* index 1: Cb plane, [7:0] Cb
|
||||
* index 2: Cr plane, [7:0] Cr
|
||||
* or
|
||||
* index 1: Cr plane, [7:0] Cr
|
||||
* index 2: Cb plane, [7:0] Cb
|
||||
*/
|
||||
#define GBM_FORMAT_YUV410 __gbm_fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */
|
||||
#define GBM_FORMAT_YVU410 __gbm_fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */
|
||||
#define GBM_FORMAT_YUV411 __gbm_fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */
|
||||
#define GBM_FORMAT_YVU411 __gbm_fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */
|
||||
#define GBM_FORMAT_YUV420 __gbm_fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
|
||||
#define GBM_FORMAT_YVU420 __gbm_fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */
|
||||
#define GBM_FORMAT_YUV422 __gbm_fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */
|
||||
#define GBM_FORMAT_YVU422 __gbm_fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */
|
||||
#define GBM_FORMAT_YUV444 __gbm_fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
|
||||
#define GBM_FORMAT_YVU444 __gbm_fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
|
||||
|
||||
struct gbm_format_name_desc {
|
||||
char name[5];
|
||||
};
|
||||
|
||||
/**
|
||||
* Flags to indicate the intended use for the buffer - these are passed into
|
||||
* gbm_bo_create(). The caller must set the union of all the flags that are
|
||||
* appropriate
|
||||
*
|
||||
* \sa Use gbm_device_is_format_supported() to check if the combination of format
|
||||
* and use flags are supported
|
||||
*/
|
||||
enum gbm_bo_flags {
|
||||
/**
|
||||
* Buffer is going to be presented to the screen using an API such as KMS
|
||||
*/
|
||||
GBM_BO_USE_SCANOUT = (1 << 0),
|
||||
/**
|
||||
* Buffer is going to be used as cursor
|
||||
*/
|
||||
GBM_BO_USE_CURSOR = (1 << 1),
|
||||
/**
|
||||
* Deprecated
|
||||
*/
|
||||
GBM_BO_USE_CURSOR_64X64 = GBM_BO_USE_CURSOR,
|
||||
/**
|
||||
* Buffer is to be used for rendering - for example it is going to be used
|
||||
* as the storage for a color buffer
|
||||
*/
|
||||
GBM_BO_USE_RENDERING = (1 << 2),
|
||||
/**
|
||||
* Buffer can be used for gbm_bo_write. This is guaranteed to work
|
||||
* with GBM_BO_USE_CURSOR. but may not work for other combinations.
|
||||
*/
|
||||
GBM_BO_USE_WRITE = (1 << 3),
|
||||
/**
|
||||
* Buffer is linear, i.e. not tiled.
|
||||
*/
|
||||
GBM_BO_USE_LINEAR = (1 << 4),
|
||||
};
|
||||
|
||||
int
|
||||
gbm_device_get_fd(struct gbm_device *gbm);
|
||||
|
||||
const char *
|
||||
gbm_device_get_backend_name(struct gbm_device *gbm);
|
||||
|
||||
int
|
||||
gbm_device_is_format_supported(struct gbm_device *gbm,
|
||||
uint32_t format, uint32_t usage);
|
||||
|
||||
int
|
||||
gbm_device_get_format_modifier_plane_count(struct gbm_device *gbm,
|
||||
uint32_t format,
|
||||
uint64_t modifier);
|
||||
|
||||
void
|
||||
gbm_device_destroy(struct gbm_device *gbm);
|
||||
|
||||
struct gbm_device *
|
||||
gbm_create_device(int fd);
|
||||
|
||||
struct gbm_bo *
|
||||
gbm_bo_create(struct gbm_device *gbm,
|
||||
uint32_t width, uint32_t height,
|
||||
uint32_t format, uint32_t flags);
|
||||
|
||||
struct gbm_bo *
|
||||
gbm_bo_create_with_modifiers(struct gbm_device *gbm,
|
||||
uint32_t width, uint32_t height,
|
||||
uint32_t format,
|
||||
const uint64_t *modifiers,
|
||||
const unsigned int count);
|
||||
|
||||
#define GBM_BO_IMPORT_WL_BUFFER 0x5501
|
||||
#define GBM_BO_IMPORT_EGL_IMAGE 0x5502
|
||||
#define GBM_BO_IMPORT_FD 0x5503
|
||||
#define GBM_BO_IMPORT_FD_MODIFIER 0x5504
|
||||
|
||||
struct gbm_import_fd_data {
|
||||
int fd;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t stride;
|
||||
uint32_t format;
|
||||
};
|
||||
|
||||
#define GBM_MAX_PLANES 4
|
||||
|
||||
struct gbm_import_fd_modifier_data {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t format;
|
||||
uint32_t num_fds;
|
||||
int fds[GBM_MAX_PLANES];
|
||||
int strides[GBM_MAX_PLANES];
|
||||
int offsets[GBM_MAX_PLANES];
|
||||
uint64_t modifier;
|
||||
};
|
||||
|
||||
struct gbm_bo *
|
||||
gbm_bo_import(struct gbm_device *gbm, uint32_t type,
|
||||
void *buffer, uint32_t usage);
|
||||
|
||||
/**
|
||||
* Flags to indicate the type of mapping for the buffer - these are
|
||||
* passed into gbm_bo_map(). The caller must set the union of all the
|
||||
* flags that are appropriate.
|
||||
*
|
||||
* These flags are independent of the GBM_BO_USE_* creation flags. However,
|
||||
* mapping the buffer may require copying to/from a staging buffer.
|
||||
*
|
||||
* See also: pipe_transfer_usage
|
||||
*/
|
||||
enum gbm_bo_transfer_flags {
|
||||
/**
|
||||
* Buffer contents read back (or accessed directly) at transfer
|
||||
* create time.
|
||||
*/
|
||||
GBM_BO_TRANSFER_READ = (1 << 0),
|
||||
/**
|
||||
* Buffer contents will be written back at unmap time
|
||||
* (or modified as a result of being accessed directly).
|
||||
*/
|
||||
GBM_BO_TRANSFER_WRITE = (1 << 1),
|
||||
/**
|
||||
* Read/modify/write
|
||||
*/
|
||||
GBM_BO_TRANSFER_READ_WRITE = (GBM_BO_TRANSFER_READ | GBM_BO_TRANSFER_WRITE),
|
||||
};
|
||||
|
||||
void *
|
||||
gbm_bo_map(struct gbm_bo *bo,
|
||||
uint32_t x, uint32_t y, uint32_t width, uint32_t height,
|
||||
uint32_t flags, uint32_t *stride, void **map_data);
|
||||
|
||||
void
|
||||
gbm_bo_unmap(struct gbm_bo *bo, void *map_data);
|
||||
|
||||
uint32_t
|
||||
gbm_bo_get_width(struct gbm_bo *bo);
|
||||
|
||||
uint32_t
|
||||
gbm_bo_get_height(struct gbm_bo *bo);
|
||||
|
||||
uint32_t
|
||||
gbm_bo_get_stride(struct gbm_bo *bo);
|
||||
|
||||
uint32_t
|
||||
gbm_bo_get_stride_for_plane(struct gbm_bo *bo, int plane);
|
||||
|
||||
uint32_t
|
||||
gbm_bo_get_format(struct gbm_bo *bo);
|
||||
|
||||
uint32_t
|
||||
gbm_bo_get_bpp(struct gbm_bo *bo);
|
||||
|
||||
uint32_t
|
||||
gbm_bo_get_offset(struct gbm_bo *bo, int plane);
|
||||
|
||||
struct gbm_device *
|
||||
gbm_bo_get_device(struct gbm_bo *bo);
|
||||
|
||||
union gbm_bo_handle
|
||||
gbm_bo_get_handle(struct gbm_bo *bo);
|
||||
|
||||
int
|
||||
gbm_bo_get_fd(struct gbm_bo *bo);
|
||||
|
||||
uint64_t
|
||||
gbm_bo_get_modifier(struct gbm_bo *bo);
|
||||
|
||||
int
|
||||
gbm_bo_get_plane_count(struct gbm_bo *bo);
|
||||
|
||||
union gbm_bo_handle
|
||||
gbm_bo_get_handle_for_plane(struct gbm_bo *bo, int plane);
|
||||
|
||||
int
|
||||
gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
|
||||
|
||||
void
|
||||
gbm_bo_set_user_data(struct gbm_bo *bo, void *data,
|
||||
void (*destroy_user_data)(struct gbm_bo *, void *));
|
||||
|
||||
void *
|
||||
gbm_bo_get_user_data(struct gbm_bo *bo);
|
||||
|
||||
void
|
||||
gbm_bo_destroy(struct gbm_bo *bo);
|
||||
|
||||
struct gbm_surface *
|
||||
gbm_surface_create(struct gbm_device *gbm,
|
||||
uint32_t width, uint32_t height,
|
||||
uint32_t format, uint32_t flags);
|
||||
|
||||
struct gbm_surface *
|
||||
gbm_surface_create_with_modifiers(struct gbm_device *gbm,
|
||||
uint32_t width, uint32_t height,
|
||||
uint32_t format,
|
||||
const uint64_t *modifiers,
|
||||
const unsigned int count);
|
||||
|
||||
int
|
||||
gbm_surface_needs_lock_front_buffer(struct gbm_surface *surface);
|
||||
|
||||
struct gbm_bo *
|
||||
gbm_surface_lock_front_buffer(struct gbm_surface *surface);
|
||||
|
||||
void
|
||||
gbm_surface_release_buffer(struct gbm_surface *surface, struct gbm_bo *bo);
|
||||
|
||||
int
|
||||
gbm_surface_has_free_buffers(struct gbm_surface *surface);
|
||||
|
||||
void
|
||||
gbm_surface_destroy(struct gbm_surface *surface);
|
||||
|
||||
char *
|
||||
gbm_format_get_name(uint32_t gbm_format, struct gbm_format_name_desc *desc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
812
qcom/opensource/display/libgbm/inc/gbm_priv.h
Normal file
812
qcom/opensource/display/libgbm/inc/gbm_priv.h
Normal file
@@ -0,0 +1,812 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Not a Contribution.
|
||||
*
|
||||
* Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
*Not a contribution
|
||||
*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* Copyright © 2011 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Benjamin Franzke <benjaminfranzke@googlemail.com>
|
||||
*/
|
||||
|
||||
#ifndef GBM_PRIV_H_
|
||||
#define GBM_PRIV_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \file gbm_priv.h
|
||||
* \brief: This header file would be an interface for Graphics and video clients
|
||||
*
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include <gbm.h>
|
||||
#include <color_metadata.h>
|
||||
/**
|
||||
* These are the flags used by the clients during allocation to
|
||||
* indicate the purpose of allocation to the gbm backend.
|
||||
* Gbm backend can use them to decide on the ION heap id and ION flags to be
|
||||
* used as part of ION allocation.
|
||||
* NOTE:
|
||||
* These usage flags are extension to the open source gbm.h defined
|
||||
* flags, so the initial integer value of these flags has spacing to avoid
|
||||
* conflicts
|
||||
*/
|
||||
/** These allocation heap are used to select the corresponding ION heap id. */
|
||||
#define GBM_BO_ALLOC_SYSTEM_HEAP_QTI 0x00000100 /*BO allocation from system heap*/
|
||||
#define GBM_BO_ALLOC_SECURE_HEAP_QTI 0x00000200 /*BO allocation from secure heap*/
|
||||
#define GBM_BO_ALLOC_SECURE_DISPLAY_HEAP_QTI 0x00000400 /*BO allocation from secure-display heap*/
|
||||
#define GBM_BO_ALLOC_ADSP_HEAP_QTI 0x00000800 /*BO allocation from ADSP heap*/
|
||||
#define GBM_BO_ALLOC_CAMERA_HEAP_QTI 0x00001000 /*BO allocation from camera heap*/
|
||||
#define GBM_BO_ALLOC_IOMMU_HEAP_QTI 0x00002000 /*BO allocation from IOMMU heap*/
|
||||
#define GBM_BO_ALLOC_MM_HEAP_QTI 0x00004000 /*BO allocation from MM heap*/
|
||||
|
||||
/** These usage flags are used to inform GBM backend about the usage of the allcated BO.*/
|
||||
#define GBM_BO_USAGE_PROTECTED_QTI 0x00008000 /*BO allocation flag to get protected BO*/
|
||||
#define GBM_BO_USAGE_UNCACHED_QTI 0x00010000 /*BO allocation flag to get uncached BO*/
|
||||
#define GBM_BO_USAGE_CPU_READ_QTI 0x00020000 /*BO has CPU read access */
|
||||
#define GBM_BO_USAGE_CPU_WRITE_QTI 0x00040000 /*BO has CPU write access */
|
||||
#define GBM_BO_USAGE_NON_CPU_WRITER_QTI 0x00080000 /*BO has non-CPU writer access */
|
||||
#define GBM_BO_USAGE_UBWC_ALIGNED_QTI 0x00100000 /*BO allocation for UBWC enabled client request*/
|
||||
#define GBM_BO_USAGE_CAMERA_READ_QTI 0x00200000 /*BO used for camera consumer */
|
||||
#define GBM_BO_USAGE_CAMERA_WRITE_QTI 0x00400000 /*BO used for camera producer */
|
||||
#define GBM_BO_USAGE_VIDEO_ENCODER_QTI 0x00800000 /*BO used for video encoder */
|
||||
#define GBM_BO_USAGE_HW_COMPOSER_QTI 0x01000000 /*BO used for video encoder */
|
||||
#define GBM_BO_USAGE_HW_RENDERING_QTI 0x02000000 /*BO allocation for GPU based rendering operation */
|
||||
#define GBM_BO_USAGE_10BIT_QTI 0x04000000 /*BO allocation for 10 bit */
|
||||
#define GBM_BO_USAGE_10BIT_TP_QTI 0x08000000 /*BO allocation for 10 bit TP */
|
||||
#define GBM_BO_USAGE_EGL_IMAGE_QTI 0x10000000 /*BO allocation for EGL image operation */
|
||||
|
||||
/**
|
||||
* These are the parameter types to be used by the clients to query metadata info from gbm backend
|
||||
*
|
||||
*/
|
||||
#define GBM_METADATA_GET_INTERLACED 0x00000001 /*Param type to query Interlaced field*/
|
||||
|
||||
#define GBM_METADATA_GET_REFRESH_RATE 0x00000002 /*Param type to query Refresh rate field*/
|
||||
|
||||
#define GBM_METADATA_GET_MAP_SECURE_BUFFER 0x00000004 /*Param type to query map secure buffer field*/
|
||||
|
||||
#define GBM_METADATA_GET_LINEAR_FORMAT 0x00000008 /*Param type to query linear format field*/
|
||||
|
||||
#define GBM_METADATA_GET_COLOR_SPACE 0x00000010 /*Param type to query Color space field*/
|
||||
|
||||
#define GBM_METADATA_GET_IGC 0x00000020 /*Param type to query IGC field*/
|
||||
|
||||
#define GBM_METADATA_GET_S3DFORMAT 0x00000040 /*Param type to query S3D format field*/
|
||||
|
||||
#define GBM_METADATA_GET_SECURE_BUF_STAT 0x00000080 /*Param type to query secure buffer status*/
|
||||
|
||||
#define GBM_METADATA_GET_COLOR_METADATA 0x00000100 /*Param type to query Color Metadata*/
|
||||
|
||||
#define GBM_METADATA_GET_UBWC_BUF_STAT 0x00000200 /*Param type to query UBWC buffer status*/
|
||||
|
||||
#define GBM_METADATA_GET_VT_TIMESTAMP 0x00000400 /*Param type to query VT timestamp*/
|
||||
|
||||
#define GBM_METADATA_GET_VIDEO_PERF_MODE 0x00000800 /*Param type to query Video Perf mode*/
|
||||
|
||||
#define GBM_METADATA_GET_CVP_METADATA 0x00001000 /*Param type to query CVPMetadata*/
|
||||
|
||||
#define GBM_METADATA_GET_VIDEO_HIST_STAT 0x00002000 /*Param type to query Video Histogram Stat*/
|
||||
|
||||
/**
|
||||
* These are the parameter types to be used by the clients to set metadata info from gbm backend
|
||||
*
|
||||
*/
|
||||
#define GBM_METADATA_SET_INTERLACED 0x00000001 /*Param type to set Interlaced field*/
|
||||
|
||||
#define GBM_METADATA_SET_REFRESH_RATE 0x00000002 /*Param type to set Refresh rate field*/
|
||||
|
||||
#define GBM_METADATA_SET_MAP_SECURE_BUFFER 0x00000004 /*Param type to set map secure buffer field*/
|
||||
|
||||
#define GBM_METADATA_SET_LINEAR_FORMAT 0x00000008 /*Param type to set linear format field*/
|
||||
|
||||
#define GBM_METADATA_SET_COLOR_SPACE 0x00000010 /*Param type to set Color space field*/
|
||||
|
||||
#define GBM_METADATA_SET_IGC 0x00000020 /*Param type to set IGC field*/
|
||||
|
||||
#define GBM_METADATA_SET_S3DFORMAT 0x00000040 /*Param type to set S3D format field*/
|
||||
|
||||
#define GBM_METADATA_SET_COLOR_METADATA 0x00000080 /*Param type to set Color Metadata*/
|
||||
|
||||
#define GBM_METADATA_SET_VT_TIMESTAMP 0x00000100 /*Param type to set VT timestamp*/
|
||||
|
||||
#define GBM_METADATA_SET_VIDEO_PERF_MODE 0x00000200 /*Param type to set Video Perf mode*/
|
||||
|
||||
#define GBM_METADATA_SET_CVP_METADATA 0x00000400 /*Param type to set CVPMetadata*/
|
||||
|
||||
#define GBM_METADATA_SET_VIDEO_HIST_STAT 0x00000800 /*Param type to set Video Histogram Stat*/
|
||||
|
||||
/**
|
||||
* These define the color space value for the Metadata Color space entry
|
||||
*
|
||||
*/
|
||||
#define GBM_METADATA_COLOR_SPACE_ITU_R_601 0x1
|
||||
|
||||
#define GBM_METADATA_COLOR_SPACE_ITU_R_601_FR 0x2
|
||||
|
||||
#define GBM_METADATA_COLOR_SPACE_ITU_R_709 0x3
|
||||
|
||||
#define GBM_METADATA_COLOR_SPACE_ITU_R_2020 0x4
|
||||
|
||||
#define GBM_METADATA_COLOR_SPACE_ITU_R_2020_FR 0x5
|
||||
|
||||
|
||||
/**
|
||||
* These define the IGC value for the Metadata IGC entry
|
||||
*
|
||||
*/
|
||||
#define GBM_METADATA_IGC_NONE 0x1
|
||||
|
||||
#define GBM_METADATA_IGC_sRGB 0x2
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Supported Perform API Operation Opcodes
|
||||
*
|
||||
*/
|
||||
#define GBM_PERFORM_GET_SURFACE_FORMAT 0x0 /*Query user provided format from the
|
||||
gbm surface*/
|
||||
|
||||
#define GBM_PERFORM_GET_SURFACE_WIDTH 0x1 /*Query user provided width from the
|
||||
gbm surface */
|
||||
|
||||
#define GBM_PERFORM_GET_SURFACE_HEIGHT 0x2 /*Query user provided height from the
|
||||
gbm surface*/
|
||||
|
||||
#define GBM_PERFORM_SET_SURFACE_FRONT_BO 0x3 /*Update the current state to
|
||||
NEW_FRONT_BUFFER of the BO associated
|
||||
with the gbm surface*/
|
||||
|
||||
#define GBM_PERFORM_GET_SURFACE_FREE_BO 0x4 /*Return the BO which is marked free
|
||||
associated with the gbm surface */
|
||||
|
||||
#define GBM_PERFORM_VALIDATE_SURFACE 0x5 /*Validate the GBM Surface*/
|
||||
|
||||
#define GBM_PERFORM_CPU_MAP_FOR_BO 0x6 /*Return the mapped address to the
|
||||
BO buffer*/
|
||||
|
||||
#define GBM_PERFORM_CPU_UNMAP_FOR_BO 0x7 /*Unmap the already mapped BO buffer*/
|
||||
|
||||
#define GBM_PERFORM_GET_BO_SIZE 0x8 /*Query BO buffer size*/
|
||||
|
||||
#define GBM_PERFORM_GET_BO_NAME 0x9 /*Query BO buffer name*/
|
||||
|
||||
#define GBM_PERFORM_IMPORT_BO_FROM_NAME 0x11 /*Import BO from specified name*/
|
||||
|
||||
#define GBM_PERFORM_GET_DRM_DEVICE_MAGIC 0x12 /*Query DRM Device magic id */
|
||||
|
||||
#define GBM_PERFORM_AUTH_DRM_DEVICE_MAGIC 0x13 /*Authenticate DRM Device magic id */
|
||||
|
||||
#define GBM_PERFORM_GET_DRM_DEVICE_NAME 0x14 /*Query DRM Device name */
|
||||
|
||||
#define GBM_PERFORM_VALIDATE_DEVICE 0x15 /*Validate the GBM Device*/
|
||||
|
||||
#define GBM_PERFORM_GET_METADATA 0x16 /*Query Metadata info */
|
||||
|
||||
#define GBM_PERFORM_SET_METADATA 0x17 /*Set Metadata info */
|
||||
|
||||
#define GBM_PERFORM_GET_YUV_PLANE_INFO 0x18 /*Query YUV plane info */
|
||||
|
||||
#define GBM_PERFORM_GET_UBWC_STATUS 0x19 /*Query if the BO Allocation was
|
||||
with UBWC enabled hardware*/
|
||||
|
||||
#define GBM_PERFORM_GET_RGB_DATA_ADDRESS 0x20 /*Query for RGB data base address*/
|
||||
|
||||
#define GBM_PERFORM_SET_GPU_ADDR_FOR_BO 0x21 /*Set GPU addr */
|
||||
|
||||
#define GBM_PERFORM_GET_GPU_ADDR_FOR_BO 0x22 /* Query GPU Addr */
|
||||
|
||||
#define GBM_PERFORM_GET_SECURE_BUFFER_STATUS 0x23 /* Query Buffer is secured */
|
||||
|
||||
#define GBM_PERFORM_GET_METADATA_ION_FD 0x24 /* Get Metadata ion fd from BO*/
|
||||
|
||||
#define GBM_PERFORM_DUMP_HASH_MAP 0x25 /* Dump the existing hash map
|
||||
table contents*/
|
||||
|
||||
#define GBM_PERFORM_DUMP_BO_CONTENT 0x26 /* Dump the BO buffer contents
|
||||
on to a file*/
|
||||
|
||||
#define GBM_PERFORM_GET_BO_ALIGNED_WIDTH 0x27 /* Get Aligned width from BO*/
|
||||
|
||||
#define GBM_PERFORM_GET_BO_ALIGNED_HEIGHT 0x28 /* Get Aligned height from BO*/
|
||||
|
||||
#define GBM_PERFORM_GET_PLANE_INFO 0x29 /* Get Plane Info from BO*/
|
||||
|
||||
#define GBM_PERFORM_DEFAULT_INIT_COLOR_META 0x30 /* Initialize Color Meta structure with
|
||||
default values to validate */
|
||||
|
||||
#define GBM_PERFORM_DUMP_COLOR_META 0x31 /* Dump Color Meta structure */
|
||||
|
||||
#define GBM_PERFORM_GET_BUFFER_SIZE_DIMENSIONS 0x32 /* Query Buffer size and dimenstions
|
||||
(aligned width, aligned height and size)*/
|
||||
|
||||
#define GBM_PERFORM_GET_SURFACE_UBWC_STATUS 0x33 /* Query if the Surface BO Allocation was
|
||||
with UBWC enabled hardware */
|
||||
|
||||
#define GBM_PERFORM_GET_WL_RESOURCE_FROM_GBM_BUF_INFO 0x34 /* Get wl_resource from gbm_buf_info*/
|
||||
|
||||
#define GBM_PERFORM_GET_GBM_BUF_INFO_FROM_WL_RESOURCE 0x35 /* Retrieve gbm_buf_info from
|
||||
wl_resource */
|
||||
|
||||
#define GBM_PERFORM_GET_RENDER_DEVICE_NAME 0x36 /* Get render node for user */
|
||||
|
||||
#define GBM_PERFORM_GET_BUFFER_STRIDE_SCANLINE_SIZE 0x37 /* Query Buffer stride, scanline and size
|
||||
(stride, scanline and size)*/
|
||||
|
||||
#define GBM_PERFORM_GET_FD_WITH_NEW 0x38 /* Query whether get fd with new */
|
||||
/**
|
||||
* Error representation for GBM API's
|
||||
*
|
||||
*/
|
||||
#define GBM_ERROR_NONE 0x0
|
||||
|
||||
#define GBM_ERROR_BAD_DESCRIPTOR 0x1
|
||||
|
||||
#define GBM_ERROR_BAD_HANDLE 0x2
|
||||
|
||||
#define GBM_ERROR_BAD_VALUE 0x3
|
||||
|
||||
#define GBM_ERROR_NOT_SHARED 0x4
|
||||
|
||||
#define GBM_ERROR_NO_RESOURCES 0x5
|
||||
|
||||
#define GBM_ERROR_UNDEFINED 0x6
|
||||
|
||||
#define GBM_ERROR_UNSUPPORTED 0x7
|
||||
|
||||
/**
|
||||
* Custom import type define
|
||||
* In case there are more enums added to GBM import,
|
||||
* they'd be in sequential order.To avoid conflicts it's
|
||||
* best to have an unused range ... 0x4FFF and decremented
|
||||
* if we have any more imports added
|
||||
*/
|
||||
#define GBM_BO_IMPORT_GBM_BUF_TYPE 0x4FFF
|
||||
|
||||
/**
|
||||
* Custom 4CC Modifiers
|
||||
*
|
||||
* Format Modifiers info extracted from open source drm_fourcc.h:
|
||||
*
|
||||
* Format modifiers describe, typically, a re-ordering or modification
|
||||
* of the data in a plane of an FB. This can be used to express tiled/
|
||||
* swizzled formats, or compression, or a combination of the two.
|
||||
*
|
||||
* The upper 4 bits of the format modifier are a vendor-id as assigned
|
||||
* below. The lower 28 bits are assigned as vendor sees fit.
|
||||
*/
|
||||
|
||||
/* Vendor Ids: */
|
||||
#define GBM_FORMAT_MOD_VENDOR_QTI 0x05
|
||||
|
||||
/* add more to the end as needed */
|
||||
#define fourcc_mod_code_qti(vendor, val) \
|
||||
((((uint32_t)GBM_FORMAT_MOD_VENDOR_## vendor) << 28) | (val & 0x0fffffffULL))
|
||||
|
||||
/**
|
||||
* Below is the list of Custom 4CC modes supported by libgbm
|
||||
*
|
||||
*/
|
||||
#define GBM_FORMAT_RAW16 fourcc_mod_code_qti(QTI, 1)
|
||||
|
||||
#define GBM_FORMAT_RAW10 fourcc_mod_code_qti(QTI, 2)
|
||||
|
||||
#define GBM_FORMAT_RAW12 fourcc_mod_code_qti(QTI, 3)
|
||||
|
||||
#define GBM_FORMAT_RAW8 fourcc_mod_code_qti(QTI, 4)
|
||||
|
||||
#define GBM_FORMAT_YV12 fourcc_mod_code_qti(QTI, 5)
|
||||
|
||||
#define GBM_FORMAT_YCbCr_420_SP fourcc_mod_code_qti(QTI, 6)
|
||||
|
||||
#define GBM_FORMAT_YCrCb_420_SP fourcc_mod_code_qti(QTI, 7)
|
||||
|
||||
#define GBM_FORMAT_YCbCr_422_SP fourcc_mod_code_qti(QTI, 8)
|
||||
|
||||
#define GBM_FORMAT_YCrCb_422_SP fourcc_mod_code_qti(QTI, 9)
|
||||
|
||||
#define GBM_FORMAT_YCbCr_422_I fourcc_mod_code_qti(QTI, 10)
|
||||
|
||||
#define GBM_FORMAT_YCrCb_422_I fourcc_mod_code_qti(QTI, 11)
|
||||
|
||||
#define GBM_FORMAT_YCbCr_420_SP_VENUS fourcc_mod_code_qti(QTI, 12)
|
||||
|
||||
#define GBM_FORMAT_NV12_ENCODEABLE fourcc_mod_code_qti(QTI, 13)
|
||||
|
||||
#define GBM_FORMAT_YCrCb_420_SP_VENUS fourcc_mod_code_qti(QTI, 14)
|
||||
|
||||
#define GBM_FORMAT_NV21_ZSL fourcc_mod_code_qti(QTI, 15)
|
||||
|
||||
#define GBM_FORMAT_BLOB fourcc_mod_code_qti(QTI, 16)
|
||||
|
||||
#define GBM_FORMAT_RAW_OPAQUE fourcc_mod_code_qti(QTI, 17)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR fourcc_mod_code_qti(QTI, 18)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR fourcc_mod_code_qti(QTI, 19)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR fourcc_mod_code_qti(QTI, 20)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR fourcc_mod_code_qti(QTI, 21)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR fourcc_mod_code_qti(QTI, 22)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR fourcc_mod_code_qti(QTI, 23)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR fourcc_mod_code_qti(QTI, 24)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR fourcc_mod_code_qti(QTI, 25)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR fourcc_mod_code_qti(QTI, 26)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR fourcc_mod_code_qti(QTI, 27)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR fourcc_mod_code_qti(QTI, 28)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR fourcc_mod_code_qti(QTI, 29)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR fourcc_mod_code_qti(QTI, 30)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR fourcc_mod_code_qti(QTI, 31)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR fourcc_mod_code_qti(QTI, 32)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR fourcc_mod_code_qti(QTI, 33)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR fourcc_mod_code_qti(QTI, 34)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR fourcc_mod_code_qti(QTI, 35)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR fourcc_mod_code_qti(QTI, 36)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR fourcc_mod_code_qti(QTI, 37)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR fourcc_mod_code_qti(QTI, 38)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR fourcc_mod_code_qti(QTI, 39)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR fourcc_mod_code_qti(QTI, 40)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR fourcc_mod_code_qti(QTI, 41)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR fourcc_mod_code_qti(QTI, 42)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR fourcc_mod_code_qti(QTI, 43)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR fourcc_mod_code_qti(QTI, 44)
|
||||
|
||||
#define GBM_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR fourcc_mod_code_qti(QTI, 45)
|
||||
|
||||
#define GBM_FORMAT_YCbCr_420_SP_VENUS_UBWC fourcc_mod_code_qti(QTI, 46)
|
||||
|
||||
#define GBM_FORMAT_YCbCr_420_888 fourcc_mod_code_qti(QTI, 47)
|
||||
|
||||
#define GBM_FORMAT_IMPLEMENTATION_DEFINED fourcc_mod_code_qti(QTI, 48)
|
||||
|
||||
#define GBM_FORMAT_NV12_HEIF fourcc_mod_code_qti(QTI, 49)
|
||||
|
||||
#define GBM_FORMAT_YCbCr_420_P010_VENUS fourcc_mod_code_qti(QTI, 50)
|
||||
|
||||
#define GBM_FORMAT_NV12_LINEAR_FLEX fourcc_mod_code_qti(QTI, 51)
|
||||
|
||||
#define GBM_FORMAT_NV12_UBWC_FLEX fourcc_mod_code_qti(QTI, 52)
|
||||
|
||||
#define GBM_FORMAT_MULTIPLANAR_FLEX fourcc_mod_code_qti(QTI, 53)
|
||||
|
||||
#define GBM_FORMAT_RGBA16161616F fourcc_mod_code_qti(QTI, 54)
|
||||
|
||||
#define GBM_FORMAT_RGB161616F fourcc_mod_code_qti(QTI, 55)
|
||||
|
||||
#define GBM_FORMAT_RGBA32323232F fourcc_mod_code_qti(QTI, 56)
|
||||
|
||||
#define GBM_FORMAT_RGB323232F fourcc_mod_code_qti(QTI, 57)
|
||||
|
||||
#define GBM_FORMAT_YCbCr_420_TP10_UBWC __gbm_fourcc_code('Q', '1', '2', 'A')
|
||||
|
||||
#define GBM_FORMAT_YCbCr_420_P010_UBWC __gbm_fourcc_code('Q', '1', '2', 'B')
|
||||
|
||||
/* Y/CbCr 4:2:0 P10 format*/
|
||||
#define GBM_FORMAT_P010 __gbm_fourcc_code('P', '0', '1', '0')
|
||||
|
||||
/**
|
||||
* Pixel component ID defines
|
||||
* to be used at the generic plane object
|
||||
*
|
||||
*/
|
||||
/* luma */
|
||||
#define PIXEL_COMPONENT_Y 0x00000001
|
||||
/* chroma blue */
|
||||
#define PIXEL_COMPONENT_Cb 0x00000002
|
||||
/* chroma red */
|
||||
#define PIXEL_COMPONENT_Cr 0x00000004
|
||||
/* red */
|
||||
#define PIXEL_COMPONENT_R 0x00000100
|
||||
/* green */
|
||||
#define PIXEL_COMPONENT_G 0x00000200
|
||||
/* blue */
|
||||
#define PIXEL_COMPONENT_B 0x00000400
|
||||
/*RAW 10 */
|
||||
#define PIXEL_COMPONENT_RAW10 0x00010000
|
||||
/*RAW 16 */
|
||||
#define PIXEL_COMPONENT_RAW16 0x00020000
|
||||
/* alpha */
|
||||
#define PIXEL_COMPONENT_A 0x00100000
|
||||
|
||||
|
||||
/* Maximum count of planes for given frame buffer
|
||||
Different from GBM_MAX_PLANES
|
||||
*/
|
||||
#define MAX_NUM_OF_PLANES 5
|
||||
#define MAX_NUM_MODIFIERS 4
|
||||
|
||||
/* possible formats for 3D content*/
|
||||
enum {
|
||||
HAL_NO_3D = 0x0,
|
||||
HAL_3D_SIDE_BY_SIDE_L_R = 0x1,
|
||||
HAL_3D_SIDE_BY_SIDE_R_L = 0x2,
|
||||
HAL_3D_TOP_BOTTOM = 0x4,
|
||||
HAL_3D_IN_SIDE_BY_SIDE_L_R = 0x10000, // unused legacy format
|
||||
};
|
||||
|
||||
enum UBWC_Version {
|
||||
UBWC_UNUSED = 0,
|
||||
UBWC_1_0 = 0x1,
|
||||
UBWC_2_0 = 0x2,
|
||||
UBWC_3_0 = 0x3,
|
||||
UBWC_4_0 = 0x4,
|
||||
UBWC_MAX_VERSION = 0xFF,
|
||||
};
|
||||
|
||||
#define MAX_UBWC_STATS_LENGTH 32
|
||||
struct UBWC_2_0_Stats {
|
||||
uint32_t nCRStatsTile32; /**< UBWC Stats info for 32 Byte Tile */
|
||||
uint32_t nCRStatsTile64; /**< UBWC Stats info for 64 Byte Tile */
|
||||
uint32_t nCRStatsTile96; /**< UBWC Stats info for 96 Byte Tile */
|
||||
uint32_t nCRStatsTile128; /**< UBWC Stats info for 128 Byte Tile */
|
||||
uint32_t nCRStatsTile160; /**< UBWC Stats info for 160 Byte Tile */
|
||||
uint32_t nCRStatsTile192; /**< UBWC Stats info for 192 Byte Tile */
|
||||
uint32_t nCRStatsTile256; /**< UBWC Stats info for 256 Byte Tile */
|
||||
};
|
||||
|
||||
struct UBWCStats {
|
||||
enum UBWC_Version version; /* Union depends on this version. */
|
||||
uint8_t bDataValid; /* If [non-zero], CR Stats data is valid.
|
||||
90 * Consumers may use stats data.
|
||||
91 * If [zero], CR Stats data is invalid.
|
||||
92 * Consumers *Shall* not use stats data */
|
||||
union {
|
||||
struct UBWC_2_0_Stats ubwc_stats;
|
||||
uint32_t reserved[MAX_UBWC_STATS_LENGTH]; /* This is for future */
|
||||
};
|
||||
};
|
||||
|
||||
#define VIDEO_HISTOGRAM_STATS_SIZE (4 * 1024)
|
||||
/* Frame type bit mask */
|
||||
#define QD_SYNC_FRAME (0x1 << 0)
|
||||
struct VideoHistogramMetadata {
|
||||
uint32_t stats_info[1024]; /* video stats payload */
|
||||
uint32_t stat_len; /* Payload size in bytes */
|
||||
uint32_t frame_type; /* bit mask to indicate frame type */
|
||||
uint32_t display_width;
|
||||
uint32_t display_height;
|
||||
uint32_t decode_width;
|
||||
uint32_t decode_height;
|
||||
uint32_t reserved[12];
|
||||
};
|
||||
|
||||
#define CVP_METADATA_SIZE 1024
|
||||
enum CVPMetadataFlags {
|
||||
/* bit wise flags */
|
||||
CVP_METADATA_FLAG_NONE = 0x00000000,
|
||||
CVP_METADATA_FLAG_REPEAT = 0x00000001,
|
||||
};
|
||||
|
||||
typedef struct CVPMetadata {
|
||||
uint32_t size; /* payload size in bytes */
|
||||
uint8_t payload[CVP_METADATA_SIZE];
|
||||
uint32_t capture_frame_rate;
|
||||
/* Frame rate in Q16 format.
|
||||
Eg: fps = 7.5, then
|
||||
capture_frame_rate = 7 << 16 --> Upper 16 bits to represent 7
|
||||
capture_frame_rate |= 5 -------> Lower 16 bits to represent 5
|
||||
|
||||
If size > 0, framerate is valid
|
||||
If size = 0, invalid data, so ignore all parameters */
|
||||
uint32_t cvp_frame_rate;
|
||||
enum CVPMetadataFlags flags;
|
||||
uint32_t reserved[8];
|
||||
} CVPMetadata;
|
||||
|
||||
/**
|
||||
* The generic_buf_layout structure is used with any pixel format that can be
|
||||
* represented by it, such as:
|
||||
* - GBM_FORMAT_YCbCr_*_888
|
||||
* - GBM_FORMAT_FLEX_RGB*_888
|
||||
* - GBM_FORMAT_RGB[AX]_888[8],BGRA_8888,RGB_888
|
||||
* - GBM_FORMAT_YV12,Y8,Y16,YCbCr_422_SP/I,YCrCb_420_SP
|
||||
* - even implementation defined formats that can be represented by
|
||||
* the structures
|
||||
*
|
||||
* Vertical increment (aka. row increment or stride) describes the distance in
|
||||
* bytes from the first pixel of one row to the first pixel of the next row
|
||||
* (below) for the component plane. This can be negative.
|
||||
*
|
||||
* Horizontal increment (aka. column or pixel increment) describes the distance
|
||||
* in bytes from one pixel to the next pixel (to the right) on the same row for
|
||||
* the component plane. This can be negative.
|
||||
*
|
||||
* Each plane can be subsampled either vertically or horizontally by
|
||||
* a power-of-two factor.
|
||||
*
|
||||
* The bit-depth of each component can be arbitrary, as long as the pixels are
|
||||
* laid out on whole bytes, in native byte-order, using the most significant
|
||||
* bits of each unit.
|
||||
*
|
||||
*
|
||||
* generic planar layout object definition
|
||||
*
|
||||
*/
|
||||
typedef struct generic_plane {
|
||||
uint32_t *top_left; /* pointer to the first byte of the top-left
|
||||
pixel of the plane. */
|
||||
/* NOTE: For secured buffers this pointer is
|
||||
NULL */
|
||||
uint32_t offset; /* offset to the first byte of the top-left
|
||||
pixel of the plane */
|
||||
int32_t component_id; /* ID to represent */
|
||||
uint32_t aligned_width; /* Aligned width in pixels */
|
||||
uint32_t aligned_height; /* Aligned height in pixels*/
|
||||
uint32_t size; /* size in bytes*/
|
||||
int32_t bits_per_component; /* bits allocated for the component in each
|
||||
pixel. Must be a positive multiple of 8. */
|
||||
int32_t bits_used; /* number of the most significant bits used
|
||||
in the format for this component.
|
||||
Must be between 1 and bits_per_component */
|
||||
int32_t h_increment; /* horizontal increment */
|
||||
int32_t v_increment; /* vertical increment */
|
||||
int32_t h_subsampling; /* horizontal subsampling. Must be a positive
|
||||
power of 2. */
|
||||
int32_t v_subsampling; /* vertical subsampling. Must be a positive
|
||||
power of 2. */
|
||||
uint32_t stride; /* stride for plane */
|
||||
} generic_plane_t;
|
||||
|
||||
|
||||
typedef struct generic_buf_layout {
|
||||
int pixel_format; /* the kind of pixel format */
|
||||
uint32_t num_planes; /* number of planes
|
||||
0 for FLEX_FORMAT_INVALID */
|
||||
generic_plane_t planes[MAX_NUM_OF_PLANES]; /* a plane for each component,
|
||||
ordered in increasing
|
||||
component value order.
|
||||
E.g. FLEX_FORMAT_RGBA
|
||||
maps 0 -> R, 1 -> G, etc.
|
||||
Can be NULL for FLEX_FORMAT_INVALID */
|
||||
} generic_buf_layout_t;
|
||||
|
||||
/**
|
||||
* gbm device object definition
|
||||
*
|
||||
*/
|
||||
struct gbm_device {
|
||||
int fd; /*gbm device fd */
|
||||
const char *name; /* gbm device name*/
|
||||
unsigned refcount; /* used to track the gbm device open call
|
||||
reference*/
|
||||
void (*destroy)(struct gbm_device *gbm);
|
||||
int (*is_format_supported)(struct gbm_device *gbm,
|
||||
uint32_t format,
|
||||
uint32_t usage);
|
||||
struct gbm_bo *(*bo_create)(struct gbm_device *gbm,
|
||||
uint32_t width, uint32_t height,
|
||||
uint32_t format,
|
||||
uint32_t usage,
|
||||
const uint64_t *modifiers,
|
||||
const unsigned int count);
|
||||
struct gbm_bo *(*bo_import)(struct gbm_device *gbm, uint32_t type,
|
||||
void *buffer, uint32_t usage);
|
||||
int (*get_format_modifier_plane_count)(uint32_t format,
|
||||
uint64_t modifier);
|
||||
|
||||
struct gbm_surface *(*surface_create)(struct gbm_device *gbm,
|
||||
uint32_t width, uint32_t height,
|
||||
uint32_t format, uint32_t flags,
|
||||
uint64_t *modifiers, unsigned int count);
|
||||
};
|
||||
|
||||
/**
|
||||
* The Metadata structure whose buffer handle is associated with
|
||||
* gbm buffer object
|
||||
*
|
||||
* The members of this structure are accessed by gbm perform API only
|
||||
*/
|
||||
struct meta_data_t {
|
||||
uint32_t operation; /* specific operation or state*/
|
||||
uint32_t interlaced; /* video buffer scan */
|
||||
uint32_t s3d_format; /* 3D video format supported */
|
||||
uint32_t linear_format; /* Producer output buffer is linear for UBWC Interlaced video */
|
||||
uint32_t color_space; /* color space specfics */
|
||||
uint32_t map_secure_buffer; /* Flag to represent SecureBuffer being used for GPU*/
|
||||
int is_buffer_secure; /* Flag to query if buffer is secure*/
|
||||
int is_buffer_ubwc; /* Flag to query if buffer is UBWC allocated */
|
||||
int igc; /* IGC value*/
|
||||
float refresh_rate; /* video referesh rate*/
|
||||
ColorMetaData color_info; /* Color Aspects + HDR info */
|
||||
uint64_t vt_timestamp; /* timestamp set by camera, intended for VT*/
|
||||
uint32_t isVideoPerfMode; /* set by camera indicates buffer will be used for
|
||||
High performace video use case */
|
||||
struct VideoHistogramMetadata histMetadata; /*histogram metadata*/
|
||||
CVPMetadata cvpMetadata; /* Metadata from cvp */
|
||||
};
|
||||
|
||||
/**
|
||||
* The allocated gbm buffer object.
|
||||
*
|
||||
* The members in this structure should not be accessed directly.
|
||||
*/
|
||||
struct gbm_bo {
|
||||
int ion_fd; /* ION buffer fd */
|
||||
int ion_metadata_fd; /* ION metadata fd */
|
||||
union gbm_bo_handle handle; /* GEM handle */
|
||||
union gbm_bo_handle metadata_handle; /* GEM metadata handle */
|
||||
uint32_t format; /* buffer format */
|
||||
uint32_t width; /* unaligned width of the buffer in pixels */
|
||||
uint32_t height; /* unaligned height of the buffer in pixels */
|
||||
uint32_t aligned_width; /* aligned width of the buffer in pixels */
|
||||
uint32_t aligned_height; /* aligned height of the buffer in pixels */
|
||||
uint32_t size; /* size of the buffer in bytes */
|
||||
uint32_t stride; /* stride of the buffer in bytes */
|
||||
uint32_t usage_flags; /* usage flags */
|
||||
uint32_t fbid; /* framebuffer id */
|
||||
uint32_t bpp; /* bytes per pixel*/
|
||||
uint32_t plane_count; /* plane count*/
|
||||
generic_buf_layout_t buf_lyt;
|
||||
uint64_t modifier;
|
||||
int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data);
|
||||
int (*bo_get_fd)(struct gbm_bo *bo);
|
||||
struct gbm_device* (*bo_get_device)(struct gbm_bo *bo);
|
||||
void (*bo_destroy)(struct gbm_bo *bo);
|
||||
void *user_data;
|
||||
void (*destroy_user_data)(struct gbm_bo *, void *);
|
||||
void * (*bo_map)(uint32_t x, uint32_t y, uint32_t width, uint32_t height,
|
||||
uint32_t flags, uint32_t *stride, void **map_data);
|
||||
|
||||
void (*bo_unmap)(void *map_data);
|
||||
uint32_t (*stride_for_plane)(int plane, struct gbm_bo *);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The allocated gbm surface object.
|
||||
*
|
||||
* The members in this structure should not be accessed directly.
|
||||
*/
|
||||
struct gbm_surface {
|
||||
uint32_t format; /* pixel format */
|
||||
uint32_t width; /* width of surface in pixels */
|
||||
uint32_t height; /* height of surface in pixels */
|
||||
uint32_t flags; /* usage flags */
|
||||
void (*surface_release_buffer)(struct gbm_surface *surface,
|
||||
struct gbm_bo *bo);
|
||||
int (*surface_has_free_buffers)(struct gbm_surface *surface);
|
||||
void (*surface_destroy)(struct gbm_surface *surface);
|
||||
struct gbm_bo* (*surface_lock_front_buffer)(struct gbm_surface *surface);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The gbm buffer data object used by the import fd API.
|
||||
*
|
||||
*/
|
||||
struct gbm_buf_info {
|
||||
int fd; /* ion fd */
|
||||
int metadata_fd; /* ion metadata fd*/
|
||||
uint32_t width; /* width of surface in pixels */
|
||||
uint32_t height; /* height of surface in pixels */
|
||||
uint32_t format; /* pixel format*/
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* gbm backend interface object.
|
||||
*
|
||||
*/
|
||||
struct gbm_backendpriv{
|
||||
const char *backend_name;
|
||||
struct gbm_device *(*create_device)(int fd);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* gbm backend interface .
|
||||
*
|
||||
*/
|
||||
struct gbm_backendpriv *gbm_get_priv(void);
|
||||
|
||||
/**
|
||||
* Perform supported queries
|
||||
* Input : operation opcodes
|
||||
* : Arguments depending on the operation
|
||||
* Return = gbm_error value
|
||||
*
|
||||
*/
|
||||
int gbm_perform(int operation,...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //GBM_PRIV_H_
|
521
qcom/opensource/display/libgbm/inc/msmgbm.h
Normal file
521
qcom/opensource/display/libgbm/inc/msmgbm.h
Normal file
@@ -0,0 +1,521 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2021 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Changes from Qualcomm Innovation Center are provided under the following license:
|
||||
*
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the
|
||||
* disclaimer below) provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
*
|
||||
* * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
|
||||
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
|
||||
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _MSM_GBM_H_
|
||||
#define _MSM_GBM_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <display/drm/sde_drm.h>
|
||||
|
||||
//Enables debug log
|
||||
#ifdef GBM_DEBUG
|
||||
#define GBM_DBG_LOG fprintf
|
||||
#else
|
||||
#define GBM_DBG_LOG(...) {}
|
||||
#endif
|
||||
|
||||
#define LOG_FATAL (1)
|
||||
#define LOG_ERR (2)
|
||||
#define LOG_WARN (3)
|
||||
#define LOG_INFO (4)
|
||||
#define LOG_DBG (5)
|
||||
|
||||
extern int g_debug_level;
|
||||
|
||||
#define LOG(level, ...) do { \
|
||||
if (level <= g_debug_level) { \
|
||||
if(level==LOG_FATAL) \
|
||||
fprintf(stderr,"%s","GBM_FATAL::"); \
|
||||
if(level==LOG_ERR) \
|
||||
fprintf(stderr,"%s", "GBM_ERR::"); \
|
||||
if(level==LOG_WARN) \
|
||||
fprintf(stderr,"%s", "GBM_WARN::"); \
|
||||
if(level==LOG_INFO) \
|
||||
fprintf(stderr,"%s", "GBM_INFO::"); \
|
||||
if(level==LOG_DBG) \
|
||||
fprintf(stderr,"%s", "GBM_DBG::"); \
|
||||
fprintf(stderr,"%s(%d)::",__func__,__LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
fflush(stderr); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
|
||||
/*Currently three buffer mechanism is used for GPU rendering and Hardware Composition sync*/
|
||||
#ifdef ALLOCATE_SURFACE_BO_AT_CREATION
|
||||
#define NUM_BACK_BUFFERS 3
|
||||
#else
|
||||
#define NUM_BACK_BUFFERS 2
|
||||
#endif
|
||||
|
||||
#define MAX_NUM_PLANES 3
|
||||
#define QCMAGIC 0XDFDFECBA // need to compe up with something unique
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* State representation of the gbm buffer object
|
||||
*
|
||||
*/
|
||||
#define GBM_BO_STATE_FREE (0x0) /* Unused/Free state of the Buffer Object */
|
||||
|
||||
#define GBM_BO_STATE_INUSE_BY_COMPOSITOR (0x1) /* Buffer Object locked for composition */
|
||||
|
||||
#define GBM_BO_STATE_INUSE_BY_GPU (0x2) /* Buffer Object locked for GPU rendering */
|
||||
|
||||
#define GBM_BO_STATE_NEW_FRONT_BUFFER (0x3) /* Buffer Object currently available for
|
||||
* grab by GPU or Compositor */
|
||||
|
||||
|
||||
/**
|
||||
* State representation of the gbm buffer object during
|
||||
* gbm surface creation if enabled
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ALLOCATE_SURFACE_BO_AT_CREATION
|
||||
|
||||
#define SURFACE_BOSLOT_STATE_FREE (0x0) /* Unused/Free state of the Buffer Object */
|
||||
|
||||
#define SURFACE_BOSLOT_STATE_INUSE_BY_COMPOSITOR (0x1) /* BO locked for composition */
|
||||
|
||||
#define SURFACE_BOSLOT_STATE_HAS_NEW_FRONT_BUFFER (0x2) /* BO currently available for
|
||||
* grab by GPU or Compositor */
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* msm gbm device object corresponding to the gbm device object instance
|
||||
*
|
||||
* The members in this structure should not be accessed directly.
|
||||
*/
|
||||
|
||||
struct msmgbm_device {
|
||||
struct gbm_device base;
|
||||
uint32_t magic;
|
||||
int fd; /* device fd */
|
||||
int iondev_fd; /* ION device fd */
|
||||
};
|
||||
|
||||
struct msmgbm_surface {
|
||||
struct gbm_surface base;
|
||||
uint32_t magic;
|
||||
struct msmgbm_device* device;
|
||||
struct msmgbm_bo *bo[NUM_BACK_BUFFERS];
|
||||
int inuse_index;
|
||||
#ifndef ALLOCATE_SURFACE_BO_AT_CREATION
|
||||
int bo_slot[NUM_BACK_BUFFERS];
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* The allocated local msm buffer object for the corresponding gbm buffer object.
|
||||
*
|
||||
* The members in this structure should not be accessed directly.
|
||||
*/
|
||||
struct msmgbm_bo {
|
||||
struct gbm_bo base;
|
||||
uint32_t magic;
|
||||
struct msmgbm_device* device;
|
||||
uint32_t name;
|
||||
uint64_t gpuaddr;
|
||||
void* cpuaddr;
|
||||
void* mt_cpuaddr;
|
||||
size_t size;
|
||||
size_t mt_size;
|
||||
uint32_t current_state;
|
||||
uint32_t fbid;
|
||||
int ion_handle;
|
||||
int ion_mt_handle;
|
||||
int import_flg;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Buffer Descriptor used for param passing between API's
|
||||
*
|
||||
*/
|
||||
struct gbm_bufdesc {
|
||||
uint32_t Width;
|
||||
uint32_t Height;
|
||||
uint32_t Format;
|
||||
uint32_t Usage;
|
||||
};
|
||||
|
||||
struct gbm_buf_resource {
|
||||
struct gbm_buf_info *buffer_info;
|
||||
uint32_t magic;
|
||||
};
|
||||
|
||||
/**
|
||||
* The gbm buffer data object related
|
||||
* information stored in hashmap
|
||||
*/
|
||||
struct msmgbm_private_info {
|
||||
void* cpuaddr; /* gbm bo cpu address */
|
||||
void* mt_cpuaddr; /* gbm bo meta data address */
|
||||
};
|
||||
|
||||
/*
|
||||
* Function prototypes of all supported API's by backend
|
||||
*
|
||||
*/
|
||||
|
||||
/** create the gbm bo
|
||||
*
|
||||
* \param handle to gbm device
|
||||
* \param width
|
||||
* \param height
|
||||
* \param format
|
||||
* \param usage flag
|
||||
* \return gbm bo handle
|
||||
*
|
||||
*/
|
||||
static struct gbm_bo *msmgbm_bo_create(struct gbm_device *gbm,uint32_t width,
|
||||
uint32_t height,uint32_t format,
|
||||
uint32_t usage, const uint64_t *modifiers,
|
||||
const unsigned int count);
|
||||
|
||||
|
||||
/** Destroy the gbm bo
|
||||
*
|
||||
* \param bo The buffer object
|
||||
* \return None
|
||||
*
|
||||
*/
|
||||
static void msmgbm_bo_destroy(struct gbm_bo *bo);
|
||||
|
||||
/** To query gbm device pointer
|
||||
*
|
||||
* \param bo The buffer object
|
||||
* \return gbm device handle
|
||||
*
|
||||
*/
|
||||
static struct gbm_device* msmgbm_bo_get_device(struct gbm_bo *bo);
|
||||
|
||||
/** query gbm bo name
|
||||
*
|
||||
* \param gbm bo handle
|
||||
* \return id
|
||||
*
|
||||
*/
|
||||
|
||||
int msmgbm_bo_get_name(struct gbm_bo* bo);
|
||||
|
||||
|
||||
/** Perform write operation onto the gbm bo
|
||||
*
|
||||
* \param bo The buffer object
|
||||
* \param user buffer handle
|
||||
* \param byte count
|
||||
* \return =0 for success
|
||||
* >0 for fail
|
||||
*
|
||||
*/
|
||||
static int msmgbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
|
||||
|
||||
/** create the gbm bo
|
||||
*
|
||||
* \param import gbm bo handle depending on type
|
||||
* \param gbm device
|
||||
* \param type
|
||||
* \param void pointer
|
||||
* \param usage flag
|
||||
* \return gbm bo handle
|
||||
*
|
||||
*/
|
||||
struct gbm_bo * msmgbm_bo_import(struct gbm_device *gbm,uint32_t type,
|
||||
void *buffer, uint32_t usage);
|
||||
|
||||
/** Import gbm bo handle from fd
|
||||
*
|
||||
* \param handle to msmgbm_device
|
||||
* \param fd via void *
|
||||
* \param usage flags
|
||||
* \return gbm bo handle
|
||||
*
|
||||
*/
|
||||
struct gbm_bo * msmgbm_bo_import_fd(struct msmgbm_device *msm_dev,
|
||||
void *buffer, uint32_t usage);
|
||||
|
||||
/** Import gbm bo handle from name element of the wl buffer resource
|
||||
*
|
||||
* \param msmgbm_device handle
|
||||
* \param wl buffer handle
|
||||
* \param usage flag
|
||||
* \return gbm bo handle
|
||||
*
|
||||
*/
|
||||
struct gbm_bo * msmgbm_bo_import_wl_buffer(struct msmgbm_device *msm_dev,
|
||||
void *buffer, uint32_t usage);
|
||||
|
||||
/** create the gbm bo
|
||||
*
|
||||
* \param msmgbm_device handle
|
||||
* \param egl buffer handle
|
||||
* \param usage flag
|
||||
* \return gbm bo handle
|
||||
*
|
||||
*/
|
||||
struct gbm_bo * msmgbm_bo_import_egl_image(struct msmgbm_device *msm_dev,
|
||||
void *buffer, uint32_t usage);
|
||||
|
||||
/** create requested gbm surface with the dimensions
|
||||
*
|
||||
* \param gbm device handle
|
||||
* \param width
|
||||
* \param height
|
||||
* \param format
|
||||
* \param usage flag
|
||||
* \return gbm surface
|
||||
*
|
||||
*/
|
||||
static struct gbm_surface *
|
||||
msmgbm_surface_create(struct gbm_device *gbm, uint32_t width,
|
||||
uint32_t height, uint32_t format, uint32_t flags,
|
||||
uint64_t *modifiers, unsigned int count);
|
||||
|
||||
/** destroy gbm surface
|
||||
*
|
||||
* \param handle to gbm surface
|
||||
* \return None
|
||||
*
|
||||
*/
|
||||
static void msmgbm_surface_destroy(struct gbm_surface *surf);
|
||||
/** Verifies if surface is allocated by MSM GBM backend
|
||||
*
|
||||
* \Returns GBM_ERROR values
|
||||
*
|
||||
*/
|
||||
static inline
|
||||
int msmgbm_validate_surface(struct gbm_surface *surf);
|
||||
/** update the state of the current bo associated with the surface to used by compositor
|
||||
*
|
||||
* \param surface handle
|
||||
* \return gbm bo handle
|
||||
*
|
||||
*/
|
||||
static struct gbm_bo * msmgbm_surface_lock_front_buffer(struct gbm_surface *surf);
|
||||
/** update the state of the current bo associated with the surface to free
|
||||
*
|
||||
* \param surface handle
|
||||
* \return gbm bo handle
|
||||
*
|
||||
*/
|
||||
static void msmgbm_surface_release_buffer(struct gbm_surface *surf,
|
||||
struct gbm_bo *bo);
|
||||
/* Returns bo which can be used as front buffer on success
|
||||
* \Returns GBM_ERROR values
|
||||
*
|
||||
*/
|
||||
struct gbm_bo* msmgbm_surface_get_free_bo(struct gbm_surface *surf);
|
||||
/** update the state machine of a bo to be used as the surface front buffer
|
||||
* \Returns GBM_ERROR values
|
||||
*
|
||||
*/
|
||||
int msmgbm_surface_set_front_bo(struct gbm_surface *surf, struct gbm_bo *gbo);
|
||||
|
||||
/** Returns the CPU address of metadata
|
||||
* if fails returns NULL
|
||||
*/
|
||||
void* msmgbm_cpu_map_metafd(int meta_ion_fd, unsigned int metadata_size);
|
||||
/** Returns the cpu address of non secure bo
|
||||
* if mmap fails or buffer is secure, returns NULL
|
||||
*/
|
||||
void* msmgbm_cpu_map_ionfd(int ion_fd, unsigned int size, struct meta_data_t *meta_data);
|
||||
/** Returns the CPU access address for the BO buffer
|
||||
* \Returns CPU address on Success / Null on fail
|
||||
*
|
||||
*/
|
||||
|
||||
void * msmgbm_bo_cpu_map(struct gbm_bo *gbo);
|
||||
/* Unmap the BO buffer from CPU access
|
||||
* \Returns GBM_ERROR values
|
||||
*
|
||||
*/
|
||||
int msmgbm_bo_cpu_unmap(struct gbm_bo *gbo);
|
||||
/* Returns BO size on success
|
||||
* \Returns size on Success/ GBM_ERROR Values on Failure
|
||||
*
|
||||
*/
|
||||
static inline
|
||||
size_t msmgbm_bo_get_size(struct gbm_bo *bo);
|
||||
/** create gbm device
|
||||
*
|
||||
* \param display driver device fd
|
||||
* \return gbm device handle
|
||||
*
|
||||
*/
|
||||
static struct gbm_device * msmgbm_device_create(int fd);
|
||||
/** destroy the gbm device handle
|
||||
*
|
||||
* \param gbm device handle
|
||||
* \return none
|
||||
*
|
||||
*/
|
||||
static void msmgbm_device_destroy(struct gbm_device *gbm);
|
||||
/** To query gbm device fd
|
||||
*
|
||||
* \param bo The buffer object
|
||||
* \return fd
|
||||
*
|
||||
*/
|
||||
static int msmgbm_device_get_fd(struct gbm_bo *bo);
|
||||
/** query device unique id
|
||||
*
|
||||
* \param handle to gbm device
|
||||
* \return ID
|
||||
*
|
||||
*/
|
||||
unsigned int msmgbm_device_get_magic(struct gbm_device *dev);
|
||||
/** query drm device file name
|
||||
*
|
||||
* \return gbm bo handle
|
||||
*
|
||||
*/
|
||||
static inline
|
||||
const char* msmgbm_drm_device_get_name(void);
|
||||
/** Authenticate the DRM magic ID
|
||||
*
|
||||
* \Returns 0 on success
|
||||
* \Returns -1 on failure
|
||||
*
|
||||
*/
|
||||
int msmgbm_device_authenticate_magic(struct gbm_device *dev,
|
||||
uint32_t magic);
|
||||
/** Import a BO handle from a unique ID/name
|
||||
*
|
||||
* \Returns imported BO pointer on success
|
||||
* \Returns NULL on failure
|
||||
*
|
||||
*/
|
||||
struct gbm_bo* msmgbm_bo_import_from_name(struct gbm_device *dev,
|
||||
unsigned int name);
|
||||
/** Returns global name on success
|
||||
*
|
||||
* \Returns GBM_ERROR values on failure
|
||||
*
|
||||
*/
|
||||
int msmgbm_bo_get_name(struct gbm_bo* bo);
|
||||
|
||||
/** Verifies if device is allocated by MSM GBM backend
|
||||
*
|
||||
* \Returns GBM_ERROR values
|
||||
*
|
||||
*/
|
||||
static inline
|
||||
int msmgbm_validate_device(struct gbm_device *dev);
|
||||
/** Query metadata info depending on the operation/paramtype
|
||||
*
|
||||
* \Returns GBM_ERROR values
|
||||
*
|
||||
*/
|
||||
int msmgbm_get_metadata(struct gbm_bo *gbo, int paramType,void *param);
|
||||
/** Set metadata info depending on the operation/paramtype
|
||||
*
|
||||
* \Returns GBM_ERROR values
|
||||
*
|
||||
*/
|
||||
int msmgbm_set_metadata(struct gbm_bo *gbo, int paramType,void *param);
|
||||
|
||||
/** Get RGB Data Address for a given gbm buffer object
|
||||
*
|
||||
* \Returns GBM_ERROR values
|
||||
*
|
||||
*/
|
||||
int msmgbm_get_rgb_data_address(struct gbm_bo *gbo, void **rgb_data);
|
||||
|
||||
/**
|
||||
* C wrapper function to increment the reference count for the valid gem_handle
|
||||
* @input param: device fd
|
||||
* @input param: gem handle
|
||||
* @return : none
|
||||
*
|
||||
*/
|
||||
void incr_handle_refcnt(int device_fd, uint32_t handle);
|
||||
|
||||
/**
|
||||
* C wrapper function to decrement the reference count for the valid map gem_handle
|
||||
* @input param: device fd
|
||||
* @input param: gem handle
|
||||
* @return : 1 for delete key from map /0 for decremented ref count
|
||||
*
|
||||
*/
|
||||
int decr_handle_refcnt(int device_fd, uint32_t handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_MSM_GBM_H_
|
||||
|
151
qcom/opensource/display/libgbm/inc/msmgbm_adreno_utils.h
Normal file
151
qcom/opensource/display/libgbm/inc/msmgbm_adreno_utils.h
Normal file
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Not a Contribution.
|
||||
*
|
||||
* Copyright (c) 2017-2018, 2021 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __MSMGBM_ADRENO_UTILS_H__
|
||||
#define __MSMGBM_ADRENO_UTILS_H__
|
||||
|
||||
namespace msm_gbm {
|
||||
|
||||
// Adreno Pixel Formats
|
||||
typedef enum {
|
||||
ADRENO_PIXELFORMAT_UNKNOWN = 0,
|
||||
ADRENO_PIXELFORMAT_R32G32B32A32_FLOAT = 2,
|
||||
ADRENO_PIXELFORMAT_R32G32B32_FLOAT = 6,
|
||||
ADRENO_PIXELFORMAT_R16G16B16A16_FLOAT = 10,
|
||||
ADRENO_PIXELFORMAT_R10G10B10A2_UNORM = 24, // Vertex, Normalized GL_UNSIGNED_INT_10_10_10_2_OES
|
||||
ADRENO_PIXELFORMAT_R8G8B8A8 = 28,
|
||||
ADRENO_PIXELFORMAT_R8G8B8A8_SRGB = 29,
|
||||
ADRENO_PIXELFORMAT_R16G16_UNORM = 35,
|
||||
ADRENO_PIXELFORMAT_R8G8_UNORM = 49,
|
||||
ADRENO_PIXELFORMAT_R16_UNORM = 56,
|
||||
ADRENO_PIXELFORMAT_R8_UNORM = 61,
|
||||
ADRENO_PIXELFORMAT_B5G6R5 = 85,
|
||||
ADRENO_PIXELFORMAT_B5G5R5A1 = 86,
|
||||
ADRENO_PIXELFORMAT_B8G8R8A8 = 90,
|
||||
ADRENO_PIXELFORMAT_B8G8R8A8_SRGB = 91,
|
||||
ADRENO_PIXELFORMAT_B8G8R8X8_SRGB = 93,
|
||||
ADRENO_PIXELFORMAT_NV12 = 103,
|
||||
ADRENO_PIXELFORMAT_P010 = 104,
|
||||
ADRENO_PIXELFORMAT_YUY2 = 107,
|
||||
ADRENO_PIXELFORMAT_B4G4R4A4 = 115,
|
||||
ADRENO_PIXELFORMAT_NV12_EXT = 506, // NV12 with non-std alignment and offsets
|
||||
ADRENO_PIXELFORMAT_R8G8B8X8 = 507, // GL_RGB8 (Internal)
|
||||
ADRENO_PIXELFORMAT_R8G8B8 = 508, // GL_RGB8
|
||||
ADRENO_PIXELFORMAT_A1B5G5R5 = 519, // GL_RGB5_A1
|
||||
ADRENO_PIXELFORMAT_R8G8B8X8_SRGB = 520, // GL_SRGB8
|
||||
ADRENO_PIXELFORMAT_R8G8B8_SRGB = 521, // GL_SRGB8
|
||||
ADRENO_PIXELFORMAT_R16G16B16_FLOAT = 523,
|
||||
ADRENO_PIXELFORMAT_R5G6B5 = 610, // RGBA version of B5G6R5
|
||||
ADRENO_PIXELFORMAT_R5G5B5A1 = 611, // RGBA version of B5G5R5A1
|
||||
ADRENO_PIXELFORMAT_R4G4B4A4 = 612, // RGBA version of B4G4R4A4
|
||||
ADRENO_PIXELFORMAT_UYVY = 614, // YUV 4:2:2 packed progressive (1 plane)
|
||||
ADRENO_PIXELFORMAT_NV21 = 619,
|
||||
ADRENO_PIXELFORMAT_Y8U8V8A8 = 620, // YUV 4:4:4 packed (1 plane)
|
||||
ADRENO_PIXELFORMAT_Y8 = 625, // Single 8-bit luma only channel YUV format
|
||||
ADRENO_PIXELFORMAT_TP10 = 654, // YUV 4:2:0 planar 10 bits/comp (2 planes)
|
||||
} ADRENOPIXELFORMAT;
|
||||
|
||||
class adreno_mem_info {
|
||||
public:
|
||||
bool init();
|
||||
adreno_mem_info();
|
||||
~adreno_mem_info();
|
||||
|
||||
/**
|
||||
* Function to compute the adreno aligned width and aligned height
|
||||
* based on the width and format.
|
||||
*
|
||||
* @return aligned width, aligned height
|
||||
*/
|
||||
void get_aligned_wdth_hght_uncmprsd_rgb_fmt(int width, int height, int format, int tileEnabled,
|
||||
unsigned int *aligned_w, unsigned int *aligned_h);
|
||||
|
||||
/**
|
||||
* Function to compute the adreno aligned width and aligned height
|
||||
* based on the width and format.
|
||||
*
|
||||
* @return aligned width, aligned height
|
||||
*/
|
||||
void get_aligned_wdth_hght_cmprsd_rgb_fmt(int width, int height, int format, unsigned int *aligned_w,
|
||||
unsigned int *aligned_h);
|
||||
|
||||
/**
|
||||
* Function to compute the pixel alignment requirement.
|
||||
*
|
||||
* @return alignment
|
||||
*/
|
||||
unsigned int get_gpu_pxl_align();
|
||||
|
||||
/**
|
||||
* Function to return whether GPU support MacroTile feature
|
||||
*
|
||||
* @return >0 : supported
|
||||
* 0 : not supported
|
||||
*/
|
||||
bool is_mcro_tiling_supported();
|
||||
|
||||
/**
|
||||
* Function to query whether GPU supports UBWC for given GBM format
|
||||
* @return > 0 : supported
|
||||
* 0 : not supported
|
||||
*/
|
||||
bool is_ubwc_supported_gpu(unsigned int gbm_format);
|
||||
|
||||
/**
|
||||
* Function to get the corresponding Adreno format for given GBM format
|
||||
*/
|
||||
ADRENOPIXELFORMAT get_gpu_pxl_fmt(unsigned int gbm_format);
|
||||
|
||||
private:
|
||||
// link(s)to adreno surface padding library.
|
||||
int (*LINK_adreno_compute_padding)(int width, int bpp, int surface_tile_height,
|
||||
int screen_tile_height, int padding_threshold) = NULL;
|
||||
void (*LINK_adreno_compute_fmt_aligned_width_and_height)(int width, int height, int plane_id,
|
||||
ADRENOPIXELFORMAT format, int num_samples,
|
||||
int tile_mode, int raster_mode,
|
||||
int padding_threshold, int *aligned_w,
|
||||
int *aligned_h) = NULL;
|
||||
int (*LINK_adreno_is_mcro_tile_supportd_gpu)(void) = NULL;
|
||||
void (*LINK_adreno_compute_compressedfmt_aligned_width_and_height)(
|
||||
int width, int height, int format, int tile_mode, int raster_mode, int padding_threshold,
|
||||
int *aligned_w, int *aligned_h, int *bpp) = NULL;
|
||||
int (*LINK_adreno_is_ubwc_supportd_gpu)(ADRENOPIXELFORMAT format) = NULL;
|
||||
unsigned int (*LINK_adreno_get_gpu_pixel_alignment)() = NULL;
|
||||
|
||||
bool gfx_ubwc_disable_ = false;
|
||||
bool map_fb_ = false;
|
||||
void *libadreno_utils_ = NULL;
|
||||
};
|
||||
|
||||
} // namespace msm_gbm
|
||||
|
||||
#endif // __MSMGBM_ADRENO_UTILS_H__
|
59
qcom/opensource/display/libgbm/inc/msmgbm_common.h
Normal file
59
qcom/opensource/display/libgbm/inc/msmgbm_common.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2021 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef MSMGBM_COMMON_H_
|
||||
#define MSMGBM_COMMON_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
bool IsImplDefinedFormat(uint32_t format);
|
||||
uint32_t GetImplDefinedFormat(uint32_t usage_flags, uint32_t format);
|
||||
uint32_t GetIonAllocFlags(uint32_t alloc_flags);
|
||||
uint32_t GetIonHeapId(uint32_t alloc_flags);
|
||||
|
||||
/*camera specific functions*/
|
||||
uint32_t GetCameraImplDefinedFormat(uint32_t usage_flags, uint32_t format);
|
||||
uint32_t GetCameraIonAllocFlags(uint32_t alloc_flags);
|
||||
uint32_t GetCameraIonHeapId(uint32_t alloc_flags);
|
||||
|
||||
/*video specific functions*/
|
||||
uint32_t GetVideoImplDefinedFormat(uint32_t usage_flags, uint32_t format);
|
||||
uint32_t GetVideoIonAllocFlags(uint32_t alloc_flags);
|
||||
uint32_t GetVideoIonHeapId(uint32_t alloc_flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MSMGBM_COMMON_H_
|
119
qcom/opensource/display/libgbm/inc/msmgbm_mapper.h
Normal file
119
qcom/opensource/display/libgbm/inc/msmgbm_mapper.h
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2021 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __MSMGBM_MAPPER_H__
|
||||
#define __MSMGBM_MAPPER_H__
|
||||
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <cstdio>
|
||||
#include <pthread.h>
|
||||
#include "gbm_priv.h"
|
||||
#include "msmgbm.h"
|
||||
|
||||
namespace msm_gbm {
|
||||
|
||||
class msmgbm_mapper {
|
||||
public:
|
||||
msmgbm_mapper();
|
||||
~msmgbm_mapper();
|
||||
bool init();
|
||||
|
||||
//Structure definition to maintain hash table on a per process basis
|
||||
//to manage metadata.
|
||||
struct msmgbm_buffer {
|
||||
int ion_fd;
|
||||
int ion_metadata_fd;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t format;
|
||||
int ref_count=0;
|
||||
void *cpuaddr = NULL;
|
||||
void *mt_cpuaddr = NULL;
|
||||
|
||||
explicit msmgbm_buffer(int fd, int mtadta_fd, uint32_t wdth, uint32_t hght, uint32_t fmt,
|
||||
void *cpu_addr, void *mt_cpu_addr):
|
||||
ion_fd(fd),
|
||||
ion_metadata_fd(mtadta_fd),
|
||||
width(wdth),
|
||||
height(hght),
|
||||
format(fmt),
|
||||
cpuaddr(cpu_addr),
|
||||
mt_cpuaddr(mt_cpu_addr) {
|
||||
}
|
||||
|
||||
void IncRef() {++ref_count;}
|
||||
int DecRef() {return --ref_count == 0;}
|
||||
};
|
||||
|
||||
std::unordered_map<int, std::shared_ptr<msmgbm_buffer>>gbm_buf_map_;
|
||||
|
||||
struct gem_handle_key {
|
||||
int device_fd;
|
||||
uint32_t handle;
|
||||
gem_handle_key(int device_fd, uint32_t handle) : device_fd(device_fd), handle(handle){}
|
||||
};
|
||||
|
||||
struct HashFunc {
|
||||
std::size_t operator()(const gem_handle_key &key) const
|
||||
{
|
||||
using std::size_t;
|
||||
using std::hash;
|
||||
|
||||
return ((hash<int>()(key.device_fd)
|
||||
^ (hash<uint32_t>()(key.handle) << 1)) >> 1);
|
||||
}
|
||||
};
|
||||
struct EqualKey {
|
||||
bool operator () (const gem_handle_key &key1, const gem_handle_key &key2) const
|
||||
{
|
||||
return key1.device_fd == key2.device_fd && key1.handle == key2.handle;
|
||||
}
|
||||
};
|
||||
|
||||
std::unordered_map<gem_handle_key, int, HashFunc, EqualKey>gem_object_map_;
|
||||
void register_to_map(int ion_fd, struct gbm_buf_info * gbm_buf,
|
||||
struct msmgbm_private_info * gbo_private_info);
|
||||
int search_map(int ion_fd, struct gbm_buf_info * gbm_buf,
|
||||
struct msmgbm_private_info * gbo_private_info);
|
||||
int update_map(int ion_fd, struct gbm_buf_info * gbm_buf,
|
||||
struct msmgbm_private_info * gbo_private_info);
|
||||
void map_dump(void);
|
||||
void add_map_entry(int ion_fd);
|
||||
int del_map_entry(int ion_fd);
|
||||
void incr_handle_refcnt(int device_fd, uint32_t handle);
|
||||
int decr_handle_refcnt(int device_fd, uint32_t handle);
|
||||
|
||||
};
|
||||
|
||||
} // namespace msm_gbm
|
||||
|
||||
#endif // __MSMGBM_MAPPER_H__
|
360
qcom/opensource/display/libgbm/inc/msmgbm_platform_wrapper.h
Normal file
360
qcom/opensource/display/libgbm/inc/msmgbm_platform_wrapper.h
Normal file
@@ -0,0 +1,360 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2021 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Changes from Qualcomm Innovation Center are provided under the following license:
|
||||
*
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the
|
||||
* disclaimer below) provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
*
|
||||
* * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
|
||||
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
|
||||
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __MSMGBM_PFM_WRP_H__
|
||||
#define __MSMGBM_PFM_WRP_H__
|
||||
|
||||
#include "msmgbm_adreno_utils.h"
|
||||
#include "gbm_priv.h"
|
||||
#include "msmgbm.h"
|
||||
#include <linux/version.h>
|
||||
|
||||
#ifdef VENUS_COLOR_FORMAT
|
||||
#include <display/media/mmm_color_fmt.h>
|
||||
#else
|
||||
#define VENUS_Y_STRIDE(args...) 0
|
||||
#define VENUS_Y_SCANLINES(args...) 0
|
||||
#define VENUS_BUFFER_SIZE(args...) 0
|
||||
#endif
|
||||
|
||||
namespace msm_gbm {
|
||||
/**
|
||||
* Function to query if CPU access usage flags are set
|
||||
* @return : true/false
|
||||
*
|
||||
*/
|
||||
bool cpu_can_accss(int prod_usage, int cons_usage);
|
||||
/**
|
||||
* Helper function to query if CPU access usage flags are set
|
||||
* @return : true/false
|
||||
*
|
||||
*/
|
||||
bool cpu_can_rd(int prod_usage, int cons_usage);
|
||||
/**
|
||||
* Helper function to query if CPU access usage flags are set
|
||||
* @return : true/false
|
||||
*
|
||||
*/
|
||||
bool cpu_can_wr(int prod_usage);
|
||||
/**
|
||||
* Function to query bpp depending on format
|
||||
* @return : bpp value
|
||||
*
|
||||
*/
|
||||
uint32_t get_bpp_for_uncmprsd_rgb_fmt(int format) ;
|
||||
|
||||
class platform_wrap {
|
||||
public:
|
||||
platform_wrap();
|
||||
~platform_wrap();
|
||||
|
||||
/**
|
||||
* Function to Initialize the platform wrapper object
|
||||
* @return true/
|
||||
* false
|
||||
*/
|
||||
bool init(void);
|
||||
/**
|
||||
* Function to query UBWC support
|
||||
* @return true/
|
||||
* false
|
||||
*/
|
||||
bool is_ubwc_enbld(int format, int prod_usage, int cons_usage);
|
||||
/**
|
||||
* Function to query MacroTile support
|
||||
* @return true/
|
||||
* false
|
||||
*/
|
||||
bool is_mcro_tile_enbld(int format, int prod_usage, int cons_usage);
|
||||
/**
|
||||
* Function to query the UBWC Enabled Buffer Size
|
||||
* @return size on success
|
||||
* 0 on fail
|
||||
*/
|
||||
unsigned int get_ubwc_size(int width, int height, int format, unsigned int alignedw, unsigned int alignedh);
|
||||
/**
|
||||
* Helper Function to query the UBWC Enabled Buffer Size
|
||||
* @return size on success
|
||||
* 0 : fail
|
||||
*/
|
||||
unsigned int get_rgb_ubwc_mb_size(int width, int height, uint32_t bpp);
|
||||
/**
|
||||
* Helper Function to query the UBWC Enabled Buffer Size
|
||||
* @return block width and height
|
||||
*/
|
||||
void get_rgb_ubwc_blk_size(uint32_t bpp, int *block_width, int *block_height);
|
||||
/**
|
||||
* Function to query the RGB format support
|
||||
* @return true : success
|
||||
* false : fail
|
||||
*/
|
||||
int is_valid_rgb_fmt(int gbm_format);
|
||||
|
||||
/**
|
||||
* Function to check whether the format is RAW
|
||||
* @params gbm format
|
||||
* @return true : success
|
||||
* false : fail
|
||||
*
|
||||
*/
|
||||
bool is_valid_raw_fmt(int format);
|
||||
|
||||
uint32_t get_bpp_for_uncmprsd_rgb_fmt(int format);
|
||||
|
||||
/**
|
||||
* Function to check whether the format is uncompressed RGB
|
||||
* @params gbm format
|
||||
* @return boolean 0 (compressed RGB format)
|
||||
* 1 (uncompressed RGB format)
|
||||
*
|
||||
*/
|
||||
bool is_valid_uncmprsd_rgb_fmt(int format);
|
||||
|
||||
/**
|
||||
* Function to check whether the format is uncompressed RGB
|
||||
* @params gbm format
|
||||
* @return boolean 0 (uncompressed RGB format)
|
||||
* 1 (compressed RGB format)
|
||||
*
|
||||
*/
|
||||
bool is_valid_cmprsd_rgb_fmt(int format);
|
||||
|
||||
/**
|
||||
* Function to check whether the format is yuv format
|
||||
* @params gbm format
|
||||
* @return true : success
|
||||
* false : fail
|
||||
*
|
||||
*/
|
||||
bool is_valid_yuv_fmt(int format);
|
||||
|
||||
/**
|
||||
* Function to query UBWC feature support
|
||||
* @return true : success
|
||||
* false : fail
|
||||
*/
|
||||
bool is_ubwc_support_enbld(int format);
|
||||
/**
|
||||
* Function to query UBWC enabled format support
|
||||
* @return true : success
|
||||
* false : fail
|
||||
*/
|
||||
bool is_valid_ubwc_fmt(int format);
|
||||
/**
|
||||
* Function to get aligned width and height depending on the underlying GPU/Video platform
|
||||
* @return aligned_w
|
||||
* aligned_h
|
||||
*/
|
||||
void get_aligned_wdth_hght(gbm_bufdesc *descriptor, unsigned int *aligned_w,
|
||||
unsigned int *aligned_h);
|
||||
|
||||
/**
|
||||
* Function to get stride, scanline and size depending on the underlying GPU/Video platform
|
||||
* @return stride
|
||||
* scanline
|
||||
* size
|
||||
*/
|
||||
void get_stride_scanline_size(gbm_bufdesc *descriptor, unsigned int *stride,
|
||||
unsigned int *scanline, unsigned int *size);
|
||||
|
||||
/**
|
||||
* Function to get size aligned width and height depending on the underlying GPU/Video platform
|
||||
* @params gbm format
|
||||
* width of the buffer
|
||||
* height of the buffer
|
||||
* usage flags
|
||||
* aligned height
|
||||
* aligned weight
|
||||
* @return size of the buffer
|
||||
*/
|
||||
unsigned int get_size(int format, int width, int height, int usage,
|
||||
int alignedw, int alignedh);
|
||||
|
||||
/**
|
||||
* Function to get aligned width and height for YUV format
|
||||
* @params gbm format
|
||||
* width of the buffer
|
||||
* height of the buffer
|
||||
* @return aligned height
|
||||
* aligned weight
|
||||
*
|
||||
*/
|
||||
void get_yuv_ubwc_wdth_hght(int width, int height, int format,
|
||||
unsigned int *aligned_w, unsigned int *aligned_h);
|
||||
|
||||
private:
|
||||
bool gpu_support_macrotile = false;
|
||||
bool display_support_macrotile = false;
|
||||
adreno_mem_info *adreno_helper_ = NULL;
|
||||
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
/**
|
||||
* C wrapper Function to get aligned width and height depending on the underlying GPU/Video platform
|
||||
* @return aligned_w
|
||||
* aligned_h
|
||||
*/
|
||||
void qry_aligned_wdth_hght(gbm_bufdesc *descriptor, unsigned int *alignedw, unsigned int *alignedh);
|
||||
|
||||
/**
|
||||
* C wrapper Function to get stride, scanline and size depending on the underlying GPU/Video platform
|
||||
* @return stride
|
||||
* scanline
|
||||
* size
|
||||
*/
|
||||
void qry_stride_scanline_size(gbm_bufdesc *descriptor, unsigned int *stride,
|
||||
unsigned int *scanline, unsigned int *size);
|
||||
|
||||
/**
|
||||
* C wrapper Function to query size based on format from the platform wrapper
|
||||
* @return : size
|
||||
*
|
||||
*/
|
||||
unsigned int qry_size(gbm_bufdesc *desc, unsigned int alignedw, unsigned int alignedh);
|
||||
|
||||
/**
|
||||
* C wrapper Function to check whether the format is UBWC or not.
|
||||
* @params gbm format
|
||||
* @return boolean 0 (non UBWC format)
|
||||
* 1 (UBWC format)
|
||||
*/
|
||||
bool is_valid_ubwc_format(int format);
|
||||
|
||||
/**
|
||||
* Function to return bytes per pixel for a given uncompressed RGB format
|
||||
* @params uncompressed RGB gbm format
|
||||
* @return bytes per pixel
|
||||
*
|
||||
*/
|
||||
uint32_t get_bpp_for_uncmprsd_rgb_format(int format);
|
||||
|
||||
/**
|
||||
* Function to return bytes needed to represent UBWC RGB Metabuffer
|
||||
* @params RGB gbm format
|
||||
* @return size of UBWC RGB meta buffer
|
||||
*
|
||||
*/
|
||||
uint32_t get_rgb_ubwc_metabuffer_size(int width, int height, int bpp);
|
||||
|
||||
/**
|
||||
* C wrapper Function to check whether the format is uncompressed RGB format or not.
|
||||
* @params gbm format
|
||||
* @return boolean 0 (compressed RGB format)
|
||||
* 1 (uncompressed RGB format)
|
||||
*/
|
||||
bool is_valid_uncmprsd_rgb_format(int format);
|
||||
|
||||
/**
|
||||
* C wrapper Function to check whether the format is uncompressed RGB format or not.
|
||||
* @params gbm format
|
||||
* @return boolean 0 (uncompressed RGB format)
|
||||
* 1 (compressed RGB format)
|
||||
*/
|
||||
bool is_valid_cmprsd_rgb_format(int format);
|
||||
|
||||
/**
|
||||
* C wrapper Function to check whether the format is yuv format or not.
|
||||
* @params gbm format
|
||||
* @return boolean 0 (non yuv format)
|
||||
* 1 (yuv format)
|
||||
*/
|
||||
bool is_valid_yuv_format(int format);
|
||||
|
||||
/**
|
||||
* C wrapper function to know if the format is UBWC
|
||||
*/
|
||||
bool is_ubwc_enbld(int format, int prod_usage,
|
||||
int cons_usage);
|
||||
|
||||
/**
|
||||
* C wrapper Function to check whether the format is RAW format or not.
|
||||
* @params gbm format
|
||||
* @return boolean 0 (non RAW format)
|
||||
* 1 (RAW format)
|
||||
*/
|
||||
bool is_valid_raw_format(int format);
|
||||
|
||||
/**
|
||||
* C wrapper function to know if the format is RGB
|
||||
*/
|
||||
bool is_valid_rgb_fmt(int format);
|
||||
/**
|
||||
* C wrapper Function to delete platform wrapper object
|
||||
* @return : None
|
||||
*
|
||||
*/
|
||||
void platform_wrap_deinstnce(void);
|
||||
|
||||
/**
|
||||
* C wrapper Function to create a cpp object of platform wrapper class
|
||||
* @return 0 : success
|
||||
* 1 : failure
|
||||
*/
|
||||
bool platform_wrap_instnce(void);
|
||||
|
||||
}
|
||||
|
||||
} // namespace msm_gbm
|
||||
|
||||
#endif // __MSMGBM_PFM_WRP_H__
|
Reference in New Issue
Block a user