From patchwork Wed Sep 2 10:24:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11750265 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 6EFD8166C for ; Wed, 2 Sep 2020 10:24:51 +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 4D9772078B for ; Wed, 2 Sep 2020 10:24:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="UbeWCMpW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D9772078B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch 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 43D3D6E2B8; Wed, 2 Sep 2020 10:24:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id A27CE6E2B8 for ; Wed, 2 Sep 2020 10:24:47 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id e16so4647172wrm.2 for ; Wed, 02 Sep 2020 03:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dohIQ5UyzZkaEYR+AwQGwtwpkxkjmspAuCqUfN2fWCY=; b=UbeWCMpW6uL7pqcGDjqZAlo2WnRVPB8DcEbjjuSYHE62cvjCtLyscx1kWpXa0DJTkr 7Q4OzXsJg2dT1D7xFOxxnw9y5NGtz8MkCD3AXqye0+ANMmfL7lUWz5VWd+UtiqFk8c+2 N7GByQQs6IZeu2SUz8/XYB98zsH/qUyWptHA8= 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=dohIQ5UyzZkaEYR+AwQGwtwpkxkjmspAuCqUfN2fWCY=; b=U71wej1p0vUk594ftroDYi0l3hyT7NpUL4Z9kSE2jCLnEJpMKmNg/F/VKbvj/C8w+S 1X8uN0y/jg/ZwBRdEAUNaP/7kX9m8nuWRqWX+heg45yHOjZUaadN9d5bNifaxKPSkX0B PXyGuvDVnzGdoVqE/rxhxvLRV7h4kK8q4K8n4i+TXYfJWdeCoVwbwhGg59SlFEMrvMr6 OetE6rPPNxYZQlcNjLD9BRUMea6R1rWdsdrVDvw6xAeg5xlb3nn4jgx1NzbCM4fwboBh S4iMhaOGDHt7hD0zIaDWngH/AIjfF6bLkGP9SAJS9PBu9DPHJYrQQcO/cMjdEcL2kzR0 leHA== X-Gm-Message-State: AOAM533MIKV4KAaNgP4QalkkeIx1Zh7PE+xzzbKHv79ZqEqJSTXYzMh6 X6FLXtzBHjekAmQRPyTYOCSNAikpH6vSI0hf X-Google-Smtp-Source: ABdhPJxZPQLtsUfZzZiQU2c6l+hctqh63Azks0gZkzfctn/GlMjRdSmBbTDK2/Od5x5aS1T26FT9DA== X-Received: by 2002:adf:c981:: with SMTP id f1mr6429105wrh.14.1599042286053; Wed, 02 Sep 2020 03:24:46 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id a10sm5546768wmj.38.2020.09.02.03.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 03:24:45 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH] drm/doc: Document that modifiers are always required for fb Date: Wed, 2 Sep 2020 12:24:40 +0200 Message-Id: <20200902102440.3621733-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.28.0 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: Daniel Stone , =?utf-8?b?TWFyZWsgT2zFocOhaw==?= , Daniel Vetter , Juston Li , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Even for legacy userspace, since otherwise GETFB2 is broken and if you switch between modifier-less and modifier-aware compositors, smooth transitions break. Also it's just best practice to make sure modifiers are invariant for a given drm_fb, and that a modifier-aware kms drivers only has one place to store them, ignoring any old implicit bo flags or whatever else might float around. Motivated by some irc discussion with Bas about amdgpu modifier support. Fixes: 455e00f1412f ("drm: Add getfb2 ioctl") Cc: Daniel Stone Cc: Juston Li Cc: Daniel Vetter Cc: Ville Syrjälä Cc: Bas Nieuwenhuizen Cc: Marek Olšák Cc: "Wentland, Harry" Signed-off-by: Daniel Vetter Acked-by: Pekka Paalanen Acked-by: Simon Ser Acked-by: Daniel Stone --- include/drm/drm_mode_config.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index a18f73eb3cf6..5ffbb4ed5b35 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -58,6 +58,12 @@ struct drm_mode_config_funcs { * actual modifier used if the request doesn't have it specified, * ie. when (@mode_cmd->flags & DRM_MODE_FB_MODIFIERS) == 0. * + * IMPORTANT: These implied modifiers for legacy userspace must be + * stored in struct &drm_framebuffer, including all relevant metadata + * like &drm_framebuffer.pitches and &drm_framebuffer.offsets if the + * modifier enables additional planes beyond the fourcc pixel format + * code. This is required by the GETFB2 ioctl. + * * If the parameters are deemed valid and the backing storage objects in * the underlying memory manager all exist, then the driver allocates * a new &drm_framebuffer structure, subclassed to contain @@ -915,6 +921,13 @@ struct drm_mode_config { * @allow_fb_modifiers: * * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call. + * + * IMPORTANT: + * + * If this is set the driver must fill out the full implicit modifier + * information in their &drm_mode_config_funcs.fb_create hook for legacy + * userspace which does not set modifiers. Otherwise the GETFB2 ioctl is + * broken for modifier aware userspace. */ bool allow_fb_modifiers;