From patchwork Tue Jan 30 09:35:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Sharma, Shashank" X-Patchwork-Id: 10191463 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 0B89460383 for ; Tue, 30 Jan 2018 09:30:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11AA7289C5 for ; Tue, 30 Jan 2018 09:30:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 067DD289EC; Tue, 30 Jan 2018 09:30:48 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 989D8289C5 for ; Tue, 30 Jan 2018 09:30:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C8E06E6FD; Tue, 30 Jan 2018 09:30:47 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 386C56E682 for ; Tue, 30 Jan 2018 09:30:43 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jan 2018 01:30:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,434,1511856000"; d="scan'208";a="23342110" Received: from shashanks-linuxbox.iind.intel.com ([10.223.161.29]) by orsmga003.jf.intel.com with ESMTP; 30 Jan 2018 01:30:41 -0800 From: Shashank Sharma To: intel-gfx@lists.freedesktop.org Date: Tue, 30 Jan 2018 15:05:58 +0530 Message-Id: <1517304963-27932-3-git-send-email-shashank.sharma@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517304963-27932-1-git-send-email-shashank.sharma@intel.com> References: <1517304963-27932-1-git-send-email-shashank.sharma@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v4 2/7] drm/i915: Add CRTC output format YCBCR 4:4:4 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for YCBCR 4:4:4 CRTC output format. To do this, this patch extends the existing YCBCR 4:2:0 framework by: - Adding new parameter in for YCBCR 4:4:4 enum crtc_iutput_format. - Adding case for YCBCR 4:4:4 in while setting AVI infoframes. - Adding necessary checks in modeset sequence. V3: Added this patch in the series V4: Added r-b from Maarten (for v3) Addressed review comment from Ville: Do not use (config->output_format > CRTC_OUTPUT_RGB) Cc: Ville Syrjälä Cc: Maarten Lankhorst Signed-off-by: Shashank Sharma --- drivers/gpu/drm/i915/intel_color.c | 3 ++- drivers/gpu/drm/i915/intel_display.c | 14 ++++++++++---- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 2 ++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c index 99e32cb..5b76de6 100644 --- a/drivers/gpu/drm/i915/intel_color.c +++ b/drivers/gpu/drm/i915/intel_color.c @@ -141,7 +141,8 @@ static void i9xx_load_csc_matrix(struct drm_crtc_state *crtc_state) uint16_t coeffs[9] = { 0, }; struct intel_crtc_state *intel_crtc_state = to_intel_crtc_state(crtc_state); - if (intel_crtc_state->output_format == CRTC_OUTPUT_YCBCR420) { + if (intel_crtc_state->output_format == CRTC_OUTPUT_YCBCR420 || + intel_crtc_state->output_format == CRTC_OUTPUT_YCBCR444) { i9xx_load_ycbcr_conversion_matrix(intel_crtc); return; } else if (crtc_state->ctm) { diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 877336d..4a40de9 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -6363,8 +6363,9 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc, return -EINVAL; } - if (pipe_config->output_format == CRTC_OUTPUT_YCBCR420 && - pipe_config->base.ctm) { + if ((pipe_config->output_format == CRTC_OUTPUT_YCBCR420 || + pipe_config->output_format == CRTC_OUTPUT_YCBCR444) && + pipe_config->base.ctm) { /* * There is only one pipe CSC unit per pipe, and we need that * for output conversion from RGB->YCBCR. So if CTM is already @@ -8194,11 +8195,13 @@ static void haswell_set_pipemisc(struct drm_crtc *crtc) if (intel_crtc->config->dither) val |= PIPEMISC_DITHER_ENABLE | PIPEMISC_DITHER_TYPE_SP; - if (config->output_format == CRTC_OUTPUT_YCBCR420) { + if (config->output_format == CRTC_OUTPUT_YCBCR420 || + config->output_format == CRTC_OUTPUT_YCBCR444) val |= PIPEMISC_OUTPUT_COLORSPACE_YUV; + + if (config->output_format == CRTC_OUTPUT_YCBCR420) val |= PIPEMISC_YUV420_ENABLE | PIPEMISC_YUV420_MODE_FULL_BLEND; - } I915_WRITE(PIPEMISC(intel_crtc->pipe), val); } @@ -9176,6 +9179,7 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc, static const char * const output_format_str[] = { "Invalid", "RGB", + "YCBCR4:4:4", "YCBCR4:2:0", }; @@ -9241,6 +9245,8 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc, output_format = CRTC_OUTPUT_INVALID; else output_format = CRTC_OUTPUT_YCBCR420; + } else { + output_format = CRTC_OUTPUT_YCBCR444; } } diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 35be78e..04b38c9 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -690,6 +690,7 @@ struct intel_crtc_wm_state { enum intel_output_format { CRTC_OUTPUT_INVALID, CRTC_OUTPUT_RGB, + CRTC_OUTPUT_YCBCR444, CRTC_OUTPUT_YCBCR420, }; diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 6700ed6..02c5954 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -481,6 +481,8 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder, if (crtc_state->output_format == CRTC_OUTPUT_YCBCR420) frame.avi.colorspace = HDMI_COLORSPACE_YUV420; + else if (crtc_state->output_format == CRTC_OUTPUT_YCBCR444) + frame.avi.colorspace = HDMI_COLORSPACE_YUV444; else frame.avi.colorspace = HDMI_COLORSPACE_RGB;