From patchwork Mon Jul 31 19:09:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 9873029 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A02566037D for ; Mon, 31 Jul 2017 19:10:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9249227FB0 for ; Mon, 31 Jul 2017 19:10:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87221285D3; Mon, 31 Jul 2017 19:10:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A60B285D2 for ; Mon, 31 Jul 2017 19:10:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751612AbdGaTKC (ORCPT ); Mon, 31 Jul 2017 15:10:02 -0400 Received: from vern.gendns.com ([206.190.152.46]:35892 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751013AbdGaTJ7 (ORCPT ); Mon, 31 Jul 2017 15:09:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject :Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=40BOOanXyAVP9PR7PhBkFbZNbzfMK9E5AhdsziAxTT4=; b=t90W2MYUlEQ57x+aomfu8GKaT FmlorOp0p8jvy0vu0tmUGmVYZx9u1vB6PYdaqcOyBGxxcFNJbf4WMBfm1sqcmNVVXCcywUJ0qSp8Z fJ0ccNPnjDA56ZwdKkyO6yxCQhhgJkMUtmz2prL/jU2tCBNjuf4dQv5VAEz+hHRjpysFpEpomh8iG PjMx78CsSe9/FLwi04OaQPbtiQ/DAdUkEEqolEBAuOkOqd0s0kj104PGAsSeMICAXsYyfW2MLzyZg yQv4WgCE/niA7+t5b/yIj+NuHIuudOJHiG3pyTrmk93jDhXjEiTPxwMHbVHB7cmzMQdDSRAsZPN6t /AuZk7Vtw==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:43550 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.89) (envelope-from ) id 1dcG26-002KeC-4b; Mon, 31 Jul 2017 15:07:14 -0400 From: David Lechner To: linux-fbdev@vger.kernel.org Cc: David Lechner , Bartlomiej Zolnierkiewicz , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] fbcon: add VT notifier for VT_UPDATE event Date: Mon, 31 Jul 2017 14:09:45 -0500 Message-Id: <1501528185-9976-3-git-send-email-david@lechnology.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501528185-9976-1-git-send-email-david@lechnology.com> References: <1501528185-9976-1-git-send-email-david@lechnology.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds notifier callback for VT events. We are currently interested in the VT_UPDATE event, which indicates there was some major change to the VT. This is used to redraw the margins. For example when the console is inverted we receive the VT_UPDATE event. The color of the margins depend on the inverted state, so it is necessary redraw the margins at this time. Signed-off-by: David Lechner --- drivers/video/console/fbcon.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 12ded23..8e7ac2f 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -3329,6 +3329,28 @@ static int fbcon_event_notify(struct notifier_block *self, return ret; } +static int vt_notifier_call(struct notifier_block *blk, + unsigned long code, void *_param) +{ + struct vt_notifier_param *param = _param; + struct vc_data *vc = param->vc; + + switch (code) { + case VT_UPDATE: + /* + * This event could indicate that the terminal has been + * inverted (or there was some other major change), in which + * case we need to re-draw the margins. + */ + if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) + fbcon_clear_margins(vc, 0); + break; + default: + break; + } + return NOTIFY_OK; +} + /* * The console `switch' structure for the frame buffer based console */ @@ -3364,6 +3386,10 @@ static struct notifier_block fbcon_event_notifier = { .notifier_call = fbcon_event_notify, }; +static struct notifier_block vt_notifier_block = { + .notifier_call = vt_notifier_call, +}; + static ssize_t store_rotate(struct device *device, struct device_attribute *attr, const char *buf, size_t count) @@ -3612,6 +3638,7 @@ static int __init fb_console_init(void) console_lock(); fb_register_client(&fbcon_event_notifier); + register_vt_notifier(&vt_notifier_block); fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL, "fbcon"); @@ -3650,6 +3677,7 @@ static void __exit fbcon_deinit_device(void) static void __exit fb_console_exit(void) { console_lock(); + unregister_vt_notifier(&vt_notifier_block); fb_unregister_client(&fbcon_event_notifier); fbcon_deinit_device(); device_destroy(fb_class, MKDEV(0, 0));