From patchwork Wed Feb 15 12:42:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 13141605 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 192F8C636CC for ; Wed, 15 Feb 2023 12:42:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 45BF110E0B9; Wed, 15 Feb 2023 12:42:09 +0000 (UTC) Received: from mail-4022.proton.ch (mail-4022.proton.ch [185.70.40.22]) by gabe.freedesktop.org (Postfix) with ESMTPS id E855410E0B9 for ; Wed, 15 Feb 2023 12:42:06 +0000 (UTC) Date: Wed, 15 Feb 2023 12:42:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1676464925; x=1676724125; bh=fvWmFsstnS/hDMPUuFyRqqOU2v5dPBuovP7aN0h0SfA=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=gy5P87cNu+91+MrZD4+I/20xyZkJTXXpM5QIGJ5H7WILTcUd/R6u9Jlxo0p3eePbo 3tJzLo/I2xVeqPNt9IZvp454OmcpUDwoN+Jx2GR1q5r7zEgBzekLjYZaX0nwMLBUvJ EyUnO688IijWGPxE4L9TZUiZFxF/Xa61AV6Qagvr3jwRZj5ikjbGvmcB+DB2JY3J1U DEWjUd7mvrezE4Z8VvdYwpsZ8c7XFLxx12WRY3DZa6SvmOK7HcznVq+77Br+rfcsEX IGu803MBj2XVNpKfCrpNU/KEsQ3YQ8jxsi47C9hjcVaBd10VzhsaqgZH1N8NPEG577 WU8z8thPqIvjg== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH] drm: document expectations for GETFB2 handles Message-ID: <20230215124152.101548-1-contact@emersion.fr> Feedback-ID: 1358184:user:proton 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: Pekka Paalanen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There are two important details missing from the docs: - If the memory object backing the FB already has a GEM handle, it's not re-used, a new one is generated. - Aliased planes will return the same GEM handle. Signed-off-by: Simon Ser Cc: Daniel Vetter Cc: Pekka Paalanen Acked-by: Pekka Paalanen --- include/uapi/drm/drm.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 642808520d92..4cb956a52aee 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -1104,8 +1104,13 @@ extern "C" { * struct as the output. * * If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles - * will be filled with GEM buffer handles. Planes are valid until one has a - * zero handle -- this can be used to compute the number of planes. + * will be filled with GEM buffer handles. Fresh new GEM handles are always + * returned, even if another GEM handle referring to the same memory object + * already exists on the DRM file description. The caller is responsible for + * removing the new handles, e.g. via the &DRM_IOCTL_GEM_CLOSE IOCTL. The same + * new handle will be returned for multiple planes in case they use the same + * memory object. Planes are valid until one has a zero handle -- this can be + * used to compute the number of planes. * * Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid * until one has a zero &drm_mode_fb_cmd2.pitches.