From patchwork Mon Oct 14 12:38:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 11188635 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60417139A for ; Mon, 14 Oct 2019 12:38:35 +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 2C8642089C for ; Mon, 14 Oct 2019 12:38:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C8642089C 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 7389C6E296; Mon, 14 Oct 2019 12:38:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3805D6E296 for ; Mon, 14 Oct 2019 12:38:33 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id v8so19556630wrt.2 for ; Mon, 14 Oct 2019 05:38:33 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=qHlgrBNnQvZHdlIhaAIwv1P7BiVcNY7YDyLmFn9uKVI=; b=XYIJoD6tXBuIdCBDC4krxtaeBXY8LktihKaloyu/a/0gjVmKfxdk3RZNN+IZPUeGlp QoPgV9/WU0lQVxcfr7DIypS7+YNboJKQ8q/Dn1Bs7TjrSffKpDuMuh6HDbcQMmgz4QEP V1suCSt92J4MveoJaafMLIauqXHXGWMZx39KzXgYJ2OX5CpVavwQtrEQgAiYavLGVyxE T+LEEDtESLeTnJvTIcWAGIM7yReLVqS9Z6mURODQGz1EDY1cktbBDCTCvjvhqVTco50P Z3FNdKRmUqi9Rm/SS2wyexMdA8njYysUxRccjIqF8WaVtQ/9g79JNTMdjn2PQNE683jn vO0Q== X-Gm-Message-State: APjAAAUMfHdpukuBhJYe2dBlx/dz8t1nVAZU9CLdWGi6rhubN0TBQzRw wCEGDdcXhZkOTIDq9/JPur4agAFtj+IdlQ== X-Google-Smtp-Source: APXvYqwMn8mKSsHjusTUrOEZvm5C0ca3mShMRyG8qq1fHYhQEd05XeLBSOf4JIln1DHYZGqjzagwvw== X-Received: by 2002:a5d:6592:: with SMTP id q18mr27503680wru.382.1571056711338; Mon, 14 Oct 2019 05:38:31 -0700 (PDT) Received: from bender.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id 3sm19171203wmo.22.2019.10.14.05.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:38:30 -0700 (PDT) From: Neil Armstrong To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 0/7] drm/meson: add AFBC support Date: Mon, 14 Oct 2019 14:38:19 +0200 Message-Id: <20191014123826.27629-1-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-Mailman-Original-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:mime-version :content-transfer-encoding; bh=qHlgrBNnQvZHdlIhaAIwv1P7BiVcNY7YDyLmFn9uKVI=; b=mz58iYxSQEYvYf9X0tiVoBtwk4DpjvkN3/8wfK1vhAFu/n1X/1t+LEo+7+LgmeDQQA s4Y98uW35kkjrTLOwvRflsDq+B9qxcprU9J6wEJ0v8XewRroDzR3ihShCkB4zv3sLNl4 KNwSA1L8XO9OO5fDEB5+xGr97e8TVBI2HLPPCtjHVdYWwHCkNJtvcGZJg154gJEvtxF5 rrJobAtc/hw4Ath1WvhV1+fZuLMqiK+HSRcaDOu5B4NsOjqu+ff/1liJ/u8A8LiXqoTV ybTFITLEt56+xLWFLN3Bt4xjD3MbMS6n+g5o+HLB5HDX5FvNspjFvGPW0NhPhRTrq903 HJYA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , khilman@baylibre.com, linux-amlogic@lists.infradead.org, ayan.halder@arm.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This adds support for the ARM Framebuffer Compression decoders found in the Amlogic GXM and G12A SoCs. The Amlogic GXM and G12A AFBC decoder are totally different, the GXM only handling only the AFBC v1.0 modes and the G12A decoder handling the AFBC v1.2 modes. The G12A AFBC decoder is an external IP integrated in the video pipeline, and the GXM AFBC decoder seems to the an Amlogic custom decoder more tighly integrated in the video pipeline. The GXM AFBC decoder can handle only one AFBC plane for 2 available OSD planes available in HW, and the G12A AFBC decoder can handle up to 4 AFBC planes for up to 3 OSD planes available in HW. The Amlogic GXM supports 16x16 SPARSE and 16x16 SPLIT AFBC buffers up to 4k. On the other side, for G12A SPLIT is mandatory in 16x16 block mode, but for 4k modes 32x8+SPLIT AFBC buffers is manadatory for performances reasons. The Amlogic GXM and G12A AFBC decoders are integrated very differently. The Amlogic GXM has a direct output path to the OSD1 VIU pixel input, because the GXM AFBC decoder seem to be a custom IP developed by Amlogic. On the other side, the Amlogic G12A AFBC decoder seems to be an external IP that emit pixels on an AXI master hooked to a "Mali Unpack" block feeding the OSD1 VIU pixel input. This uses a weird "0x1000000" internal HW physical address on both sides to transfer the pixels. For Amlogic GXM, the supported pixel formats are the same as the normal linear OSD1 mode. On the other side, Amlogic added support for all AFBC v1.2 formats for the G12A AFBC integration. For testing, the only available AFBC buffer generation is the Android Yukawa Dvalin Android Mali blobs found at [1]. Both SoCs has been tested using buffers generated under AOSP, but only G12A was tested using a runtime stream of AFBC buffers, GXM was only tested using static buffers loaded from files. Changes since v1 at [2]: - Discards XRGB modes with YTR, only allow XBGR with YTR - Add non-YTR modifiers for G12A - Disable completely XRGB modes for GXM, until we find how to disable YTR - Add proper argb remap for XRGB modes - Enable OSD_STAT sync signal [1] https://android.googlesource.com/device/amlogic/yukawa/+/refs/heads/master/gpu/ [2] https://patchwork.freedesktop.org/series/67832/#rev1 Neil Armstrong (7): drm/meson: add AFBC decoder registers for GXM and G12A drm/meson: store the framebuffer width for plane commit drm/meson: Add AFBCD module driver drm/meson: plane: add support for AFBC mode for OSD1 plane drm/meson: viu: add AFBC modules routing functions drm/meson: hold 32 lines after vsync to give time for AFBC start drm/meson: crtc: add OSD1 plane AFBC commit drivers/gpu/drm/meson/Makefile | 1 + drivers/gpu/drm/meson/meson_crtc.c | 81 ++++- drivers/gpu/drm/meson/meson_drv.c | 38 ++- drivers/gpu/drm/meson/meson_drv.h | 17 ++ drivers/gpu/drm/meson/meson_osd_afbcd.c | 375 ++++++++++++++++++++++++ drivers/gpu/drm/meson/meson_osd_afbcd.h | 28 ++ drivers/gpu/drm/meson/meson_plane.c | 224 ++++++++++++-- drivers/gpu/drm/meson/meson_registers.h | 62 ++++ drivers/gpu/drm/meson/meson_viu.c | 78 ++++- drivers/gpu/drm/meson/meson_viu.h | 19 ++ 10 files changed, 880 insertions(+), 43 deletions(-) create mode 100644 drivers/gpu/drm/meson/meson_osd_afbcd.c create mode 100644 drivers/gpu/drm/meson/meson_osd_afbcd.h