From patchwork Thu Nov 9 08:11:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 118386 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp636784edl; Thu, 9 Nov 2017 00:12:18 -0800 (PST) X-Google-Smtp-Source: ABhQp+QZv5FbaCRtaTyg0fa+QtnNqGWgZ27ia+y7tUw4KZly8eA/w1ziW7u6p7dS8cJpSZ4c6BaJ X-Received: by 10.98.71.194 with SMTP id p63mr3376641pfi.26.1510215137952; Thu, 09 Nov 2017 00:12:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510215137; cv=none; d=google.com; s=arc-20160816; b=0aiQntOLAkRToctHSUzcFo+sQLXlXAWBzZzZ+9+rsOcTX0baff5q66po3mZctl8JVL rCHXaP2Z8f1VAVGgYuUC1mKaGja1Lrtk+5mYux4p43msOK7ssqq0RGkJptgf3Zo2YEfj qW+OqsdkxoKmh7lkiYKwrRoRuwPn7gTLSqQNmwqh0nIxnwb/gmtC1HdZOY/CzsB2RDsY dmmQfag9fQNfcep9iG/PctuU+Y64RY1k968HsuPdRVtBULvQc0xG6G5sDfzqPgmd1zfz bT+5bPswNpLKomDuPyvFSUwtAIx8UOcbXsOEHRg6ojDUlnSlU90k2gJXyAbj/PYNUTv7 AeBQ== 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=ePQEUOcUOJtEpzwzsaoXF3Fqzt6uXNULj3aaaVPLc7c=; b=GzMgOFHaWukTCe/ZRbQmeRMJkh3dk6ntGTXZpIZnQE/8mHL1UZMJUgaFDqAvCAtfru tvj6pAQl6jPxE7PZmhHsH4pdfhDUSm3AT0vWON7/0XMQz2mGBqeLAjNFcDhYkz98i9dd KjrsBkElGjuC0F6RPFzCBw0Vau5rrlaAzNWdO7AfuYHV02OxXNiKeqOCeIKiyuTsuSQ/ P3vnp4GRT5Iz5Z76MKdCReorTiguYO9P4VqkMGMa1Z1ktR98CAE12IvGQrW8dT2QE2LW 3mwQ/G2NVUFPzZNXV64SNMmVZdid0961X15DhVjUJpiekRAb652PZRmUDBwQlgrsfKJq 6RhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=ADKriO0e; 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 k2si5597633plt.571.2017.11.09.00.12.17; Thu, 09 Nov 2017 00:12:17 -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=ADKriO0e; 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 S1753181AbdKIIMR (ORCPT + 3 others); Thu, 9 Nov 2017 03:12:17 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:44899 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753103AbdKIIMQ (ORCPT ); Thu, 9 Nov 2017 03:12:16 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20171109081213euoutp02795a8765917bdf56a5beea5d26c5078c~1XKmd0r5m3042830428euoutp02f; Thu, 9 Nov 2017 08:12:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20171109081213euoutp02795a8765917bdf56a5beea5d26c5078c~1XKmd0r5m3042830428euoutp02f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1510215133; bh=xaC7fNH9Gar4BX0/2w8Hh2iMRIoHwrBvZJqucicvFIc=; h=From:To:Cc:Subject:Date:References:From; b=ADKriO0eGa8j4fvW5N82WWzT8IIWPp0KamLZah74vZEt8CEb+JVPipM1v5TWkHj1S R9Xes7LgEKdmTVp3QF4XjN90UWBakEsKBzKBzyvd44dzk8YITT4+MhfOVWQ/Cn/LKO jFBNcZVo2exji0vt4tYKXT9uJreIASqh5Do0ZHBo= Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171109081212eucas1p1ad5f4e1eb0ade0654b3129652b9111bd~1XKlp0nDs2677226772eucas1p1L; Thu, 9 Nov 2017 08:12:12 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 40.AF.12907.CDD040A5; Thu, 9 Nov 2017 08:12:12 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171109081211eucas1p1c91ab42c56aff38b1217324e7e9e617f~1XKk7Y9PF1890118901eucas1p13; Thu, 9 Nov 2017 08:12:11 +0000 (GMT) X-AuditID: cbfec7f1-f793a6d00000326b-fd-5a040ddcadd2 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 53.F5.20118.BDD040A5; Thu, 9 Nov 2017 08:12:11 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OZ5001YG5G1B580@eusync3.samsung.com>; Thu, 09 Nov 2017 08:12:11 +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 v6 0/8] Exynos DRM: rewrite IPP subsystem and userspace API Date: Thu, 09 Nov 2017 09:11:48 +0100 Message-id: <20171109081156.7111-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.14.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJIsWRmVeSWpSXmKPExsWy7djP87p3eFmiDN6dkLG4te4cq8Wsl+0s FhtnrGe1uPL1PZvF++VdbBaT7k9gsTh/fgO7xYzz+5gs1h65y25x+E07q8WMyS/ZLNpWf2B1 4PHYtKqTzeN+93Emj3/H2D36tqxi9Pi8SS6ANYrLJiU1J7MstUjfLoEr4/yCc4wF0xwqVn6d zNTAOMmki5GTQ0LAROLz7jOsELaYxIV769m6GLk4hASWMkpcvbqPBcL5zCix8O47ZpiOg139 UIlljBI/Tyxmh3AamCQmHulgAaliEzCU6HrbxQZiiwi4STQdnskKUsQssItZ4sXk1+wgCWEB b4lL9x+CjWURUJW4e+Q6E4jNK2Aj8fnTbKh18hLvF9xnBGmWEJjBJrH24z12iISLxJSnB6Bs YYlXx7dA2TISlyd3s0DY/YwSTa3aEPYMRolzb3khbGuJw8cvgn3NLMAnMWnbdKBlHEBxXomO NiEI00Ni8RMziGpHiUWrToOdJiQQK3H15kGWCYxSCxgZVjGKpJYW56anFhvpFSfmFpfmpesl 5+duYgRG8Ol/xz/uYHx/wuoQowAHoxIP74tVzFFCrIllxZW5hxglOJiVRHhF3gKFeFMSK6tS i/Lji0pzUosPMUpzsCiJ89pG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-CMS-RootMailID: 20171109081211eucas1p1c91ab42c56aff38b1217324e7e9e617f X-RootMTR: 20171109081211eucas1p1c91ab42c56aff38b1217324e7e9e617f 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-20171109 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: v6: - fixed most checkpatch.pl warnings, only some debug messages exceeds 80 characters line boundary to avoid breaking strings v5: https://www.spinics.net/lists/linux-samsung-soc/msg61171.html - fixed and reworked items pointed by Inki Dae: * formats and limits arrays are no longer NULL terminated, all functions accessing them require explicit 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 | 28 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 12 +- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 3171 +++++++++---------- 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 | 2704 ++++++----------- drivers/gpu/drm/exynos/exynos_drm_ipp.h | 427 ++- 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 | 694 +++++ drivers/gpu/drm/exynos/regs-scaler.h | 426 +++ include/uapi/drm/exynos_drm.h | 798 ++--- 18 files changed, 5977 insertions(+), 6944 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpu/samsung-scaler.txt rewrite drivers/gpu/drm/exynos/exynos_drm_fimc.c (47%) 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