From patchwork Wed Apr 3 22:24:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10884605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF121922 for ; Wed, 3 Apr 2019 22:24:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5240262FF for ; Wed, 3 Apr 2019 22:24:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98BC92870D; Wed, 3 Apr 2019 22:24:46 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 55EBD262FF for ; Wed, 3 Apr 2019 22:24:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E11C16E517; Wed, 3 Apr 2019 22:24:44 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by gabe.freedesktop.org (Postfix) with ESMTPS id C437F6E517; Wed, 3 Apr 2019 22:24:43 +0000 (UTC) Received: by mail-qk1-x742.google.com with SMTP id z76so418531qkb.12; Wed, 03 Apr 2019 15:24:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=JtpGAAa1hj62acs1xxZcX1uBpyA2gbidjj+GTZOx30k=; b=dirHGf3KcamboQTWGymcio8bxt17Wq1CeNdQRQbZKNN3DUfV0xChgDKfgJGXmx6KH5 yVvHdCFVbsWjaKT7NOFGea/RNaxK34G0bA4A/xs8IknIX2UOiRih5d5O0PrMKfw3l8tT YP+7b83zfS0Pm1O1mFHqfmH6XpN01VrK55qxSBGbWF7u72OPi6mOBwcTLEK/A5ppZP5i c8W7WTElbUyAvyhA0EOg+QmkloVyFWPzavAk0vpIZTW6jvj6cKYhjBWq3ek1ygRpIgxc A6WOqm8stdc4kbNfxxy9At4S9GBryNI05dv8QhTZ0v2ErNsYs3A963B6clKa/oUiu9qs StaA== X-Gm-Message-State: APjAAAXXe172G8M2TfvVhcOOFW7kvy7erqMkKJkoNyuW76UAYyrojcYh ihh6+MYu34iilSBCeEPyqsLftosa0Ng= X-Google-Smtp-Source: APXvYqzFT8zoRAxi3t6L94otmiypVaLCHUm1o6QWrQXaK3lqmSsQfxtYm4Sk94n34Sh7QK0Atle9yg== X-Received: by 2002:ae9:e40d:: with SMTP id q13mr2203941qkc.118.1554330282892; Wed, 03 Apr 2019 15:24:42 -0700 (PDT) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id h22sm12907070qth.68.2019.04.03.15.24.41 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 03 Apr 2019 15:24:42 -0700 (PDT) Date: Wed, 3 Apr 2019 19:24:39 -0300 From: Rodrigo Siqueira To: Petri Latvala , Arkadiusz Hiler Message-ID: <20190403222439.jidjcpw7ywd6eomz@smtp.gmail.com> MIME-Version: 1.0 User-Agent: NeoMutt/20180716 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=JtpGAAa1hj62acs1xxZcX1uBpyA2gbidjj+GTZOx30k=; b=ddJjaiLoZTTeLer0ujlYfuf/ctTweMJxeDcXJExDvMhBneK+Xny91lNaJiRxKUgrPc I0SHA20O3OZ7skB+VXJe1wQBSUgOF5hWTfmjrcKSSm5hnJEx+WZeA+4JWBwpyB8XabRa 2lDCH4lfsx0KhR4HHGQsNiz/ALptpjOI8LUqXBjx40hl8MgaZCpiMRpVM42RxNeOVfFx kQDMabZFclSh+Dwqm8Sod3Dn1H7vyzpdUISeD6lc+B5fE9ZpiV0YNjtqMmZ4ngr8nlvv dyaNKJUSQHf65cKCr3ok36jLSmJUJn08zVLUy9TTUueHJ5WIo6VGEIHNZJAAtIEVRDO5 FtVA== Subject: [Intel-gfx] [PATCH i-g-t] lib: Rework __kms_addfb() function X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP The function __kms_addfb() and drmModeAddFB2WithModifiers() have a similar code. Due to this similarity, this commit replace part of the code inside __kms_addfb() by using drmModeAddFB2WithModifiers(). Signed-off-by: Rodrigo Siqueira --- lib/ioctl_wrappers.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 39920f87..4240d138 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -46,6 +46,7 @@ #include #include #include +#include #include "drmtest.h" #include "i915_drm.h" @@ -1479,29 +1480,13 @@ int __kms_addfb(int fd, uint32_t handle, uint32_t strides[4], uint32_t offsets[4], int num_planes, uint32_t flags, uint32_t *buf_id) { - struct drm_mode_fb_cmd2 f; - int ret, i; + uint32_t handles[4] = {handle}; + uint64_t modifiers[4] = {modifier}; if (flags & DRM_MODE_FB_MODIFIERS) igt_require_fb_modifiers(fd); - memset(&f, 0, sizeof(f)); - - f.width = width; - f.height = height; - f.pixel_format = pixel_format; - f.flags = flags; - - for (i = 0; i < num_planes; i++) { - f.handles[i] = handle; - f.modifier[i] = modifier; - f.pitches[i] = strides[i]; - f.offsets[i] = offsets[i]; - } - - ret = igt_ioctl(fd, DRM_IOCTL_MODE_ADDFB2, &f); - - *buf_id = f.fb_id; - - return ret < 0 ? -errno : ret; + return drmModeAddFB2WithModifiers(fd, width, height, pixel_format, + handles, strides, offsets, modifiers, + buf_id, flags); }