From patchwork Fri Feb 3 18:21:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 650213 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 1E881C678D5 for ; Fri, 3 Feb 2023 18:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233540AbjBCSWH (ORCPT ); Fri, 3 Feb 2023 13:22:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233505AbjBCSWE (ORCPT ); Fri, 3 Feb 2023 13:22:04 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B17E2A9D4D for ; Fri, 3 Feb 2023 10:22:03 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id z11so6033847ede.1 for ; Fri, 03 Feb 2023 10:22:03 -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=1Y4pSm/Bj529M4uC0aMtacaczh2sUlKGTK5XPOQ7wz8=; b=tqVejs3vVOJkQMVD7r36nMAoWREisbRglmamslGPPPDsdSmdFm+wmRyFN0keVmHP7j ICDVEey0vN0JSpLBQcM7t+5hOW0XocaTKMqtu/CA8QYc24m7Sw1F8NLNjzZv88aUMm7O Vgw+JPAXOGGZ50oaGYG+yYJV6VLs//c2waZuLDpo2ObCVx00fc8R1JulIoxnrAzjnjas cfR0DeV1/x6jagtHiytHTwYBq9RbVcHby5B/Ga+twaPcH7QUoDzhoFFNJtRobm/HHiQG 5cw2+Np5cC0qhuNuimy8Iej7eSI8v/Nas+YFf9FxAaOD4rfOH6H2e1zzf/HLoJlZOP9G kTpw== 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=1Y4pSm/Bj529M4uC0aMtacaczh2sUlKGTK5XPOQ7wz8=; b=3qG5eQ7gd5EBn23je1DSpz7vbdfUnU/rHJVLTZH1rOxQ1PjeZI314V8Og/AhcYq65X oXUfFUXnvIoNx0wwaRowrDEkMliFLaq2CSrxnSBC5iJoOcccGJoDjrslG4Ty9/HaPzTT 5e14lRKBcEDWIs2htMtc1mBtLyucMHt25EybhrLQuza+lnZiW1OtWP4PLESfAsHbOvQx t03UZu8OwzD6y2Nxro3RalZihxOgaKCXWB+/lQhaqfRLgJK6/lS4MWvO/Hb8RKYizHnp AJztEEp4G2KbKQLsRyNLZAVa6mLFuKSfCXJlC0E2rqyYJoP83f15b2Myk/lDtO36ILeQ WtqQ== X-Gm-Message-State: AO0yUKXvva0LkOhX8bwToTwzB8Y+BUIGxfnV94r/yP2/GUqpZ5GtEZt6 SU966iwCmBDBompOSsca+RCVMg== X-Google-Smtp-Source: AK7set+sRAN5KFzMumTOkTagS9d5oC7yHfa8OZgH5vCeYN0IZ0ecLoqO83IkHvtK6Teq5HB+8zmfZA== X-Received: by 2002:aa7:c403:0:b0:46c:8544:42be with SMTP id j3-20020aa7c403000000b0046c854442bemr10267197edq.5.1675448522239; Fri, 03 Feb 2023 10:22:02 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id w16-20020a05640234d000b0046267f8150csm1487523edc.19.2023.02.03.10.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 10:22:01 -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 v3 25/27] drm/msm/dpu: rework static color fill code Date: Fri, 3 Feb 2023 20:21:30 +0200 Message-Id: <20230203182132.1307834-26-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230203182132.1307834-1-dmitry.baryshkov@linaro.org> References: <20230203182132.1307834-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 05047192cb37..e2e85688ed3c 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_sspp_cfg *old_pipe_cfg, + u32 fill_color, + const struct dpu_format *fmt) +{ + struct dpu_hw_sspp_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_sspp_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)