[Intel-gfx] [PATCH i-g-t] tests/kms_cursor_crc: Open DRM device with DRIVER_ANY
So that this test can be run in drivers other than i915. Remove devid and only check it if the driver is i915. Signed-off-by: Haneen Mohammed --- tests/kms_cursor_crc.c | 31 +-- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index a164839e..870d7fec 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -59,7 +59,6 @@ typedef struct { int curw, curh; /* cursor size */ int cursor_max_w, cursor_max_h; igt_pipe_crc_t *pipe_crc; - uint32_t devid; unsigned flags; } data_t; @@ -108,6 +107,13 @@ static void cursor_disable(data_t *data) static bool chv_cursor_broken(data_t *data, int x) { + uint32_t devid; + + if (!is_i915_device(data->drm_fd)) + return false; + + devid = intel_get_drm_devid(data->drm_fd); + /* * CHV gets a FIFO underrun on pipe C when cursor x coordinate * is negative and the cursor visible. @@ -121,7 +127,7 @@ static bool chv_cursor_broken(data_t *data, int x) if (x >= 0) return false; - return IS_CHERRYVIEW(data->devid) && data->pipe == PIPE_C; + return IS_CHERRYVIEW(devid) && data->pipe == PIPE_C; } static bool cursor_visible(data_t *data, int x, int y) @@ -459,8 +465,15 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h) igt_put_cairo_ctx(data->drm_fd, &data->fb, cr); } -static bool has_nonsquare_cursors(uint32_t devid) +static bool has_nonsquare_cursors(data_t *data) { + uint32_t devid; + + if (!is_i915_device(data->drm_fd)) + return true; + + devid = intel_get_drm_devid(data->drm_fd); + /* * Test non-square cursors a bit on the platforms * that support such things. @@ -616,19 +629,19 @@ static void run_test_generic(data_t *data) /* Using created cursor FBs to test cursor support */ igt_subtest_f("cursor-%dx%d-onscreen", w, h) { - igt_require(has_nonsquare_cursors(data->devid)); + igt_require(has_nonsquare_cursors(data)); run_test(data, test_crc_onscreen, w, h); } igt_subtest_f("cursor-%dx%d-offscreen", w, h) { - igt_require(has_nonsquare_cursors(data->devid)); + igt_require(has_nonsquare_cursors(data)); run_test(data, test_crc_offscreen, w, h); } igt_subtest_f("cursor-%dx%d-sliding", w, h) { - igt_require(has_nonsquare_cursors(data->devid)); + igt_require(has_nonsquare_cursors(data)); run_test(data, test_crc_sliding, w, h); } igt_subtest_f("cursor-%dx%d-random", w, h) { - igt_require(has_nonsquare_cursors(data->devid)); + igt_require(has_nonsquare_cursors(data)); run_test(data, test_crc_random, w, h); } @@ -647,9 +660,7 @@ igt_main igt_skip_on_simulation(); igt_fixture { - data.drm_fd = drm_open_driver_master(DRIVER_INTEL); - - data.devid = intel_get_drm_devid(data.drm_fd); + data.drm_fd = drm_open_driver_master(DRIVER_ANY); ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_WIDTH, &cursor_width); igt_assert(ret == 0 || errno == EINVAL); -- 2.17.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH i-g-t V2] tests/kms_cursor_crc: Open DRM device with DRIVER_ANY
So that this test can be run in drivers other than i915. Remove devid and only check it if the driver is i915. Signed-off-by: Haneen Mohammed --- changes in v2: - return false for has_nonsquare_cursors() when driver not i915. tests/kms_cursor_crc.c | 31 +-- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index a164839e..99946b1a 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -59,7 +59,6 @@ typedef struct { int curw, curh; /* cursor size */ int cursor_max_w, cursor_max_h; igt_pipe_crc_t *pipe_crc; - uint32_t devid; unsigned flags; } data_t; @@ -108,6 +107,13 @@ static void cursor_disable(data_t *data) static bool chv_cursor_broken(data_t *data, int x) { + uint32_t devid; + + if (!is_i915_device(data->drm_fd)) + return false; + + devid = intel_get_drm_devid(data->drm_fd); + /* * CHV gets a FIFO underrun on pipe C when cursor x coordinate * is negative and the cursor visible. @@ -121,7 +127,7 @@ static bool chv_cursor_broken(data_t *data, int x) if (x >= 0) return false; - return IS_CHERRYVIEW(data->devid) && data->pipe == PIPE_C; + return IS_CHERRYVIEW(devid) && data->pipe == PIPE_C; } static bool cursor_visible(data_t *data, int x, int y) @@ -459,8 +465,15 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h) igt_put_cairo_ctx(data->drm_fd, &data->fb, cr); } -static bool has_nonsquare_cursors(uint32_t devid) +static bool has_nonsquare_cursors(data_t *data) { + uint32_t devid; + + if (!is_i915_device(data->drm_fd)) + return false; + + devid = intel_get_drm_devid(data->drm_fd); + /* * Test non-square cursors a bit on the platforms * that support such things. @@ -616,19 +629,19 @@ static void run_test_generic(data_t *data) /* Using created cursor FBs to test cursor support */ igt_subtest_f("cursor-%dx%d-onscreen", w, h) { - igt_require(has_nonsquare_cursors(data->devid)); + igt_require(has_nonsquare_cursors(data)); run_test(data, test_crc_onscreen, w, h); } igt_subtest_f("cursor-%dx%d-offscreen", w, h) { - igt_require(has_nonsquare_cursors(data->devid)); + igt_require(has_nonsquare_cursors(data)); run_test(data, test_crc_offscreen, w, h); } igt_subtest_f("cursor-%dx%d-sliding", w, h) { - igt_require(has_nonsquare_cursors(data->devid)); + igt_require(has_nonsquare_cursors(data)); run_test(data, test_crc_sliding, w, h); } igt_subtest_f("cursor-%dx%d-random", w, h) { - igt_require(has_nonsquare_cursors(data->devid)); + igt_require(has_nonsquare_cursors(data)); run_test(data, test_crc_random, w, h); } @@ -647,9 +660,7 @@ igt_main igt_skip_on_simulation(); igt_fixture { - data.drm_fd = drm_open_driver_master(DRIVER_INTEL); - - data.devid = intel_get_drm_devid(data.drm_fd); + data.drm_fd = drm_open_driver_master(DRIVER_ANY); ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_WIDTH, &cursor_width); igt_assert(ret == 0 || errno == EINVAL); -- 2.17.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH V2 1/3] drm/vkms/crc: Implement verify_crc_source callback
On Tue, Aug 21, 2018 at 09:53:11AM +0530, Kumar, Mahesh wrote: > Hi Haneen, > > > On 8/21/2018 4:09 AM, Haneen Mohammed wrote: > > On Tue, Aug 14, 2018 at 08:31:03AM +0530, Mahesh Kumar wrote: > > > This patch implements "verify_crc_source" callback function for > > > Virtual KMS drm driver. > > > > > > Changes Since V1: > > > - update values_cnt in verify_crc_source > > > > > > Cc: Haneen Mohammed > > > Signed-off-by: Mahesh Kumar > > > --- > > > drivers/gpu/drm/vkms/vkms_crc.c | 38 > > > ++ > > > drivers/gpu/drm/vkms/vkms_crtc.c | 1 + > > > drivers/gpu/drm/vkms/vkms_drv.h | 2 ++ > > > 3 files changed, 37 insertions(+), 4 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/vkms/vkms_crc.c > > > b/drivers/gpu/drm/vkms/vkms_crc.c > > > index 37d717f38e3c..b2a484b4e2ad 100644 > > > --- a/drivers/gpu/drm/vkms/vkms_crc.c > > > +++ b/drivers/gpu/drm/vkms/vkms_crc.c > > > @@ -70,6 +70,37 @@ void vkms_crc_work_handle(struct work_struct *work) > > > drm_crtc_add_crc_entry(crtc, true, crtc_state->n_frame, &crc32); > > > } > > > +static int vkms_crc_parse_source(const char *src_name, bool *enabled) > > > +{ > > > + int ret = 0; > > > + > > > + if (!src_name) { > > > + *enabled = false; > > > + } else if (strcmp(src_name, "auto") == 0) { > > > + *enabled = true; > > > + } else { > > > + *enabled = false; > > > + ret = -EINVAL; > > > + } > > > + > > > + return ret; > > > +} > > > + > > > +int vkms_verify_crc_source(struct drm_crtc *crtc, const char *src_name, > > > +size_t *values_cnt) > > > +{ > > > + bool enabled; > > > + > > > + if (vkms_crc_parse_source(src_name, &enabled) < 0) { > > > + DRM_DEBUG_DRIVER("unknown source %s\n", src_name); > > > + return -EINVAL; > > > + } > > > + > > > + *values_cnt = 1; > > > + > > > + return 0; > > > +} > > > + > > > int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name, > > > size_t *values_cnt) > > > { > > > @@ -78,10 +109,9 @@ int vkms_set_crc_source(struct drm_crtc *crtc, const > > > char *src_name, > > > unsigned long flags; > > > int ret = 0; > > > - if (src_name && strcmp(src_name, "auto") == 0) > > > - enabled = true; > > > - else if (src_name) > > > - ret = -EINVAL; > > > + ret = vkms_crc_parse_source(src_name, &enabled); > > > + if (ret) > > > + return ret; > > I think the return value after vkms_crc_parse_source should be called > > once instead at the end of vkms_set_crc_source otherwise crc_enabled > > won't be updated? > Here I'm assuming if src_name is wrong we don't need to proceed further, let > the CRC generation to continue whatever it was doing (enabled or disabled). > But anyway that is changing the original design, will remove above return to > keep the behavior same. > > -Mahesh hm I'm not really sure if my approach was the right way, but if it wasn't then I think maybe this change would be better if it was either in a separate patch or here with more details Thank you, Haneen > > > > - Haneen > > > > > *values_cnt = 1; > > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c > > > b/drivers/gpu/drm/vkms/vkms_crtc.c > > > index bfe6e0312cc4..9d0b1a325a78 100644 > > > --- a/drivers/gpu/drm/vkms/vkms_crtc.c > > > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c > > > @@ -140,6 +140,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { > > > .enable_vblank = vkms_enable_vblank, > > > .disable_vblank = vkms_disable_vblank, > > > .set_crc_source = vkms_set_crc_source, > > > + .verify_crc_source = vkms_verify_crc_source, > > > }; > > > static void vkms_crtc_atomic_enable(struct drm_crtc *crtc, > > > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h > > > b/drivers/gpu/drm/vkms/vkms_drv.h > > > index f156c930366a..090c5e4f5544 100644 > > > --- a/drivers/gpu/drm/vkms/vkms_drv.h > > > +++ b/drivers/gpu/drm/vkms/vkms_drv.h > > > @@ -125,6 +125,8 @@ void vkms_gem_vunmap(struct drm_gem_object *obj); > > > /* CRC Support */ > > > int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name, > > > size_t *values_cnt); > > > +int vkms_verify_crc_source(struct drm_crtc *crtc, const char > > > *source_name, > > > +size_t *values_cnt); > > > void vkms_crc_work_handle(struct work_struct *work); > > > #endif /* _VKMS_DRV_H_ */ > > > -- > > > 2.16.2 > > > > ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH V2 1/3] drm/vkms/crc: Implement verify_crc_source callback
On Tue, Aug 14, 2018 at 08:31:03AM +0530, Mahesh Kumar wrote: > This patch implements "verify_crc_source" callback function for > Virtual KMS drm driver. > > Changes Since V1: > - update values_cnt in verify_crc_source > > Cc: Haneen Mohammed > Signed-off-by: Mahesh Kumar > --- > drivers/gpu/drm/vkms/vkms_crc.c | 38 ++ > drivers/gpu/drm/vkms/vkms_crtc.c | 1 + > drivers/gpu/drm/vkms/vkms_drv.h | 2 ++ > 3 files changed, 37 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c > index 37d717f38e3c..b2a484b4e2ad 100644 > --- a/drivers/gpu/drm/vkms/vkms_crc.c > +++ b/drivers/gpu/drm/vkms/vkms_crc.c > @@ -70,6 +70,37 @@ void vkms_crc_work_handle(struct work_struct *work) > drm_crtc_add_crc_entry(crtc, true, crtc_state->n_frame, &crc32); > } > > +static int vkms_crc_parse_source(const char *src_name, bool *enabled) > +{ > + int ret = 0; > + > + if (!src_name) { > + *enabled = false; > + } else if (strcmp(src_name, "auto") == 0) { > + *enabled = true; > + } else { > + *enabled = false; > + ret = -EINVAL; > + } > + > + return ret; > +} > + > +int vkms_verify_crc_source(struct drm_crtc *crtc, const char *src_name, > +size_t *values_cnt) > +{ > + bool enabled; > + > + if (vkms_crc_parse_source(src_name, &enabled) < 0) { > + DRM_DEBUG_DRIVER("unknown source %s\n", src_name); > + return -EINVAL; > + } > + > + *values_cnt = 1; > + > + return 0; > +} > + > int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name, > size_t *values_cnt) > { > @@ -78,10 +109,9 @@ int vkms_set_crc_source(struct drm_crtc *crtc, const char > *src_name, > unsigned long flags; > int ret = 0; > > - if (src_name && strcmp(src_name, "auto") == 0) > - enabled = true; > - else if (src_name) > - ret = -EINVAL; > + ret = vkms_crc_parse_source(src_name, &enabled); > + if (ret) > + return ret; I think the return value after vkms_crc_parse_source should be called once instead at the end of vkms_set_crc_source otherwise crc_enabled won't be updated? - Haneen > > *values_cnt = 1; > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c > b/drivers/gpu/drm/vkms/vkms_crtc.c > index bfe6e0312cc4..9d0b1a325a78 100644 > --- a/drivers/gpu/drm/vkms/vkms_crtc.c > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c > @@ -140,6 +140,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { > .enable_vblank = vkms_enable_vblank, > .disable_vblank = vkms_disable_vblank, > .set_crc_source = vkms_set_crc_source, > + .verify_crc_source = vkms_verify_crc_source, > }; > > static void vkms_crtc_atomic_enable(struct drm_crtc *crtc, > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h > index f156c930366a..090c5e4f5544 100644 > --- a/drivers/gpu/drm/vkms/vkms_drv.h > +++ b/drivers/gpu/drm/vkms/vkms_drv.h > @@ -125,6 +125,8 @@ void vkms_gem_vunmap(struct drm_gem_object *obj); > /* CRC Support */ > int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name, > size_t *values_cnt); > +int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name, > +size_t *values_cnt); > void vkms_crc_work_handle(struct work_struct *work); > > #endif /* _VKMS_DRV_H_ */ > -- > 2.16.2 > ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH V3 1/3] drm/vkms/crc: Implement verify_crc_source callback
On Tue, Aug 21, 2018 at 10:04:01AM +0530, Mahesh Kumar wrote: > This patch implements "verify_crc_source" callback function for > Virtual KMS drm driver. > > Changes Since V1: > - update values_cnt in verify_crc_source > Changes Since V2: > - don't return early from set_crc_source to keep behavior same (Haneen) > > Cc: Haneen Mohammed > Signed-off-by: Mahesh Kumar > --- Reviewed-by: Haneen Mohammed > drivers/gpu/drm/vkms/vkms_crc.c | 36 > drivers/gpu/drm/vkms/vkms_crtc.c | 1 + > drivers/gpu/drm/vkms/vkms_drv.h | 2 ++ > 3 files changed, 35 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c > index 37d717f38e3c..68421d3d809a 100644 > --- a/drivers/gpu/drm/vkms/vkms_crc.c > +++ b/drivers/gpu/drm/vkms/vkms_crc.c > @@ -70,6 +70,37 @@ void vkms_crc_work_handle(struct work_struct *work) > drm_crtc_add_crc_entry(crtc, true, crtc_state->n_frame, &crc32); > } > > +static int vkms_crc_parse_source(const char *src_name, bool *enabled) > +{ > + int ret = 0; > + > + if (!src_name) { > + *enabled = false; > + } else if (strcmp(src_name, "auto") == 0) { > + *enabled = true; > + } else { > + *enabled = false; > + ret = -EINVAL; > + } > + > + return ret; > +} > + > +int vkms_verify_crc_source(struct drm_crtc *crtc, const char *src_name, > +size_t *values_cnt) > +{ > + bool enabled; > + > + if (vkms_crc_parse_source(src_name, &enabled) < 0) { > + DRM_DEBUG_DRIVER("unknown source %s\n", src_name); > + return -EINVAL; > + } > + > + *values_cnt = 1; > + > + return 0; > +} > + > int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name, > size_t *values_cnt) > { > @@ -78,10 +109,7 @@ int vkms_set_crc_source(struct drm_crtc *crtc, const char > *src_name, > unsigned long flags; > int ret = 0; > > - if (src_name && strcmp(src_name, "auto") == 0) > - enabled = true; > - else if (src_name) > - ret = -EINVAL; > + ret = vkms_crc_parse_source(src_name, &enabled); > > *values_cnt = 1; > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c > b/drivers/gpu/drm/vkms/vkms_crtc.c > index bfe6e0312cc4..9d0b1a325a78 100644 > --- a/drivers/gpu/drm/vkms/vkms_crtc.c > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c > @@ -140,6 +140,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { > .enable_vblank = vkms_enable_vblank, > .disable_vblank = vkms_disable_vblank, > .set_crc_source = vkms_set_crc_source, > + .verify_crc_source = vkms_verify_crc_source, > }; > > static void vkms_crtc_atomic_enable(struct drm_crtc *crtc, > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h > index f156c930366a..090c5e4f5544 100644 > --- a/drivers/gpu/drm/vkms/vkms_drv.h > +++ b/drivers/gpu/drm/vkms/vkms_drv.h > @@ -125,6 +125,8 @@ void vkms_gem_vunmap(struct drm_gem_object *obj); > /* CRC Support */ > int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name, > size_t *values_cnt); > +int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name, > +size_t *values_cnt); > void vkms_crc_work_handle(struct work_struct *work); > > #endif /* _VKMS_DRV_H_ */ > -- > 2.16.2 > ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx