msm: display: panel frame rate report

Add metadata ioctl for retrieving panel frame rate.
Get ready to remove reserved fields usage.

Change-Id: I51a4aed9d85efd5f83a184100b6a3dc682c7a67c
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
This commit is contained in:
Ken Zhang 2013-01-08 14:28:20 -05:00 committed by Stephen Boyd
parent b64984a087
commit 4ba4e55f0f
2 changed files with 52 additions and 2 deletions

View file

@ -3,7 +3,7 @@
* Core MSM framebuffer driver.
*
* Copyright (C) 2007 Google Incorporated
* Copyright (c) 2008-2013, Code Aurora Forum. All rights reserved.
* Copyright (c) 2008-2013, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@ -3672,6 +3672,23 @@ static int msmfb_display_commit(struct fb_info *info,
return ret;
}
static int msmfb_get_metadata(struct msm_fb_data_type *mfd,
struct msmfb_metadata *metadata_ptr)
{
int ret = 0;
switch (metadata_ptr->op) {
case metadata_op_frame_rate:
metadata_ptr->data.panel_frame_rate =
mdp_get_panel_framerate(mfd);
break;
default:
pr_warn("Unsupported request to MDP META IOCTL.\n");
ret = -EINVAL;
break;
}
return ret;
}
static int msm_fb_ioctl(struct fb_info *info, unsigned int cmd,
unsigned long arg)
{
@ -3690,6 +3707,7 @@ static int msm_fb_ioctl(struct fb_info *info, unsigned int cmd,
struct mdp_page_protection fb_page_protection;
struct msmfb_mdp_pp mdp_pp;
struct mdp_buf_sync buf_sync;
struct msmfb_metadata mdp_metadata;
int ret = 0;
msm_fb_pan_idle(mfd);
@ -3986,6 +4004,17 @@ static int msm_fb_ioctl(struct fb_info *info, unsigned int cmd,
ret = msmfb_display_commit(info, argp);
break;
case MSMFB_METADATA_GET:
ret = copy_from_user(&mdp_metadata, argp, sizeof(mdp_metadata));
if (ret)
return ret;
ret = msmfb_get_metadata(mfd, &mdp_metadata);
if (!ret)
ret = copy_to_user(argp, &mdp_metadata,
sizeof(mdp_metadata));
break;
default:
MSM_FB_INFO("MDP: unknown ioctl (cmd=%x) received!\n", cmd);
ret = -EINVAL;

View file

@ -1,7 +1,7 @@
/* include/linux/msm_mdp.h
*
* Copyright (C) 2007 Google Incorporated
* Copyright (c) 2013 Code Aurora Forum. All rights reserved.
* Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@ -73,6 +73,7 @@
#define MSMFB_BUFFER_SYNC _IOW(MSMFB_IOCTL_MAGIC, 162, struct mdp_buf_sync)
#define MSMFB_DISPLAY_COMMIT _IOW(MSMFB_IOCTL_MAGIC, 164, \
struct mdp_display_commit)
#define MSMFB_METADATA_GET _IOW(MSMFB_IOCTL_MAGIC, 166, struct msmfb_metadata)
#define FB_TYPE_3D_PANEL 0x10101010
#define MDP_IMGTYPE2_START 0x10000
@ -496,6 +497,26 @@ struct msmfb_mdp_pp {
} data;
};
enum {
metadata_op_none,
metadata_op_base_blend,
metadata_op_frame_rate,
metadata_op_max
};
struct mdp_blend_cfg {
uint32_t is_premultiplied;
};
struct msmfb_metadata {
uint32_t op;
uint32_t flags;
union {
struct mdp_blend_cfg blend_cfg;
uint32_t panel_frame_rate;
} data;
};
#define MDP_MAX_FENCE_FD 10
#define MDP_BUF_SYNC_FLAG_WAIT 1