Skip to contentSkip to conversation

ff-memless instant starting

RFC In review Jari Vanhala 3 participants 3 messages Dec 23, 2009 – Dec 24, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 ff-memless instant starting

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
Quoted 1 line

From d3b6fa1eaac42f878f7c9b89b22ddfa85d900f38 Mon Sep 17 00:00:00 2001

From: Jari Vanhala <[email protected]>
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.

---
 drivers/input/ff-memless.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/input/ff-memless.c +8 -1
index b483b29..dfd5830 100644
@@ -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");
Signature · 1 line
1.6.3.3
maintainer
#1 lore raw
Quoted 11 lines · Jari Vanhala

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.

Quoted 7 lines

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. =)

I think we should just start playing the effect immediately, without any additional module parameters. I'll queue such patch unless I hear otherwise from Anssi.

Signature · 1 line
Dmitry
#2 lore raw
Quoted 17 lines · Dmitry Torokhov
Quoted 16 lines · Jari Vanhala

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.

Quoted 6 lines
Quoted 2 lines

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

I think we should just start playing the effect immediately, without any additional module parameters. I'll queue such patch unless I hear otherwise from Anssi.

Indeed that is ok, no need for a module parameter.

Signature · 1 line
Anssi Hannula