Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2579822ybp; Thu, 10 Oct 2019 09:23:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxFmnhdXiUyrJepvuYPi0NlF57x/+zdYS9vLiwp7lpm4VOUjlRGHmK0+PqR+6BQxt1LhV5 X-Received: by 2002:a17:906:c317:: with SMTP id s23mr9303035ejz.251.1570724632485; Thu, 10 Oct 2019 09:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570724632; cv=none; d=google.com; s=arc-20160816; b=uLglE8EV+nloY0YV2BqEN2lsPusmGpRLis0QfLTNPGElDM07VAjb8BhInGx8A5b0pH Aj3774V0ow+6/bC+Yfhx+CJ0dlAtcdE7ciiJSwukf4qWQg0yPo+pomUcgKItOmiimP+a zzQhQAa0Baq3xcUscFqiixwJ3W3d7qNcAcDGYSQ/PY1ANF9+AyABRmWVo5E2yLyAddH5 XKGPnLcmOObOR4UJ5wLht7b+je+4r+lWCO/ZBYNMpx33Y/VDn1Rv8mzdxg/0vf/yaweQ Tu0jjVYA4J1JLzOAffVx9PAmkBSolWFtZraI9zVDoYjjxA6O4C0gHPOWv3PkYKoxWmiW lQCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=KBjP/c0OKbAYMhFk+/MWcTlhvk8Dj6HOEt+fBr53HAk=; b=eh73FhzLa019Q2aqWpH9D0LPKHSxJORFNbtFhxJ1+zm2S6KQY6MOfyQ5J4gbbTmhtS IXKmFGcXqA1tvDV6Kd0QYNzYXD+/cOcecDyo5desKDwi6rx65jL+q4kXmqjQK2XckN8I eyRcjFAIs4DQ1ldP6AokrSzWQqESb+FBUvESAlL8cXHZbztuqpKampyJo3pJlKr5o6Y2 CTFoluj8i0AsjacxCr6JKTWw4lhLIyvHTwYSrpZQTnrEm2KPwLQSdYzjvpANS0qAR4an VrxX/UUY9IeivATBSS+yZ3Kawbwk/DQ3U/1NmaaYHpkxhw+lZLYYJkKachV8tWXVJGIh CPtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a30si4049629eda.39.2019.10.10.09.23.28; Thu, 10 Oct 2019 09:23:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726088AbfJJQXT (ORCPT + 99 others); Thu, 10 Oct 2019 12:23:19 -0400 Received: from mail-vk1-f194.google.com ([209.85.221.194]:45173 "EHLO mail-vk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfJJQXS (ORCPT ); Thu, 10 Oct 2019 12:23:18 -0400 Received: by mail-vk1-f194.google.com with SMTP id q25so1471292vkn.12; Thu, 10 Oct 2019 09:23:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KBjP/c0OKbAYMhFk+/MWcTlhvk8Dj6HOEt+fBr53HAk=; b=XOmUJOUlkWZe5ls4RwRWWg+kYqPnfYl1n0QN2bSuAuQ7fKRg9mrzL7z8p7OiXZH2zQ 5ABBVXDJZVTyAGciqNWbQZPWoF0mm4tGkBiVrA/iwgqzn3H27I/dAQrKutyyuM5ZcrvC 5bGgbCdVBbob7VuJGnXC+xvCR/TD+LnLsj6Jw06SmJpfDvnhCatRjaiEqIhl32KB6yO9 W/z0o9eCcZYzZe/enOkk59WHbD0E9Qh7qidyYkv846uQSuOHQNNUpuPuW9nmEai27/k1 b3oq6esB1oRmDuiR/mnCmxIzfDKoPNhIPw5osSWI+DL7uLIoir8PHyesPIfPCmBS3K6l 0FQw== X-Gm-Message-State: APjAAAVViYlH2xP18Sw1YVa7K3X0875G8xb0y2e41iTK9cvSqMfd0wcd 3mgW+jg6/5HaicasbadlBFNKSf7YxPjAKCUtyTU= X-Received: by 2002:a1f:3811:: with SMTP id f17mr5853576vka.56.1570724597472; Thu, 10 Oct 2019 09:23:17 -0700 (PDT) MIME-Version: 1.0 References: <20191008230038.24037-1-ezequiel@collabora.com> <20191008230038.24037-3-ezequiel@collabora.com> <20191009180136.GE85762@art_vandelay> <20191010160059.GJ85762@art_vandelay> In-Reply-To: <20191010160059.GJ85762@art_vandelay> From: Ilia Mirkin Date: Thu, 10 Oct 2019 12:23:05 -0400 Message-ID: Subject: Re: [PATCH v4 2/3] drm/rockchip: Add optional support for CRTC gamma LUT To: Sean Paul Cc: Ezequiel Garcia , Ezequiel Garcia , Mark Rutland , devicetree , Jacopo Mondi , Linux Kernel Mailing List , dri-devel , Douglas Anderson , "open list:ARM/Rockchip SoC..." , Boris Brezillon , Sean Paul , Rob Herring , kernel@collabora.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 10, 2019 at 12:01 PM Sean Paul wrote: > > > > +static int vop_crtc_atomic_check(struct drm_crtc *crtc, > > > > + struct drm_crtc_state *crtc_state) > > > > +{ > > > > + struct vop *vop = to_vop(crtc); > > > > + > > > > + if (vop->lut_regs && crtc_state->color_mgmt_changed && > > > > + crtc_state->gamma_lut) { > > > > + unsigned int len; > > > > + > > > > + len = drm_color_lut_size(crtc_state->gamma_lut); > > > > + if (len != crtc->gamma_size) { > > > > + DRM_DEBUG_KMS("Invalid LUT size; got %d, expected %d\n", > > > > + len, crtc->gamma_size); > > > > + return -EINVAL; > > > > + } > > > > > > Overflow is avoided in drm_mode_gamma_set_ioctl(), so I don't think you need > > > this function. > > > > > > > But that only applies to the legacy path. Isn't this needed to ensure > > a gamma blob > > has the right size? > > Yeah, good point, we check the element size in the atomic path, but not the max > size. I haven't looked at enough color lut stuff to have an opinion whether this > check would be useful in a helper function or not, something to consider, I > suppose. Some implementations support multiple sizes (e.g. 256 and 1024) but not anything in between. It would be difficult to expose this generically, I would imagine. The 256 size is kind of special, since basically all legacy usage assumes that 256 is the one true quantity of LUT entries... -ilia