From patchwork Wed Dec 12 01:05:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Roper X-Patchwork-Id: 10725415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF18B17FE for ; Wed, 12 Dec 2018 01:06:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCA612B1DE for ; Wed, 12 Dec 2018 01:06:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEA812B45F; Wed, 12 Dec 2018 01:06:23 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable 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 895D52B1DE for ; Wed, 12 Dec 2018 01:06:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B60F6E0E5; Wed, 12 Dec 2018 01:06:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9DFB46E065; Wed, 12 Dec 2018 01:06:18 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2018 17:06:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,343,1539673200"; d="scan'208";a="301400203" Received: from mdroper-desk.fm.intel.com ([10.105.128.10]) by fmsmga006.fm.intel.com with ESMTP; 11 Dec 2018 17:06:17 -0800 From: Matt Roper To: intel-gfx@lists.freedesktop.org Subject: [PATCH 0/2] Add gamma/degamma LUT validation helpers Date: Tue, 11 Dec 2018 17:05:49 -0800 Message-Id: <20181212010551.6337-1-matthew.d.roper@intel.com> X-Mailer: git-send-email 2.14.4 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Some platforms require that gamma or degamma LUT's have certain characteristics in order to be programmed into the hardware. If a userspace-provided LUT violates a platform's hardware requirements, we want to be able to catch this during the atomic check and reject the transaction rather than just silently trying to program an invalid table into the hardware. Let's add a couple helpers that can be called by drivers' check functions: - drm_color_lut_is_increasing() checks a table to see whether subsequent entries are always equal to or greater than prior entries (i.e., the gamma ramp never decreases). - drm_color_lut_has_equal_channels() checks a table to see whether the r, g, and b channels are equal for each table entry. On Intel, we need the first helper for the degamma table on all platforms, and we need the second one for the degamma table on GLK and ICL (actual degamma support for those two platforms hasn't landed yet, but there's work in flight by Uma and Swati to add it, so we might as well get the checks ready early). Matt Roper (2): drm: Add color management LUT validation helpers drm/i915: Validate userspace-provided color management LUT's drivers/gpu/drm/drm_color_mgmt.c | 53 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color.c | 18 +++++++++++++ include/drm/drm_color_mgmt.h | 3 +++ 3 files changed, 74 insertions(+)