diff options
| author | Tatenda Chipeperekwa <tatendac@codeaurora.org> | 2013-10-25 17:44:37 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:23:01 -0700 |
| commit | b3acb686a93104b91a668a015bc1f341eec12ab7 (patch) | |
| tree | e149beb90810cde29b79edb3f94e0b160d6e0196 | |
| parent | e1583e0eb16476e6e6ed5ecdd19b8ead15700ea0 (diff) | |
msm: mdss: Add support to get/set secure flag via an ioctl
Add support to get/set secure flag for WB session through an ioctl.
This is required for WB clients such as AD/WFD, enabling them to modify
or query the secure flag depending on requirements e.g. secure video
playback when using AD.
Change-Id: I852b6f79b31b5ba027d9a5c11561c562023cb99f
Signed-off-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp.h | 3 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_overlay.c | 6 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_wb.c | 32 | ||||
| -rw-r--r-- | include/uapi/linux/msm_mdp.h | 2 |
4 files changed, 43 insertions, 0 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp.h b/drivers/video/fbdev/msm/mdss_mdp.h index 79ffd681c24f..e33c20c64ba6 100644 --- a/drivers/video/fbdev/msm/mdss_mdp.h +++ b/drivers/video/fbdev/msm/mdss_mdp.h @@ -664,6 +664,9 @@ int mdss_mdp_wb_get_format(struct msm_fb_data_type *mfd, struct mdp_mixer_cfg *mixer_cfg); int mdss_mdp_pipe_program_pixel_extn(struct mdss_mdp_pipe *pipe); +int mdss_mdp_wb_set_secure(struct msm_fb_data_type *mfd, int enable); +int mdss_mdp_wb_get_secure(struct msm_fb_data_type *mfd, uint8_t *enable); + #define mfd_to_mdp5_data(mfd) (mfd->mdp.private1) #define mfd_to_mdata(mfd) (((struct mdss_overlay_private *)\ (mfd->mdp.private1))->mdata) diff --git a/drivers/video/fbdev/msm/mdss_mdp_overlay.c b/drivers/video/fbdev/msm/mdss_mdp_overlay.c index 08d183319fc1..8d2ed7d3d3cd 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_overlay.c +++ b/drivers/video/fbdev/msm/mdss_mdp_overlay.c @@ -2119,6 +2119,9 @@ static int mdss_fb_set_metadata(struct msm_fb_data_type *mfd, ret = mdss_mdp_wb_set_format(mfd, metadata->data.mixer_cfg.writeback_format); break; + case metadata_op_wb_secure: + ret = mdss_mdp_wb_set_secure(mfd, metadata->data.secure_en); + break; default: pr_warn("unsupported request to MDP META IOCTL\n"); ret = -EINVAL; @@ -2166,6 +2169,9 @@ static int mdss_fb_get_metadata(struct msm_fb_data_type *mfd, case metadata_op_wb_format: ret = mdss_mdp_wb_get_format(mfd, &metadata->data.mixer_cfg); break; + case metadata_op_wb_secure: + ret = mdss_mdp_wb_get_secure(mfd, &metadata->data.secure_en); + break; default: pr_warn("Unsupported request to MDP META IOCTL.\n"); ret = -EINVAL; diff --git a/drivers/video/fbdev/msm/mdss_mdp_wb.c b/drivers/video/fbdev/msm/mdss_mdp_wb.c index 18fb11c319b1..5fe587ffb4df 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_wb.c +++ b/drivers/video/fbdev/msm/mdss_mdp_wb.c @@ -133,6 +133,34 @@ struct mdss_mdp_data *mdss_mdp_wb_debug_buffer(struct msm_fb_data_type *mfd) } #endif +/* + * mdss_mdp_get_secure() - Queries the secure status of a writeback session + * @mfd: Frame buffer device structure + * @enabled: Pointer to convey if session is secure + * + * This api enables an entity (userspace process, driver module, etc.) to + * query the secure status of a writeback session. The secure status is + * then supplied via a pointer. + */ +int mdss_mdp_wb_get_secure(struct msm_fb_data_type *mfd, uint8_t *enabled) +{ + struct mdss_mdp_wb *wb = mfd_to_wb(mfd); + if (!wb) + return -EINVAL; + *enabled = wb->is_secure; + return 0; +} + +/* + * mdss_mdp_set_secure() - Updates the secure status of a writeback session + * @mfd: Frame buffer device structure + * @enable: New secure status (1: secure, 0: non-secure) + * + * This api enables an entity to modify the secure status of a writeback + * session. If enable is 1, we allocate a secure pipe so that MDP is + * allowed to write back into the secure buffer. If enable is 0, we + * deallocate the secure pipe (if it was allocated previously). + */ int mdss_mdp_wb_set_secure(struct msm_fb_data_type *mfd, int enable) { struct mdss_mdp_wb *wb = mfd_to_wb(mfd); @@ -141,6 +169,10 @@ int mdss_mdp_wb_set_secure(struct msm_fb_data_type *mfd, int enable) struct mdss_mdp_mixer *mixer; pr_debug("setting secure=%d\n", enable); + if ((enable != 1) && (enable != 0)) { + pr_err("Invalid enable value = %d\n", enable); + return -EINVAL; + } if (!ctl || !ctl->mdata) { pr_err("%s : ctl is NULL", __func__); diff --git a/include/uapi/linux/msm_mdp.h b/include/uapi/linux/msm_mdp.h index 15895f9825bc..858f093c5db2 100644 --- a/include/uapi/linux/msm_mdp.h +++ b/include/uapi/linux/msm_mdp.h @@ -873,6 +873,7 @@ enum { metadata_op_frame_rate, metadata_op_vic, metadata_op_wb_format, + metadata_op_wb_secure, metadata_op_get_caps, metadata_op_crc, metadata_op_max @@ -905,6 +906,7 @@ struct msmfb_metadata { uint32_t panel_frame_rate; uint32_t video_info_code; struct mdss_hw_caps caps; + uint8_t secure_en; } data; }; |
