From patchwork Thu Dec 13 21:55:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Roper X-Patchwork-Id: 10729999 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 E78F66C5 for ; Thu, 13 Dec 2018 21:55:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D996E2CCC7 for ; Thu, 13 Dec 2018 21:55:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCC6D2CCD8; Thu, 13 Dec 2018 21:55:38 +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 996382CCC7 for ; Thu, 13 Dec 2018 21:55:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B04326F19F; Thu, 13 Dec 2018 21:55:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4B31A6F0C0; Thu, 13 Dec 2018 21:55:34 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2018 13:55:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,349,1539673200"; d="scan'208";a="109355851" Received: from mdroper-desk.fm.intel.com ([10.105.128.10]) by fmsmga008.fm.intel.com with ESMTP; 13 Dec 2018 13:55:33 -0800 From: Matt Roper To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [PATCH v2 0/2] Add gamma/degamma LUT validation helper Date: Thu, 13 Dec 2018 13:55:24 -0800 Message-Id: <20181213215526.31991-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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Previous version of this series was here: https://lists.freedesktop.org/archives/dri-devel/2018-December/200178.html Gamma and degamma LUT's uploaded by userspace need to be checked to ensure they're valid tables and that they meet any additional constraints of a given platform's hardware. Let's add a DRM helper that drivers can call to perform some common LUT sanity tests that are likely to be useful on multiple platforms: - LUT entries are always increasing or flat, never decreasing - LUT entries have equal red, green, and blue values for each entry - LUT size is valid (i.e., it's a multiple of sizeof(struct drm_color_lut)) The size test will always be performed (since it's verifying that the proper ABI was followed), but the other two tests are optional and will only be applied as requested by the driver. This revision incorporates Brian Starkey's suggestion to combine the separate helpers into a single function that takes a bitmask of tests to apply. It also adds an additional LUT size test inspired by the ARM malidp driver. Matt Roper (2): drm: Add color management LUT validation helper (v2) drm/i915: Validate userspace-provided color management LUT's (v2) drivers/gpu/drm/drm_color_mgmt.c | 64 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color.c | 19 +++++++++++ include/drm/drm_color_mgmt.h | 5 +++ 3 files changed, 88 insertions(+)