From patchwork Tue Nov 9 08:56:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12610135 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 B3B57C433EF for ; Tue, 9 Nov 2021 08:56:21 +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 7CB9B61027 for ; Tue, 9 Nov 2021 08:56:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7CB9B61027 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr 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 EA2AA89D8E; Tue, 9 Nov 2021 08:56:20 +0000 (UTC) Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1D10189D84 for ; Tue, 9 Nov 2021 08:56:19 +0000 (UTC) Date: Tue, 09 Nov 2021 08:56:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1636448176; bh=h9g+TWBFwYPvz01TYa0i+9VGeS2AR7++zm5oaD617Qs=; h=Date:To:From:Cc:Reply-To:Subject:From; b=xRQ+iV2gbF5P/otqkPPuFCnoamMpMCwxU5LeyewGEioY7gKM8FYstnWqDibnOeDnf 7tCpThOqEvkIU8Kj8JL3m32K63L/ZQJ+qBaoAgvUxhQtU/r3c2DHPUcwps16PcECGL CJ1lrr87IMwnx07xv+/I2cVndk7xBPP4gJu5/jWQnF2ni9kBe2MubxSLnvEtCFw1Tn DFhIjHqjzlm/3LRETvG3eL6ZkmTUBXS8MK+Yq6dFh1qmuvZYDr4shETFivOFGvfwei vivUTaLh97Gk5DT/bsYBMH342+bqbuYSquMIX1w7U9lTE0XlbwkMwtKrSrVIqcdPfe c+4KEOlc6gLpw== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH] drm: document DRM_IOCTL_MODE_GETFB2 Message-ID: <20211109085601.170275-1-contact@emersion.fr> 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: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There are a few details specific to the GETFB2 IOCTL. It's not immediately clear how user-space should check for the number of planes. Suggest using the pitches field. The modifier array is filled with zeroes, ie. DRM_FORMAT_MOD_LINEAR. So explicitly tell user-space to not look at it unless the flag is set. Signed-off-by: Simon Ser Cc: Daniel Vetter Cc: Pekka Paalanen Reviewed-by: Daniel Vetter Acked-by: Pekka Paalanen Acked-by: Daniel Stone --- include/uapi/drm/drm.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 3b810b53ba8b..9809078b0f51 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -1096,6 +1096,22 @@ extern "C" { #define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array) +/** + * DRM_IOCTL_MODE_GETFB2 - Get framebuffer metadata. + * + * This queries metadata about a framebuffer. User-space fills + * &drm_mode_fb_cmd2.fb_id as the input, and the kernels fills the rest of the + * struct as the output. + * + * If the client is not DRM master and doesn't have &CAP_SYS_ADMIN, + * &drm_mode_fb_cmd2.handles will be zeroed. Planes are valid until one has a + * zero &drm_mode_fb_cmd2.pitches -- this can be used to compute the number of + * planes. + * + * If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set + * in &drm_mode_fb_cmd2.flags. Otherwise, &drm_mode_fb_cmd2.modifier has + * undefined contents. + */ #define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2) /*