From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8242606A322 for ; Thu, 3 Dec 2026 20:13:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=YKLwMcjz; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=I1xkcPjG; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=L+HiamEZ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:Reply-To:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:Subject: From:MIME-Version:Date:Message-ID:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=4LcUCKUPfyr0Hx7PN/7P61zVsUAfaNdJXw5XcjA9UEs=; b=YKLwMcjzEarFXP2cL4dDlT8ATZ mmJWIheNDjc3pgfoRhG7cbC6KEQ8LufyCM+qBFFm8DvrzzJ6vyLt59RBV8TDP7ENp91Z/FmrAs+CB vPM72tmlHS+PRzWFqWldDKm7U+lo4iHtqIA2kX02C8NxEPLaQRmSk+E2SoX3x2/XzGx/wq46+dUnQ AEZ4lxHR7sOBDAFjo0xnonlurjRcxOSPoRpMwqVJffNaCl0iJSgMZjYuzjYs79SKMezsyGCDB7HmT LGsRaaVhw2sqQl7DZBOT7KfB1IhJdbcpmGN3835Sdm9pcs4P3QGcioH0xmUjpQzd2FZF+5ZSzzwPH avjk6qLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZCY3-0000000FojE-0dFR; Thu, 03 Dec 2026 19:32:55 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZCXz-0000000Foi4-1aAi for linux-amlogic@bombadil.infradead.org; Thu, 03 Dec 2026 19:32:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :In-Reply-To:References:Cc:To:Subject:Reply-To:From:MIME-Version:Date: Message-ID:Sender:Content-ID:Content-Description; bh=ZX6tS5SH0wk7yjKy0RLoRKizZD1QwmktkweM+I07ohs=; b=I1xkcPjGoT0tq+StK5kIHC17Wk IAOc5zny/iS7enefDKtSb3k4iuxYxQTtka9aUPW3YfWLacl9doOvqnt21t5G24TcunIhIhKg5MY9e t0PQKDkbE5uyDADdKUlK7lNYgZYuCTKRd1enzeL/z1VnDImcJQRIAbXiQxDwma2m5zUdmZcs+mwiD lHN/IgJNe2oumpnnfCNmxFP5VbRhoZw98t/MuqeLP3NaEPBoXzU4YEt7SBOR38FImCZCvLmBknOfU 4IMcNfFJr5HcGvYbdwXaYXt1jyHjwQAc9mOB/61CnqXxXidMTNvlwlzc7jiJ4dL/kJ4S0+p9eWrBL +1z+AMMw==; Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by desiato.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZCXw-0000000DcWn-0HLp for linux-amlogic@lists.infradead.org; Thu, 03 Dec 2026 19:32:49 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4a9a8d6cea8so1702535e9.1 for ; Thu, 03 Dec 2026 11:32:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1796326365; x=1796931165; darn=lists.infradead.org; h=content-transfer-encoding:content-type:in-reply-to:organization :autocrypt:content-language:references:cc:to:subject:reply-to:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ZX6tS5SH0wk7yjKy0RLoRKizZD1QwmktkweM+I07ohs=; b=L+HiamEZ3SKW0v6nHDHR7xT8avW5WzaBUZM3y2fX9E4x5dRSWr8JsvqKwozyNDtjBC YRhZAJ5bBQKthltXNGumvxDOwd7/biQ0dcLVHgwr05ygC47bRk7/sc2LlD9K8FGXDRqK EEI7Oc++0pBgiwSzkJkXK8b9TJyqzjG2E4tlAJGNW3ksStZLecPby/DbDNBmINZZ5n93 811+jl3n5L8IMmOQwdVXsTyA5PW3RE+wQSbumimVOJ7ZBAoOydtrmt353eKUwCocKpbu F0CAtiot7JV3FaZbYqIU6i0t/Lb05ZOwwXflMDHBS/dDYxwBlnZoM/KtMsnlZEtD0Tz0 v2Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796326365; x=1796931165; h=content-transfer-encoding:content-type:in-reply-to:organization :autocrypt:content-language:references:cc:to:subject:reply-to:from :user-agent:mime-version:date:message-id:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to:content-type; bh=ZX6tS5SH0wk7yjKy0RLoRKizZD1QwmktkweM+I07ohs=; b=0VtaN22NC109v12gwvWsHFnHf1XGiPpErkCRg9jm+MFri3h3BmHcva6Rpcz+9XZU3b 0POQYFdY9YhMHRJu2dBt2iRI3Zhlg5y3PWgEgbnCUxW8dmT3dvXFCK1hHkUONAduApqg bJaYFerPDeYXZt36hnZi2noOAV1RwZYSVlbBLH1JsBPQBK9PvU0WQfq1/isQZRWAlill 1zWDRRUiYPbWq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w4xDSL7nood3PLQzrSyg== X-Received: by 2002:a05:600c:46d4:b0:4a0:20b4:ba93 with SMTP id 5b1f17b1804b1-4bbe19926c2mr61076555e9.16.1796326365463; Thu, 03 Dec 2026 11:32:45 -0800 (PST) Received: from ?IPV6:2a01:e0a:106d:1080:7de3:fcb2:e184:4e7b? ([2a01:e0a:106d:1080:7de3:fcb2:e184:4e7b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbea0b5e3csm26615e9.0.2026.12.03.11.32.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Dec 2026 11:32:44 -0800 (PST) Message-ID: <2f246acc-0a15-422b-8d73-fcfaf8859836@linaro.org> Date: Thu, 3 Dec 2026 20:32:43 +0100 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Neil Armstrong Subject: Re: [PATCH v2 2/9] drm/meson: isolate primary plane scaler setup To: Guillaume La Roque , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Simona Vetter References: <20261203-meson-g12a-osd2-v2-0-8a4a57d32e20@baylibre.com> <20261203-meson-g12a-osd2-v2-2-8a4a57d32e20@baylibre.com> Content-Language: en-US, fr Autocrypt: addr=neil.armstrong@linaro.org; keydata= xsBNBE1ZBs8BCAD78xVLsXPwV/2qQx2FaO/7mhWL0Qodw8UcQJnkrWmgTFRobtTWxuRx8WWP GTjuhvbleoQ5Cxjr+v+1ARGCH46MxFP5DwauzPekwJUD5QKZlaw/bURTLmS2id5wWi3lqVH4 BVF2WzvGyyeV1o4RTCYDnZ9VLLylJ9bneEaIs/7cjCEbipGGFlfIML3sfqnIvMAxIMZrvcl9 qPV2k+KQ7q+aXavU5W+yLNn7QtXUB530Zlk/d2ETgzQ5FLYYnUDAaRl+8JUTjc0CNOT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qa3 3eDIHu/zr1HMKErm+2SD6PO9umRef8V82o2oaCLvf4WeIssFjwB0b6a12opuRP7yo3E3gTCS KmbUuLv1CtxKQF+fUV1cVaTPMyT25Od+RC1K+iOR0F54oUJvJeq7fUzbn/KdlhA8XPGzwGRy 4zcsPWvwnXgfe5tk680fEKZVwOZKIEuJC3v+/yZpQzDvGYJvbyix0lHnrCzq43WefRHI5XTT QbM0WUIBIcGmq38+OgUsMYu4NzLu7uZFAcmp6h8g Organization: Linaro In-Reply-To: <20261203-meson-g12a-osd2-v2-2-8a4a57d32e20@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261203_193248_216974_CBF5C6C8 X-CRM114-Status: GOOD ( 22.98 ) X-Spam-Score: -0.2 (/) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Neil Armstrong Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-amlogic" X-Spam-Status: No, score=-15.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 12/3/26 20:21, Guillaume La Roque wrote: > Separate the OSD1 scaler from format, buffer and geometry handling so > another RGB plane can reuse scanout setup without changing the primary > scaler state. > > Keep the primary blender dimensions based on crtc_w and crtc_h, > including the existing height division for interlaced modes. > > Signed-off-by: Guillaume La Roque > --- > drivers/gpu/drm/meson/meson_plane.c | 224 +++++++++++++++++++----------------- > 1 file changed, 119 insertions(+), 105 deletions(-) > > diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c > index 639234d2f9d4..04c28289106b 100644 > --- a/drivers/gpu/drm/meson/meson_plane.c > +++ b/drivers/gpu/drm/meson/meson_plane.c > @@ -131,6 +131,118 @@ static u32 meson_g12a_afbcd_line_stride(struct meson_drm *priv) > return ((line_stride + 1) >> 1) << 1; > } > > +static void meson_plane_setup_scaler(struct meson_drm *priv, > + struct drm_plane_state *new_state, > + struct drm_rect *dest) > +{ > + int vsc_ini_rcv_num, vsc_ini_rpt_p0_num; > + int vsc_bot_rcv_num, vsc_bot_rpt_p0_num; > + int hsc_ini_rcv_num, hsc_ini_rpt_p0_num; > + int hf_phase_step, vf_phase_step; > + int src_w, src_h, dst_w, dst_h; > + int bot_ini_phase; > + int hf_bank_len; > + int vf_bank_len; > + > + /* Default scaler parameters */ > + vsc_bot_rcv_num = 0; > + vsc_bot_rpt_p0_num = 0; > + hf_bank_len = 4; > + vf_bank_len = 4; > + > + if (new_state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) { > + vsc_bot_rcv_num = 6; > + vsc_bot_rpt_p0_num = 2; > + } > + > + hsc_ini_rcv_num = hf_bank_len; > + vsc_ini_rcv_num = vf_bank_len; > + hsc_ini_rpt_p0_num = (hf_bank_len / 2) - 1; > + vsc_ini_rpt_p0_num = (vf_bank_len / 2) - 1; > + > + src_w = fixed16_to_int(new_state->src_w); > + src_h = fixed16_to_int(new_state->src_h); > + dst_w = new_state->crtc_w; > + dst_h = new_state->crtc_h; > + > + /* > + * When the output is interlaced, the OSD must switch between > + * each field using the INTERLACE_SEL_ODD (0) of VIU_OSD1_BLK0_CFG_W0 > + * at each vsync. > + * But the vertical scaler can provide such funtionnality if > + * is configured for 2:1 scaling with interlace options enabled. > + */ > + if (new_state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) { > + dest->y1 /= 2; > + dest->y2 /= 2; > + dst_h /= 2; > + } > + > + hf_phase_step = ((src_w << 18) / dst_w) << 6; > + vf_phase_step = (src_h << 20) / dst_h; > + > + if (new_state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) > + bot_ini_phase = ((vf_phase_step / 2) >> 4); > + else > + bot_ini_phase = 0; > + > + vf_phase_step = (vf_phase_step << 4); > + > + /* In interlaced mode, scaler is always active */ > + if (src_h != dst_h || src_w != dst_w) { > + priv->viu.osd_sc_i_wh_m1 = SCI_WH_M1_W(src_w - 1) | > + SCI_WH_M1_H(src_h - 1); > + priv->viu.osd_sc_o_h_start_end = SCO_HV_START(dest->x1) | > + SCO_HV_END(dest->x2 - 1); > + priv->viu.osd_sc_o_v_start_end = SCO_HV_START(dest->y1) | > + SCO_HV_END(dest->y2 - 1); > + /* Enable OSD Scaler */ > + priv->viu.osd_sc_ctrl0 = SC_CTRL0_PATH_EN | SC_CTRL0_SEL_OSD1; > + } else { > + priv->viu.osd_sc_i_wh_m1 = 0; > + priv->viu.osd_sc_o_h_start_end = 0; > + priv->viu.osd_sc_o_v_start_end = 0; > + priv->viu.osd_sc_ctrl0 = 0; > + } > + > + /* In interlaced mode, vertical scaler is always active */ > + if (src_h != dst_h) { > + priv->viu.osd_sc_v_ctrl0 = > + VSC_BANK_LEN(vf_bank_len) | > + VSC_TOP_INI_RCV_NUM(vsc_ini_rcv_num) | > + VSC_TOP_RPT_L0_NUM(vsc_ini_rpt_p0_num) | > + VSC_VERTICAL_SCALER_EN; > + > + if (new_state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) > + priv->viu.osd_sc_v_ctrl0 |= > + VSC_BOT_INI_RCV_NUM(vsc_bot_rcv_num) | > + VSC_BOT_RPT_L0_NUM(vsc_bot_rpt_p0_num) | > + VSC_PROG_INTERLACE; > + > + priv->viu.osd_sc_v_phase_step = SC_PHASE_STEP(vf_phase_step); > + priv->viu.osd_sc_v_ini_phase = VSC_INI_PHASE_BOT(bot_ini_phase); > + } else { > + priv->viu.osd_sc_v_ctrl0 = 0; > + priv->viu.osd_sc_v_phase_step = 0; > + priv->viu.osd_sc_v_ini_phase = 0; > + } > + > + /* Horizontal scaler is only used if width does not match */ > + if (src_w != dst_w) { > + priv->viu.osd_sc_h_ctrl0 = > + HSC_BANK_LENGTH(hf_bank_len) | > + HSC_INI_RCV_NUM0(hsc_ini_rcv_num) | > + HSC_RPT_P0_NUM0(hsc_ini_rpt_p0_num) | > + HSC_HORIZ_SCALER_EN; > + priv->viu.osd_sc_h_phase_step = SC_PHASE_STEP(hf_phase_step); > + priv->viu.osd_sc_h_ini_phase = 0; > + } else { > + priv->viu.osd_sc_h_ctrl0 = 0; > + priv->viu.osd_sc_h_phase_step = 0; > + priv->viu.osd_sc_h_ini_phase = 0; > + } > +} > + > static void meson_plane_atomic_update(struct drm_plane *plane, > struct drm_atomic_commit *state) > { > @@ -142,14 +254,6 @@ static void meson_plane_atomic_update(struct drm_plane *plane, > struct drm_framebuffer *fb = new_state->fb; > struct drm_gem_dma_object *gem; > unsigned long flags; > - int vsc_ini_rcv_num, vsc_ini_rpt_p0_num; > - int vsc_bot_rcv_num, vsc_bot_rpt_p0_num; > - int hsc_ini_rcv_num, hsc_ini_rpt_p0_num; > - int hf_phase_step, vf_phase_step; > - int src_w, src_h, dst_w, dst_h; > - int bot_ini_phase; > - int hf_bank_len; > - int vf_bank_len; > u8 canvas_id_osd1; > > /* > @@ -246,103 +350,7 @@ static void meson_plane_atomic_update(struct drm_plane *plane, > break; > } > > - /* Default scaler parameters */ > - vsc_bot_rcv_num = 0; > - vsc_bot_rpt_p0_num = 0; > - hf_bank_len = 4; > - vf_bank_len = 4; > - > - if (new_state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) { > - vsc_bot_rcv_num = 6; > - vsc_bot_rpt_p0_num = 2; > - } > - > - hsc_ini_rcv_num = hf_bank_len; > - vsc_ini_rcv_num = vf_bank_len; > - hsc_ini_rpt_p0_num = (hf_bank_len / 2) - 1; > - vsc_ini_rpt_p0_num = (vf_bank_len / 2) - 1; > - > - src_w = fixed16_to_int(new_state->src_w); > - src_h = fixed16_to_int(new_state->src_h); > - dst_w = new_state->crtc_w; > - dst_h = new_state->crtc_h; > - > - /* > - * When the output is interlaced, the OSD must switch between > - * each field using the INTERLACE_SEL_ODD (0) of VIU_OSD1_BLK0_CFG_W0 > - * at each vsync. > - * But the vertical scaler can provide such funtionnality if > - * is configured for 2:1 scaling with interlace options enabled. > - */ > - if (new_state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) { > - dest.y1 /= 2; > - dest.y2 /= 2; > - dst_h /= 2; > - } > - > - hf_phase_step = ((src_w << 18) / dst_w) << 6; > - vf_phase_step = (src_h << 20) / dst_h; > - > - if (new_state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) > - bot_ini_phase = ((vf_phase_step / 2) >> 4); > - else > - bot_ini_phase = 0; > - > - vf_phase_step = (vf_phase_step << 4); > - > - /* In interlaced mode, scaler is always active */ > - if (src_h != dst_h || src_w != dst_w) { > - priv->viu.osd_sc_i_wh_m1 = SCI_WH_M1_W(src_w - 1) | > - SCI_WH_M1_H(src_h - 1); > - priv->viu.osd_sc_o_h_start_end = SCO_HV_START(dest.x1) | > - SCO_HV_END(dest.x2 - 1); > - priv->viu.osd_sc_o_v_start_end = SCO_HV_START(dest.y1) | > - SCO_HV_END(dest.y2 - 1); > - /* Enable OSD Scaler */ > - priv->viu.osd_sc_ctrl0 = SC_CTRL0_PATH_EN | SC_CTRL0_SEL_OSD1; > - } else { > - priv->viu.osd_sc_i_wh_m1 = 0; > - priv->viu.osd_sc_o_h_start_end = 0; > - priv->viu.osd_sc_o_v_start_end = 0; > - priv->viu.osd_sc_ctrl0 = 0; > - } > - > - /* In interlaced mode, vertical scaler is always active */ > - if (src_h != dst_h) { > - priv->viu.osd_sc_v_ctrl0 = > - VSC_BANK_LEN(vf_bank_len) | > - VSC_TOP_INI_RCV_NUM(vsc_ini_rcv_num) | > - VSC_TOP_RPT_L0_NUM(vsc_ini_rpt_p0_num) | > - VSC_VERTICAL_SCALER_EN; > - > - if (new_state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) > - priv->viu.osd_sc_v_ctrl0 |= > - VSC_BOT_INI_RCV_NUM(vsc_bot_rcv_num) | > - VSC_BOT_RPT_L0_NUM(vsc_bot_rpt_p0_num) | > - VSC_PROG_INTERLACE; > - > - priv->viu.osd_sc_v_phase_step = SC_PHASE_STEP(vf_phase_step); > - priv->viu.osd_sc_v_ini_phase = VSC_INI_PHASE_BOT(bot_ini_phase); > - } else { > - priv->viu.osd_sc_v_ctrl0 = 0; > - priv->viu.osd_sc_v_phase_step = 0; > - priv->viu.osd_sc_v_ini_phase = 0; > - } > - > - /* Horizontal scaler is only used if width does not match */ > - if (src_w != dst_w) { > - priv->viu.osd_sc_h_ctrl0 = > - HSC_BANK_LENGTH(hf_bank_len) | > - HSC_INI_RCV_NUM0(hsc_ini_rcv_num) | > - HSC_RPT_P0_NUM0(hsc_ini_rpt_p0_num) | > - HSC_HORIZ_SCALER_EN; > - priv->viu.osd_sc_h_phase_step = SC_PHASE_STEP(hf_phase_step); > - priv->viu.osd_sc_h_ini_phase = 0; > - } else { > - priv->viu.osd_sc_h_ctrl0 = 0; > - priv->viu.osd_sc_h_phase_step = 0; > - priv->viu.osd_sc_h_ini_phase = 0; > - } > + meson_plane_setup_scaler(priv, new_state, &dest); > > /* > * The format of these registers is (x2 << 16 | x1), > @@ -359,6 +367,12 @@ static void meson_plane_atomic_update(struct drm_plane *plane, > priv->viu.osd1_blk0_cfg[4] = ((dest.y2 - 1) << 16) | dest.y1; > > if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) { > + int dst_w = new_state->crtc_w; > + int dst_h = new_state->crtc_h; > + > + if (new_state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) > + dst_h /= 2; > + > priv->viu.osd_blend_din0_scope_h = ((dest.x2 - 1) << 16) | dest.x1; > priv->viu.osd_blend_din0_scope_v = ((dest.y2 - 1) << 16) | dest.y1; > priv->viu.osb_blend0_size = dst_h << 16 | dst_w; > Reviewed-by: Neil Armstrong Thanks, Neil _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic