Browse files

s3cfb: Notify userspace of vsync using sysfs, make uevents optional

Change-Id: I6fe8de47961d5c0ba73eb45543a675b6fd4344a4
  • Loading branch information...
1 parent 4d85b96 commit 228b18b0a0e430ad4a131dac2a2bd5f03ec78252 @Entropy512 Entropy512 committed with Dec 1, 2012
Showing with 41 additions and 0 deletions.
  1. +18 −0 drivers/video/samsung/Kconfig
  2. +23 −0 drivers/video/samsung/s3cfb_main.c
View
18 drivers/video/samsung/Kconfig
@@ -38,6 +38,24 @@ config FB_S5P_VSYNC_THREAD
bool "S5P Framebuffer vsync thread"
depends on FB_S5P
+config FB_S5P_VSYNC_SEND_UEVENTS
+ bool "S5P Framebuffer vsync uevents"
+ depends on FB_S5P_VSYNC_THREAD
+ default n
+ help
+ Some hwcomposer implementations support vsync hinting via uevents to userspace
+ However this also wakes up many other parts of Android, draining battery.
+ ICS hwcomposer does not support any form of sync, so these uevents should be
+ optional and only sent to HWC implementations that expect uevents to be sent
+
+config FB_S5P_VSYNC_SYSFS
+ bool "S5P Framebuffer vsync via sysfs"
+ depends on FB_S5P_VSYNC_THREAD
+ default n
+ help
+ A more efficient method of passing vsync to userspace that doesn't
+ broadcast uevents.
+
config FB_S5P_TRACE_UNDERRUN
bool "S5P Framebuffer FIFO underrun trace"
depends on FB_S5P
View
23 drivers/video/samsung/s3cfb_main.c
@@ -387,6 +387,18 @@ static ssize_t fimd_dump_show(struct device *dev,
}
static DEVICE_ATTR(fimd_dump, 0444, fimd_dump_show, NULL);
+#ifdef CONFIG_FB_S5P_VSYNC_SYSFS
+static ssize_t s3c_fb_vsync_time(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct s3cfb_global *fbdev = fbfimd->fbdev[0];
+
+ return snprintf(buf, PAGE_SIZE, "%llu", ktime_to_ns(fbdev->vsync_info.timestamp));
+}
+
+static DEVICE_ATTR(vsync_time, S_IRUGO, s3c_fb_vsync_time, NULL);
+#endif
+
#if 0 /* def CONFIG_FB_S5P_MIPI_DSIM */
void s3cfb_display_on_remote(void)
{
@@ -430,6 +442,7 @@ static int s3cfb_wait_for_vsync_thread(void *data)
msecs_to_jiffies(VSYNC_TIMEOUT_MSEC));
if (ret > 0) {
+#if defined(CONFIG_FB_S5P_VSYNC_SEND_UEVENTS)
char *envp[2];
char buf[64];
snprintf(buf, sizeof(buf), "VSYNC=%llu",
@@ -438,6 +451,10 @@ static int s3cfb_wait_for_vsync_thread(void *data)
envp[1] = NULL;
kobject_uevent_env(&fbdev->dev->kobj, KOBJ_CHANGE,
envp);
+#endif
+#if defined(CONFIG_FB_S5P_VSYNC_SYSFS)
+ sysfs_notify(&fbdev->dev->kobj, NULL, "vsync_time");
+#endif
}
}
@@ -667,6 +684,12 @@ static int s3cfb_probe(struct platform_device *pdev)
if (ret < 0)
dev_err(fbdev[0]->dev, "failed to add sysfs entries\n");
+#ifdef CONFIG_FB_S5P_VSYNC_SYSFS
+ ret = device_create_file(fbdev[i]->dev, &dev_attr_vsync_time);
+ if (ret < 0)
+ dev_err(fbdev[0]->dev, "failed to add sysfs entries\n");
+#endif
+
ret = device_create_file(fbdev[i]->dev, &dev_attr_ielcd_dump);
if (ret < 0)
dev_err(fbdev[0]->dev, "failed to add sysfs entries\n");

0 comments on commit 228b18b

Please sign in to comment.