replace common qcom sources with samsung ones
This commit is contained in:
141
qcom/opensource/mm-sys-kernel/ubwcp/include/kernel/ubwcp.h
Normal file
141
qcom/opensource/mm-sys-kernel/ubwcp/include/kernel/ubwcp.h
Normal file
@@ -0,0 +1,141 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __UBWCP_H_
|
||||
#define __UBWCP_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/dma-buf.h>
|
||||
|
||||
#include "../uapi/ubwcp_ioctl.h"
|
||||
|
||||
|
||||
typedef int (*configure_mmap)(struct dma_buf *dmabuf, bool linear, phys_addr_t ula_pa_addr,
|
||||
size_t ula_pa_size);
|
||||
|
||||
/**
|
||||
* Get UBWCP hardware version
|
||||
*
|
||||
* @param ver : ptr to ver struct where hw version will be
|
||||
* copied
|
||||
*
|
||||
* @return int : 0 on success, otherwise error code
|
||||
*/
|
||||
int ubwcp_get_hw_version(struct ubwcp_ioctl_hw_version *ver);
|
||||
|
||||
/**
|
||||
* Configures ubwcp buffer with the provided buffer image
|
||||
* attributes. This call must be done at least once before
|
||||
* ubwcp_lock(). Attributes can be configured multiple times,
|
||||
* but only during unlocked state.
|
||||
*
|
||||
* Upon error, buffer will be in undefined state.
|
||||
* There is no guarantee that previously set attributes will be retained.
|
||||
* Caller could retry set attributes, but must not reuse buffer
|
||||
* until a successful set attribute call is done.
|
||||
*
|
||||
* @param dmabuf : ptr to the dma buf
|
||||
* @param attr : buffer attributes to set
|
||||
*
|
||||
* @return int : 0 on success, otherwise error code
|
||||
*/
|
||||
int ubwcp_set_buf_attrs(struct dma_buf *dmabuf, struct ubwcp_buffer_attrs *attr);
|
||||
|
||||
/**
|
||||
* Get the currently configured attributes for the buffer
|
||||
*
|
||||
* @param dmabuf : ptr to the dma buf
|
||||
* @param attr : pointer to location where image attributes
|
||||
* for this buffer will be copied to.
|
||||
*
|
||||
* @return int : 0 on success, otherwise error code
|
||||
*/
|
||||
int ubwcp_get_buf_attrs(struct dma_buf *dmabuf, struct ubwcp_buffer_attrs *attr);
|
||||
|
||||
/**
|
||||
* Set permanent range translation for the buffer. This reserves
|
||||
* ubwcp address translation resources for the buffer until free
|
||||
* is called. This may speed up lock()/unlock() calls as they
|
||||
* don't need to configure address translations for the buffer.
|
||||
*
|
||||
* @param dmabuf : ptr to the dma buf
|
||||
* @param enable : true == enable, false == disable
|
||||
*
|
||||
* @return int : 0 on success, otherwise error code
|
||||
*/
|
||||
int ubwcp_set_perm_range_translation(struct dma_buf *dmabuf, bool enable);
|
||||
|
||||
enum ubwcp_error {
|
||||
UBWCP_ENCODE_ERROR = 0,
|
||||
UBWCP_DECODE_ERROR,
|
||||
UBWCP_RANGE_TRANSLATION_ERROR,
|
||||
UBWCP_SMMU_FAULT,
|
||||
UBWCP_UNKNOWN_ERROR,
|
||||
};
|
||||
|
||||
enum iommu_cb_id {
|
||||
UBWCP_DESC_CB_ID = 0,
|
||||
UBWCP_BUF_CB_ID,
|
||||
UBWCP_UNKNOWN_CB_ID,
|
||||
};
|
||||
|
||||
struct ubwcp_enc_err_info {
|
||||
struct dma_buf *dmabuf;
|
||||
phys_addr_t ula_pa;
|
||||
};
|
||||
|
||||
struct ubwcp_dec_err_info {
|
||||
struct dma_buf *dmabuf;
|
||||
phys_addr_t ula_pa;
|
||||
};
|
||||
|
||||
struct ubwcp_translation_err_info {
|
||||
struct dma_buf *dmabuf;
|
||||
phys_addr_t ula_pa;
|
||||
bool read;
|
||||
};
|
||||
|
||||
struct ubwcp_smmu_fault_err_info {
|
||||
struct dma_buf *dmabuf;
|
||||
unsigned long iova;
|
||||
enum iommu_cb_id iommu_dev_id;
|
||||
int iommu_fault_flags;
|
||||
};
|
||||
|
||||
struct ubwcp_err_info {
|
||||
enum ubwcp_error err_code;
|
||||
union {
|
||||
struct ubwcp_enc_err_info enc_err;
|
||||
struct ubwcp_dec_err_info dec_err;
|
||||
struct ubwcp_translation_err_info translation_err;
|
||||
struct ubwcp_smmu_fault_err_info smmu_err;
|
||||
};
|
||||
};
|
||||
|
||||
typedef void (*ubwcp_error_handler_t)(struct ubwcp_err_info *err, void *data);
|
||||
|
||||
/*
|
||||
* Register an error handler
|
||||
*
|
||||
* @param client_id : not currently supported (pass in -1)
|
||||
* @param handler : the error handler function which will be called when an
|
||||
* error occurs
|
||||
* @param data : data pointer provided with the error handler function
|
||||
*
|
||||
* @return int : 0 on success, otherwise error code
|
||||
*/
|
||||
int ubwcp_register_error_handler(u32 client_id, ubwcp_error_handler_t handler,
|
||||
void *data);
|
||||
|
||||
/*
|
||||
* Unregister an error handler
|
||||
*
|
||||
* @param client_id : client id of handler to unregister (pass in -1)
|
||||
*
|
||||
* @return int : 0 on success, otherwise error code
|
||||
*/
|
||||
int ubwcp_unregister_error_handler(u32 client_id);
|
||||
|
||||
#endif /* __UBWCP_H_ */
|
||||
151
qcom/opensource/mm-sys-kernel/ubwcp/include/uapi/ubwcp_ioctl.h
Normal file
151
qcom/opensource/mm-sys-kernel/ubwcp/include/uapi/ubwcp_ioctl.h
Normal file
@@ -0,0 +1,151 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
|
||||
/*
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __UBWCP_IOCTL_H_
|
||||
#define __UBWCP_IOCTL_H_
|
||||
|
||||
#include <linux/ioctl.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#define UBWCP_IOCTL_SET_BUF_ATTR _IOW('U', 1, struct ubwcp_ioctl_buffer_attrs)
|
||||
#define UBWCP_IOCTL_GET_HW_VER _IOR('U', 2, struct ubwcp_ioctl_hw_version)
|
||||
#define UBWCP_IOCTL_GET_STRIDE_ALIGN _IOWR('U', 3, struct ubwcp_ioctl_stride_align)
|
||||
#define UBWCP_IOCTL_VALIDATE_STRIDE _IOWR('U', 4, struct ubwcp_ioctl_validate_stride)
|
||||
|
||||
|
||||
enum ubwcp_image_format {
|
||||
UBWCP_LINEAR = 0,
|
||||
UBWCP_RGBA8888,
|
||||
UBWCP_NV12,
|
||||
UBWCP_NV12_Y,
|
||||
UBWCP_NV12_UV,
|
||||
UBWCP_NV124R,
|
||||
UBWCP_NV124R_Y,
|
||||
UBWCP_NV124R_UV,
|
||||
UBWCP_TP10,
|
||||
UBWCP_TP10_Y,
|
||||
UBWCP_TP10_UV,
|
||||
UBWCP_P010,
|
||||
UBWCP_P010_Y,
|
||||
UBWCP_P010_UV,
|
||||
UBWCP_P016,
|
||||
UBWCP_P016_Y,
|
||||
UBWCP_P016_UV,
|
||||
};
|
||||
|
||||
enum ubwcp_compression_type {
|
||||
UBWCP_COMPRESSION_LOSSLESS = 0,
|
||||
};
|
||||
|
||||
enum ubwcp_subsample {
|
||||
UBWCP_SUBSAMPLE_4_2_0 = 0,
|
||||
};
|
||||
|
||||
#define UBWCP_SUBSYSTEM_TARGET_CPU (1 << 0)
|
||||
|
||||
/**
|
||||
* @image_format: image format
|
||||
* @major_ubwc_ver: set to 0. This is not HW version.
|
||||
* @minor_ubwc_ver: set to 0. This is not HW version.
|
||||
* @compression_type: only lossless is supported.
|
||||
* @lossy_params: set to 0
|
||||
* @width: image width (pixels)
|
||||
* @height: image height (pixels)
|
||||
* @stride: image stride (bytes)
|
||||
* @scanlines: number of scanlines
|
||||
* @planar_padding: padding between Y and UV planes (bytes)
|
||||
* @subsample: only 4:2:0 is supported
|
||||
* @sub_system_target: only CPU is supported
|
||||
* @y_offset: set to 0
|
||||
* @batch_size: set to 1
|
||||
*
|
||||
* All pad[x] and unused[x] fields must be set to 0
|
||||
*/
|
||||
struct ubwcp_buffer_attrs {
|
||||
|
||||
__u16 image_format; /* enum ubwcp_image_format */
|
||||
__u16 major_ubwc_ver; /* per-buffer version: must be set to 0 */
|
||||
__u16 minor_ubwc_ver; /* per-buffer version: must be set to 0 */
|
||||
__u16 compression_type; /* enum ubwcp_compression_type */
|
||||
|
||||
__u64 lossy_params; /* must be set to 0 */
|
||||
|
||||
__u32 width;
|
||||
__u32 height;
|
||||
__u32 stride;
|
||||
__u32 scanlines;
|
||||
|
||||
__u32 planar_padding;
|
||||
__u32 subsample; /* enum enum ubwcp_subsample */
|
||||
__u32 sub_system_target;/* bit mask: UBWCP_SUBSYSTEM_TARGET_XXX */
|
||||
__u32 y_offset; /* must be set to 0 */
|
||||
|
||||
__u32 batch_size; /* only size supported: 1 */
|
||||
__u32 unused1;
|
||||
|
||||
__u32 unused2;
|
||||
__u32 unused3;
|
||||
__u32 unused4;
|
||||
__u32 unused5;
|
||||
|
||||
__u32 unused6;
|
||||
__u32 unused7;
|
||||
__u32 unused8;
|
||||
__u32 unused9;
|
||||
};
|
||||
|
||||
/**
|
||||
* @fd: dma_buf file descriptor for the buffer whose
|
||||
* attributes are specified
|
||||
* @attr: ubwcp buffer attributes
|
||||
*/
|
||||
struct ubwcp_ioctl_buffer_attrs {
|
||||
__u32 fd;
|
||||
__u32 pad;
|
||||
struct ubwcp_buffer_attrs attr;
|
||||
};
|
||||
|
||||
/**
|
||||
* ubwcp hardware version
|
||||
* @major: major version
|
||||
* @minor: minor version
|
||||
*/
|
||||
struct ubwcp_ioctl_hw_version {
|
||||
__u32 major;
|
||||
__u32 minor;
|
||||
};
|
||||
|
||||
/**
|
||||
* Stride alignment for given format
|
||||
* @image_format: image format
|
||||
* @stride_align: stride alignment
|
||||
* @unused: must be set to 0
|
||||
* IOCTL will fail for linear image format
|
||||
*/
|
||||
struct ubwcp_ioctl_stride_align {
|
||||
__u16 image_format;
|
||||
__u16 stride_align;
|
||||
__u32 unused;
|
||||
};
|
||||
|
||||
/**
|
||||
* validate stride
|
||||
* @image_format: image format
|
||||
* @width: image width in pixels
|
||||
* @stride: image stride in bytes
|
||||
* @valid: returns 0 (not valid), 1 (valid)
|
||||
* @unusedX: must be set to 0
|
||||
* IOCTL will fail for linear image format
|
||||
*/
|
||||
struct ubwcp_ioctl_validate_stride {
|
||||
__u16 image_format;
|
||||
__u32 width;
|
||||
__u32 stride;
|
||||
__u16 valid;
|
||||
__u16 unused1;
|
||||
__u16 unused2;
|
||||
};
|
||||
|
||||
#endif /* __UBWCP_IOCTL_H_ */
|
||||
Reference in New Issue
Block a user