summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2018-07-18 17:38:07 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2018-09-25 16:27:39 +0300
commitc7b3e2465773f9fb30bf45976732028e4e4dc365 (patch)
tree6703d13493ffc7804e55f4f1af3dea9a50e49524 /lib
parent42359edda12e5ebf715f2a978944a18baaba6490 (diff)
lib/kms: Pass the number of planes explicitly to __kms_addfb()
Currently __kms_addfb() assumes that only the first plane can be at offset 0. I don't particularly like such assumptions so let's just pass in the number of planes explicitly. We'll also require offsets[] to be passed in always. Nothing really to gain by making it optional. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_fb.c1
-rw-r--r--lib/ioctl_wrappers.c9
-rw-r--r--lib/ioctl_wrappers.h2
3 files changed, 5 insertions, 7 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 13fce9f0..b7d70edc 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -876,6 +876,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
do_or_die(__kms_addfb(fd, fb->gem_handle, width, height,
format, tiling, pitches, fb->offsets,
+ fb_num_planes(f),
LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id));
} else {
uint32_t handles[4];
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index a3485726..d992e015 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1674,7 +1674,7 @@ int __kms_addfb(int fd, uint32_t handle,
uint32_t width, uint32_t height,
uint32_t pixel_format, uint64_t modifier,
uint32_t strides[4], uint32_t offsets[4],
- uint32_t flags, uint32_t *buf_id)
+ int num_planes, uint32_t flags, uint32_t *buf_id)
{
struct drm_mode_fb_cmd2 f;
int ret, i;
@@ -1687,14 +1687,11 @@ int __kms_addfb(int fd, uint32_t handle,
f.height = height;
f.pixel_format = pixel_format;
f.flags = flags;
- f.handles[0] = handle;
- f.pitches[0] = strides[0];
- f.modifier[0] = modifier;
- for (i = 1; i < 4 && offsets && offsets[i]; i++) {
+ for (i = 0; i < num_planes; i++) {
f.handles[i] = handle;
- f.pitches[i] = strides[i];
f.modifier[i] = modifier;
+ f.pitches[i] = strides[i];
f.offsets[i] = offsets[i];
}
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 67bf5056..872e3056 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -239,7 +239,7 @@ int __kms_addfb(int fd, uint32_t handle,
uint32_t width, uint32_t height,
uint32_t pixel_format, uint64_t modifier,
uint32_t strides[4], uint32_t offsets[4],
- uint32_t flags, uint32_t *buf_id);
+ int num_planes, uint32_t flags, uint32_t *buf_id);
/**
* to_user_pointer: