From patchwork Thu Mar 16 16:16:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 664061 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03693C7618B for ; Thu, 16 Mar 2023 16:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229732AbjCPQR4 (ORCPT ); Thu, 16 Mar 2023 12:17:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230238AbjCPQRq (ORCPT ); Thu, 16 Mar 2023 12:17:46 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB5CFE20F9 for ; Thu, 16 Mar 2023 09:17:20 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id l22so2245743ljc.11 for ; Thu, 16 Mar 2023 09:17:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678983437; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yDA9CEnvG2YyMzYnEDe0cTC8lauV5N3JdEd+315v1f0=; b=JBx92nT82PNXvFG583MR5FO1IvLX9DEFVDXHLkjadXgOmp+EKd9+I+RSKNOkrQvHeW W6IaGVhHophSsm0DwVFHAI4trCS6XDjXeREIeIRv+Qx5Kfgj0TP907e0d8D5EYUPyMLH bnesOQt+61kdund1LwbTxeuS+hF3Q8KZWn/3lqtCIcR5N6Dchg8Ddh9yQ7bIr5V+Dv95 I/Yqu4qwvJSTavobBUwTzvx9Er0VklVAd0xWZarPNJl9RtsUQrXNr5m+SCuZuKS3xVwa Mhb3rGe2mjp+Qfgf8hVtHKCaP5i0rbAFZjJ+/jBP8qi49TjR8Z2EJGTwOWSzhSEDwl3v KDNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678983437; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yDA9CEnvG2YyMzYnEDe0cTC8lauV5N3JdEd+315v1f0=; b=zJ9ognNwHfPoXEJQSFqco+zGop5YYxLaY7lSXWkujxt9MOytGgnylquJN96zXFtjhw 5caJM/UF+sJdJ4iF25SoPOVOB7sUxVYzm/GqU7NOxcapG3VKzopfXC9s0teo/ypFwM+E HSSzcetuJ41lQPTVe2wSV7BeNSd2cJcZvpC/DBrYU2B/9SvlXxlFqZYRe/Pw3D90Meu+ VS91//EtVGXa7Fm6hYEpRFX2+vfuiKmvANpKVPVVXaIl4Dzzy2UJcX6GIehem7YN/HrF hWCYQs0l/ky5dUE4vi3KSGOYXTWP5ktlw5tFBv8i9f/yFuqODFLmNw/6zfHwKNWqPxRA ZdCw== X-Gm-Message-State: AO0yUKUl5xiKId9Nw1asIfUIrdO/XF56ThOe1tIsV1hNpRbOz/iN2pU+ M1KsHJdt5fW5+o54ZG82s3yJ7w== X-Google-Smtp-Source: AK7set9EyuGvlYgyOJ3KfspDaOALx5/QC2bPRsphSBCytKcITJS7wBn6bK/hf0Y8BUhGq78cbQFtbg== X-Received: by 2002:a05:651c:1a21:b0:293:6020:19db with SMTP id by33-20020a05651c1a2100b00293602019dbmr2914216ljb.14.1678983437500; Thu, 16 Mar 2023 09:17:17 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id l2-20020a2e8342000000b00298b33afe1csm549152ljh.87.2023.03.16.09.17.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 09:17:17 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v7 25/32] drm/msm/dpu: rework static color fill code Date: Thu, 16 Mar 2023 19:16:46 +0300 Message-Id: <20230316161653.4106395-26-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230316161653.4106395-1-dmitry.baryshkov@linaro.org> References: <20230316161653.4106395-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Rework static color fill code to separate the pipe / pipe_cfg handling. This is a preparation for the r_pipe support. Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 69 +++++++++++++---------- 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index 6031d270992f..f52120b05b6e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -640,20 +640,52 @@ static void _dpu_plane_setup_scaler(struct dpu_sw_pipe *pipe, fmt); } +static void _dpu_plane_color_fill_pipe(struct dpu_plane_state *pstate, + struct dpu_sw_pipe *pipe, + struct drm_rect *dst_rect, + u32 fill_color, + const struct dpu_format *fmt) +{ + struct dpu_sw_pipe_cfg pipe_cfg; + + /* update sspp */ + if (!pipe->sspp->ops.setup_solidfill) + return; + + pipe->sspp->ops.setup_solidfill(pipe, fill_color); + + /* override scaler/decimation if solid fill */ + pipe_cfg.dst_rect = *dst_rect; + + pipe_cfg.src_rect.x1 = 0; + pipe_cfg.src_rect.y1 = 0; + pipe_cfg.src_rect.x2 = + drm_rect_width(&pipe_cfg.dst_rect); + pipe_cfg.src_rect.y2 = + drm_rect_height(&pipe_cfg.dst_rect); + + if (pipe->sspp->ops.setup_format) + pipe->sspp->ops.setup_format(pipe, fmt, DPU_SSPP_SOLID_FILL); + + if (pipe->sspp->ops.setup_rects) + pipe->sspp->ops.setup_rects(pipe, &pipe_cfg); + + _dpu_plane_setup_scaler(pipe, fmt, true, &pipe_cfg, pstate->rotation); +} + /** * _dpu_plane_color_fill - enables color fill on plane * @pdpu: Pointer to DPU plane object * @color: RGB fill color value, [23..16] Blue, [15..8] Green, [7..0] Red * @alpha: 8-bit fill alpha value, 255 selects 100% alpha - * Returns: 0 on success */ -static int _dpu_plane_color_fill(struct dpu_plane *pdpu, +static void _dpu_plane_color_fill(struct dpu_plane *pdpu, uint32_t color, uint32_t alpha) { const struct dpu_format *fmt; const struct drm_plane *plane = &pdpu->base; struct dpu_plane_state *pstate = to_dpu_plane_state(plane->state); - struct dpu_sw_pipe_cfg pipe_cfg; + u32 fill_color = (color & 0xFFFFFF) | ((alpha & 0xFF) << 24); DPU_DEBUG_PLANE(pdpu, "\n"); @@ -662,34 +694,13 @@ static int _dpu_plane_color_fill(struct dpu_plane *pdpu, * h/w only supports RGB variants */ fmt = dpu_get_dpu_format(DRM_FORMAT_ABGR8888); + /* should not happen ever */ + if (!fmt) + return; /* update sspp */ - if (fmt && pstate->pipe.sspp->ops.setup_solidfill) { - pstate->pipe.sspp->ops.setup_solidfill(&pstate->pipe, - (color & 0xFFFFFF) | ((alpha & 0xFF) << 24)); - - /* override scaler/decimation if solid fill */ - pipe_cfg.dst_rect = pstate->base.dst; - - pipe_cfg.src_rect.x1 = 0; - pipe_cfg.src_rect.y1 = 0; - pipe_cfg.src_rect.x2 = - drm_rect_width(&pipe_cfg.dst_rect); - pipe_cfg.src_rect.y2 = - drm_rect_height(&pipe_cfg.dst_rect); - - if (pstate->pipe.sspp->ops.setup_format) - pstate->pipe.sspp->ops.setup_format(&pstate->pipe, - fmt, DPU_SSPP_SOLID_FILL); - - if (pstate->pipe.sspp->ops.setup_rects) - pstate->pipe.sspp->ops.setup_rects(&pstate->pipe, - &pipe_cfg); - - _dpu_plane_setup_scaler(&pstate->pipe, fmt, true, &pipe_cfg, pstate->rotation); - } - - return 0; + _dpu_plane_color_fill_pipe(pstate, &pstate->pipe, &pstate->pipe_cfg.dst_rect, + fill_color, fmt); } int dpu_plane_validate_multirect_v2(struct dpu_multirect_plane_states *plane)