From: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
To: Petri Latvala <petri.latvala@intel.com>,
Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] lib: Rework __kms_addfb() function
Date: Wed, 3 Apr 2019 19:24:39 -0300 [thread overview]
Message-ID: <20190403222439.jidjcpw7ywd6eomz@smtp.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1636 bytes --]
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 <rodrigosiqueiramelo@gmail.com>
---
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 <sys/utsname.h>
#include <termios.h>
#include <errno.h>
+#include <xf86drmMode.h>
#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);
}
--
2.21.0
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 153 bytes --]
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2019-04-03 22:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-03 22:24 Rodrigo Siqueira [this message]
2019-04-03 23:08 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib: Rework __kms_addfb() function Patchwork
2019-04-10 11:28 ` [igt-dev] [PATCH i-g-t] " Arkadiusz Hiler
2019-04-10 11:34 ` [Intel-gfx] " Chris Wilson
2019-04-10 11:57 ` Arkadiusz Hiler
2019-04-10 11:59 ` [Intel-gfx] " Chris Wilson
2019-04-18 12:00 ` [Intel-gfx] " Rodrigo Siqueira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190403222439.jidjcpw7ywd6eomz@smtp.gmail.com \
--to=rodrigosiqueiramelo@gmail.com \
--cc=arkadiusz.hiler@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=petri.latvala@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox