From patchwork Thu Mar 1 01:20:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 10250247 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 02D5860365 for ; Thu, 1 Mar 2018 01:21:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA43728EA8 for ; Thu, 1 Mar 2018 01:21:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE85228EAB; Thu, 1 Mar 2018 01:21:14 +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]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8573228EA4 for ; Thu, 1 Mar 2018 01:21:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C2776EBC5; Thu, 1 Mar 2018 01:21:13 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@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 78E6F6EBC5 for ; Thu, 1 Mar 2018 01:21:11 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id w128so8565283wmw.0 for ; Wed, 28 Feb 2018 17:21:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=8pU2nB32E+pKnqplF+MSZfeLoFl4spmaAd0Qxsqrdkg=; b=ERCkvKn7Doi+T/d4NMV/qdEW+6NMB5GYRZfLzT8GXE8FLVrlmhLcBD9Shxu7M6PssN h8vfZS6rFhhG5fdGgNYEJWE8lpudyaLOQPAJk4u6uLSoXdvifLcP53L0WKun05UlPoOB x0YhNJtg2+yaMju2u/mWrnpUOHWRHUqzRiEjrNx63+daRC7Kl6IcZ+Mi35jU/hWhRHsc ozTZEyidc6X9AGr1xRh/hH+iC57R8PaLZ6Zot0ESVW7bsM8PbnNALFkzcVjlTIGP901L bnw0H9gjaxBQUD/aUYI7sJGqFgHXxpPk+t+d7+v0Pj5VQtop3tMwHD8zJEbCumoL1ePa r7Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8pU2nB32E+pKnqplF+MSZfeLoFl4spmaAd0Qxsqrdkg=; b=pmGk7RFyDaRQ7YcUh+VqKarCQgQjdOXESRQCK3pfmENT1asAmAVZt0a5u+oa3wdejI waqRBKEG21wfghtNuuVMitFEwaTO381EzV6sUAZGGEMoc0u4gDyzmSuB7BU2aFcoHrWJ h7G4j2qA7SAv+HIPwZq4cwqYA/pslbOEDiluzwqmccJmk0P4iS52NNKbJJfEbGhmZz9G Uw5BaeH8o5nn3uYKDi+Ufe0daRFzAkZ4nx6KMQelLYGKFbILer5clL0c7GDUcwVpEivw nj4dLqffdkhyDP8ULp3E9OrOMcqsjPaUeq83ycctgQtfQWXINmlvzhHSXQKuEd/2LPQU yrAg== X-Gm-Message-State: APf1xPCNU4w/FE1T2lsCVUZ02ViaVtPXRGZVGM45PZYMPaDx/+Y5me2J QpuuWb3xxP+5ORWD9qYqp/aXGw== X-Google-Smtp-Source: AG47ELsvP83XNv4yHwWczD34omzPV+z/EFxC8G7y91WMwtvv9F4Roox6TxO7dH1+4fzsXcvpGg3z6Q== X-Received: by 10.28.207.201 with SMTP id f192mr279458wmg.81.1519867269724; Wed, 28 Feb 2018 17:21:09 -0800 (PST) Received: from twisty.cin.medizin.uni-tuebingen.de (cin-11.medizin.uni-tuebingen.de. [134.2.118.242]) by smtp.gmail.com with ESMTPSA id 32sm2417206wrm.14.2018.02.28.17.21.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Feb 2018 17:21:09 -0800 (PST) From: Mario Kleiner To: intel-gfx@lists.freedesktop.org Date: Thu, 1 Mar 2018 02:20:48 +0100 Message-Id: <20180301012048.17717-1-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.13.0.rc1.294.g07d810a77f Subject: [Intel-gfx] [PATCH] sna/uxa: Fix colormap handling at screen depth 30. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP The various clut handling functions like a setup consistent with the x-screen color depth. Otherwise we observe improper sampling in the gamma tables at depth 30. Therefore replace hard-coded bitsPerRGB = 8 by actual bits per channel scrn->rgbBits. Also use this for call to xf86HandleColormaps(). Tested for uxa and sna at depths 8, 16, 24 and 30 on IvyBridge, and tested at depth 24 and 30 that xgamma and gamma table animations work, and with measurement equipment to make sure identity gamma ramps actually are identity mappings at the output. Signed-off-by: Mario Kleiner --- src/sna/sna_driver.c | 5 +++-- src/uxa/intel_driver.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index 2643e6c..9c4bcd4 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -1145,7 +1145,7 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL) if (!miInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth, &defaultVisual, ((unsigned long)1 << (scrn->bitsPerPixel - 1)), - 8, -1)) + scrn->rgbBits, -1)) return FALSE; if (!miScreenInit(screen, NULL, @@ -1217,7 +1217,8 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL) return FALSE; if (sna->mode.num_real_crtc && - !xf86HandleColormaps(screen, 256, 8, sna_load_palette, NULL, + !xf86HandleColormaps(screen, 1 << scrn->rgbBits, scrn->rgbBits, + sna_load_palette, NULL, CMAP_RELOAD_ON_MODE_SWITCH | CMAP_PALETTED_TRUECOLOR)) return FALSE; diff --git a/src/uxa/intel_driver.c b/src/uxa/intel_driver.c index 3703c41..88c749e 100644 --- a/src/uxa/intel_driver.c +++ b/src/uxa/intel_driver.c @@ -991,7 +991,8 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL) if (!miCreateDefColormap(screen)) return FALSE; - if (!xf86HandleColormaps(screen, 256, 8, I830LoadPalette, NULL, + if (!xf86HandleColormaps(screen, 1 << scrn->rgbBits, scrn->rgbBits, + I830LoadPalette, NULL, CMAP_RELOAD_ON_MODE_SWITCH | CMAP_PALETTED_TRUECOLOR)) { return FALSE;