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>main
parent
0659558f64
commit
abfa680dbd
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue