mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
VPU: support compatible vpu request from userspace.
This revision need rk3368 android library libvpu to revert it VPUReq_t definition, Revert RK_U64 req; to RK_U32 *req; Signed-off-by: Alpha Lin <alpha.lin@rock-chips.com>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/compat.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
@@ -475,10 +476,15 @@ struct vcodec_combo {
|
||||
enum vcodec_device_id current_hw_mode;
|
||||
};
|
||||
|
||||
typedef struct vpu_request {
|
||||
u64 req;
|
||||
struct vpu_request {
|
||||
u32 *req;
|
||||
u32 size;
|
||||
} vpu_request;
|
||||
};
|
||||
|
||||
struct compat_vpu_request {
|
||||
compat_uptr_t req;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
/* debugfs root directory for all device (vpu, hevc).*/
|
||||
static struct dentry *parent;
|
||||
@@ -895,8 +901,6 @@ static int vcodec_bufid_to_iova(struct vpu_subdev_data *data, u8 *tbl,
|
||||
return -1;
|
||||
}
|
||||
|
||||
vpu_service_power_on(pservice);
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
usr_fd = reg->reg[tbl[i]] & 0x3FF;
|
||||
|
||||
@@ -1068,9 +1072,8 @@ static vpu_reg *reg_init(struct vpu_subdev_data *data,
|
||||
}
|
||||
|
||||
if (size > data->reg_size) {
|
||||
/*printk("warning: vpu reg size %lu is larger than hw reg size %lu\n",
|
||||
size, pservice->reg_size);
|
||||
size = pservice->reg_size;*/
|
||||
/*printk("warning: vpu reg size %u is larger than hw reg size %u\n",
|
||||
size, data->reg_size);*/
|
||||
extra_size = size - data->reg_size;
|
||||
size = data->reg_size;
|
||||
}
|
||||
@@ -1515,8 +1518,8 @@ static long vpu_service_ioctl(struct file *filp, unsigned int cmd,
|
||||
break;
|
||||
}
|
||||
case VPU_IOC_GET_HW_FUSE_STATUS : {
|
||||
vpu_request req;
|
||||
if (copy_from_user(&req, (void __user *)arg, sizeof(vpu_request))) {
|
||||
struct vpu_request req;
|
||||
if (copy_from_user(&req, (void __user *)arg, sizeof(struct vpu_request))) {
|
||||
vpu_err("error: VPU_IOC_GET_HW_FUSE_STATUS copy_from_user failed\n");
|
||||
return -EFAULT;
|
||||
} else {
|
||||
@@ -1542,10 +1545,10 @@ static long vpu_service_ioctl(struct file *filp, unsigned int cmd,
|
||||
break;
|
||||
}
|
||||
case VPU_IOC_SET_REG : {
|
||||
vpu_request req;
|
||||
struct vpu_request req;
|
||||
vpu_reg *reg;
|
||||
if (copy_from_user(&req, (void __user *)arg,
|
||||
sizeof(vpu_request))) {
|
||||
sizeof(struct vpu_request))) {
|
||||
vpu_err("error: VPU_IOC_SET_REG copy_from_user failed\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
@@ -1562,10 +1565,10 @@ static long vpu_service_ioctl(struct file *filp, unsigned int cmd,
|
||||
break;
|
||||
}
|
||||
case VPU_IOC_GET_REG : {
|
||||
vpu_request req;
|
||||
struct vpu_request req;
|
||||
vpu_reg *reg;
|
||||
if (copy_from_user(&req, (void __user *)arg,
|
||||
sizeof(vpu_request))) {
|
||||
sizeof(struct vpu_request))) {
|
||||
vpu_err("error: VPU_IOC_GET_REG copy_from_user failed\n");
|
||||
return -EFAULT;
|
||||
} else {
|
||||
@@ -1648,9 +1651,10 @@ static long compat_vpu_service_ioctl(struct file *filp, unsigned int cmd,
|
||||
break;
|
||||
}
|
||||
case COMPAT_VPU_IOC_GET_HW_FUSE_STATUS : {
|
||||
vpu_request req;
|
||||
struct compat_vpu_request req;
|
||||
|
||||
if (copy_from_user(&req, compat_ptr((compat_uptr_t)arg),
|
||||
sizeof(vpu_request))) {
|
||||
sizeof(struct compat_vpu_request))) {
|
||||
vpu_err("error: VPU_IOC_GET_HW_FUSE_STATUS"
|
||||
" copy_from_user failed\n");
|
||||
return -EFAULT;
|
||||
@@ -1679,10 +1683,10 @@ static long compat_vpu_service_ioctl(struct file *filp, unsigned int cmd,
|
||||
break;
|
||||
}
|
||||
case COMPAT_VPU_IOC_SET_REG : {
|
||||
vpu_request req;
|
||||
struct compat_vpu_request req;
|
||||
vpu_reg *reg;
|
||||
if (copy_from_user(&req, compat_ptr((compat_uptr_t)arg),
|
||||
sizeof(vpu_request))) {
|
||||
sizeof(struct compat_vpu_request))) {
|
||||
vpu_err("VPU_IOC_SET_REG copy_from_user failed\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
@@ -1699,10 +1703,10 @@ static long compat_vpu_service_ioctl(struct file *filp, unsigned int cmd,
|
||||
break;
|
||||
}
|
||||
case COMPAT_VPU_IOC_GET_REG : {
|
||||
vpu_request req;
|
||||
struct compat_vpu_request req;
|
||||
vpu_reg *reg;
|
||||
if (copy_from_user(&req, compat_ptr((compat_uptr_t)arg),
|
||||
sizeof(vpu_request))) {
|
||||
sizeof(struct compat_vpu_request))) {
|
||||
vpu_err("VPU_IOC_GET_REG copy_from_user failed\n");
|
||||
return -EFAULT;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user