aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian H. Kristensen2016-09-08 15:08:59 -0500
committerKristian H. Kristensen2016-09-28 05:32:23 -0500
commitabfa680dbdfa4600105d904f4903c047d453cdb5 (patch)
treedaf38a1dd067d42524137c8980ee3303398ee081 /xf86drmMode.c
parent0659558f6418693ad203b5de2f1bc4fa9f28708e (diff)
downloadexternal-libdrm-abfa680dbdfa4600105d904f4903c047d453cdb5.tar.gz
external-libdrm-abfa680dbdfa4600105d904f4903c047d453cdb5.tar.xz
external-libdrm-abfa680dbdfa4600105d904f4903c047d453cdb5.zip
Add drmModeAddFB2WithModifiers() which takes format modifiers
The only other user of this feature open codes the ioctl. Let's add an entry point for this to libdrm. Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org> Reviewed-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'xf86drmMode.c')
-rw-r--r--xf86drmMode.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/xf86drmMode.c b/xf86drmMode.c
index f7b59484..228c6e4b 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -270,10 +270,10 @@ int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
270 return 0; 270 return 0;
271} 271}
272 272
273int drmModeAddFB2(int fd, uint32_t width, uint32_t height, 273int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
274 uint32_t pixel_format, uint32_t bo_handles[4], 274 uint32_t pixel_format, uint32_t bo_handles[4],
275 uint32_t pitches[4], uint32_t offsets[4], 275 uint32_t pitches[4], uint32_t offsets[4],
276 uint32_t *buf_id, uint32_t flags) 276 uint64_t modifier[4], uint32_t *buf_id, uint32_t flags)
277{ 277{
278 struct drm_mode_fb_cmd2 f; 278 struct drm_mode_fb_cmd2 f;
279 int ret; 279 int ret;
@@ -286,6 +286,8 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
286 memcpy(f.handles, bo_handles, 4 * sizeof(bo_handles[0])); 286 memcpy(f.handles, bo_handles, 4 * sizeof(bo_handles[0]));
287 memcpy(f.pitches, pitches, 4 * sizeof(pitches[0])); 287 memcpy(f.pitches, pitches, 4 * sizeof(pitches[0]));
288 memcpy(f.offsets, offsets, 4 * sizeof(offsets[0])); 288 memcpy(f.offsets, offsets, 4 * sizeof(offsets[0]));
289 if (modifier)
290 memcpy(f.modifier, modifier, 4 * sizeof(modifier[0]));
289 291
290 if ((ret = DRM_IOCTL(fd, DRM_IOCTL_MODE_ADDFB2, &f))) 292 if ((ret = DRM_IOCTL(fd, DRM_IOCTL_MODE_ADDFB2, &f)))
291 return ret; 293 return ret;
@@ -294,6 +296,17 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
294 return 0; 296 return 0;
295} 297}
296 298
299int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
300 uint32_t pixel_format, uint32_t bo_handles[4],
301 uint32_t pitches[4], uint32_t offsets[4],
302 uint32_t *buf_id, uint32_t flags)
303{
304 return drmModeAddFB2WithModifiers(fd, width, height,
305 pixel_format, bo_handles,
306 pitches, offsets, NULL,
307 buf_id, flags);
308}
309
297int drmModeRmFB(int fd, uint32_t bufferId) 310int drmModeRmFB(int fd, uint32_t bufferId)
298{ 311{
299 return DRM_IOCTL(fd, DRM_IOCTL_MODE_RMFB, &bufferId); 312 return DRM_IOCTL(fd, DRM_IOCTL_MODE_RMFB, &bufferId);