From patchwork Tue Jul 12 10:33:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 9225029 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 CA12E604DB for ; Tue, 12 Jul 2016 10:33:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAE5A27E78 for ; Tue, 12 Jul 2016 10:33:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD9F927F7F; Tue, 12 Jul 2016 10:33:54 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FBDF27E78 for ; Tue, 12 Jul 2016 10:33:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F2596E1A3; Tue, 12 Jul 2016 10:33:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 914B76E1A3; Tue, 12 Jul 2016 10:33:48 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id w75so1629461wmd.1; Tue, 12 Jul 2016 03:33:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=S8bfqzuG4I8B7nJuXHAO7QykMRUbT4Ok5feJ3KIe0KU=; b=xjZhkV2qPX1bxSpME9LbnlyspL66abL49axOuhaySmfyWqu1XWOUiCVXXaAtKR1MQW 2EtQoI80jI5bex4r4/F/PCKt5uPXwnPsBVkJxnHdrasCwjYmrbC+FkvECBio9kPXf9oD f75ZijqG8OZEDh30FP1UrYigIN0+bLcKIoDyWUpxUAgR1LqMwXfU4zeDNSjpdRzbLxLA CYKPMywvQbOlLgNtL48NyQ8XXEFtAMIFS3c9q533YklC57Ah7EvgchbD1eS7ydhHtaPS WQh5zsELlWAQxO0JisTrGpoBiaA0x9m3Akgpy+rGPhhrkLwo0GdiyIXkPrzVpLogJD6V XB1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=S8bfqzuG4I8B7nJuXHAO7QykMRUbT4Ok5feJ3KIe0KU=; b=R0vqquds9DBqikUqiljhaLUf6g4MW99U6UN1Lz/EnJJiZwN3tN0Tit6qqqLIEeC0TE grfhQKYYsCBjUs/mba4ilNkQT2fdA6Rq2zeIgOVbu0/fonNETxRFJehx0Ex4ye6CDxS9 lFxm69htzICNudzOjH/8b1hMQ/Y0X+AktoLOhyWFyhqbqwV01P5fw83GFxk38dHn4JU+ uIff0PoQslFwupKFO/gIWelzGtRbpUCacX0O118rESi5LMxaqlsghN/YscZLiH1qZ7Xh IRT4wdZRWpnH++ylG0sgf0Pv4rAQm6OT2l1LN5TDqFQl+uiqXeenDCLrfukRdCpbb74G g+wA== X-Gm-Message-State: ALyK8tJjreB/zDf1n6My1P7C9yiwaFJ+gNvVEoQb2Z6Zrjbkr+RTk3356V39TlZ+5e9M1g== X-Received: by 10.28.141.4 with SMTP id p4mr20473317wmd.46.1468319626873; Tue, 12 Jul 2016 03:33:46 -0700 (PDT) Received: from twisty.fritz.box (x5f71941a.dyn.telefonica.de. [95.113.148.26]) by smtp.gmail.com with ESMTPSA id d8sm1244398wmi.0.2016.07.12.03.33.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Jul 2016 03:33:45 -0700 (PDT) From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/i915: Fix legacy gamma lut updates in Linux 4.7-rc6 Date: Tue, 12 Jul 2016 12:33:05 +0200 Message-Id: <1468319586-8509-1-git-send-email-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.7.0 Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Updating legacy gamma tables, e.g., via RandR doesn't work at all as of Linux 4.7-rc6. Reason seems to be that the required call to drm_atomic_helper_commit_planes_on_crtc is skipped in intel_atomic_commit after userspace set new gamma tables, because neither crtc->state->planes_changed nor update_pipe (= pipe_config->update_pipe) are true. Removing the check for planes_changed || update_pipe fixes gamma table updates. The code for Linux 4.8 drm-next has changed a lot in that area wrt. 4.7, but the new code for 4.8 also removed those checks and calls drm_atomic_helper_commit_planes_on_crtc unconditionally, and legacy gamma lut updates work on drm-next, so this seems to be the right solution. Tested also shutdown/reboot, suspend/resume, (un-)plugging displays, mode switches for resolution/refresh rate, display rotation, and page-flipping/pageflip timing on Intel HD Ironlake to confirm the fix apparently doesn't break anything under X11. Signed-off-by: Mario Kleiner Cc: Maarten Lankhorst Cc: Lionel Landwerlin Cc: Daniel Vetter --- drivers/gpu/drm/i915/intel_display.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 04452cf..eb8fb36 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -13685,7 +13685,6 @@ static int intel_atomic_commit(struct drm_device *dev, bool modeset = needs_modeset(crtc->state); struct intel_crtc_state *pipe_config = to_intel_crtc_state(crtc->state); - bool update_pipe = !modeset && pipe_config->update_pipe; if (modeset && crtc->state->active) { update_scanline_offset(to_intel_crtc(crtc)); @@ -13699,8 +13698,7 @@ static int intel_atomic_commit(struct drm_device *dev, drm_atomic_get_existing_plane_state(state, crtc->primary)) intel_fbc_enable(intel_crtc); - if (crtc->state->active && - (crtc->state->planes_changed || update_pipe)) + if (crtc->state->active) drm_atomic_helper_commit_planes_on_crtc(old_crtc_state); if (pipe_config->base.active && needs_vblank_wait(pipe_config))