From patchwork Wed Nov 8 09:41:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 118221 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5063128qgn; Wed, 8 Nov 2017 01:42:01 -0800 (PST) X-Google-Smtp-Source: ABhQp+RgXuBPwlIMzwlKjOhIL6FypGPITrGvOHSuCt7eYip7XeaZ2hJFEqGtfD3K6aDz8WSTRtzd X-Received: by 10.84.143.195 with SMTP id 61mr1691545plz.277.1510134121658; Wed, 08 Nov 2017 01:42:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510134121; cv=none; d=google.com; s=arc-20160816; b=mPeexw3M8T8RL1zRJlw8fKoUzjxJI2QvEpKYCaH16ouqauDLmy3xt/EwERFJsPpJC/ QeCUcS+FQPdyTKkbh6FqluFhW78v/TW/CRIZyAr6GbluNezEn0f6rZBJ0WHHaSQ7xrUL mIRqzH8ge/m3b/aZzjatxCXDqBGqmgk1JKhcIrBjDk4bO9NngzM0g4vGcobZDkAgXEG4 60yf8F83xw26USBzTroNKWw/TbOqiaUK8r3jBXbKC2WUK5YYhmy+3Y4YiZqIWl+p+f18 7ItGvXULryOZ7jjc6rp3AJGvqk5etozOIHkaNCnTz8whvbX0jZxJoNCo61AXSnb60OQY aAUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=2f3RgixCim3E3c72W8zN1nchAvTyinMNcz+Pm2btLVs=; b=hLwnhQz3ssPcEYPpXAeXLGdW3VZWT090RBWCUDNpdaYPR3TAXb/61FhCgH0K54J0H2 I3/sE92AosL9nz/GcrxmsePvjdTlTDFmRTIgeDDieE7Is000e6MwWl1XTR9wJP5R9GLY othJ/l/Q2S47a0CLQjFHBvCH+Epf32pZtR3qd4K5it/LCrwQSG4mp27HXlf0FpyoAXLN kWIDFQlsbrVU0QK+e5SWedXRQ2aoCvEN/ozN2pVLKoUCDaabMOOkGixKNn6uOqK1rR+n K7SHDmWYXOr/IMhS9W217JpH3zn124oquDs/ieWHN0kEhNVM1y8XwI9tKQFqWF/UG1pl tgfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=eFznX0bg; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v7si3401723pgr.136.2017.11.08.01.42.01; Wed, 08 Nov 2017 01:42:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=eFznX0bg; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751350AbdKHJmA (ORCPT + 3 others); Wed, 8 Nov 2017 04:42:00 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:55201 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751081AbdKHJl5 (ORCPT ); Wed, 8 Nov 2017 04:41:57 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20171108094154euoutp026ea48c08cbd40f00a11543fa4b8b4fff~1Evn5YCys1873818738euoutp02f; Wed, 8 Nov 2017 09:41:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20171108094154euoutp026ea48c08cbd40f00a11543fa4b8b4fff~1Evn5YCys1873818738euoutp02f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1510134114; bh=RPC+p4BUAyzTc+paedgUS5s81/w3/ml4MgyGgIBD/aI=; h=From:To:Cc:Subject:Date:References:From; b=eFznX0bg6H2PjVNvqjvfb/SYSybhbqUbi4ET4ua7opt+dlohO7yVOzDukwBACLnr1 yOvb4A81vNxgcKWnJET+wGeRcIzA7zDKXNycoX9PY40CqatEza7DLjo2ffE/wSCy9K n7lTTGMYLVr7WlaahOyxILX84waLGhfUVOc2AgYI= Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171108094154eucas1p2649fcf06279742d9ba5671e9d041ac89~1EvnM5uA21706517065eucas1p20; Wed, 8 Nov 2017 09:41:54 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 30.99.12907.161D20A5; Wed, 8 Nov 2017 09:41:53 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171108094153eucas1p20e6bf5de3d596d5968cfcb25f1e15a78~1Evmhprh62464124641eucas1p2F; Wed, 8 Nov 2017 09:41:53 +0000 (GMT) X-AuditID: cbfec7f1-f793a6d00000326b-bd-5a02d161237b Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id AD.03.20118.161D20A5; Wed, 8 Nov 2017 09:41:53 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OZ300D3HEXPW8A0@eusync4.samsung.com>; Wed, 08 Nov 2017 09:41:53 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Seung-Woo Kim , Andrzej Hajda , Bartlomiej Zolnierkiewicz , Tobias Jakobi , Krzysztof Kozlowski , Sylwester Nawrocki , Andrzej Pietrasiewicz , Hoegeun Kwon Subject: [PATCH v5 0/8] Exynos DRM: rewrite IPP subsystem and userspace API Date: Wed, 08 Nov 2017 10:41:39 +0100 Message-id: <20171108094147.25854-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.14.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsWy7djP87qJF5miDNZuN7W4te4cq8Wsl+0s FhtnrGe1uPL1PZvF++VdbBaT7k9gsTh/fgO7xYzz+5gs1h65y25x+E07q8WMyS/ZLNpWf2B1 4PHYtKqTzeN+93Emj3/H2D36tqxi9Pi8SS6ANYrLJiU1J7MstUjfLoErY/mNi4wFF+wq9vbc YmpgfG7UxcjJISFgIvGr8TIrhC0mceHeerYuRi4OIYGljBITDrxngnA+M0q8O7+fBabjcddW sA4hgWWMEnM280IUNTBJbP2+ix0kwSZgKNH1tosNxBYRcJNoOjyTFaSIWWAXs8SLya/BioQF vCUOrdkINolFQFVix5PpQOs4OHgFbCV23y6GWCYv8X7BfUaQXgmBOWwSq9vuMEMkXCQaLy1m h7CFJV4d3wJly0hcntwNdWk/o0RTqzaEPYNR4txbXgjbWuLw8Ytge5kF+CQmbZvODLJXQoBX oqNNCML0kOidA9XpKHFgyU1GiH9jJa4c/844gVFqASPDKkaR1NLi3PTUYiO94sTc4tK8dL3k /NxNjMDoPf3v+McdjO9PWB1iFOBgVOLh1VBkihJiTSwrrsw9xCjBwawkwnvuLFCINyWxsiq1 KD++qDQntfgQozQHi5I4r21UW6SQQHpiSWp2ampBahFMlomDU6qBkdfYulZooeK5y5etpja7 SDo8z7bTeyPcxZ3/YOG/Jh7jwOZnU1O8gu6cvXZbITzzd23BRgOXnx7FF5/9zZfqKPn8eEWD 47udzO72T9U15wgVXHiw/h7/1aVeU8XvhS22btIrmnDV8se3uneac+s5+LMtZofvaUix8fjg PXH69KOlRpr7GHw7lFiKMxINtZiLihMB10Yc7NoCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprELMWRmVeSWpSXmKPExsVy+t/xa7qJF5miDP58FLe4te4cq8Wsl+0s FhtnrGe1uPL1PZvF++VdbBaT7k9gsTh/fgO7xYzz+5gs1h65y25x+E07q8WMyS/ZLNpWf2B1 4PHYtKqTzeN+93Emj3/H2D36tqxi9Pi8SS6ANYrLJiU1J7MstUjfLoErY/mNi4wFF+wq9vbc YmpgfG7UxcjJISFgIvG4aysrhC0mceHeerYuRi4OIYEljBIz9/9lh3CamCQOPOtjBqliEzCU 6HrbxQZiiwi4STQdngnWzSywj1liY5s3iC0s4C1xaM1GsDiLgKrEjifTmboYOTh4BWwldt8u hlgmL/F+wX3GCYzcCxgZVjGKpJYW56bnFhvpFSfmFpfmpesl5+duYgSG1LZjP7fsYOx6F3yI UYCDUYmHV0ORKUqINbGsuDL3EKMEB7OSCO+5s0Ah3pTEyqrUovz4otKc1OJDjNIcLErivL17 VkcKCaQnlqRmp6YWpBbBZJk4OKUaGAOcZVb/rrG3Lruz6g7vCknFsv7VeV6ZXy+Xa1km/b7J /XZxyO+7L0+yM69m/3v1Wv0CT7Ue3nV+r8/8/M/Rz/S8tTZy2/99KaEVt/db2N9eeMCc/9zR 31Gz6pe3Xah36+N+tD9Uc7fMmwm8kw8ntk089Mng9uvkqRluMkvllsUVv11v1++Y/VyJpTgj 0VCLuag4EQAKbFCGJQIAAA== X-CMS-MailID: 20171108094153eucas1p20e6bf5de3d596d5968cfcb25f1e15a78 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171108094153eucas1p20e6bf5de3d596d5968cfcb25f1e15a78 X-RootMTR: 20171108094153eucas1p20e6bf5de3d596d5968cfcb25f1e15a78 References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Dear all, This patchset performs complete rewrite of Exynos DRM IPP subsystem and its userspace API. Why such rewrite is needed? Exynos DRM IPP API is over-engineered in general, but not really extensible on the other side. It is also buggy, with significant design flaws: - Userspace API covers memory-2-memory picture operations together with CRTC writeback and duplicating features, which belongs to video plane. - Lack of support of the all required image formats (for example NV12 Samsung-tiled cannot be used due to lack of pixel format modifier support). - Userspace API designed only to mimic hardware behaviour, not easy to understand. - Lack of proper input validation in the core, drivers also didn't do that correctly, so it was possible to set incorrect parameters and easil trigger IOMMU fault or memory trash. - Drivers were partially disfunctional or supported only a subset of modes. Due to the above limitations and issues the Exynos DRM IPP API was not used by any of the open-source projects. I assume that it is safe to remove this broken API without any damage to open-source community. All remaining users (mainly Tizen project related) will be updated to the new version. This patchset changes Exynos DRM IPP subsystem to something useful. The userspace API is much simpler, state-less and easy to understand. Also the code of the core and driver is significantly smaller and easier to understand. A new driver to Exynos Scaler hardware module available in Exynos5420 and newer SoCs is also added on top of the provided changes. Patches were tested on Exynos4412 based Odroid U3, Exynos5422 Odroid XU3 and Exynos5433 TM2 boards, on top of Linux next-20171106 kernel. A simple userspace test tool has been sent together with v1 of this patchset: https://www.spinics.net/lists/linux-samsung-soc/msg60498.html Tobias Jakobi has added support for this new API to his fork of libdrm and mpv video player: https://github.com/tobiasjakobi/libdrm/tree/ippv2 https://github.com/tobiasjakobi/mpv Best regards Marek Szyprowski Samsung R&D Institute Poland Changelog: v5: - fixed and reworked items pointed by Inki Dae: * formats and limits arrays are no longer NULL terminated, all functions accessing them require explict array size argument * fixed return value for functions in GScaler, FIMC and Rotator drivers * simplified exynos_drm_ipp_task_set() function (removed temporary buffer) * reworked FIMC driver sharing with V4L2 subsystem, now user can specify mask of devices assigned to DRM driver (defaults to fimc.2 and fimc.3) * removed drivers specific task check (not used anymore) - fixed issue pointed by Arnd Bergmann and Tobias Jakobi: * removed usage of timeval structures - removed more dead-code from GScaler and FIMC drivers - fixed IOMMU page fault caused by FIMC operation in 90 degree rotation mode - added Ack from Rob Herring for Scaler driver - generated patches with -B/40% to make Rotator, GScaler and FIMC patches easier to read (forced complete rewrite) v4: https://www.spinics.net/lists/linux-samsung-soc/msg61066.html - fixed Exynos GSC limits (alignment) and operation in 90 degree rotation mode - fixed some style issues in Scaler driver (thanks to Andrzej) - fixed copy/paste typos in commit messages - improved debug messages, especially if provided parameters exceeds hardwave limits v3: https://www.spinics.net/lists/linux-samsung-soc/msg60981.html - fixed minor issues and added features pointed by other developers: * fixed missing ipp_unregister (Hoegeun) * added missing limits to FIMC and GSC driver (Hoegeun) * added more specific compatible strings to GSC driver (Hoegeun) * added Exynos5433 support to GSC driver (Hoegeun) * added autosuspend runtime PM to all IPP drivers (Tobias) - added Exynos5433 support to Scaler driver (thanks to Andrzej) - dropped Exynos5420 clk patch, which has been alredy merged v2: https://www.spinics.net/lists/dri-devel/msg153418.html - fixed minor issues pointed by other developers: * fixed possible null pointer dereferrence (Tobias) * changed limits_size to limits_count (Tobias) * renamed struct exynos_drm_ipp_format to drm_exynos_ipp_format (Andrzej) * added proper return value from exynos_drm_ipp_get_res_ioctl when no IPP driver is present (Andrzej) * properly aligned all uapi structures to be 32/64 bit safe (Emil) * properly initialize all strucutres - added new Exynos Scaler driver from Andrzej Pietrasiewicz v1: https://www.spinics.net/lists/linux-samsung-soc/msg60492.html - initial version of IPP v2 My previous works in this area: "[RFC v2 0/2] Exynos DRM: add Picture Processor extension" https://www.spinics.net/lists/dri-devel/msg140669.html - removed usage of DRM objects and properties - replaced them with simple list of parameters with predefined IDs "[RFC 0/4] Exynos DRM: add Picture Processor extension" https://www.spinics.net/lists/linux-samsung-soc/msg59323.html - moved this feature from DRM core to Exynos DRM driver - changed name from framebuffer processor to picture processor - simplified code to cover only things needed by Exynos drivers - implemented simple fifo task scheduler - cleaned up rotator driver conversion (removed IPP remainings) "[RFC 0/2] New feature: Framebuffer processors" https://www.spinics.net/lists/linux-samsung-soc/msg54810.html - generic approach implemented in DRM core, rejected Patch summary: Andrzej Pietrasiewicz (3): drm/exynos: Add driver for Exynos Scaler module ARM: dts: exynos: Add mem-2-mem Scaler devices ARM64: dts: exynos: Add mem-2-mem Scaler devices Marek Szyprowski (5): drm/exynos: ipp: Remove Exynos DRM IPP subsystem drm/exynos: ipp: Add IPP v2 framework drm/exynos: rotator: Convert driver to IPP v2 core API drm/exynos: gsc: Convert driver to IPP v2 core API drm/exynos: fimc: Convert driver to IPP v2 core API .../devicetree/bindings/gpu/samsung-scaler.txt | 27 + arch/arm/boot/dts/exynos5420.dtsi | 35 + arch/arm64/boot/dts/exynos/exynos5433.dtsi | 42 + drivers/gpu/drm/exynos/Kconfig | 17 +- drivers/gpu/drm/exynos/Makefile | 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 25 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 12 +- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 3187 +++++++++---------- drivers/gpu/drm/exynos/exynos_drm_fimc.h | 23 - drivers/gpu/drm/exynos/exynos_drm_gsc.c | 3199 +++++++++----------- drivers/gpu/drm/exynos/exynos_drm_gsc.h | 24 - drivers/gpu/drm/exynos/exynos_drm_ipp.c | 2700 ++++++----------- drivers/gpu/drm/exynos/exynos_drm_ipp.h | 425 ++- drivers/gpu/drm/exynos/exynos_drm_rotator.c | 1274 +++----- drivers/gpu/drm/exynos/exynos_drm_rotator.h | 19 - drivers/gpu/drm/exynos/exynos_drm_scaler.c | 693 +++++ drivers/gpu/drm/exynos/regs-scaler.h | 426 +++ include/uapi/drm/exynos_drm.h | 796 ++--- 18 files changed, 5981 insertions(+), 6944 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpu/samsung-scaler.txt rewrite drivers/gpu/drm/exynos/exynos_drm_fimc.c (45%) delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.h rewrite drivers/gpu/drm/exynos/exynos_drm_gsc.c (43%) delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_gsc.h rewrite drivers/gpu/drm/exynos/exynos_drm_ipp.c (96%) rewrite drivers/gpu/drm/exynos/exynos_drm_ipp.h (93%) rewrite drivers/gpu/drm/exynos/exynos_drm_rotator.c (72%) delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_rotator.h create mode 100644 drivers/gpu/drm/exynos/exynos_drm_scaler.c create mode 100644 drivers/gpu/drm/exynos/regs-scaler.h rewrite include/uapi/drm/exynos_drm.h (44%) -- 2.14.2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html