* [igt-dev] [PATCH 0/8] Add GetFB2 ioctl
@ 2018-03-23 13:42 Daniel Stone
2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Daniel Stone
2018-03-23 13:51 ` [igt-dev] [PATCH 0/8] Add GetFB2 ioctl Daniel Stone
0 siblings, 2 replies; 9+ messages in thread
From: Daniel Stone @ 2018-03-23 13:42 UTC (permalink / raw)
To: dri-devel, igt-dev
Hi,
AddFB is single-planar, with no offset and only depth/bpp rather than
an explicit format, so we now have AddFB2 which can carry multiple
planes, an explicit format and also a modifier. At the time we never
actually did GetFB2 to go with GetFB.
This submission rights that historical wrong, which allows Xorg
-background none to continue to work in the face of exotic buffers.
I've written patches to Xorg to use this as UABI verification, and
I'll post a link to that very shortly.
This is also available in git form, in the wip/2018-03/getfb2 branches of:
https://gitlab.collabora.com/daniels/linux
https://gitlab.collabora.com/daniels/libdrm
https://gitlab.collabora.com/daniels/igt-gpu-tools
https://gitlab.collabora.com/daniels/xserver
Note that the kernel tree is based on top of drm-tip, and has a bunch
of patches to convert drivers to placing objects (rather than creating
handles). At the moment this is just missing amdgpu and nouveau to
complete the set of drivers, and also any testing whatsoever; I'm
sending a patch to convert Intel as that's what I've actually tested
on.
The conversion is necessary since GetFB2 ensures that it does _not_
return duplicate handles if multiple planes of a single buffer share
the same BO. This is impossible if we just use create_handle from the
driver, so instead we just rely on drivers placing the GEM object
pointers in the drm_framebuffer directly. This has the added advantage
of cleaning up a ton of unnecessary code in drivers.
Cheers,
Daniel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 9+ messages in thread* [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper 2018-03-23 13:42 [igt-dev] [PATCH 0/8] Add GetFB2 ioctl Daniel Stone @ 2018-03-23 13:46 ` Daniel Stone 2018-03-23 13:46 ` [PATCH i-g-t 2/3] NOMERGE: Update DRM UAPI to latest kernel version Daniel Stone ` (2 more replies) 2018-03-23 13:51 ` [igt-dev] [PATCH 0/8] Add GetFB2 ioctl Daniel Stone 1 sibling, 3 replies; 9+ messages in thread From: Daniel Stone @ 2018-03-23 13:46 UTC (permalink / raw) To: igt-dev, dri-devel We'll want to reuse this, so split it out into a (smaller!) helper. Signed-off-by: Daniel Stone <daniels@collabora.com> --- tests/kms_getfb.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/tests/kms_getfb.c b/tests/kms_getfb.c index c5968e75..a9852626 100644 --- a/tests/kms_getfb.c +++ b/tests/kms_getfb.c @@ -72,6 +72,23 @@ static void get_ccs_fb(int fd, struct drm_mode_fb_cmd2 *ret) gem_close(fd, add.handles[0]); } +/** + * Find and return an arbitrary valid property ID. + */ +static uint32_t get_prop_id(int fd) +{ + igt_display_t display; + + igt_display_init(&display, fd); + for (int i = 0; i < display.n_outputs; i++) { + igt_output_t *output = &display.outputs[i]; + if (output->props[IGT_CONNECTOR_DPMS] != 0) + return output->props[IGT_CONNECTOR_DPMS]; + } + + return 0; +} + static void test_handle_input(int fd) { struct drm_mode_fb_cmd2 add = {}; @@ -111,23 +128,8 @@ static void test_handle_input(int fd) } igt_subtest("getfb-handle-not-fb") { - struct drm_mode_fb_cmd get = { }; - uint32_t prop_id = 0; - igt_display_t display; - - /* Find a valid property ID to use. */ - igt_display_init(&display, fd); - for (int i = 0; i < display.n_outputs; i++) { - igt_output_t *output = &display.outputs[i]; - - if (output->props[IGT_CONNECTOR_DPMS] != 0) { - prop_id = output->props[IGT_CONNECTOR_DPMS]; - break; - } - } - igt_require(prop_id > 0); - - get.fb_id = prop_id; + struct drm_mode_fb_cmd get = { .fb_id = get_prop_id(fd) }; + igt_require(get.fb_id > 0); do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB, &get, ENOENT); } } -- 2.16.2 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH i-g-t 2/3] NOMERGE: Update DRM UAPI to latest kernel version 2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Daniel Stone @ 2018-03-23 13:46 ` Daniel Stone 2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests Daniel Stone 2018-03-23 14:53 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Ville Syrjälä 2 siblings, 0 replies; 9+ messages in thread From: Daniel Stone @ 2018-03-23 13:46 UTC (permalink / raw) To: igt-dev, dri-devel This depends on unmerged kernel code, so. --- include/drm-uapi/amdgpu_drm.h | 1 + include/drm-uapi/drm.h | 1 + include/drm-uapi/drm_mode.h | 9 ++++++--- include/drm-uapi/etnaviv_drm.h | 1 + include/drm-uapi/msm_drm.h | 9 ++++++++- include/drm-uapi/virtgpu_drm.h | 1 + 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/drm-uapi/amdgpu_drm.h b/include/drm-uapi/amdgpu_drm.h index 1816bd82..528f6d04 100644 --- a/include/drm-uapi/amdgpu_drm.h +++ b/include/drm-uapi/amdgpu_drm.h @@ -806,6 +806,7 @@ struct drm_amdgpu_info_firmware { #define AMDGPU_VRAM_TYPE_GDDR5 5 #define AMDGPU_VRAM_TYPE_HBM 6 #define AMDGPU_VRAM_TYPE_DDR3 7 +#define AMDGPU_VRAM_TYPE_DDR4 8 struct drm_amdgpu_info_device { /** PCI Device ID */ diff --git a/include/drm-uapi/drm.h b/include/drm-uapi/drm.h index f0bd91de..c0a35878 100644 --- a/include/drm-uapi/drm.h +++ b/include/drm-uapi/drm.h @@ -886,6 +886,7 @@ extern "C" { #define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees) #define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease) #define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) +#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCA, struct drm_mode_fb_cmd2) /** * Device specific ioctls should only be in their respective headers diff --git a/include/drm-uapi/drm_mode.h b/include/drm-uapi/drm_mode.h index 2c575794..50bcf421 100644 --- a/include/drm-uapi/drm_mode.h +++ b/include/drm-uapi/drm_mode.h @@ -363,7 +363,7 @@ struct drm_mode_get_connector { __u32 pad; }; -#define DRM_MODE_PROP_PENDING (1<<0) +#define DRM_MODE_PROP_PENDING (1<<0) /* deprecated, do not use */ #define DRM_MODE_PROP_RANGE (1<<1) #define DRM_MODE_PROP_IMMUTABLE (1<<2) #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ @@ -598,8 +598,11 @@ struct drm_mode_crtc_lut { }; struct drm_color_ctm { - /* Conversion matrix in S31.32 format. */ - __s64 matrix[9]; + /* + * Conversion matrix in S31.32 sign-magnitude + * (not two's complement!) format. + */ + __u64 matrix[9]; }; struct drm_color_lut { diff --git a/include/drm-uapi/etnaviv_drm.h b/include/drm-uapi/etnaviv_drm.h index e9b997a0..71958c80 100644 --- a/include/drm-uapi/etnaviv_drm.h +++ b/include/drm-uapi/etnaviv_drm.h @@ -145,6 +145,7 @@ struct drm_etnaviv_gem_submit_reloc { */ #define ETNA_SUBMIT_BO_READ 0x0001 #define ETNA_SUBMIT_BO_WRITE 0x0002 +#define ETNA_SUBMIT_BO_NO_IMPLICIT 0x0004 struct drm_etnaviv_gem_submit_bo { __u32 flags; /* in, mask of ETNA_SUBMIT_BO_x */ __u32 handle; /* in, GEM handle */ diff --git a/include/drm-uapi/msm_drm.h b/include/drm-uapi/msm_drm.h index bbbaffad..57a67fb3 100644 --- a/include/drm-uapi/msm_drm.h +++ b/include/drm-uapi/msm_drm.h @@ -188,8 +188,13 @@ struct drm_msm_gem_submit_cmd { */ #define MSM_SUBMIT_BO_READ 0x0001 #define MSM_SUBMIT_BO_WRITE 0x0002 +#define MSM_SUBMIT_BO_NO_IMPLICIT 0x0004 /* disable implicit sync */ -#define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE) +#define MSM_SUBMIT_BO_FLAGS ( \ + MSM_SUBMIT_BO_READ | \ + MSM_SUBMIT_BO_WRITE | \ + MSM_SUBMIT_BO_NO_IMPLICIT | \ + 0) struct drm_msm_gem_submit_bo { __u32 flags; /* in, mask of MSM_SUBMIT_BO_x */ @@ -201,10 +206,12 @@ struct drm_msm_gem_submit_bo { #define MSM_SUBMIT_NO_IMPLICIT 0x80000000 /* disable implicit sync */ #define MSM_SUBMIT_FENCE_FD_IN 0x40000000 /* enable input fence_fd */ #define MSM_SUBMIT_FENCE_FD_OUT 0x20000000 /* enable output fence_fd */ +#define MSM_SUBMIT_SUDO 0x10000000 /* run submitted cmds from RB */ #define MSM_SUBMIT_FLAGS ( \ MSM_SUBMIT_NO_IMPLICIT | \ MSM_SUBMIT_FENCE_FD_IN | \ MSM_SUBMIT_FENCE_FD_OUT | \ + MSM_SUBMIT_SUDO | \ 0) /* Each cmdstream submit consists of a table of buffers involved, and diff --git a/include/drm-uapi/virtgpu_drm.h b/include/drm-uapi/virtgpu_drm.h index 91a31ffe..9a781f06 100644 --- a/include/drm-uapi/virtgpu_drm.h +++ b/include/drm-uapi/virtgpu_drm.h @@ -63,6 +63,7 @@ struct drm_virtgpu_execbuffer { }; #define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */ +#define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */ struct drm_virtgpu_getparam { __u64 param; -- 2.16.2 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests 2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Daniel Stone 2018-03-23 13:46 ` [PATCH i-g-t 2/3] NOMERGE: Update DRM UAPI to latest kernel version Daniel Stone @ 2018-03-23 13:46 ` Daniel Stone 2018-03-23 15:01 ` Ville Syrjälä 2018-03-23 14:53 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Ville Syrjälä 2 siblings, 1 reply; 9+ messages in thread From: Daniel Stone @ 2018-03-23 13:46 UTC (permalink / raw) To: igt-dev, dri-devel Mirroring addfb2, add tests for the new ioctl which will return us information about framebuffers containing multiple buffers, as well as modifiers. Signed-off-by: Daniel Stone <daniels@collabora.com> --- tests/kms_getfb.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/tests/kms_getfb.c b/tests/kms_getfb.c index a9852626..b8583694 100644 --- a/tests/kms_getfb.c +++ b/tests/kms_getfb.c @@ -186,7 +186,96 @@ static void test_duplicate_handles(int fd) do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add.fb_id); gem_close(fd, add.handles[0]); } +} + +static void test_getfb2(int fd) +{ + struct drm_mode_fb_cmd2 add_basic = {}; + + igt_fixture { + struct drm_mode_fb_cmd2 get = {}; + + add_basic.width = 1024; + add_basic.height = 1024; + add_basic.pixel_format = DRM_FORMAT_XRGB8888; + add_basic.pitches[0] = 1024*4; + add_basic.handles[0] = igt_create_bo_with_dimensions(fd, 1024, 1024, + DRM_FORMAT_XRGB8888, 0, 0, NULL, NULL, NULL); + igt_assert(add_basic.handles[0]); + do_ioctl(fd, DRM_IOCTL_MODE_ADDFB2, &add_basic); + + get.fb_id = add_basic.fb_id; + do_ioctl(fd, DRM_IOCTL_MODE_GETFB2, &get); + igt_assert_neq_u32(get.handles[0], 0); + gem_close(fd, get.handles[0]); + } + + igt_subtest("getfb2-handle-zero") { + struct drm_mode_fb_cmd2 get = {}; + do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB2, &get, ENOENT); + } + + igt_subtest("getfb2-handle-closed") { + struct drm_mode_fb_cmd2 add = add_basic; + struct drm_mode_fb_cmd2 get = { }; + + add.handles[0] = igt_create_bo_with_dimensions(fd, 1024, 1024, + DRM_FORMAT_XRGB8888, 0, 0, NULL, NULL, NULL); + igt_assert(add.handles[0]); + do_ioctl(fd, DRM_IOCTL_MODE_ADDFB2, &add); + do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add.fb_id); + get.fb_id = add.fb_id; + do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB2, &get, ENOENT); + gem_close(fd, add.handles[0]); + } + + igt_subtest("getfb2-handle-not-fb") { + struct drm_mode_fb_cmd get = { .fb_id = get_prop_id(fd) }; + igt_require(get.fb_id > 0); + do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB, &get, ENOENT); + } + + igt_subtest("getfb2-accept-ccs") { + struct drm_mode_fb_cmd2 add_ccs = { }; + struct drm_mode_fb_cmd2 get = { }; + int i; + + get_ccs_fb(fd, &add_ccs); + igt_require(add_ccs.fb_id != 0); + get.fb_id = add_ccs.fb_id; + do_ioctl(fd, DRM_IOCTL_MODE_GETFB2, &get); + + igt_assert_eq_u32(get.width, add_ccs.width); + igt_assert_eq_u32(get.height, add_ccs.height); + igt_assert(get.flags & DRM_MODE_FB_MODIFIERS); + + for (i = 0; i < ARRAY_SIZE(get.handles); i++) { + igt_assert_eq_u32(get.pitches[i], add_ccs.pitches[i]); + igt_assert_eq_u32(get.offsets[i], add_ccs.offsets[i]); + if (add_ccs.handles[i] != 0) { + igt_assert_neq_u32(get.handles[i], 0); + igt_assert_neq_u32(get.handles[i], + add_ccs.handles[i]); + igt_assert_eq_u64(get.modifier[i], + add_ccs.modifier[i]); + } else { + igt_assert_eq_u32(get.handles[i], 0); + igt_assert_eq_u64(get.modifier[i], + DRM_FORMAT_MOD_INVALID); + } + } + igt_assert_eq_u32(get.handles[0], get.handles[1]); + + do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &get.fb_id); + gem_close(fd, add_ccs.handles[0]); + gem_close(fd, get.handles[0]); + } + + igt_fixture { + do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add_basic.fb_id); + gem_close(fd, add_basic.handles[0]); + } } igt_main @@ -200,6 +289,8 @@ igt_main test_duplicate_handles(fd); + test_getfb2(fd); + igt_fixture close(fd); } -- 2.16.2 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests 2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests Daniel Stone @ 2018-03-23 15:01 ` Ville Syrjälä 0 siblings, 0 replies; 9+ messages in thread From: Ville Syrjälä @ 2018-03-23 15:01 UTC (permalink / raw) To: Daniel Stone; +Cc: igt-dev, dri-devel On Fri, Mar 23, 2018 at 01:46:16PM +0000, Daniel Stone wrote: > Mirroring addfb2, add tests for the new ioctl which will return us > information about framebuffers containing multiple buffers, as well as > modifiers. lgtm Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Maybe we also want to encode my earlier 'getfb2(&cmd); addfb2(&cmd);' idea into a test? > > Signed-off-by: Daniel Stone <daniels@collabora.com> > --- > tests/kms_getfb.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 91 insertions(+) > > diff --git a/tests/kms_getfb.c b/tests/kms_getfb.c > index a9852626..b8583694 100644 > --- a/tests/kms_getfb.c > +++ b/tests/kms_getfb.c > @@ -186,7 +186,96 @@ static void test_duplicate_handles(int fd) > do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add.fb_id); > gem_close(fd, add.handles[0]); > } > +} > + > +static void test_getfb2(int fd) > +{ > + struct drm_mode_fb_cmd2 add_basic = {}; > + > + igt_fixture { > + struct drm_mode_fb_cmd2 get = {}; > + > + add_basic.width = 1024; > + add_basic.height = 1024; > + add_basic.pixel_format = DRM_FORMAT_XRGB8888; > + add_basic.pitches[0] = 1024*4; > + add_basic.handles[0] = igt_create_bo_with_dimensions(fd, 1024, 1024, > + DRM_FORMAT_XRGB8888, 0, 0, NULL, NULL, NULL); > + igt_assert(add_basic.handles[0]); > + do_ioctl(fd, DRM_IOCTL_MODE_ADDFB2, &add_basic); > + > + get.fb_id = add_basic.fb_id; > + do_ioctl(fd, DRM_IOCTL_MODE_GETFB2, &get); > + igt_assert_neq_u32(get.handles[0], 0); > + gem_close(fd, get.handles[0]); > + } > + > + igt_subtest("getfb2-handle-zero") { > + struct drm_mode_fb_cmd2 get = {}; > + do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB2, &get, ENOENT); > + } > + > + igt_subtest("getfb2-handle-closed") { > + struct drm_mode_fb_cmd2 add = add_basic; > + struct drm_mode_fb_cmd2 get = { }; > + > + add.handles[0] = igt_create_bo_with_dimensions(fd, 1024, 1024, > + DRM_FORMAT_XRGB8888, 0, 0, NULL, NULL, NULL); > + igt_assert(add.handles[0]); > + do_ioctl(fd, DRM_IOCTL_MODE_ADDFB2, &add); > + do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add.fb_id); > > + get.fb_id = add.fb_id; > + do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB2, &get, ENOENT); > + gem_close(fd, add.handles[0]); > + } > + > + igt_subtest("getfb2-handle-not-fb") { > + struct drm_mode_fb_cmd get = { .fb_id = get_prop_id(fd) }; > + igt_require(get.fb_id > 0); > + do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB, &get, ENOENT); > + } > + > + igt_subtest("getfb2-accept-ccs") { > + struct drm_mode_fb_cmd2 add_ccs = { }; > + struct drm_mode_fb_cmd2 get = { }; > + int i; > + > + get_ccs_fb(fd, &add_ccs); > + igt_require(add_ccs.fb_id != 0); > + get.fb_id = add_ccs.fb_id; > + do_ioctl(fd, DRM_IOCTL_MODE_GETFB2, &get); > + > + igt_assert_eq_u32(get.width, add_ccs.width); > + igt_assert_eq_u32(get.height, add_ccs.height); > + igt_assert(get.flags & DRM_MODE_FB_MODIFIERS); > + > + for (i = 0; i < ARRAY_SIZE(get.handles); i++) { > + igt_assert_eq_u32(get.pitches[i], add_ccs.pitches[i]); > + igt_assert_eq_u32(get.offsets[i], add_ccs.offsets[i]); > + if (add_ccs.handles[i] != 0) { > + igt_assert_neq_u32(get.handles[i], 0); > + igt_assert_neq_u32(get.handles[i], > + add_ccs.handles[i]); > + igt_assert_eq_u64(get.modifier[i], > + add_ccs.modifier[i]); > + } else { > + igt_assert_eq_u32(get.handles[i], 0); > + igt_assert_eq_u64(get.modifier[i], > + DRM_FORMAT_MOD_INVALID); > + } > + } > + igt_assert_eq_u32(get.handles[0], get.handles[1]); > + > + do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &get.fb_id); > + gem_close(fd, add_ccs.handles[0]); > + gem_close(fd, get.handles[0]); > + } > + > + igt_fixture { > + do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add_basic.fb_id); > + gem_close(fd, add_basic.handles[0]); > + } > } > > igt_main > @@ -200,6 +289,8 @@ igt_main > > test_duplicate_handles(fd); > > + test_getfb2(fd); > + > igt_fixture > close(fd); > } > -- > 2.16.2 > > _______________________________________________ > igt-dev mailing list > igt-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/igt-dev -- Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper 2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Daniel Stone 2018-03-23 13:46 ` [PATCH i-g-t 2/3] NOMERGE: Update DRM UAPI to latest kernel version Daniel Stone 2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests Daniel Stone @ 2018-03-23 14:53 ` Ville Syrjälä 2018-03-23 14:55 ` Daniel Stone 2 siblings, 1 reply; 9+ messages in thread From: Ville Syrjälä @ 2018-03-23 14:53 UTC (permalink / raw) To: Daniel Stone; +Cc: igt-dev, dri-devel On Fri, Mar 23, 2018 at 01:46:14PM +0000, Daniel Stone wrote: > We'll want to reuse this, so split it out into a (smaller!) helper. > > Signed-off-by: Daniel Stone <daniels@collabora.com> > --- > tests/kms_getfb.c | 36 +++++++++++++++++++----------------- > 1 file changed, 19 insertions(+), 17 deletions(-) > > diff --git a/tests/kms_getfb.c b/tests/kms_getfb.c > index c5968e75..a9852626 100644 > --- a/tests/kms_getfb.c > +++ b/tests/kms_getfb.c > @@ -72,6 +72,23 @@ static void get_ccs_fb(int fd, struct drm_mode_fb_cmd2 *ret) > gem_close(fd, add.handles[0]); > } > > +/** > + * Find and return an arbitrary valid property ID. > + */ > +static uint32_t get_prop_id(int fd) get_any_prop_id() or something like that maybe? Either way Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > +{ > + igt_display_t display; > + > + igt_display_init(&display, fd); > + for (int i = 0; i < display.n_outputs; i++) { > + igt_output_t *output = &display.outputs[i]; > + if (output->props[IGT_CONNECTOR_DPMS] != 0) > + return output->props[IGT_CONNECTOR_DPMS]; > + } > + > + return 0; > +} > + > static void test_handle_input(int fd) > { > struct drm_mode_fb_cmd2 add = {}; > @@ -111,23 +128,8 @@ static void test_handle_input(int fd) > } > > igt_subtest("getfb-handle-not-fb") { > - struct drm_mode_fb_cmd get = { }; > - uint32_t prop_id = 0; > - igt_display_t display; > - > - /* Find a valid property ID to use. */ > - igt_display_init(&display, fd); > - for (int i = 0; i < display.n_outputs; i++) { > - igt_output_t *output = &display.outputs[i]; > - > - if (output->props[IGT_CONNECTOR_DPMS] != 0) { > - prop_id = output->props[IGT_CONNECTOR_DPMS]; > - break; > - } > - } > - igt_require(prop_id > 0); > - > - get.fb_id = prop_id; > + struct drm_mode_fb_cmd get = { .fb_id = get_prop_id(fd) }; > + igt_require(get.fb_id > 0); > do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB, &get, ENOENT); > } > } > -- > 2.16.2 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrjälä Intel OTC _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper 2018-03-23 14:53 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Ville Syrjälä @ 2018-03-23 14:55 ` Daniel Stone 0 siblings, 0 replies; 9+ messages in thread From: Daniel Stone @ 2018-03-23 14:55 UTC (permalink / raw) To: Ville Syrjälä; +Cc: igt-dev, dri-devel On 23 March 2018 at 14:53, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote: > On Fri, Mar 23, 2018 at 01:46:14PM +0000, Daniel Stone wrote: >> +/** >> + * Find and return an arbitrary valid property ID. >> + */ >> +static uint32_t get_prop_id(int fd) > > get_any_prop_id() or something like that maybe? Yeah, a good choice of colour. :) Cheers, Daniel _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [igt-dev] [PATCH 0/8] Add GetFB2 ioctl 2018-03-23 13:42 [igt-dev] [PATCH 0/8] Add GetFB2 ioctl Daniel Stone 2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Daniel Stone @ 2018-03-23 13:51 ` Daniel Stone 1 sibling, 0 replies; 9+ messages in thread From: Daniel Stone @ 2018-03-23 13:51 UTC (permalink / raw) To: dri-devel, igt-dev On 23 March 2018 at 13:42, Daniel Stone <daniel@fooishbar.org> wrote: > This submission rights that historical wrong, which allows Xorg > -background none to continue to work in the face of exotic buffers. > I've written patches to Xorg to use this as UABI verification, and > I'll post a link to that very shortly. Et voila: https://lists.x.org/archives/xorg-devel/2018-March/056363.html Cheers, Daniel _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 9+ messages in thread
* [igt-dev] [PATCH i-g-t 1/3] include: Update DRM uAPI headers @ 2018-03-30 15:49 Daniel Stone 2018-03-30 15:49 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests Daniel Stone 0 siblings, 1 reply; 9+ messages in thread From: Daniel Stone @ 2018-03-30 15:49 UTC (permalink / raw) To: igt-dev Taken from the drm-next pull for 4.17-rc1 (694f54f680f7). Signed-off-by: Daniel Stone <daniels@collabora.com> --- include/drm-uapi/amdgpu_drm.h | 3 +++ include/drm-uapi/drm_mode.h | 9 ++++++--- include/drm-uapi/etnaviv_drm.h | 6 ++++++ include/drm-uapi/msm_drm.h | 2 ++ include/drm-uapi/virtgpu_drm.h | 1 + 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/drm-uapi/amdgpu_drm.h b/include/drm-uapi/amdgpu_drm.h index 1816bd82..c363b67f 100644 --- a/include/drm-uapi/amdgpu_drm.h +++ b/include/drm-uapi/amdgpu_drm.h @@ -618,6 +618,8 @@ struct drm_amdgpu_cs_chunk_data { #define AMDGPU_INFO_FW_SOS 0x0c /* Subquery id: Query PSP ASD firmware version */ #define AMDGPU_INFO_FW_ASD 0x0d + /* Subquery id: Query VCN firmware version */ + #define AMDGPU_INFO_FW_VCN 0x0e /* number of bytes moved for TTM migration */ #define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f /* the used VRAM size */ @@ -806,6 +808,7 @@ struct drm_amdgpu_info_firmware { #define AMDGPU_VRAM_TYPE_GDDR5 5 #define AMDGPU_VRAM_TYPE_HBM 6 #define AMDGPU_VRAM_TYPE_DDR3 7 +#define AMDGPU_VRAM_TYPE_DDR4 8 struct drm_amdgpu_info_device { /** PCI Device ID */ diff --git a/include/drm-uapi/drm_mode.h b/include/drm-uapi/drm_mode.h index 2c575794..50bcf421 100644 --- a/include/drm-uapi/drm_mode.h +++ b/include/drm-uapi/drm_mode.h @@ -363,7 +363,7 @@ struct drm_mode_get_connector { __u32 pad; }; -#define DRM_MODE_PROP_PENDING (1<<0) +#define DRM_MODE_PROP_PENDING (1<<0) /* deprecated, do not use */ #define DRM_MODE_PROP_RANGE (1<<1) #define DRM_MODE_PROP_IMMUTABLE (1<<2) #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ @@ -598,8 +598,11 @@ struct drm_mode_crtc_lut { }; struct drm_color_ctm { - /* Conversion matrix in S31.32 format. */ - __s64 matrix[9]; + /* + * Conversion matrix in S31.32 sign-magnitude + * (not two's complement!) format. + */ + __u64 matrix[9]; }; struct drm_color_lut { diff --git a/include/drm-uapi/etnaviv_drm.h b/include/drm-uapi/etnaviv_drm.h index e9b997a0..0d5c49dc 100644 --- a/include/drm-uapi/etnaviv_drm.h +++ b/include/drm-uapi/etnaviv_drm.h @@ -55,6 +55,12 @@ struct drm_etnaviv_timespec { #define ETNAVIV_PARAM_GPU_FEATURES_4 0x07 #define ETNAVIV_PARAM_GPU_FEATURES_5 0x08 #define ETNAVIV_PARAM_GPU_FEATURES_6 0x09 +#define ETNAVIV_PARAM_GPU_FEATURES_7 0x0a +#define ETNAVIV_PARAM_GPU_FEATURES_8 0x0b +#define ETNAVIV_PARAM_GPU_FEATURES_9 0x0c +#define ETNAVIV_PARAM_GPU_FEATURES_10 0x0d +#define ETNAVIV_PARAM_GPU_FEATURES_11 0x0e +#define ETNAVIV_PARAM_GPU_FEATURES_12 0x0f #define ETNAVIV_PARAM_GPU_STREAM_COUNT 0x10 #define ETNAVIV_PARAM_GPU_REGISTER_MAX 0x11 diff --git a/include/drm-uapi/msm_drm.h b/include/drm-uapi/msm_drm.h index bbbaffad..c06d0a5b 100644 --- a/include/drm-uapi/msm_drm.h +++ b/include/drm-uapi/msm_drm.h @@ -201,10 +201,12 @@ struct drm_msm_gem_submit_bo { #define MSM_SUBMIT_NO_IMPLICIT 0x80000000 /* disable implicit sync */ #define MSM_SUBMIT_FENCE_FD_IN 0x40000000 /* enable input fence_fd */ #define MSM_SUBMIT_FENCE_FD_OUT 0x20000000 /* enable output fence_fd */ +#define MSM_SUBMIT_SUDO 0x10000000 /* run submitted cmds from RB */ #define MSM_SUBMIT_FLAGS ( \ MSM_SUBMIT_NO_IMPLICIT | \ MSM_SUBMIT_FENCE_FD_IN | \ MSM_SUBMIT_FENCE_FD_OUT | \ + MSM_SUBMIT_SUDO | \ 0) /* Each cmdstream submit consists of a table of buffers involved, and diff --git a/include/drm-uapi/virtgpu_drm.h b/include/drm-uapi/virtgpu_drm.h index 91a31ffe..9a781f06 100644 --- a/include/drm-uapi/virtgpu_drm.h +++ b/include/drm-uapi/virtgpu_drm.h @@ -63,6 +63,7 @@ struct drm_virtgpu_execbuffer { }; #define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */ +#define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */ struct drm_virtgpu_getparam { __u64 param; -- 2.17.0.rc1 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests 2018-03-30 15:49 [igt-dev] [PATCH i-g-t 1/3] include: Update DRM uAPI headers Daniel Stone @ 2018-03-30 15:49 ` Daniel Stone 0 siblings, 0 replies; 9+ messages in thread From: Daniel Stone @ 2018-03-30 15:49 UTC (permalink / raw) To: igt-dev Mirroring addfb2, add tests for the new ioctl which will return us information about framebuffers containing multiple buffers, as well as modifiers. Signed-off-by: Daniel Stone <daniels@collabora.com> --- tests/kms_getfb.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/tests/kms_getfb.c b/tests/kms_getfb.c index 81d796a4..b9a46420 100644 --- a/tests/kms_getfb.c +++ b/tests/kms_getfb.c @@ -191,7 +191,96 @@ static void test_duplicate_handles(int fd) do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add.fb_id); gem_close(fd, add.handles[0]); } +} + +static void test_getfb2(int fd) +{ + struct drm_mode_fb_cmd2 add_basic = {}; + struct drm_mode_fb_cmd2 get = {}; + + igt_fixture { + int ret; + + add_basic.width = 1024; + add_basic.height = 1024; + add_basic.pixel_format = DRM_FORMAT_XRGB8888; + add_basic.pitches[0] = 1024*4; + add_basic.handles[0] = igt_create_bo_with_dimensions(fd, 1024, 1024, + DRM_FORMAT_XRGB8888, 0, 0, NULL, NULL, NULL); + do_ioctl(fd, DRM_IOCTL_MODE_ADDFB2, &add_basic); + get.fb_id = add_basic.fb_id; + ret = drmIoctl(fd, DRM_IOCTL_MODE_GETFB2, &get); + igt_require(ret == 0); + igt_assert_neq_u32(get.handles[0], 0); + gem_close(fd, get.handles[0]); + } + + igt_subtest("getfb2-handle-zero") { + struct drm_mode_fb_cmd2 get = {}; + do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB2, &get, ENOENT); + } + + igt_subtest("getfb2-handle-closed") { + struct drm_mode_fb_cmd2 add = add_basic; + struct drm_mode_fb_cmd2 get = { }; + + add.handles[0] = igt_create_bo_with_dimensions(fd, 1024, 1024, + DRM_FORMAT_XRGB8888, 0, 0, NULL, NULL, NULL); + igt_assert(add.handles[0]); + do_ioctl(fd, DRM_IOCTL_MODE_ADDFB2, &add); + do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &add.fb_id); + + get.fb_id = add.fb_id; + do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB2, &get, ENOENT); + gem_close(fd, add.handles[0]); + } + + igt_subtest("getfb2-handle-not-fb") { + struct drm_mode_fb_cmd get = { .fb_id = get_any_prop_id(fd) }; + igt_require(get.fb_id > 0); + do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB, &get, ENOENT); + } + + igt_subtest("getfb2-accept-ccs") { + struct drm_mode_fb_cmd2 add_ccs = { }; + struct drm_mode_fb_cmd2 get = { }; + int i; + get_ccs_fb(fd, &add_ccs); + igt_require(add_ccs.fb_id != 0); + get.fb_id = add_ccs.fb_id; + do_ioctl(fd, DRM_IOCTL_MODE_GETFB2, &get); + + igt_assert_eq_u32(get.width, add_ccs.width); + igt_assert_eq_u32(get.height, add_ccs.height); + igt_assert(get.flags & DRM_MODE_FB_MODIFIERS); + + for (i = 0; i < ARRAY_SIZE(get.handles); i++) { + igt_assert_eq_u32(get.pitches[i], add_ccs.pitches[i]); + igt_assert_eq_u32(get.offsets[i], add_ccs.offsets[i]); + if (add_ccs.handles[i] != 0) { + igt_assert_neq_u32(get.handles[i], 0); + igt_assert_neq_u32(get.handles[i], + add_ccs.handles[i]); + igt_assert_eq_u64(get.modifier[i], + add_ccs.modifier[i]); + } else { + igt_assert_eq_u32(get.handles[i], 0); + igt_assert_eq_u64(get.modifier[i], + DRM_FORMAT_MOD_INVALID); + } + } + igt_assert_eq_u32(get.handles[0], get.handles[1]); + + do_ioctl(fd, DRM_IOCTL_MODE_RMFB, &get.fb_id); + gem_close(fd, add_ccs.handles[0]); + gem_close(fd, get.handles[0]); + } + + igt_fixture { + drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &add_basic.fb_id); + gem_close(fd, add_basic.handles[0]); + } } igt_main @@ -207,6 +296,9 @@ igt_main igt_subtest_group test_duplicate_handles(fd); + igt_subtest_group + test_getfb2(fd); + igt_fixture close(fd); } -- 2.17.0.rc1 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-03-30 15:49 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-03-23 13:42 [igt-dev] [PATCH 0/8] Add GetFB2 ioctl Daniel Stone 2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Daniel Stone 2018-03-23 13:46 ` [PATCH i-g-t 2/3] NOMERGE: Update DRM UAPI to latest kernel version Daniel Stone 2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests Daniel Stone 2018-03-23 15:01 ` Ville Syrjälä 2018-03-23 14:53 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Ville Syrjälä 2018-03-23 14:55 ` Daniel Stone 2018-03-23 13:51 ` [igt-dev] [PATCH 0/8] Add GetFB2 ioctl Daniel Stone -- strict thread matches above, loose matches on Subject: below -- 2018-03-30 15:49 [igt-dev] [PATCH i-g-t 1/3] include: Update DRM uAPI headers Daniel Stone 2018-03-30 15:49 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests Daniel Stone
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox