Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3698756imu; Mon, 28 Jan 2019 09:14:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN4z60zDVQbOy/fTx4HMsRGckgJUCpNNCCzxzLguuIVO7XEA3RmIgkFmUFRNIUQVefaaVBnk X-Received: by 2002:a63:8043:: with SMTP id j64mr20899270pgd.405.1548695659550; Mon, 28 Jan 2019 09:14:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695659; cv=none; d=google.com; s=arc-20160816; b=IbKhh4lG4Ia6i1tF1BjyZmLoQ6L+ySy2IpdE4+eiTMGTE8olDxDp/ybSfcH83hvfoo kDMSS9KPFS9gwdMfndA04aC3YMtjH9x4QUgmQCkt4QbNYHpEn5f9waSTHn+YbkDH+Auz JDn7Dh169tJyZFu2OuR7lBFfAmMpfer+rEQvqM/9mpfog5MCH6gIs2Yb6T7/xDTd5RNN 3YEE/JZXPnguCfhbdoxxft9wpm/bScXTUaSYuiJzf/MQTKnIKqryVrA8FUv0MGWgYDHw KIIEfsXNgXatkq0XhRceD58avL38WyKhfb4C9vfa/VEK3kiC+JmbAiQGHhbfO1Cr/INI XpYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/1lTHhivJLHj28RH6nQzVJPQjqtNSTY75IqdlHY1TwA=; b=m3ApwHb5rv4Koqz4V3DUL2ADs9KCAIp0rWunYpWQnNLFHqikfR9coJfKddAU7xW+f/ ew8N0jKQjU6S1QRuBjGJGTQ6XI6/daw93QSX7ZCr4wyyYqF0/UVMw712tXXvnEYAjYZa 8pcVNDc/8V7+xKONlIiMagy3xXlc4MBGrQtv/pF5DGVoORIYjQxFiOF9SFD3IyCRcI2I sVKdd/Zlj/pDA3LcQ+IIEH1QQeGnz8my75GiS/jPqPDOg+ll/DylHlaTQKZGrOLz7Clo G2MWM672AY485nkG0RcmkC5njJozujXT05oqBn9doPlLXrzH8voJQfbCxMBKLE+WoWqm NHlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NzFGDeof; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si32515336plr.127.2019.01.28.09.14.01; Mon, 28 Jan 2019 09:14:19 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=NzFGDeof; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732336AbfA1QIN (ORCPT + 99 others); Mon, 28 Jan 2019 11:08:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:59604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731912AbfA1QIK (ORCPT ); Mon, 28 Jan 2019 11:08:10 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A55F420989; Mon, 28 Jan 2019 16:08:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691689; bh=65Zfj6BcI6f12litBoEQgNcOV3JapBerVXX1HVlLm4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NzFGDeofWx5A7TBzYsuBn7R2LlFnVjNblq+/RBzbSKuryzpbrby6LvPl3JIOIPb4k k5YjSNbJ+UHOxzcNzHaSjE1DJ2QeL0SLngqi8QZyuNCidXacvcpTcvvHnTFMc66UvV sM6oYDt9xAVjM0s/P6tiKM+jZz1hf0ngs8qZBuxY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Eric Yang , Alex Deucher , Sasha Levin , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 4.19 185/258] drm/amd/display: fix YCbCr420 blank color Date: Mon, 28 Jan 2019 10:58:11 -0500 Message-Id: <20190128155924.51521-185-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Yang [ Upstream commit 12750d1647f118496f1da727146f255f5e44d500 ] [Why] YCbCr420 packing format uses two chanels for luma, and 1 channel for both chroma component. Our previous implementation did not account for this and results in every other pixel having very high luma value, showing greyish color instead of black. YCbCr444 = ; ..... YCbCr420 = ; ..... [How] Program the second channel with the black color value for luma as well. Signed-off-by: Eric Yang Reviewed-by: Hugo Hu Acked-by: Leo Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 11 ++++++++++- .../gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c index 0941f3c689bc..580e7e82034f 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c @@ -1268,10 +1268,19 @@ static void program_scaler(const struct dc *dc, pipe_ctx->plane_res.scl_data.lb_params.depth, &pipe_ctx->stream->bit_depth_params); - if (pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color) + if (pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color) { + /* + * The way 420 is packed, 2 channels carry Y component, 1 channel + * alternate between Cb and Cr, so both channels need the pixel + * value for Y + */ + if (pipe_ctx->stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420) + color.color_r_cr = color.color_g_y; + pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color( pipe_ctx->stream_res.tg, &color); + } pipe_ctx->plane_res.xfm->funcs->transform_set_scaler(pipe_ctx->plane_res.xfm, &pipe_ctx->plane_res.scl_data); diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c index 33a9d0c58966..4058b59d9bea 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c @@ -2121,6 +2121,15 @@ static void dcn10_blank_pixel_data( color_space = stream->output_color_space; color_space_to_black_color(dc, color_space, &black_color); + /* + * The way 420 is packed, 2 channels carry Y component, 1 channel + * alternate between Cb and Cr, so both channels need the pixel + * value for Y + */ + if (stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420) + black_color.color_r_cr = black_color.color_g_y; + + if (stream_res->tg->funcs->set_blank_color) stream_res->tg->funcs->set_blank_color( stream_res->tg, -- 2.19.1