mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
msm: vidc: Get the current performance level
This change supports client to get the current performance level of the video driver via IOCTL_GET_PERF_LEVEL. The current performance level indicate the number of MBs per second is being processed by video hardware. Change-Id: Ic6f5b2b14e0d77bf801c4f857f8a0e20339c199f Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
This commit is contained in:
parent
fc9cab72cb
commit
6a9440707a
10 changed files with 128 additions and 9 deletions
|
@ -678,6 +678,30 @@ static u32 vid_dec_set_frame_resolution(struct video_client_ctx *client_ctx,
|
|||
return true;
|
||||
}
|
||||
|
||||
static u32 vid_dec_get_curr_perf_level(struct video_client_ctx *client_ctx,
|
||||
u32 *perf_level)
|
||||
{
|
||||
struct vcd_property_hdr vcd_property_hdr;
|
||||
u32 vcd_status = VCD_ERR_FAIL;
|
||||
u32 perf_lvl = 0;
|
||||
|
||||
if (!client_ctx)
|
||||
return false;
|
||||
|
||||
vcd_property_hdr.prop_id = VCD_I_GET_CURR_PERF_LEVEL;
|
||||
vcd_property_hdr.sz = sizeof(u32);
|
||||
vcd_status = vcd_get_property(client_ctx->vcd_handle,
|
||||
&vcd_property_hdr, &perf_lvl);
|
||||
if (vcd_status) {
|
||||
ERR("VCD_I_GET_PERF_LEVEL failed!!");
|
||||
*perf_level = 0;
|
||||
return false;
|
||||
} else {
|
||||
*perf_level = perf_lvl;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static u32 vid_dec_set_turbo_clk(struct video_client_ctx *client_ctx)
|
||||
{
|
||||
struct vcd_property_hdr vcd_property_hdr;
|
||||
|
@ -2134,6 +2158,24 @@ static long vid_dec_ioctl(struct file *file,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case VDEC_IOCTL_GET_PERF_LEVEL:
|
||||
{
|
||||
u32 curr_perf_level;
|
||||
if (copy_from_user(&vdec_msg, arg, sizeof(vdec_msg)))
|
||||
return -EFAULT;
|
||||
result = vid_dec_get_curr_perf_level(client_ctx,
|
||||
&curr_perf_level);
|
||||
if (!result) {
|
||||
ERR("get_curr_perf_level failed!!");
|
||||
return -EIO;
|
||||
}
|
||||
DBG("VDEC_IOCTL_GET_PERF_LEVEL %u\n",
|
||||
curr_perf_level);
|
||||
if (copy_to_user(vdec_msg.out,
|
||||
&curr_perf_level, sizeof(u32)))
|
||||
return -EFAULT;
|
||||
break;
|
||||
}
|
||||
case VDEC_IOCTL_SET_PERF_CLK:
|
||||
{
|
||||
DBG("VDEC_IOCTL_SET_PERF_CLK\n");
|
||||
|
|
|
@ -1824,6 +1824,24 @@ static long vid_enc_ioctl(struct file *file,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case VEN_IOCTL_GET_PERF_LEVEL:
|
||||
{
|
||||
u32 curr_perf_level;
|
||||
if (copy_from_user(&venc_msg, arg, sizeof(venc_msg)))
|
||||
return -EFAULT;
|
||||
result = vid_enc_get_curr_perf_level(client_ctx,
|
||||
&curr_perf_level);
|
||||
if (!result) {
|
||||
ERR("get_curr_perf_level failed!!");
|
||||
return -EIO;
|
||||
}
|
||||
DBG("VEN_IOCTL_GET_PERF_LEVEL %u\n",
|
||||
curr_perf_level);
|
||||
if (copy_to_user(venc_msg.out,
|
||||
&curr_perf_level, sizeof(u32)))
|
||||
return -EFAULT;
|
||||
break;
|
||||
}
|
||||
case VEN_IOCTL_SET_AC_PREDICTION:
|
||||
case VEN_IOCTL_GET_AC_PREDICTION:
|
||||
case VEN_IOCTL_SET_RVLC:
|
||||
|
|
|
@ -2060,3 +2060,27 @@ u32 vid_enc_get_recon_buffer_size(struct video_client_ctx *client_ctx,
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
u32 vid_enc_get_curr_perf_level(struct video_client_ctx *client_ctx,
|
||||
u32 *curr_perf_level)
|
||||
{
|
||||
struct vcd_property_hdr vcd_property_hdr;
|
||||
u32 vcd_status = VCD_ERR_FAIL;
|
||||
u32 curr_perf_lvl = 0;
|
||||
|
||||
if (!client_ctx)
|
||||
return false;
|
||||
|
||||
vcd_property_hdr.prop_id = VCD_I_GET_CURR_PERF_LEVEL;
|
||||
vcd_property_hdr.sz = sizeof(u32);
|
||||
vcd_status = vcd_get_property(client_ctx->vcd_handle,
|
||||
&vcd_property_hdr, &curr_perf_lvl);
|
||||
if (vcd_status) {
|
||||
ERR("VCD_I_GET_PERF_LEVEL failed!!");
|
||||
*curr_perf_level = 0;
|
||||
return false;
|
||||
} else {
|
||||
*curr_perf_level = curr_perf_lvl;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,4 +152,7 @@ u32 vid_enc_free_recon_buffers(struct video_client_ctx *client_ctx,
|
|||
u32 vid_enc_get_recon_buffer_size(struct video_client_ctx *client_ctx,
|
||||
struct venc_recon_buff_size *venc_recon_size);
|
||||
|
||||
u32 vid_enc_get_curr_perf_level(struct video_client_ctx *client_ctx,
|
||||
u32 *curr_perf_level);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -327,6 +327,7 @@ u32 vcd_enable_clock(struct vcd_dev_ctxt *dev_ctxt,
|
|||
|
||||
u32 vcd_disable_clock(struct vcd_dev_ctxt *dev_ctxt);
|
||||
|
||||
u32 vcd_get_curr_perf_level(struct vcd_dev_ctxt *dev_ctxt);
|
||||
u32 vcd_set_perf_level(struct vcd_dev_ctxt *dev_ctxt, u32 perf_lvl);
|
||||
|
||||
u32 vcd_update_clnt_perf_lvl
|
||||
|
|
|
@ -584,7 +584,8 @@ static u32 vcd_get_property_cmn
|
|||
(struct vcd_clnt_ctxt *cctxt,
|
||||
struct vcd_property_hdr *prop_hdr, void *prop_val)
|
||||
{
|
||||
int rc;
|
||||
int rc = VCD_ERR_FAIL;
|
||||
u32 prop_handled = true;
|
||||
VCD_MSG_LOW("vcd_get_property_cmn in %d:", cctxt->clnt_state.state);
|
||||
VCD_MSG_LOW("property Id = %d", prop_hdr->prop_id);
|
||||
if (!prop_hdr->sz || !prop_hdr->prop_id) {
|
||||
|
@ -592,13 +593,6 @@ static u32 vcd_get_property_cmn
|
|||
|
||||
return VCD_ERR_ILLEGAL_PARM;
|
||||
}
|
||||
rc = ddl_get_property(cctxt->ddl_handle, prop_hdr, prop_val);
|
||||
if (rc) {
|
||||
/* Some properties aren't known to ddl that we can handle */
|
||||
if (prop_hdr->prop_id != VCD_I_VOP_TIMING_CONSTANT_DELTA)
|
||||
VCD_FAILED_RETURN(rc, "Failed: ddl_set_property");
|
||||
}
|
||||
|
||||
switch (prop_hdr->prop_id) {
|
||||
case VCD_I_VOP_TIMING_CONSTANT_DELTA:
|
||||
{
|
||||
|
@ -608,8 +602,30 @@ static u32 vcd_get_property_cmn
|
|||
delta->constant_delta = cctxt->time_frame_delta;
|
||||
rc = VCD_S_SUCCESS;
|
||||
}
|
||||
break;
|
||||
case VCD_I_GET_CURR_PERF_LEVEL:
|
||||
{
|
||||
u32 curr_perf_level = 0;
|
||||
curr_perf_level = vcd_get_curr_perf_level(
|
||||
cctxt->dev_ctxt);
|
||||
*(u32 *)prop_val = curr_perf_level;
|
||||
VCD_MSG_LOW("%s: curr_perf_level = %u",
|
||||
__func__, curr_perf_level);
|
||||
rc = VCD_S_SUCCESS;
|
||||
}
|
||||
return rc;
|
||||
break;
|
||||
default:
|
||||
prop_handled = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (prop_handled) {
|
||||
VCD_MSG_LOW("%s: property %u handled at vcd level",
|
||||
__func__, prop_hdr->prop_id);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return ddl_get_property(cctxt->ddl_handle, prop_hdr, prop_val);
|
||||
}
|
||||
|
||||
static u32 vcd_set_buffer_requirements_cmn
|
||||
|
|
|
@ -299,6 +299,11 @@ u32 vcd_disable_clock(struct vcd_dev_ctxt *dev_ctxt)
|
|||
return rc;
|
||||
}
|
||||
|
||||
u32 vcd_get_curr_perf_level(struct vcd_dev_ctxt *dev_ctxt)
|
||||
{
|
||||
return dev_ctxt->reqd_perf_lvl;
|
||||
}
|
||||
|
||||
u32 vcd_set_perf_level(struct vcd_dev_ctxt *dev_ctxt, u32 perf_lvl)
|
||||
{
|
||||
u32 rc = VCD_S_SUCCESS;
|
||||
|
|
|
@ -223,6 +223,10 @@ struct vdec_ioctl_msg {
|
|||
#define VDEC_IOCTL_GET_ENABLE_SEC_METADATA \
|
||||
_IOR(VDEC_IOCTL_MAGIC, 41, struct vdec_ioctl_msg)
|
||||
|
||||
/*IOCTL params:GET: InputData - NULL, OutputData - unsigned int.*/
|
||||
#define VDEC_IOCTL_GET_PERF_LEVEL \
|
||||
_IOR(VDEC_IOCTL_MAGIC, 42, struct vdec_ioctl_msg)
|
||||
|
||||
enum vdec_picture {
|
||||
PICTURE_TYPE_I,
|
||||
PICTURE_TYPE_P,
|
||||
|
|
|
@ -468,6 +468,11 @@ struct venc_ioctl_msg{
|
|||
#define VEN_IOCTL_SET_VUI_BITSTREAM_RESTRICT_FLAG \
|
||||
_IO(VEN_IOCTLBASE_ENC, 52)
|
||||
|
||||
/*IOCTL params:GET: InputData - NULL, OutputData - unsigned int.*/
|
||||
#define VEN_IOCTL_GET_PERF_LEVEL \
|
||||
_IOR(VEN_IOCTLBASE_ENC, 53, struct venc_ioctl_msg)
|
||||
|
||||
|
||||
struct venc_switch{
|
||||
unsigned char status;
|
||||
};
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#define VCD_I_FREE_EXT_METABUFFER (VCD_START_BASE + 0x2D)
|
||||
#define VCD_I_ENABLE_SEC_METADATA (VCD_START_BASE + 0x2E)
|
||||
#define VCD_I_ENABLE_VUI_BITSTREAM_RESTRICT_FLAG (VCD_START_BASE + 0x2F)
|
||||
#define VCD_I_GET_CURR_PERF_LEVEL (VCD_START_BASE + 0x30)
|
||||
|
||||
#define VCD_START_REQ (VCD_START_BASE + 0x1000)
|
||||
#define VCD_I_REQ_IFRAME (VCD_START_REQ + 0x1)
|
||||
|
|
Loading…
Reference in a new issue