From: Luca Tettamanti <kronos.it@gmail.com>
To: Zhang Rui <rui.zhang@intel.com>
Cc: Alex Deucher <alexdeucher@gmail.com>,
airlied@gmail.com, dri-devel@lists.freedesktop.org,
Alex Deucher <alexander.deucher@amd.com>, joeyli <jlee@suse.com>,
linux-acpi@vger.kernel.org, Len Brown <lenb@kernel.org>
Subject: Re: [PATCH/RFC] drm/radeon: ACPI: veto the keypress on ATIF events
Date: Thu, 2 Aug 2012 15:46:12 +0200 [thread overview]
Message-ID: <20120802134612.GA30802@growl> (raw)
In-Reply-To: <1343868330.1682.502.camel@rui.sh.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]
On Thu, Aug 02, 2012 at 08:45:30AM +0800, Zhang Rui wrote:
> On 三, 2012-08-01 at 15:49 +0200, Luca Tettamanti wrote:
> > AMD ACPI interface may overload the standard event
> > ACPI_VIDEO_NOTIFY_PROBE (0x81) to signal AMD-specific events. In such
> > cases we don't want to send the keypress (KEY_SWITCHVIDEOMODE) to the
> > userspace because the user did not press the mode switch key (the
> > spurious keypress confuses the DE which usually changes the
> > display configuration and messes up a dual-screen setup).
> > This patch gives the radeon driver the chance to examine the event and
> > block the keypress if the event is an "AMD event".
> >
> > Signed-off-by: Luca Tettamanti <kronos.it@gmail.com>
> > ---
> > Any comment from ACPI front?
> >
> it looks good to me.
> But I'm wondering if we can use the following code for ACPI part, which
> looks cleaner.
> I know this may change the behavior of other events, but in theory, we
> should not send any input event if we know something wrong in kernel.
>
> what do you think?
I like it, it's cleaner.
I've split the patch in two pieces (one for video, the other for
radeon) and adopted your suggestion.
BTW, I'm leaving for vacation in a few hours, I'll be offline till mid
August.
Luca
[-- Attachment #2: 0001-ACPI-video-allow-events-handlers-to-veto-the-keypres.patch --]
[-- Type: text/plain, Size: 1959 bytes --]
>From acce30c96b90d1bc550e82a9e7f19226fa194d5e Mon Sep 17 00:00:00 2001
From: Luca Tettamanti <kronos.it@gmail.com>
Date: Thu, 2 Aug 2012 15:30:27 +0200
Subject: [PATCH 1/2] ACPI video: allow events handlers to veto the keypress
The standard video events may be overloaded for device specific
purposes. For example AMD ACPI interface overloads
ACPI_VIDEO_NOTIFY_PROBE (0x81) to signal AMD-specific events. In such
cases we don't want to send the keypress (KEY_SWITCHVIDEOMODE) to the
userspace because the user did not press the mode switch key (the
spurious keypress confuses the DE which usually changes the
display configuration and messes up a dual-screen setup).
This patch gives the handlers the chance to examine the event and
block the keypress if the event is device specific.
v2: refactor as suggested by Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Luca Tettamanti <kronos.it@gmail.com>
---
drivers/acpi/video.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 1e0a9e1..d75642a 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1448,8 +1448,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch,
* most likely via hotkey. */
acpi_bus_generate_proc_event(device, event, 0);
- if (!acpi_notifier_call_chain(device, event, 0))
- keycode = KEY_SWITCHVIDEOMODE;
+ keycode = KEY_SWITCHVIDEOMODE;
break;
case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video
@@ -1479,8 +1478,9 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
break;
}
- if (event != ACPI_VIDEO_NOTIFY_SWITCH)
- acpi_notifier_call_chain(device, event, 0);
+ if (acpi_notifier_call_chain(device, event, 0))
+ /* Something vetoed the keypress. */
+ keycode = 0;
if (keycode) {
input_report_key(input, keycode, 1);
--
1.7.10.4
[-- Attachment #3: 0002-drm-radeon-block-the-keypress-on-ATIF-events.patch --]
[-- Type: text/plain, Size: 1193 bytes --]
>From def5119d8f617eef0fac2cd35d7bb18c176ff8f6 Mon Sep 17 00:00:00 2001
From: Luca Tettamanti <kronos.it@gmail.com>
Date: Thu, 2 Aug 2012 15:33:03 +0200
Subject: [PATCH 2/2] drm/radeon: block the keypress on ATIF events
The AMD ACPI interface may use ACPI_VIDEO_NOTIFY_PROBE to signal SBIOS
requests; block the keypress in this case since the user did not
actually press the mode switch key.
Signed-off-by: Luca Tettamanti <kronos.it@gmail.com>
---
drivers/gpu/drm/radeon/radeon_acpi.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c
index 96de08d..ee0d29e 100644
--- a/drivers/gpu/drm/radeon/radeon_acpi.c
+++ b/drivers/gpu/drm/radeon/radeon_acpi.c
@@ -273,7 +273,12 @@ int radeon_atif_handler(struct radeon_device *rdev,
}
/* TODO: check other events */
- return NOTIFY_OK;
+ /* We've handled the event, stop the notifier chain. The ACPI interface
+ * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to
+ * userspace if the event was generated only to signal a SBIOS
+ * request.
+ */
+ return NOTIFY_BAD;
}
/* Call all ACPI methods here */
--
1.7.10.4
next prev parent reply other threads:[~2012-08-02 13:46 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-25 17:38 [PATCH] drm/radeon: add new AMD ACPI header and update relevant code alexdeucher
2012-07-26 12:58 ` Luca Tettamanti
2012-07-26 15:35 ` Alex Deucher
2012-07-26 19:33 ` Luca Tettamanti
2012-07-26 19:42 ` Alex Deucher
2012-07-26 19:58 ` Alex Deucher
2012-07-28 14:56 ` Luca Tettamanti
2012-07-28 21:29 ` Alex Deucher
2012-07-29 13:06 ` Luca Tettamanti
2012-07-30 14:20 ` Alex Deucher
2012-07-30 20:24 ` Luca Tettamanti
2012-07-30 20:30 ` Alex Deucher
2012-07-30 20:36 ` Luca Tettamanti
2012-07-30 20:45 ` Alex Deucher
2012-07-31 9:16 ` Luca Tettamanti
2012-07-31 13:58 ` Alex Deucher
2012-07-31 20:05 ` Luca Tettamanti
2012-07-31 21:33 ` Alex Deucher
2012-08-01 8:57 ` Luca Tettamanti
2012-08-01 13:56 ` Alex Deucher
2012-08-02 15:03 ` Alex Deucher
2012-08-02 16:31 ` Luca Tettamanti
2012-08-02 16:33 ` Alex Deucher
2012-08-02 20:54 ` Alex Deucher
2012-08-01 13:49 ` [PATCH/RFC] drm/radeon: ACPI: veto the keypress on ATIF events Luca Tettamanti
2012-08-01 14:02 ` Alex Deucher
2012-08-01 14:50 ` joeyli
2012-08-02 0:45 ` Zhang Rui
2012-08-02 13:46 ` Luca Tettamanti [this message]
2012-08-03 1:40 ` Zhang Rui
2012-08-03 1:45 ` Alex Deucher
2012-08-03 2:06 ` Zhang Rui
2012-07-29 19:33 ` [PATCH] drm/radeon: add new AMD ACPI header and update relevant code Luca Tettamanti
2012-07-30 14:29 ` Alex Deucher
2012-07-29 3:51 ` joeyli
2012-07-29 13:10 ` Luca Tettamanti
2012-07-30 8:32 ` joeyli
2012-07-30 14:16 ` Luca Tettamanti
2012-07-28 14:39 ` Pali Rohár
2012-07-27 2:50 ` joeyli
2012-07-27 3:31 ` Alex Deucher
2012-07-27 4:46 ` joeyli
2012-07-27 9:02 ` Luca Tettamanti
2012-07-27 13:21 ` Alex Deucher
2012-07-27 15:32 ` joeyli
2012-07-27 15:36 ` joeyli
2012-07-27 16:31 ` Alex Deucher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120802134612.GA30802@growl \
--to=kronos.it@gmail.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jlee@suse.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.