Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA6ADC433DF for ; Fri, 29 May 2020 15:19:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C12EC2100A for ; Fri, 29 May 2020 15:19:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="CdyvHuXN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C12EC2100A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F38636E92F; Fri, 29 May 2020 15:19:50 +0000 (UTC) Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0A48B6E92F for ; Fri, 29 May 2020 15:19:49 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id d128so4038011wmc.1 for ; Fri, 29 May 2020 08:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bxjlfwjwrOxt5UTQatxMHEDDG1cEpZr3A7ziLWB5/Ps=; b=CdyvHuXNeinarWetQUHY23NlfBktrI7NsPvPK4QlHcreNJ7+g9PbgZNBsYMwf6ax1F RNCIJSRRvKuHs2LPiVSO7cQ2FC1FLwlDYFieXVxz029U7D9UY6XnCP6xhTOW32ww8PbI 9SVmJQIUTw6tsV37Ot+vVFVc9FC3FhMpAhtiqeJ6zYodDKT9gTDNFqSLZO6n5hp90b1s IttYpeJ2CZlHqOfXsmc9m7dlSnR+I2D+ShB1y8QMmgOGioE0Gg07UpAg8BQN3tfpYgBr PJtFYp8P8I/wA0SUC+lCCNFKZKCWuWIGe15F6Wdopx11rqkVe+TBk2NBHTzpI0EMniTH appQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bxjlfwjwrOxt5UTQatxMHEDDG1cEpZr3A7ziLWB5/Ps=; b=fdPXuaA2gJe9n4Dtal0AunRBeTaCzAJjDBwDVlW7neZUjiQTZ7GucE5fPovj4M5p3O lpP0aHwxhXjrRMJ/mjfFnfblqG+6cU7xdiYy6pB2dyRKWxLPuyhNv5kZSFY1n18paWN7 Bd4dUlT39vr+rg81wFR/Q6Co6Pth/f/jcmNsv7G3mvDd7rg9mc03G4CZyRxv9pDS8iEx wCRVf6rFeXdxS8hJj8vfdtNNYMNyqoj5wW0kRBKSt5Phy7WX9uCs57qj0n4n6dUN50kH vRtS5GtQt/XC5csboNfzeDTQ8cVbTmrs/l9AggITxfOpjtIIzo6lh63yWKKO9mgdj0rq YkVg== X-Gm-Message-State: AOAM532DQ1VNvstSatAuKdvkeTNCCzfwfqwa+CT9rSg2LCg/VVTc200J VtWUTZm/o4OGAhftD5p/kdt/oA== X-Google-Smtp-Source: ABdhPJxh/bVaeh2MVgKx4F3/KaCcTUoYmLlR6YS3YGbWKR0BbqEsj+GvB2QgVpXtXKQc6FhL6LDVEg== X-Received: by 2002:a05:600c:2259:: with SMTP id a25mr3528245wmm.32.1590765587441; Fri, 29 May 2020 08:19:47 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:2ec0:82b0:acf8:18a8:b3a5:a17b]) by smtp.gmail.com with ESMTPSA id x66sm9220421wmb.40.2020.05.29.08.19.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 08:19:46 -0700 (PDT) From: Neil Armstrong To: daniel@ffwll.ch, dri-devel@lists.freedesktop.org Subject: [PATCH v7 4/6] drm/meson: overlay: setup overlay for Amlogic FBC Memory Saving mode Date: Fri, 29 May 2020 17:19:33 +0200 Message-Id: <20200529151935.13418-5-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200529151935.13418-1-narmstrong@baylibre.com> References: <20200529151935.13418-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Neil Armstrong Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Setup the Amlogic FBC decoder for the VD1 video overlay plane to use a different superblock size for the Memory Saving mode. Tested-by: Kevin Hilman Signed-off-by: Neil Armstrong --- drivers/gpu/drm/meson/meson_overlay.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_overlay.c b/drivers/gpu/drm/meson/meson_overlay.c index 2713d008cee8..b5c502876428 100644 --- a/drivers/gpu/drm/meson/meson_overlay.c +++ b/drivers/gpu/drm/meson/meson_overlay.c @@ -487,6 +487,10 @@ static void meson_overlay_atomic_update(struct drm_plane *plane, AFBC_HOLD_LINE_NUM(8) | AFBC_BURST_LEN(2); + if (fb->modifier & DRM_FORMAT_MOD_AMLOGIC_FBC(0, + AMLOGIC_FBC_OPTION_MEM_SAVING)) + priv->viu.vd1_afbc_mode |= AFBC_BLK_MEM_MODE; + priv->viu.vd1_afbc_en = 0x1600 | AFBC_DEC_ENABLE; priv->viu.vd1_afbc_conv_ctrl = AFBC_CONV_LBUF_LEN(256); @@ -672,12 +676,17 @@ static void meson_overlay_atomic_update(struct drm_plane *plane, } if (priv->viu.vd1_afbc) { + /* Default mode is 4k per superblock */ + unsigned long block_size = 4096; unsigned long body_size; - /* Default mode is 4k per superblock */ + /* 8bit mem saving mode is 3072bytes per superblock */ + if (priv->viu.vd1_afbc_mode & AFBC_BLK_MEM_MODE) + block_size = 3072; + body_size = (ALIGN(priv->viu.vd1_stride0, 64) / 64) * (ALIGN(priv->viu.vd1_height0, 32) / 32) * - 4096; + block_size; priv->viu.vd1_afbc_body_addr = priv->viu.vd1_addr0 >> 4; @@ -735,6 +744,9 @@ static bool meson_overlay_format_mod_supported(struct drm_plane *plane, unsigned int layout = modifier & DRM_FORMAT_MOD_AMLOGIC_FBC( __fourcc_mod_amlogic_layout_mask, 0); + unsigned int options = + (modifier >> __fourcc_mod_amlogic_options_shift) & + __fourcc_mod_amlogic_options_mask; if (format != DRM_FORMAT_YUV420_8BIT && format != DRM_FORMAT_YUV420_10BIT) { @@ -749,6 +761,13 @@ static bool meson_overlay_format_mod_supported(struct drm_plane *plane, return false; } + if (options && + options != AMLOGIC_FBC_OPTION_MEM_SAVING) { + DRM_DEBUG_KMS("%llx invalid layout %x\n", + modifier, layout); + return false; + } + return true; } @@ -782,6 +801,8 @@ static const uint32_t supported_drm_formats[] = { }; static const uint64_t format_modifiers[] = { + DRM_FORMAT_MOD_AMLOGIC_FBC(AMLOGIC_FBC_LAYOUT_BASIC, + AMLOGIC_FBC_OPTION_MEM_SAVING), DRM_FORMAT_MOD_AMLOGIC_FBC(AMLOGIC_FBC_LAYOUT_BASIC, 0), DRM_FORMAT_MOD_LINEAR, DRM_FORMAT_MOD_INVALID, -- 2.22.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel