Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1188808pxb; Fri, 21 Jan 2022 11:50:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzST63QcEAv4A4uGCbORu1XKJnKP2OsHJuJxY7qYD2wP44wGV0va0zFCWiUq8sdrXVpKQQj X-Received: by 2002:a17:902:8498:b0:14a:1b37:9f2b with SMTP id c24-20020a170902849800b0014a1b379f2bmr5510323plo.85.1642794619057; Fri, 21 Jan 2022 11:50:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642794619; cv=none; d=google.com; s=arc-20160816; b=ZWYWc1gGGH0GRejNb3WZpylsaFGTWf6Q8SxCVhewcFpKlfM+Y8YFsw0qoDFvRdeTQq 8PuGfRJprG2nKwEsdsAbSNam1ttnXDGa8+D8yn1r/V4nvajjqYvhTB/xl62aevqaw6xm CXSslYGR0lB5VkWdqozTG78NOJD6ZZ5+/jGBQs9L/bFQ38E+Uy1vJve0kT1nUXbOaTwv oRC0Io5l7Ssefkdydm/Iy0l8RbSb7S9h1aEJb4+QFV2W2dEqTR4ZBDl3rSi4YiPPOwmS eaBVnlZyUunnV2hzkMfU4Tosgyl+kkYMdVJfM05llPYmkB7QbBpEm8tyJwWObwZWPThB ecnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=kcVKA3cO1gMjv5znetYf0gFrDVY8f+ZwutG6o8Ga6LM=; b=quP/mzsXoXqjDncs+D/rNTUcqSSYzZeI4KSLwXR1vn/ilh/IRXJIyxUN8rBG90iGfd 1DWXFeLAlVvHuhD4Nh8Fl8bu/myd9Zhz+KkBl7egDT74FxBzYO87ed+Ib0BeX37DDDym /cd2SZwPLIRoDiaCpGTJtxgR5/huF1Bhbf8Shm14DJ1v7WR7RkLjl5VI4juQJvYM+r4+ dSdqPFHgIbk3AHSD4DhZtKQ9laKzwj1VmsQYWGcyJu1ech8idjq5YFGw47rSQ3/lSVQ+ Tz4i8sB6owMwxJvS2SNXTu2sSSno1yWGDVEJD4wOSxnHpzHI7srpQwSC9jcgVMChbQya xtCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=IhNIoFSr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si7362701pge.313.2022.01.21.11.50.07; Fri, 21 Jan 2022 11:50:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=IhNIoFSr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243087AbiASQa2 (ORCPT + 99 others); Wed, 19 Jan 2022 11:30:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356144AbiASQaW (ORCPT ); Wed, 19 Jan 2022 11:30:22 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ED9BC06161C for ; Wed, 19 Jan 2022 08:30:22 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id v123so6172083wme.2 for ; Wed, 19 Jan 2022 08:30:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=kcVKA3cO1gMjv5znetYf0gFrDVY8f+ZwutG6o8Ga6LM=; b=IhNIoFSrR1xUQmRTkygi8eVtSAV917TMwd/C4acdPt/AnQdQtaHjnZetbdOAic8uPF L/OpokHD8oxH6EjUSLalVxIJCo+bnZUouhEpkZSRIw3SARnzK8FHIULZZfqrdFnkeCqZ 5ZeMF3rY6HjUPY8TK5khep/e4j4CIESxlPbiE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=kcVKA3cO1gMjv5znetYf0gFrDVY8f+ZwutG6o8Ga6LM=; b=lRTOLscVw/30yeRCqorh2qVA26LBM/TsY4MfNIGXlC+y+ItxDQx38tcaqY1kpKBeC/ NccrqysjQ5s4rkwHap/i2VI0O+xZBT7Le2SIutiiRnpOuCJQ8pJfj+MZ3hIuVN458HuH wzPfjsSPvkqHH1yGHhX9uQYmypNhmR05U+xM7BP2ouiXnoWaYCRRceWJK2CYaFHSZGSU qxoqai2QhNXyz7o5ENUmhcaiwgkx4YguD45yRhVJDQL+gYFgwgK8u+iMR530M/0WM6MO 4mKIWIK58eXL3qFK/nQzdhAI9FYCtLt7Jpw1HMkSUbMEqYKzECW+zBKddei/KzfMJNkL r9ew== X-Gm-Message-State: AOAM532VS7I+ek71udpR4M0l9IUcxgrvn2FRfEj7Tzz4R7xAo53Eyhdi vEV4oSHK9cNaYNv906fIFiHAdw== X-Received: by 2002:a5d:588d:: with SMTP id n13mr16737444wrf.153.1642609820911; Wed, 19 Jan 2022 08:30:20 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id x4sm367217wrp.13.2022.01.19.08.30.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 08:30:20 -0800 (PST) Date: Wed, 19 Jan 2022 17:30:18 +0100 From: Daniel Vetter To: Daniel Palmer , Hans de Goede Cc: dri-devel@lists.freedesktop.org, Linux Kernel Mailing List Subject: Re: [RFC] How to add hardware rotation, scaling etc to a DRM/KMS driver Message-ID: Mail-Followup-To: Daniel Palmer , Hans de Goede , dri-devel@lists.freedesktop.org, Linux Kernel Mailing List References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.10.0-8-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 19, 2022 at 05:55:22PM +0900, Daniel Palmer wrote: > Hi all, > > I've copied and pasted my way to mostly working DRM/KMS driver for a > low cost ARM SoC (Sigmastar SSD202D). The hardware is 2D only. > > One of the devices that uses this SoC has the screen upside down so it > needs the screen rotated. > The hardware doesn't have bits that change the scan out direction from > what I can tell (so it can't mirror/flip while feeding it to the > screen) but it does have a 2D blitter style block that can take a > framebuffer and flip/mirror/scale/convert the colour space into > another buffer. > > My idea was to create a buffer for the rotated image when allocating > the framebuffer and trigger the hardware to do the conversion each > vblank or something. > > While reading the discussion about maintaining fbdev I realised maybe > I should ask instead of wasting too much time on something that's > wrong. > > I got the feeling that maybe I should just provide an interface to the > blitter from userspace and userspace should be doing the rotation. I'd > like to do it in the kernel so stuff like SDL1 apps just work but > maybe that isn't possible? panel orientation property is for that stuff: https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#standard-connector-properties You need to scroll down to the "panel orientation:" property. And here's how to quirk this for at least some cases (for dt panels it should be in the dt): https://dri.freedesktop.org/docs/drm/gpu/drm-kms-helpers.html?highlight=drm_get_panel_orientation_quirk#c.drm_get_panel_orientation_quirk" fbcon will head this and rotate in sw, as should any competent compositor in userspace (but some might not, it depends). Also ping Hans de Geode if you have any questions, he's done this. -Daniel > > Cheers, > > Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch