From patchwork Mon Nov 1 14:15:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 12596505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBE72C4321E for ; Mon, 1 Nov 2021 14:15:37 +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 9BD9C61058 for ; Mon, 1 Nov 2021 14:15:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9BD9C61058 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D0A006E866; Mon, 1 Nov 2021 14:15:36 +0000 (UTC) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by gabe.freedesktop.org (Postfix) with ESMTPS id 859C06E865 for ; Mon, 1 Nov 2021 14:15:35 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id F03752195B; Mon, 1 Nov 2021 14:15:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1635776133; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HuhZeq0vdKOIGaUmo7BdgypTDB6banM6V2x33G2xT/M=; b=WExAJiEmxaUb3UKF8TzK4kaZu8eOp/fFMOpN+48NwkHx1jNqgrkwVAfPQwtSfMC+DxXTkR 01xqQSXzuyQOA6jhiIbWCVf/qFB4BHCZwOAlaqBdiJo5U5/bQFkMIhfB2jRpIQ+ENopTp2 OujmDkvDr0tTfr+wNNYFZdj98cKUWRQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1635776134; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HuhZeq0vdKOIGaUmo7BdgypTDB6banM6V2x33G2xT/M=; b=S7h0YOxs9Xi6vVoq04SZ5tunMezUuBSwMAMZdvzEd6mmS7Kn8+EiZY8cg2xP8kV3xuP95e js0TCaMPe4RK8gAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8AA261342A; Mon, 1 Nov 2021 14:15:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 5IrQIIX2f2GlHwAAMHmgww (envelope-from ); Mon, 01 Nov 2021 14:15:33 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, airlied@linux.ie, mripard@kernel.org, maarten.lankhorst@linux.intel.com, noralf@tronnes.org, drawat.floss@gmail.com, airlied@redhat.com, kraxel@redhat.com, david@lechnology.com, sam@ravnborg.org, javierm@redhat.com, kernel@amanoeldawod.com, dirty.ice.hu@gmail.com, michael+lkml@stapelberg.ch, aros@gmx.com, joshua@stroblindustries.com, arnd@arndb.de Subject: [PATCH v2 0/9] drm/simpledrm: Enable damage clips and virtual screens Date: Mon, 1 Nov 2021 15:15:23 +0100 Message-Id: <20211101141532.26655-1-tzimmermann@suse.de> X-Mailer: git-send-email 2.33.1 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-hyperv@vger.kernel.org, Thomas Zimmermann , dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Enable FB_DAMAGE_CLIPS with simpledrm for improved performance and/or less overhead. With this in place, add support for virtual screens (i.e., framebuffers that are larger than the display resolution). This also enables fbdev panning and page flipping. After the discussion and bug fixing wrt to fbdev overallocation, I decided to add full support for this to simpledrm. Patches #1 to #5 change the format-helper functions accordingly. Destination buffers are now clipped by the caller and all functions support a similar feature set. This has some fallout in various drivers. Patch #6 change fbdev emulation to support overallocation with shadow buffers, even if the hardware buffer would be too small. Patch #7 and #8 update simpledrm to enable damage clipping and virtual screen sizes. Both features go hand in hand, sort of. For shadow- buffered planes, the DRM framebuffer lives in system memory. So the maximum size of the virtual screen is somewhat arbitrary. We add two constants for resonable maximum width and height of 4096 each. Patch #9 adds documentation and a TODO item. Tested with simpledrm. I also ran the recently posted fbdev panning tests to make sure that the fbdev overallocation works correctly. [1] v2: * add missing docs (Sam) * return unsigned int from drm_fb_clip_offset() (Sam, Noralf) * fix OOB access in drm_fb_xrgb8888_to_gray8() (Noralf) [1] https://lists.freedesktop.org/archives/igt-dev/2021-October/036642.html Thomas Zimmermann (9): drm/format-helper: Export drm_fb_clip_offset() drm/format-helper: Rework format-helper memcpy functions drm/format-helper: Add destination-buffer pitch to drm_fb_swab() drm/format-helper: Rework format-helper conversion functions drm/format-helper: Streamline blit-helper interface drm/fb-helper: Allocate shadow buffer of surface height drm/simpledrm: Enable FB_DAMAGE_CLIPS property drm/simpledrm: Support virtual screen sizes drm: Clarify semantics of struct drm_mode_config.{min,max}_{width,height} Documentation/gpu/todo.rst | 15 ++ drivers/gpu/drm/drm_fb_helper.c | 2 +- drivers/gpu/drm/drm_format_helper.c | 247 ++++++++++---------- drivers/gpu/drm/drm_mipi_dbi.c | 6 +- drivers/gpu/drm/gud/gud_pipe.c | 14 +- drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 5 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 4 +- drivers/gpu/drm/tiny/cirrus.c | 24 +- drivers/gpu/drm/tiny/repaper.c | 2 +- drivers/gpu/drm/tiny/simpledrm.c | 41 +++- drivers/gpu/drm/tiny/st7586.c | 2 +- include/drm/drm_format_helper.h | 58 ++--- include/drm/drm_gem_atomic_helper.h | 18 ++ include/drm/drm_mode_config.h | 13 ++ 14 files changed, 264 insertions(+), 187 deletions(-) --- 2.33.1