mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-11 16:32:58 +00:00
tests/kms_addfb: Add support for fb modifiers
Just a few basic tests to make sure fb modifiers can be used and
behave sanely when mixed with the old set_tiling API.
v2:
* Review feedback from Daniel Vetter:
1. Move cap detection into the subtest so skipping works.
2. Added some gtkdoc comments.
3. Two more test cases.
4. Removed unused parts for now.
v3:
* Removed two tests which do not make sense any more after the
fb modifier rewrite.
v4:
* Moved gtkdoc comments into .c file.
* Moved all initialization into fixtures.
* Rebased for fb modifier changes.
v5:
* Added bad modifier subtest.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
This commit is contained in:
committed by
Damien Lespiau
parent
f59935c0ce
commit
0a087733d2
@@ -1142,3 +1142,26 @@ off_t prime_get_size(int dma_buf_fd)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* igt_require_fb_modifiers:
|
||||
* @fd: Open DRM file descriptor.
|
||||
*
|
||||
* Requires presence of DRM_CAP_ADDFB2_MODIFIERS.
|
||||
*/
|
||||
void igt_require_fb_modifiers(int fd)
|
||||
{
|
||||
static bool has_modifiers, cap_modifiers_tested;
|
||||
|
||||
if (!cap_modifiers_tested) {
|
||||
uint64_t cap_modifiers;
|
||||
int ret;
|
||||
|
||||
ret = drmGetCap(fd, LOCAL_DRM_CAP_ADDFB2_MODIFIERS, &cap_modifiers);
|
||||
igt_assert(ret == 0 || errno == EINVAL);
|
||||
has_modifiers = ret == 0 && cap_modifiers == 1;
|
||||
cap_modifiers_tested = true;
|
||||
}
|
||||
|
||||
igt_require(has_modifiers);
|
||||
}
|
||||
|
||||
@@ -135,4 +135,34 @@ int prime_handle_to_fd(int fd, uint32_t handle);
|
||||
uint32_t prime_fd_to_handle(int fd, int dma_buf_fd);
|
||||
off_t prime_get_size(int dma_buf_fd);
|
||||
|
||||
/* addfb2 fb modifiers */
|
||||
struct local_drm_mode_fb_cmd2 {
|
||||
uint32_t fb_id;
|
||||
uint32_t width, height;
|
||||
uint32_t pixel_format;
|
||||
uint32_t flags;
|
||||
uint32_t handles[4];
|
||||
uint32_t pitches[4];
|
||||
uint32_t offsets[4];
|
||||
uint64_t modifier[4];
|
||||
};
|
||||
|
||||
#define LOCAL_DRM_MODE_FB_MODIFIERS (1<<1)
|
||||
|
||||
#define LOCAL_DRM_FORMAT_MOD_VENDOR_INTEL 0x01
|
||||
|
||||
#define local_fourcc_mod_code(vendor, val) \
|
||||
((((uint64_t)LOCAL_DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | \
|
||||
(val & 0x00ffffffffffffffL))
|
||||
|
||||
#define LOCAL_DRM_FORMAT_MOD_NONE (0)
|
||||
#define LOCAL_I915_FORMAT_MOD_X_TILED local_fourcc_mod_code(INTEL, 1)
|
||||
|
||||
#define LOCAL_DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, \
|
||||
struct local_drm_mode_fb_cmd2)
|
||||
|
||||
#define LOCAL_DRM_CAP_ADDFB2_MODIFIERS 0x10
|
||||
|
||||
void igt_require_fb_modifiers(int fd);
|
||||
|
||||
#endif /* IOCTL_WRAPPERS_H */
|
||||
|
||||
Reference in New Issue
Block a user