From patchwork Thu Jan 9 19:45:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun R Murthy X-Patchwork-Id: 13933179 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0D07E77197 for ; Thu, 9 Jan 2025 20:01:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FD5910EFD6; Thu, 9 Jan 2025 20:01:28 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="HTYXuAm0"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8325A10EFD0; Thu, 9 Jan 2025 20:01:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736452886; x=1767988886; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=0mJYExgfGh5ZoSbx6BzzBc5RqPthCDRzI1fAAvKWWOk=; b=HTYXuAm06bO6kt8emZcdgT0dp8h9ygjXuJWm+NSGYy7TLQooP+eaMhSU KH8SdkBSogWIQrpE0e5LJDxcH/oBsC65hk8oAKLX3MyxNVQV0P/cxIa/F Gzl7aMQp0Odb8oAHkZTLoUkfKw7j4jCVQs7H3sQdlFViGvkVRJMMsRarD XAawC6CfLc9lB0ZJ1sZPyukx48m5KZvfiY7LEjoi5VL8+ixOFbyiBTQuz zhDizUmqcnXEdwi+HMsKK1SdSUvOXj8eIX/ZUgSgATspae3bd5kw614QG Qt7N7hfZlKahoqITUQz4qqHa3qGUKtRel3b6py5h6pRmzVBqwX0so88iN Q==; X-CSE-ConnectionGUID: QVMEbzelQ/+1lyY09uqTaw== X-CSE-MsgGUID: KedO0MwDQYWh++8jGLuNYw== X-IronPort-AV: E=McAfee;i="6700,10204,11310"; a="36619259" X-IronPort-AV: E=Sophos;i="6.12,302,1728975600"; d="scan'208";a="36619259" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2025 12:01:18 -0800 X-CSE-ConnectionGUID: nE7SyqrmS5+vCQv8U1zyWg== X-CSE-MsgGUID: 070K76ZKSB+lIqDYINXK/Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="126798658" Received: from srr4-3-linux-106-armuthy.iind.intel.com ([10.190.238.56]) by fmviesa002.fm.intel.com with ESMTP; 09 Jan 2025 12:01:15 -0800 From: Arun R Murthy Date: Fri, 10 Jan 2025 01:15:37 +0530 Subject: [PATCH v7 09/14] drm/i915/histogram: Hook i915 histogram with drm histogram MIME-Version: 1.0 Message-Id: <20250110-dpst-v7-9-605cb0271162@intel.com> References: <20250110-dpst-v7-0-605cb0271162@intel.com> In-Reply-To: <20250110-dpst-v7-0-605cb0271162@intel.com> To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: dmitry.baryshkov@linaro.org, suraj.kandpal@intel.com, uma.shankar@intel.com, "Imported from f20241218-dpst-v7-0-81bfe7d08c2d"@intel.com, 20240705091333.328322-1-mohammed.thasleem@intel.com, Arun R Murthy X-Mailer: b4 0.15-dev X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Handle histogram caps and histogram config property in i915 driver. Fill the histogram hardware capability and act upon the histogram config property to enable/disable histogram in i915. Signed-off-by: Arun R Murthy --- drivers/gpu/drm/i915/display/intel_crtc.c | 7 +++++++ drivers/gpu/drm/i915/display/intel_display.c | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c index c910168602d28cd51a7fb376e8935dfe3922845b..619aa363724602d4084184bfdf5766b71aed1b9f 100644 --- a/drivers/gpu/drm/i915/display/intel_crtc.c +++ b/drivers/gpu/drm/i915/display/intel_crtc.c @@ -28,6 +28,7 @@ #include "intel_drrs.h" #include "intel_dsi.h" #include "intel_fifo_underrun.h" +#include "intel_histogram.h" #include "intel_pipe_crc.h" #include "intel_psr.h" #include "intel_sprite.h" @@ -211,6 +212,7 @@ static struct intel_crtc *intel_crtc_alloc(void) static void intel_crtc_free(struct intel_crtc *crtc) { intel_crtc_destroy_state(&crtc->base, crtc->base.state); + intel_histogram_finish(crtc); kfree(crtc); } @@ -381,6 +383,11 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe) BIT(DRM_SCALING_FILTER_DEFAULT) | BIT(DRM_SCALING_FILTER_NEAREST_NEIGHBOR)); + intel_histogram_init(crtc); + if (drm_crtc_create_histogram_property(&crtc->base, + crtc->histogram->caps)) + drm_err(&dev_priv->drm, "Failed to initialize histogram properties\n"); + intel_color_crtc_init(crtc); intel_drrs_crtc_init(crtc); intel_crtc_crc_init(crtc); diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 4271da219b4105630106a2bc7e1fa42015ede1e1..486992a2caadebf2d3deb200b01d2d0d26b26cb0 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -93,6 +93,7 @@ #include "intel_fifo_underrun.h" #include "intel_frontbuffer.h" #include "intel_hdmi.h" +#include "intel_histogram.h" #include "intel_hotplug.h" #include "intel_link_bw.h" #include "intel_lvds.h" @@ -4612,6 +4613,12 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state, if (ret) return ret; + if (crtc_state->uapi.histogram_updated) { + ret = intel_histogram_atomic_check(crtc); + if (ret) + return ret; + } + return 0; } @@ -7878,6 +7885,11 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state) */ old_crtc_state->dsb_color_vblank = fetch_and_zero(&new_crtc_state->dsb_color_vblank); old_crtc_state->dsb_commit = fetch_and_zero(&new_crtc_state->dsb_commit); + + if (new_crtc_state->uapi.histogram_updated) + intel_histogram_update(crtc, + (struct drm_histogram_config *) + new_crtc_state->uapi.histogram_enable->data); } /* Underruns don't always raise interrupts, so check manually */