From patchwork Thu Dec 29 19:18:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 637577 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 44D71C4332F for ; Thu, 29 Dec 2022 19:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233850AbiL2TT0 (ORCPT ); Thu, 29 Dec 2022 14:19:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233980AbiL2TTY (ORCPT ); Thu, 29 Dec 2022 14:19:24 -0500 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E804C1409F for ; Thu, 29 Dec 2022 11:19:22 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id p36so28727448lfa.12 for ; Thu, 29 Dec 2022 11:19:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=EdD87IzJZslu2pAEGZWp1ZNvSgMg3L3aKGZIcrAngiI=; b=CJ8Fe35WTy96/TiUxLieBMctYl6WHmdZ46DCW/krgtUAOMZsB4SlydYl9OH8RGC79y +4bazdes6eh1SSrRha3C2lk2MGJpBm/8HFkV7iNch/CR4IJ/Y+dzOsXYJowkMVgE6Q+x O1T1bMnimq+oe2rxN7tRJxs2MvEWaEkE3KTrRmXj321X3luY0OG36RWd+M0doAAkRPAX 8FziRhSi9t5iAYF1Fzcdm+z2yLJDmi8cjrOgV0M0+/PKs+bAxiojCTTS6JxvZ5JFkPPL ap9NbO+WjCx5nQr7VZZY7U/Lg4M/yLf1eC3qEj0NB1O2I1gL8ITnVhfer8UPr14+m5ko B+bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=EdD87IzJZslu2pAEGZWp1ZNvSgMg3L3aKGZIcrAngiI=; b=yqw29eOez2IxcYnxJ2mRYvOwOV/UQ3ajuJSCe46xNdwKPUOTgF+z3BNz1y590W/KfR naFZROKSdVcLmHlhLhdh7HLvzKwgw1WkuL7hSW1WFFpBJ8OkDwl0awb9i6mXuYElV8Yf JYWfdIwlrhoBboTsxS52R7wDlWOP3e1S+1NGUwWgw4B8c6IiRTmWNZI6BZVcljvoqDvu N4orj8E4Oa0u3N8xEPTq8BxABpwt02D/VF0TdIjaw2FW7jkRvxMTETa89SPoha+Rjz6M XQM9tGp+zDfmFDyvD00daCCiVOYaGTkM5LY6dJmF5J6Nx8qrH6i6r7dHnJG7/WePzfYf bApw== X-Gm-Message-State: AFqh2kqZVbQ3K8YF0GMvy1udie411B9hwX0+FdXpMYZANwTYhOqEHnSN xMMGJo76xiriUCMLh2OtKp+eCQ== X-Google-Smtp-Source: AMrXdXswIMQ6243ayOHu//0Kuz68mS99iiN9hLTFuNO+T6hV9FAF0nfuUB0tfvirysy8OwcEKPcadA== X-Received: by 2002:a05:6512:2292:b0:4b5:b7a7:ebfa with SMTP id f18-20020a056512229200b004b5b7a7ebfamr8060749lfu.64.1672341562532; Thu, 29 Dec 2022 11:19:22 -0800 (PST) Received: from eriador.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id t13-20020ac24c0d000000b004cb10c151fasm1162295lfq.88.2022.12.29.11.19.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 11:19:21 -0800 (PST) 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 v2 25/27] drm/msm/dpu: rework static color fill code Date: Thu, 29 Dec 2022 21:18:54 +0200 Message-Id: <20221229191856.3508092-26-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221229191856.3508092-1-dmitry.baryshkov@linaro.org> References: <20221229191856.3508092-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. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 70 +++++++++++++---------- 1 file changed, 41 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 fa59ae007de1..2851f40cb915 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -639,20 +639,54 @@ static void _dpu_plane_setup_scaler(struct dpu_sw_pipe *pipe, fmt); } +static int _dpu_plane_color_fill_pipe(struct dpu_plane_state *pstate, + struct dpu_sw_pipe *pipe, + struct dpu_hw_pipe_cfg *old_pipe_cfg, + u32 fill_color, + const struct dpu_format *fmt) +{ + struct dpu_hw_pipe_cfg pipe_cfg; + + /* update sspp */ + if (!pipe->sspp->ops.setup_solidfill) + return 0; + + pipe->sspp->ops.setup_solidfill(pipe, fill_color); + + /* override scaler/decimation if solid fill */ + pipe_cfg.dst_rect = old_pipe_cfg->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); + + return 0; +} + /** * _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_hw_pipe_cfg pipe_cfg; + u32 fill_color = (color & 0xFFFFFF) | ((alpha & 0xFF) << 24); DPU_DEBUG_PLANE(pdpu, "\n"); @@ -661,34 +695,12 @@ 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, fill_color, fmt); } int dpu_plane_validate_multirect_v2(struct dpu_multirect_plane_states *plane)