Merge "msm: mdss: Fix compat IOCTLS in rotator and primary"

This commit is contained in:
Linux Build Service Account 2017-01-05 02:08:47 -08:00 committed by Gerrit - the friendly Code Review server
commit afc76e01c9
6 changed files with 71 additions and 8 deletions

View file

@ -225,6 +225,7 @@ static struct mdp_input_layer *__create_layer_list(
layer->transp_mask = layer32->transp_mask;
layer->bg_color = layer32->bg_color;
layer->blend_op = layer32->blend_op;
layer->color_space = layer32->color_space;
layer->src_rect = layer32->src_rect;
layer->dst_rect = layer32->dst_rect;
layer->buffer = layer32->buffer;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -15,6 +15,15 @@
#ifndef MDSS_COMPAT_UTILS_H
#define MDSS_COMPAT_UTILS_H
/*
* To allow proper structure padding for 64bit/32bit target
*/
#ifdef __LP64
#define MDP_LAYER_COMMIT_V1_PAD 3
#else
#define MDP_LAYER_COMMIT_V1_PAD 4
#endif
struct mdp_buf_sync32 {
u32 flags;
u32 acq_fen_fd_cnt;
@ -498,7 +507,8 @@ struct mdp_input_layer32 {
uint16_t z_order;
uint32_t transp_mask;
uint32_t bg_color;
enum mdss_mdp_blend_op blend_op;
enum mdss_mdp_blend_op blend_op;
enum mdp_color_space color_space;
struct mdp_rect src_rect;
struct mdp_rect dst_rect;
compat_caddr_t scale;
@ -512,7 +522,8 @@ struct mdp_output_layer32 {
uint32_t flags;
uint32_t writeback_ndx;
struct mdp_layer_buffer buffer;
uint32_t reserved[6];
enum mdp_color_space color_space;
uint32_t reserved[5];
};
struct mdp_layer_commit_v1_32 {
uint32_t flags;
@ -523,7 +534,9 @@ struct mdp_layer_commit_v1_32 {
uint32_t input_layer_cnt;
compat_caddr_t output_layer;
int retire_fence;
uint32_t reserved[6];
compat_caddr_t dest_scaler;
uint32_t dest_scaler_cnt;
uint32_t reserved[MDP_LAYER_COMMIT_V1_PAD];
};
struct mdp_layer_commit32 {

View file

@ -35,6 +35,8 @@
static DEFINE_MUTEX(cmd_clk_mtx);
static DEFINE_MUTEX(cmd_off_mtx);
enum mdss_mdp_cmd_autorefresh_state {
MDP_AUTOREFRESH_OFF,
MDP_AUTOREFRESH_ON_REQUESTED,
@ -1351,7 +1353,7 @@ static int mdss_mdp_cmd_add_lineptr_handler(struct mdss_mdp_ctl *ctl,
unsigned long flags;
int ret = 0;
mutex_lock(&ctl->offlock);
mutex_lock(&cmd_off_mtx);
ctx = (struct mdss_mdp_cmd_ctx *) ctl->intf_ctx[MASTER_CTX];
if (!ctx || !ctl->is_master) {
ret = -EINVAL;
@ -1379,7 +1381,7 @@ static int mdss_mdp_cmd_add_lineptr_handler(struct mdss_mdp_ctl *ctl,
if (ctl->mfd->split_mode == MDP_DUAL_LM_DUAL_DISPLAY)
mutex_unlock(&cmd_clk_mtx);
done:
mutex_unlock(&ctl->offlock);
mutex_unlock(&cmd_off_mtx);
return ret;
}
@ -1820,7 +1822,7 @@ static int mdss_mdp_cmd_add_vsync_handler(struct mdss_mdp_ctl *ctl,
bool enable_rdptr = false;
int ret = 0;
mutex_lock(&ctl->offlock);
mutex_lock(&cmd_off_mtx);
ctx = (struct mdss_mdp_cmd_ctx *) ctl->intf_ctx[MASTER_CTX];
if (!ctx) {
pr_err("%s: invalid ctx\n", __func__);
@ -1857,7 +1859,7 @@ static int mdss_mdp_cmd_add_vsync_handler(struct mdss_mdp_ctl *ctl,
}
done:
mutex_unlock(&ctl->offlock);
mutex_unlock(&cmd_off_mtx);
return ret;
}
@ -3190,6 +3192,7 @@ int mdss_mdp_cmd_stop(struct mdss_mdp_ctl *ctl, int panel_power_state)
MDSS_XLOG(ctx->panel_power_state, panel_power_state);
mutex_lock(&ctl->offlock);
mutex_lock(&cmd_off_mtx);
if (mdss_panel_is_power_off(panel_power_state)) {
/* Transition to display off */
send_panel_events = true;
@ -3309,6 +3312,7 @@ end:
}
MDSS_XLOG(ctl->num, atomic_read(&ctx->koff_cnt), XLOG_FUNC_EXIT);
mutex_unlock(&cmd_off_mtx);
mutex_unlock(&ctl->offlock);
pr_debug("%s:-\n", __func__);

View file

@ -3228,6 +3228,7 @@ int mdss_mdp_dfps_update_params(struct msm_fb_data_type *mfd,
pr_warn("Unsupported FPS. Configuring to max_fps = %d\n",
pdata->panel_info.max_fps);
dfps = pdata->panel_info.max_fps;
dfps_data->fps = dfps;
}
dfps_update_panel_params(pdata, dfps_data);

View file

@ -2386,6 +2386,31 @@ handle_request32_err:
return ret;
}
static unsigned int __do_compat_ioctl_rot(unsigned int cmd32)
{
unsigned int cmd;
switch (cmd32) {
case MDSS_ROTATION_REQUEST32:
cmd = MDSS_ROTATION_REQUEST;
break;
case MDSS_ROTATION_OPEN32:
cmd = MDSS_ROTATION_OPEN;
break;
case MDSS_ROTATION_CLOSE32:
cmd = MDSS_ROTATION_CLOSE;
break;
case MDSS_ROTATION_CONFIG32:
cmd = MDSS_ROTATION_CONFIG;
break;
default:
cmd = cmd32;
break;
}
return cmd;
}
static long mdss_rotator_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
@ -2408,6 +2433,8 @@ static long mdss_rotator_compat_ioctl(struct file *file, unsigned int cmd,
return -EINVAL;
}
cmd = __do_compat_ioctl_rot(cmd);
switch (cmd) {
case MDSS_ROTATION_REQUEST:
ATRACE_BEGIN("rotator_request32");

View file

@ -187,6 +187,23 @@ struct mdss_rot_mgr {
};
#ifdef CONFIG_COMPAT
/* open a rotation session */
#define MDSS_ROTATION_OPEN32 \
_IOWR(MDSS_ROTATOR_IOCTL_MAGIC, 1, compat_caddr_t)
/* change the rotation session configuration */
#define MDSS_ROTATION_CONFIG32 \
_IOWR(MDSS_ROTATOR_IOCTL_MAGIC, 2, compat_caddr_t)
/* queue the rotation request */
#define MDSS_ROTATION_REQUEST32 \
_IOWR(MDSS_ROTATOR_IOCTL_MAGIC, 3, compat_caddr_t)
/* close a rotation session with the specified rotation session ID */
#define MDSS_ROTATION_CLOSE32 \
_IOW(MDSS_ROTATOR_IOCTL_MAGIC, 4, unsigned int)
struct mdp_rotation_request32 {
uint32_t version;
uint32_t flags;