linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] ff-memless instant starting
@ 2009-12-23 13:31 Jari Vanhala
  2009-12-23 19:38 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Jari Vanhala @ 2009-12-23 13:31 UTC (permalink / raw)
  To: Linux Input; +Cc: Dmitry Torokhov, Anssi Hannula

[-- Attachment #1: Type: text/plain, Size: 723 bytes --]

Hi,

Looks like starting effect with low HZ machine takes considerably time
due need to wait for system timer. Simplest way to make things faster is
to do calculation for effect always instantly, like in stopping, but
this makes starting multiple effects more costly.

Other solution would be making it a module parameter, so behavior could
be controlled per machine. Optimize possible cost or speed. I attached
small patch which will do that.

If starting priority of individual effect is needed to controlled, you
probably need to add flag for that to effect itself... I don't know
which way FF-api is developing, so this could be either good or bad
thing.

Any opinions or suggestions? Other than rising HZ. =)

	++Jam


[-- Attachment #2: 0001-Input-Add-instant-option-to-ff-memless.patch --]
[-- Type: text/x-patch, Size: 1345 bytes --]

>From d3b6fa1eaac42f878f7c9b89b22ddfa85d900f38 Mon Sep 17 00:00:00 2001
From: Jari Vanhala <ext-jari.vanhala@nokia.com>
Date: Tue, 22 Dec 2009 16:49:29 +0200
Subject: [PATCH] Input: Add instant option to ff-memless

Allows Force Feedback effect to be started immediately
and not to wait for timer. Useful in low HZ systems.

Signed-off-by: Jari Vanhala <ext-jari.vanhala@nokia.com>
---
 drivers/input/ff-memless.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
index b483b29..dfd5830 100644
--- a/drivers/input/ff-memless.c
+++ b/drivers/input/ff-memless.c
@@ -67,6 +67,10 @@ struct ml_device {
 			   struct ff_effect *effect);
 };
 
+static int instant;
+module_param(instant, int, 0);
+MODULE_PARM_DESC(instant, "Start new effect instantly");
+
 static const struct ff_envelope *get_envelope(const struct ff_effect *effect)
 {
 	static const struct ff_envelope empty_envelope;
@@ -411,7 +415,10 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
 				 msecs_to_jiffies(state->effect->replay.length);
 		state->adj_at = state->play_at;
 
-		ml_schedule_timer(ml);
+		if (instant && !state->effect->replay.delay)
+			ml_play_effects(ml);
+		else
+			ml_schedule_timer(ml);
 
 	} else {
 		debug("initiated stop");
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-24 23:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-23 13:31 [RFC] ff-memless instant starting Jari Vanhala
2009-12-23 19:38 ` Dmitry Torokhov
2009-12-24 23:52   ` Anssi Hannula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).