From patchwork Tue Sep 13 22:07:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Kristian_H=C3=B8gsberg?= X-Patchwork-Id: 9330019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E4CB8607FD for ; Tue, 13 Sep 2016 22:08:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFDF2297B5 for ; Tue, 13 Sep 2016 22:08:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C46E8297D0; Tue, 13 Sep 2016 22:08:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4D67E297B5 for ; Tue, 13 Sep 2016 22:08:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 00E766E0C5; Tue, 13 Sep 2016 22:08:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-x242.google.com (mail-pa0-x242.google.com [IPv6:2607:f8b0:400e:c03::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8F42F6E0C5 for ; Tue, 13 Sep 2016 22:08:01 +0000 (UTC) Received: by mail-pa0-x242.google.com with SMTP id pp5so118882pac.2 for ; Tue, 13 Sep 2016 15:08:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=3QNQUmbzdrxZ+gkxZ1lrSpjSDEj5DopNQwN//aLk4Qk=; b=Z4DCE3pHl5k0wXjK87/vs1JBIdqcy+wUoch91+xsZ2N4JbsrQ2so1Ony8QnQo72TDA rL9UnrUdIFLnXIdSBTj2qom9NJya0/KXfPRzZfK2e5aXo5q/wnL9HUpWWI6Hm8QLUkIQ zn+rX4YAbUKjhPdpPH3dBd1U8i6b1BF/T5OO3Un6I18MfhIgUB4nGoTwYE5rv3npChFI d9vtLdUkUVnzlt7rN8C4LEHSwmgHyWI5+yN84BDviARevDIZn3zW6cPjhyX7QXL6i+7v CYOH+jk9tcvoknq4JF0GnOb4UJ5wsgJ+Qv4Yr4i9n5KPyscqpMF8Upyi2iY2/PpgcNq0 naDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3QNQUmbzdrxZ+gkxZ1lrSpjSDEj5DopNQwN//aLk4Qk=; b=JmqDbreFQ+40OBUs2cArG5QPPUAUaWR5dleknaog08hO5AqLZZfXxvhn2ZZLUn6J+d 222bm8EMhAHavVXioPG+Oxnnxy7ZguJNmQyg5LXHXgF8PKGq8TdZi1iwrWDaUOPu75EH 40fG5izvEn+JJhUc9vM2zaST2OudrFiVqugPjS22x6I9zeFRzAQAVgPQj8rZGqbQnlPw uUuIrY1PS4kO8wNvPSGzQZH5+i0s44toW7+2PURj0CfccKOvyLfw3u7d4QQ1ODOOdI58 D3n6hAoTVsoKn6y7wm6qSmsBYNfQT3p4PnpU+3+6qwsb2uLBx3jUV5/5eF1Oq0i2cXP0 o6qQ== X-Gm-Message-State: AE9vXwOn9ekERn1d3AHROxSedfHrvczI2wjn9JiOyc2NrhZCmj/FXW9tJwFyHiu0EicFhw== X-Received: by 10.66.89.230 with SMTP id br6mr5192225pab.49.1473804480338; Tue, 13 Sep 2016 15:08:00 -0700 (PDT) Received: from hawkmoon.pdx.corp.google.com ([100.118.88.18]) by smtp.gmail.com with ESMTPSA id i74sm33217138pfk.2.2016.09.13.15.07.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Sep 2016 15:07:59 -0700 (PDT) From: "Kristian H. Kristensen" X-Google-Original-From: "Kristian H. Kristensen" To: dri-devel@lists.freedesktop.org Subject: [PATCH] Add drmModeAddFB2WithModifiers() which takes format modifiers Date: Tue, 13 Sep 2016 15:07:55 -0700 Message-Id: <1473804475-53897-1-git-send-email-hoegsberg@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 Cc: "Kristian H. Kristensen" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The only current user of this open codes the ioctl. Let's add an entry point for this to libdrm. Signed-off-by: Kristian H. Kristensen Reviewed-by: Rob Clark Tested-by: Alexandre Courbot --- xf86drmMode.c | 21 +++++++++++++++++---- xf86drmMode.h | 7 +++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/xf86drmMode.c b/xf86drmMode.c index f7b5948..2907c5c 100644 --- a/xf86drmMode.c +++ b/xf86drmMode.c @@ -270,10 +270,10 @@ int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth, return 0; } -int drmModeAddFB2(int fd, uint32_t width, uint32_t height, - uint32_t pixel_format, uint32_t bo_handles[4], - uint32_t pitches[4], uint32_t offsets[4], - uint32_t *buf_id, uint32_t flags) +int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height, + uint32_t pixel_format, uint32_t bo_handles[4], + uint32_t pitches[4], uint32_t offsets[4], + uint64_t modifier[4], uint32_t *buf_id, uint32_t flags) { struct drm_mode_fb_cmd2 f; int ret; @@ -286,6 +286,8 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height, memcpy(f.handles, bo_handles, 4 * sizeof(bo_handles[0])); memcpy(f.pitches, pitches, 4 * sizeof(pitches[0])); memcpy(f.offsets, offsets, 4 * sizeof(offsets[0])); + if (modifier) + memcpy(f.modifier, modifier, 4 * sizeof(modifier[0])); if ((ret = DRM_IOCTL(fd, DRM_IOCTL_MODE_ADDFB2, &f))) return ret; @@ -294,6 +296,17 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height, return 0; } +int drmModeAddFB2(int fd, uint32_t width, uint32_t height, + uint32_t pixel_format, uint32_t bo_handles[4], + uint32_t pitches[4], uint32_t offsets[4], + uint32_t *buf_id, uint32_t flags) +{ + return drmModeAddFB2WithModifiers(fd, width, height, + pixel_format, bo_handles, + pitches, offsets, NULL, + buf_id, flags); +} + int drmModeRmFB(int fd, uint32_t bufferId) { return DRM_IOCTL(fd, DRM_IOCTL_MODE_RMFB, &bufferId); diff --git a/xf86drmMode.h b/xf86drmMode.h index 4de7bbb..02190ea 100644 --- a/xf86drmMode.h +++ b/xf86drmMode.h @@ -369,6 +369,13 @@ extern int drmModeAddFB2(int fd, uint32_t width, uint32_t height, uint32_t pixel_format, uint32_t bo_handles[4], uint32_t pitches[4], uint32_t offsets[4], uint32_t *buf_id, uint32_t flags); + +/* ...with format modifiers */ +int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height, + uint32_t pixel_format, uint32_t bo_handles[4], + uint32_t pitches[4], uint32_t offsets[4], + uint64_t modifier[4], uint32_t *buf_id, uint32_t flags); + /** * Destroies the given framebuffer. */