lib/igt_kms: Convert properties to be more atomic-like.
cover lib/igt_kms: Convert properties to be more atomic-like.
Instead of having to special case each property when it's added, I want to make sure that any test can add arbitrary properties without having to add too much code. Some of the members I want to expose directly, and I also add a way to set a blob as property for planes and pipes, which will be useful for the upcoming plane color management stuff.
Maarten Lankhorst (4):
tests: Stop looking at plane private members lib/igt_kms: Rework connector properties to be more atomic lib/igt_kms: Rework plane properties to be more atomic lib/igt_kms: Rework pipe properties to be more atomic
lib/igt_kms.c | 539 ++++++++++++++++++-------------------- lib/igt_kms.h | 152 +++++------ tests/kms_atomic_interruptible.c | 20 +- tests/kms_atomic_transition.c | 119 ++++----- tests/kms_busy.c | 5 +- tests/kms_concurrent.c | 4 +- tests/kms_crtc_background_color.c | 2 +- tests/kms_cursor_legacy.c | 6 +- tests/kms_fbc_crc.c | 3 +- tests/kms_panel_fitting.c | 16 +- tests/kms_plane_scaling.c | 14 +- tests/kms_rmfb.c | 2 +- tests/kms_rotation_crc.c | 14 +- 13 files changed, 414 insertions(+), 482 deletions(-)
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/6 tests: Stop looking at plane private members
Most of these tests have no reason to look at those members, so try other ways of getting the information.
--- lib/igt_kms.h | 21 ++++++++ tests/kms_atomic_transition.c | 117 +++++++++++++++++++++--------------------- tests/kms_busy.c | 5 +- tests/kms_concurrent.c | 4 +- tests/kms_cursor_legacy.c | 6 +-- tests/kms_fbc_crc.c | 3 +- tests/kms_panel_fitting.c | 14 +---- tests/kms_plane_scaling.c | 14 +---- tests/kms_rmfb.c | 2 +- tests/kms_rotation_crc.c | 10 ---- 10 files changed, 93 insertions(+), 103 deletions(-)
lib/igt_kms.h +21 -0
@@ -556,6 +556,27 @@ static inline bool igt_output_is_connected(igt_output_t *output)igt_assert_lt (0 ,drmModeAtomicAddProperty (req, output->config.connector->connector_id,\ output->config.atomic_props_connector[prop], value)) +/* +* igt_pipe_refresh: +* @display: a pointer to an #igt_display_t structure +* @pipe: Pipe to refresh +* @force: Should be set to true if mode_blob is no longer considered +* to be valid, for example after doing an atomic commit during fork or closing display fd. +* +* Requests the pipe to be part of the state on next update. +* This is useful when state may have been out of sync after +* a fork, or we just want to be sure the pipe is included +* in the next commit. + */ +static inline void +igt_pipe_refresh (igt_display_t *display,enum pipe pipe,bool force) +{ +if (force) + display->pipes[pipe].mode_blob =0 ; + + display->pipes[pipe].mode_changed = true; +} +void igt_enable_connectors (void );void igt_reset_connectors (void );
tests/kms_atomic_transition.c +59 -58
254 lines not on this page · raw message
tests/kms_busy.c +4 -1
@@ -146,7 +146,10 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,if (modeset) {igt_set_module_param_int ("enable_hangcheck" ,1 ); - dpy->pipes[pipe].mode_blob =0 ; + +/* Clear old mode blob. */ +igt_pipe_refresh (dpy, pipe, true); +igt_output_set_pipe (output, pipe);igt_display_commit2 (dpy,COMMIT_ATOMIC ); }
tests/kms_concurrent.c +2 -2
@@ -91,7 +91,7 @@ static void test_fini(data_t *data, enum pipe pipe, int n_planes, {int i; - data->display.pipes[pipe].mode_blob =0 ; +igt_pipe_refresh (&data->display, pipe, true);for (i =0 ; i < n_planes; i++) {igt_plane_t *plane = data->plane[i];
@@ -292,7 +292,7 @@ test_resolution_with_output(data_t *data, enum pipe pipe, igt_output_t *output) i =0 ;while (i < iterations || loop_forever) { - data->display.pipes[pipe].mode_blob =0 ; +igt_pipe_refresh (&data->display, pipe, true); mode_hi =igt_output_get_mode (output); mode_lo =get_lowres_mode (data, mode_hi, output);
tests/kms_cursor_legacy.c +3 -3
@@ -784,7 +784,7 @@ static bool skip_on_unsupported_nonblocking_modeset(igt_display_t *display)/* Force the next state to update all crtc's, to synchronize with the nonblocking modeset. */ for_each_pipe (display, pipe) - display->pipes[pipe].mode_changed = true; +igt_pipe_refresh (display, pipe, false);return false; }
@@ -971,8 +971,8 @@ static void two_screens_flip_vs_cursor(igt_display_t *display, int nloops, boolif (modeset) {/* wait for pending modeset and page flip to complete, to prevent -EBUSY */ - display->pipes[pipe].mode_changed = true; - display->pipes[pipe2].mode_changed = true; +igt_pipe_refresh (display, pipe, false); +igt_pipe_refresh (display, pipe2, false);igt_display_commit2 (display,COMMIT_ATOMIC ); } }
tests/kms_fbc_crc.c +1 -2
@@ -461,8 +461,7 @@ static void reset_display(data_t *data)igt_pipe_t *pipe = &display->pipes[pipe_id];igt_plane_t *plane =igt_pipe_get_plane_type (pipe,DRM_PLANE_TYPE_PRIMARY ); -if (plane->fb) -igt_plane_set_fb (plane,NULL ); +igt_plane_set_fb (plane,NULL ); }for_each_connected_output (display, data->output)
tests/kms_panel_fitting.c +1 -13
@@ -84,19 +84,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, }igt_plane_set_fb (plane, &data->fb1); -if (s ==COMMIT_LEGACY ) { -int ret; - ret =drmModeSetCrtc (data->drm_fd, - plane->pipe->crtc_id, - data->fb_id1, - plane->src_x, plane->src_y, - &output->id, -1 , - mode); -igt_assert_eq (ret,0 ); - }else { -igt_display_commit2 (display, s); - } +igt_display_commit2 (display, s); }static void cleanup_crtc (data_t *data,igt_output_t *output,igt_plane_t *plane)
tests/kms_plane_scaling.c +1 -13
@@ -93,19 +93,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, }igt_plane_set_fb (plane, &data->fb1); -if (s ==COMMIT_LEGACY ) { -int ret; - ret =drmModeSetCrtc (data->drm_fd, - plane->pipe->crtc_id, - data->fb_id1, - plane->src_x, plane->src_y, - &output->id, -1 , - mode); -igt_assert_eq (ret,0 ); - }else { -igt_display_commit2 (display, s); - } +igt_display_commit2 (display, s); }static void cleanup_crtc (data_t *data,igt_output_t *output,igt_plane_t *plane)
tests/kms_rmfb.c +1 -1
@@ -102,7 +102,7 @@ test_rmfb(struct rmfb_data *data, igt_output_t *output, enum pipe pipe, bool reodrmSetClientCap (data->drm_fd,DRM_CLIENT_CAP_UNIVERSAL_PLANES ,1 );drmSetClientCap (data->drm_fd,DRM_CLIENT_CAP_ATOMIC ,1 ); - data->display.pipes[pipe].mode_blob =0 ; +igt_pipe_refresh (&data->display, pipe, true); }else {igt_remove_fb (data->drm_fd, &fb);igt_remove_fb (data->drm_fd, &argb_fb);
tests/kms_rotation_crc.c +0 -10
@@ -465,12 +465,6 @@ static void test_plane_rotation_ytiled_obj(data_t *data,igt_plane_set_fb (plane, &data->fb);igt_plane_set_size (plane, h, w); -if (commit <COMMIT_ATOMIC ) -drmModeObjectSetProperty (fd, plane->drm_plane->plane_id, -DRM_MODE_OBJECT_PLANE , - plane->rotation_property, - plane->rotation); - ret =igt_display_try_commit2 (display, commit);igt_output_set_pipe (output,PIPE_NONE );
@@ -562,10 +556,6 @@ static void test_plane_rotation_exhaust_fences(data_t *data,igt_plane_set_rotation (plane,IGT_ROTATION_90 );igt_plane_set_size (plane, h, w); -drmModeObjectSetProperty (fd, plane->drm_plane->plane_id, -DRM_MODE_OBJECT_PLANE , - plane->rotation_property, - plane->rotation);igt_display_commit2 (display, commit);if (ret) {igt_warn ("failed to commit hardware rotated fb: %i\n" , ret);
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/6 lib/igt_kms: Rework connector properties to be more atomic
In reply to Maarten LankhorstIn the future I want to allow tests to commit more properties, but for this to work I have to fix all properties to work better with atomic commit. Instead of special casing each property make a bitmask for all property changed flags, and try to commit all properties.
--- lib/igt_kms.c | 41 ++++++++++++++++------------------------ lib/igt_kms.h | 35 ++++++++++++++++++++-------------- tests/kms_atomic_interruptible.c | 4 ++-- tests/kms_panel_fitting.c | 2 +- 4 files changed, 40 insertions(+), 42 deletions(-)
lib/igt_kms.c +16 -25
@@ -248,7 +248,7 @@ igt_atomic_fill_connector_props(igt_display_t *display, igt_output_t *output,if (strcmp (prop->name, conn_prop_names[j]) !=0 )continue ; - output->config.atomic_props_connector[j] = props->props[i]; + output->props[j] = props->props[i];break ; }
@@ -1836,7 +1836,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)igt_output_refresh (output); - output->config.pipe_changed = true; +igt_output_set_prop_changed (output,IGT_CONNECTOR_CRTC_ID ); }drmModeFreePlaneResources (plane_resources);
@@ -2514,23 +2514,17 @@ static void igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicRestatic void igt_atomic_prepare_connector_commit (igt_output_t *output,drmModeAtomicReq *req) { -struct kmstest_connector_config *config = &output->config; - -if (config->connector_scaling_mode_changed) -igt_atomic_populate_connector_req (req, output,IGT_CONNECTOR_SCALING_MODE , config->connector_scaling_mode); - -if (config->pipe_changed) { -uint32_t crtc_id =0 ; +int i; -if (output->config.pipe !=PIPE_NONE ) - crtc_id = output->config.crtc->crtc_id; +for (i =0 ; i <IGT_NUM_CONNECTOR_PROPS ; i++) { +if (!igt_output_is_prop_changed (output, i)) +continue ; -igt_atomic_populate_connector_req (req, output,IGT_CONNECTOR_CRTC_ID , crtc_id); +igt_assert_lt (0 ,drmModeAtomicAddProperty (req, + output->config.connector->connector_id, + output->props[i], + output->values[i])); } -/* -* TODO: Add all other connector level properties here -*/ - }/*
@@ -2625,11 +2619,10 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s)for (i =0 ; i < display->n_outputs; i++) {igt_output_t *output = &display->outputs[i]; -if (s !=COMMIT_UNIVERSAL ) - output->config.pipe_changed = false; -if (s ==COMMIT_ATOMIC ) - output->config.connector_scaling_mode_changed = false; + output->changed =0 ; +else if (s !=COMMIT_UNIVERSAL ) +igt_output_clear_prop_changed (output,IGT_CONNECTOR_CRTC_ID ); } }
@@ -2877,18 +2870,16 @@ void igt_output_set_pipe(igt_output_t *output, enum pipe pipe) display->pipes[pipe].mode_changed = true; } - output->config.pipe_changed = true; +igt_output_set_prop_value (output,IGT_CONNECTOR_CRTC_ID , pipe ==PIPE_NONE ?0 : display->pipes[pipe].crtc_id);igt_output_refresh (output); }void igt_output_set_scaling_mode (igt_output_t *output,uint64_t scaling_mode) { - output->config.connector_scaling_mode_changed = true; - - output->config.connector_scaling_mode = scaling_mode; +igt_output_set_prop_value (output,IGT_CONNECTOR_SCALING_MODE , scaling_mode); -igt_require (output->config.atomic_props_connector[IGT_CONNECTOR_SCALING_MODE ]); +igt_require (output->props[IGT_CONNECTOR_SCALING_MODE ]); }igt_plane_t *igt_output_get_plane (igt_output_t *output,int plane_idx)
lib/igt_kms.h +21 -14
@@ -131,10 +131,7 @@ struct kmstest_connector_config {drmModeConnector *connector;drmModeEncoder *encoder;drmModeModeInfo default_mode; -uint64_t connector_scaling_mode; -bool connector_scaling_mode_changed; -bool pipe_changed; -uint32_t atomic_props_connector[IGT_NUM_CONNECTOR_PROPS ]; +int pipe;unsigned valid_crtc_idx_mask; };
@@ -364,6 +361,12 @@ typedef struct {unsigned long pending_crtc_idx_mask;bool use_override_mode;drmModeModeInfo override_mode; + +/* bitmask of changed properties */ +uint64_t changed; + +uint32_t props[IGT_NUM_CONNECTOR_PROPS ]; +uint64_t values[IGT_NUM_CONNECTOR_PROPS ]; } igt_output_t;struct igt_display {
@@ -545,16 +548,20 @@ static inline bool igt_output_is_connected(igt_output_t *output)#define igt_atomic_populate_crtc_req (req, pipe, prop, value) \ igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe->crtc_id,\ pipe->atomic_props_crtc[prop], value)) -/** -* igt_atomic_populate_connector_req: -* @req: A pointer to drmModeAtomicReq -* @output: A pointer igt_output_t -* @prop: one of igt_atomic_connector_properties -* @value: the value to add -*/ -#define igt_atomic_populate_connector_req (req, output, prop, value) \ - igt_assert_lt(0, drmModeAtomicAddProperty(req, output->config.connector->connector_id,\ - output->config.atomic_props_connector[prop], value)) + +#define igt_output_is_prop_changed (output, prop) \ + (!!((output)->changed & (1 << (prop)))) +#define igt_output_set_prop_changed (output, prop) \ + (output)->changed |= 1 << (prop) + +#define igt_output_clear_prop_changed (output, prop) \ + (output)->changed &= ~(1 << (prop)) + +#define igt_output_set_prop_value (output, prop, value) \ + do { \ + (output)->values[prop] = (value); \ + igt_output_set_prop_changed(output, prop); \ + } while (0)/* * igt_pipe_refresh:
tests/kms_atomic_interruptible.c +2 -2
@@ -159,7 +159,7 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t plane->pipe->atomic_props_crtc[IGT_CRTC_MODE_ID ], plane->pipe->atomic_props_crtc[IGT_CRTC_ACTIVE ],/* connector: 1 prop */ - output->config.atomic_props_connector[IGT_CONNECTOR_CRTC_ID ], + output->props[IGT_CONNECTOR_CRTC_ID ],/* plane: remainder props */ plane->atomic_props_plane[IGT_PLANE_CRTC_ID ], plane->atomic_props_plane[IGT_PLANE_FB_ID],
@@ -204,7 +204,7 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_tcase test_legacy_dpms: {struct drm_mode_connector_set_property prop = { .value =DRM_MODE_DPMS_OFF , - .prop_id = output->config.atomic_props_connector[IGT_CONNECTOR_DPMS ], + .prop_id = output->props[IGT_CONNECTOR_DPMS ], .connector_id = output->id, };
tests/kms_panel_fitting.c +1 -1
@@ -275,7 +275,7 @@ static void test_atomic_fastset(igt_display_t *display)igt_require (intel_gen (intel_get_drm_devid (display->drm_fd)) >=5 );for_each_pipe_with_valid_output (display, pipe, output) { -if (!output->config.atomic_props_connector[IGT_CONNECTOR_SCALING_MODE ]) +if (!output->props[IGT_CONNECTOR_SCALING_MODE ])continue ;test_panel_fitting_fastset (display, pipe, output);
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/6 lib/igt_kms: Rework plane properties to be more atomic
In reply to Maarten LankhorstIn the future I want to allow tests to commit more properties, but for this to work I have to fix all properties to work better with atomic commit. Instead of special casing each property make a bitmask for all property changed flags, and try to commit all properties.
--- lib/igt_kms.c | 292 ++++++++++++++++++--------------------- lib/igt_kms.h | 59 ++++---- tests/kms_atomic_interruptible.c | 12 +- tests/kms_rotation_crc.c | 4 +- 4 files changed, 165 insertions(+), 202 deletions(-)
lib/igt_kms.c +133 -159
@@ -192,11 +192,11 @@ const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {/* * Retrieve all the properies specified in props_name and store them into -* plane->atomic_props_plane. +* plane->props. */ static void -igt_atomic_fill_plane_props (igt_display_t *display,igt_plane_t *plane, -int num_props,const char **prop_names) +igt_fill_plane_props (igt_display_t *display,igt_plane_t *plane, +int num_props,const char **prop_names) {drmModeObjectPropertiesPtr props;int i, j, fd;
@@ -214,7 +214,7 @@ igt_atomic_fill_plane_props(igt_display_t *display, igt_plane_t *plane,if (strcmp (prop->name, prop_names[j]) !=0 )continue ; - plane->atomic_props_plane[j] = props->props[i]; + plane->props[j] = props->props[i];break ; }
@@ -1661,7 +1661,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)drmModeRes *resources;drmModePlaneRes *plane_resources;int i; -int is_atomic =0 ;memset (display,0 ,sizeof (igt_display_t));
@@ -1681,7 +1680,9 @@ void igt_display_init(igt_display_t *display, int drm_fd)igt_assert_f (display->pipes,"Failed to allocate memory for %d pipes\n" , display->n_pipes);drmSetClientCap (drm_fd,DRM_CLIENT_CAP_UNIVERSAL_PLANES ,1 ); - is_atomic =drmSetClientCap (drm_fd,DRM_CLIENT_CAP_ATOMIC ,1 ); +if (drmSetClientCap (drm_fd,DRM_CLIENT_CAP_ATOMIC ,1 ) ==0 ) + display->is_atomic =1 ; + plane_resources =drmModeGetPlaneResources (display->drm_fd);igt_assert (plane_resources);
@@ -1778,19 +1779,15 @@ void igt_display_init(igt_display_t *display, int drm_fd) plane->type = type; plane->pipe = pipe; plane->drm_plane = drm_plane; - plane->fence_fd =-1 ; + plane->values[IGT_PLANE_IN_FENCE_FD ] = ~0ULL ; -if (is_atomic ==0 ) { - display->is_atomic =1 ; -igt_atomic_fill_plane_props (display, plane,IGT_NUM_PLANE_PROPS , igt_plane_prop_names); - } +igt_fill_plane_props (display, plane,IGT_NUM_PLANE_PROPS , igt_plane_prop_names);get_plane_property (display->drm_fd, drm_plane->plane_id,"rotation" , - &plane->rotation_property, - &prop_value, + &plane->props[IGT_PLANE_ROTATION ], + &plane->values[IGT_PLANE_ROTATION ],NULL ); - plane->rotation = (igt_rotation_t )prop_value; }/*
@@ -1807,8 +1804,10 @@ void igt_display_init(igt_display_t *display, int drm_fd) pipe->n_planes = n_planes; -for_each_plane_on_pipe (display, i, plane) - plane->fb_changed = true; +for_each_plane_on_pipe (display, i, plane) { +igt_plane_set_prop_changed (plane,IGT_PLANE_FB_ID ); +igt_plane_set_prop_changed (plane,IGT_PLANE_CRTC_ID ); + } pipe->mode_changed = true; }
@@ -2070,18 +2069,7 @@ bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,static uint32_t igt_plane_get_fb_id (igt_plane_t *plane) { -if (plane->fb) -return plane->fb->fb_id; -else -return 0 ; -} - -static uint32_t igt_plane_get_fb_gem_handle (igt_plane_t *plane) -{ -if (plane->fb) -return plane->fb->gem_handle; -else -return 0 ; +return plane->values[IGT_PLANE_FB_ID ]; }#define CHECK_RETURN (r, fail) { \
@@ -2090,9 +2078,6 @@ static uint32_t igt_plane_get_fb_gem_handle(igt_plane_t *plane)igt_assert_eq (r,0 ); \ } - - -/* * Add position and fb changes of a plane to the atomic property set */
@@ -2101,63 +2086,44 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe, drmModeAtomicReq *req) {igt_display_t *display = pipe->display; -uint32_t fb_id, crtc_id; +int i;igt_assert (plane->drm_plane); -/* it's an error to try an unsupported feature */ -igt_assert (igt_plane_supports_rotation (plane) || - !plane->rotation_changed); - - fb_id =igt_plane_get_fb_id (plane); - crtc_id = pipe->crtc_id; -LOG (display,"populating plane data: %s.%d, fb %u\n" ,kmstest_pipe_name (pipe->pipe), plane->index, - fb_id); +igt_plane_get_fb_id (plane)); -if (plane->fence_fd >=0 ) { -uint64_t fence_fd = (int64_t ) plane->fence_fd; -igt_atomic_populate_plane_req (req, plane,IGT_PLANE_IN_FENCE_FD , fence_fd); - } +for (i =0 ; i <IGT_NUM_PLANE_PROPS ; i++) { +if (!igt_plane_is_prop_changed (plane, i)) +continue ; -if (plane->fb_changed) { -igt_atomic_populate_plane_req (req, plane,IGT_PLANE_CRTC_ID , fb_id ? crtc_id :0 ); -igt_atomic_populate_plane_req (req, plane,IGT_PLANE_FB_ID , fb_id); +/* it's an error to try an unsupported feature */ +igt_assert (plane->props[i]); + +igt_assert_lt (0 ,drmModeAtomicAddProperty (req, plane->drm_plane->plane_id, + plane->props[i], + plane->values[i])); } -if (plane->position_changed || plane->size_changed) { -uint32_t src_x =IGT_FIXED (plane->src_x,0 );/* src_x */ -uint32_t src_y =IGT_FIXED (plane->src_y,0 );/* src_y */ -uint32_t src_w =IGT_FIXED (plane->src_w,0 );/* src_w */ -uint32_t src_h =IGT_FIXED (plane->src_h,0 );/* src_h */ -int32_t crtc_x = plane->crtc_x; -int32_t crtc_y = plane->crtc_y; -uint32_t crtc_w = plane->crtc_w; -uint32_t crtc_h = plane->crtc_h; +if (plane->changed &IGT_PLANE_COORD_CHANGED_MASK ) { +uint32_t src_x = plane->values[IGT_PLANE_SRC_X ]; +uint32_t src_y = plane->values[IGT_PLANE_SRC_Y ]; +uint32_t src_w = plane->values[IGT_PLANE_SRC_W ]; +uint32_t src_h = plane->values[IGT_PLANE_SRC_H ]; +int32_t crtc_x = plane->values[IGT_PLANE_CRTC_X ]; +int32_t crtc_y = plane->values[IGT_PLANE_CRTC_Y ]; +uint32_t crtc_w = plane->values[IGT_PLANE_CRTC_W ]; +uint32_t crtc_h = plane->values[IGT_PLANE_CRTC_H ];LOG (display,"src = (%d, %d) %u x %u " "dst = (%d, %d) %u x %u\n" , src_x >>16 , src_y >>16 , src_w >>16 , src_h >>16 , crtc_x, crtc_y, crtc_w, crtc_h); - -igt_atomic_populate_plane_req (req, plane,IGT_PLANE_SRC_X , src_x); -igt_atomic_populate_plane_req (req, plane,IGT_PLANE_SRC_Y , src_y); -igt_atomic_populate_plane_req (req, plane,IGT_PLANE_SRC_W , src_w); -igt_atomic_populate_plane_req (req, plane,IGT_PLANE_SRC_H , src_h); - -igt_atomic_populate_plane_req (req, plane,IGT_PLANE_CRTC_X , crtc_x); -igt_atomic_populate_plane_req (req, plane,IGT_PLANE_CRTC_Y , crtc_y); -igt_atomic_populate_plane_req (req, plane,IGT_PLANE_CRTC_W , crtc_w); -igt_atomic_populate_plane_req (req, plane,IGT_PLANE_CRTC_H , crtc_h); } - -if (plane->rotation_changed) -igt_atomic_populate_plane_req (req, plane, -IGT_PLANE_ROTATION , plane->rotation); }
@@ -2183,17 +2149,20 @@ static int igt_drm_plane_commit(igt_plane_t *plane,int32_t crtc_y;uint32_t crtc_w;uint32_t crtc_h; +bool setplane = +igt_plane_is_prop_changed (plane,IGT_PLANE_FB_ID ) || + plane->changed &IGT_PLANE_COORD_CHANGED_MASK ;igt_assert (plane->drm_plane);/* it's an error to try an unsupported feature */ igt_assert (igt_plane_supports_rotation (plane) || - !plane->rotation_changed); + !igt_plane_is_prop_changed (plane,IGT_PLANE_ROTATION )); fb_id =igt_plane_get_fb_id (plane); crtc_id = pipe->crtc_id; -if ((plane->fb_changed || plane->size_changed) && fb_id ==0 ) { +if (setplane && fb_id ==0 ) { LOG(display, "SetPlane pipe %s, plane %d, disabling\n", kmstest_pipe_name(pipe->pipe),
@@ -2212,16 +2181,15 @@ static int igt_drm_plane_commit(igt_plane_t *plane, IGT_FIXED(0,0) /* src_h */);CHECK_RETURN (ret, fail_on_error); - }else if (plane->fb_changed || plane->position_changed || - plane->size_changed) { - src_x =IGT_FIXED (plane->src_x,0 );/* src_x */ - src_y =IGT_FIXED (plane->src_y,0 );/* src_y */ - src_w =IGT_FIXED (plane->src_w,0 );/* src_w */ - src_h =IGT_FIXED (plane->src_h,0 );/* src_h */ - crtc_x = plane->crtc_x; - crtc_y = plane->crtc_y; - crtc_w = plane->crtc_w; - crtc_h = plane->crtc_h; + }else if (setplane) { + src_x = plane->values[IGT_PLANE_SRC_X ]; + src_y = plane->values[IGT_PLANE_SRC_Y ]; + src_w = plane->values[IGT_PLANE_SRC_W ]; + src_h = plane->values[IGT_PLANE_SRC_H ]; + crtc_x = plane->values[IGT_PLANE_CRTC_X ]; + crtc_y = plane->values[IGT_PLANE_CRTC_Y ]; + crtc_w = plane->values[IGT_PLANE_CRTC_W ]; + crtc_h = plane->values[IGT_PLANE_CRTC_H ];LOG (display, "SetPlane %s.%d, fb %u, src = (%d, %d) "
@@ -2245,9 +2213,10 @@ static int igt_drm_plane_commit(igt_plane_t *plane,CHECK_RETURN (ret, fail_on_error); } -if (plane->rotation_changed) { - ret =igt_plane_set_property (plane, plane->rotation_property, - plane->rotation); +if (igt_plane_is_prop_changed (plane,IGT_PLANE_ROTATION )) { + ret =igt_plane_set_property (plane, + plane->props[IGT_PLANE_ROTATION ], + plane->values[IGT_PLANE_ROTATION ]);CHECK_RETURN (ret, fail_on_error); }
@@ -2269,35 +2238,30 @@ static int igt_cursor_commit_legacy(igt_plane_t *cursor,uint32_t crtc_id = pipe->crtc_id;int ret; -if (cursor->fb_changed) { -uint32_t gem_handle =igt_plane_get_fb_gem_handle (cursor); - -if (gem_handle) { +if (igt_plane_is_prop_changed (cursor,IGT_PLANE_FB_ID )) { +if (cursor->gem_handle)LOG (display,"SetCursor pipe %s, fb %u %dx%d\n" ,kmstest_pipe_name (pipe->pipe), - gem_handle, - cursor->crtc_w, cursor->crtc_h); - - ret =drmModeSetCursor (display->drm_fd, crtc_id, - gem_handle, - cursor->crtc_w, - cursor->crtc_h); - }else { + cursor->gem_handle, + (unsigned )cursor->values[IGT_PLANE_CRTC_W ], + (unsigned )cursor->values[IGT_PLANE_CRTC_H ]); +else LOG (display,"SetCursor pipe %s, disabling\n" ,kmstest_pipe_name (pipe->pipe)); - ret =drmModeSetCursor (display->drm_fd, crtc_id, -0 ,0 ,0 ); - } - + ret =drmModeSetCursor (display->drm_fd, crtc_id, + cursor->gem_handle, + cursor->values[IGT_PLANE_CRTC_W ], + cursor->values[IGT_PLANE_CRTC_H ]);CHECK_RETURN (ret, fail_on_error); } -if (cursor->position_changed) { -int x = cursor->crtc_x; -int y = cursor->crtc_y; +if (igt_plane_is_prop_changed (cursor,IGT_PLANE_CRTC_X ) || +igt_plane_is_prop_changed (cursor,IGT_PLANE_CRTC_Y )) { +int x = cursor->values[IGT_PLANE_CRTC_X ]; +int y = cursor->values[IGT_PLANE_CRTC_Y ]; LOG(display, "MoveCursor pipe %s, (%d, %d)\n",
@@ -2326,13 +2290,13 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,int ret;/* Primary planes can't be windowed when using a legacy commit */ -igt_assert ((primary->crtc_x ==0 && primary->crtc_y ==0 )); +igt_assert ((primary->values[IGT_PLANE_CRTC_X ] ==0 && primary->values[IGT_PLANE_CRTC_Y ] ==0 ));/* nor rotated */ -igt_assert (!primary->rotation_changed); +igt_assert (!igt_plane_is_prop_changed (primary,IGT_PLANE_ROTATION )); -if (!primary->fb_changed && !primary->position_changed && - !primary->size_changed) +if (!igt_plane_is_prop_changed (primary,IGT_PLANE_FB_ID ) && + !(primary->changed &IGT_PLANE_COORD_CHANGED_MASK ))return 0 ; crtc_id = pipe->crtc_id;
@@ -2343,19 +2307,22 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary, mode =NULL ;if (fb_id) { +uint32_t src_x = primary->values[IGT_PLANE_SRC_X ] >>16 ; +uint32_t src_y = primary->values[IGT_PLANE_SRC_Y ] >>16 ; +LOG (display,"%s: SetCrtc pipe %s, fb %u, src (%d, %d), " "mode %dx%d\n" ,igt_output_name (output),kmstest_pipe_name (pipe->pipe), fb_id, - primary->src_x, primary->src_y, + src_x, src_y, mode->hdisplay, mode->vdisplay); ret =drmModeSetCrtc (display->drm_fd, crtc_id, fb_id, - primary->src_x, primary->src_y, + src_x, src_y, &output->id,1 , mode);
@@ -2601,18 +2568,27 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s) }for_each_plane_on_pipe (display, pipe, plane) { - plane->fb_changed = false; - plane->position_changed = false; - plane->size_changed = false; +if (s ==COMMIT_ATOMIC ) { +int fd; + plane->changed =0 ; -if (s !=COMMIT_LEGACY || - !(plane->type ==DRM_PLANE_TYPE_PRIMARY || - plane->type ==DRM_PLANE_TYPE_CURSOR )) - plane->rotation_changed = false; + fd = plane->values[IGT_PLANE_IN_FENCE_FD ]; +if (fd !=-1 ) +close (fd); -if (s ==COMMIT_ATOMIC )/* reset fence_fd to prevent it from being set for the next commit */ -igt_plane_set_fence_fd (plane,-1 ); + plane->values[IGT_PLANE_IN_FENCE_FD ] =-1 ; + }else { + plane->changed &= ~IGT_PLANE_COORD_CHANGED_MASK ; + +igt_plane_clear_prop_changed (plane,IGT_PLANE_CRTC_ID ); +igt_plane_clear_prop_changed (plane,IGT_PLANE_FB_ID ); + +if (s !=COMMIT_LEGACY || + !(plane->type ==DRM_PLANE_TYPE_PRIMARY || + plane->type ==DRM_PLANE_TYPE_CURSOR )) +igt_plane_clear_prop_changed (plane,IGT_PLANE_ROTATION ); + } } }
@@ -2910,30 +2886,31 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)LOG (display,"%s.%d: plane_set_fb(%d)\n" ,kmstest_pipe_name (pipe->pipe), plane->index, fb ? fb->fb_id :0 ); - plane->fb = fb; +igt_plane_set_prop_value (plane,IGT_PLANE_CRTC_ID , fb ? pipe->crtc_id :0 ); +igt_plane_set_prop_value (plane,IGT_PLANE_FB_ID , fb ? fb->fb_id :0 ); + +if (plane->type ==DRM_PLANE_TYPE_CURSOR && fb) + plane->gem_handle = fb->gem_handle; +else + plane->gem_handle =0 ; +/* hack to keep tests working that don't call igt_plane_set_size() */ if (fb) {/* set default plane size as fb size */ - plane->crtc_w = fb->width; - plane->crtc_h = fb->height; +igt_plane_set_position (plane,0 ,0 ); +igt_plane_set_size (plane, fb->width, fb->height);/* set default src pos/size as fb size */ - plane->src_x =0 ; - plane->src_y =0 ; - plane->src_w = fb->width; - plane->src_h = fb->height; +igt_fb_set_position (fb, plane,0 ,0 ); +igt_fb_set_size (fb, plane, fb->width, fb->height); }else { - plane->src_x =0 ; - plane->src_y =0 ; - plane->src_w =0 ; - plane->src_h =0 ; +igt_plane_set_position (plane,0 ,0 ); +igt_plane_set_size (plane,0 ,0 ); - plane->crtc_w =0 ; - plane->crtc_h =0 ; +/* set default src pos/size as fb size */ +igt_fb_set_position (fb, plane,0 ,0 ); +igt_fb_set_size (fb, plane,0 ,0 ); } - - plane->fb_changed = true; - plane->size_changed = true; }/**
@@ -2946,12 +2923,19 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)*/ void igt_plane_set_fence_fd (igt_plane_t *plane,int fence_fd) { -close (plane->fence_fd); +int64_t fd; -if (fcntl (fence_fd,F_GETFD ) !=-1 ) - plane->fence_fd =dup (fence_fd); -else - plane->fence_fd =-1 ; + fd = plane->values[IGT_PLANE_IN_FENCE_FD ]; +if (fd !=-1 ) +close (fd); + +if (fence_fd !=-1 ) { + fd =dup (fence_fd); +igt_fail_on (fd ==-1 ); + }else + fd =-1 ; + +igt_plane_set_prop_value (plane,IGT_PLANE_IN_FENCE_FD , fd); }void igt_plane_set_position (igt_plane_t *plane,int x,int y)
@@ -2962,10 +2946,8 @@ void igt_plane_set_position(igt_plane_t *plane, int x, int y)LOG (display,"%s.%d: plane_set_position(%d,%d)\n" ,kmstest_pipe_name (pipe->pipe), plane->index, x, y); - plane->crtc_x = x; - plane->crtc_y = y; - - plane->position_changed = true; +igt_plane_set_prop_value (plane,IGT_PLANE_CRTC_X , x); +igt_plane_set_prop_value (plane,IGT_PLANE_CRTC_Y , y); }/**
@@ -2986,10 +2968,8 @@ void igt_plane_set_size(igt_plane_t *plane, int w, int h)LOG (display,"%s.%d: plane_set_size (%dx%d)\n" ,kmstest_pipe_name (pipe->pipe), plane->index, w, h); - plane->crtc_w = w; - plane->crtc_h = h; - - plane->size_changed = true; +igt_plane_set_prop_value (plane,IGT_PLANE_CRTC_W , w); +igt_plane_set_prop_value (plane,IGT_PLANE_CRTC_H , h); }/**
@@ -3011,10 +2991,8 @@ void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,LOG (display,"%s.%d: fb_set_position(%d,%d)\n" ,kmstest_pipe_name (pipe->pipe), plane->index, x, y); - plane->src_x = x; - plane->src_y = y; - - plane->fb_changed = true; +igt_plane_set_prop_value (plane,IGT_PLANE_SRC_X ,IGT_FIXED (x,0 )); +igt_plane_set_prop_value (plane,IGT_PLANE_SRC_Y ,IGT_FIXED (y,0 )); }/**
@@ -3037,10 +3015,8 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,LOG (display,"%s.%d: fb_set_size(%dx%d)\n" ,kmstest_pipe_name (pipe->pipe), plane->index, w, h); - plane->src_w = w; - plane->src_h = h; - - plane->fb_changed = true; +igt_plane_set_prop_value (plane,IGT_PLANE_SRC_W ,IGT_FIXED (w,0 )); +igt_plane_set_prop_value (plane,IGT_PLANE_SRC_H ,IGT_FIXED (h,0 )); }static const char *rotation_name (igt_rotation_t rotation)
@@ -3068,9 +3044,7 @@ void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)kmstest_pipe_name (pipe->pipe), plane->index, rotation_name(rotation)); - plane->rotation = rotation; - - plane->rotation_changed = true; +igt_plane_set_prop_value (plane,IGT_PLANE_ROTATION , rotation); }/**
lib/igt_kms.h +24 -35
90 lines not on this page · raw message
tests/kms_atomic_interruptible.c +6 -6
@@ -161,12 +161,12 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t/* connector: 1 prop */ output->props[IGT_CONNECTOR_CRTC_ID ],/* plane: remainder props */ - plane->atomic_props_plane[IGT_PLANE_CRTC_ID ], - plane->atomic_props_plane[IGT_PLANE_FB_ID ], - plane->atomic_props_plane[IGT_PLANE_SRC_W ], - plane->atomic_props_plane[IGT_PLANE_SRC_H ], - plane->atomic_props_plane[IGT_PLANE_CRTC_W ], - plane->atomic_props_plane[IGT_PLANE_CRTC_H ] + plane->props[IGT_PLANE_CRTC_ID ], + plane->props[IGT_PLANE_FB_ID ], + plane->props[IGT_PLANE_SRC_W ], + plane->props[IGT_PLANE_SRC_H ], + plane->props[IGT_PLANE_CRTC_W ], + plane->props[IGT_PLANE_CRTC_H ] };uint64_t prop_vals[] = { /* crtc */
tests/kms_rotation_crc.c +2 -2
@@ -122,11 +122,11 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,igt_plane_set_fb (primary, &data->fb_modeset);if (commit <COMMIT_ATOMIC ) { - primary->rotation_changed = false; +igt_plane_clear_prop_changed (primary,IGT_PLANE_ROTATION );igt_display_commit (display);if (plane->type ==DRM_PLANE_TYPE_PRIMARY ) - primary->rotation_changed = true; +igt_plane_set_prop_changed (primary,IGT_PLANE_ROTATION ); }igt_plane_set_fb (plane,NULL );
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/6 lib/igt_kms: Rework pipe properties to be more atomic
In reply to Maarten LankhorstIn the future I want to allow tests to commit more properties, but for this to work I have to fix all properties to work better with atomic commit. Instead of special casing each property make a bitmask for all property changed flags, and try to commit all properties.
This has been the most involved one, since legacy pipe commit still handles a lot of the properties differently from the rest.
--- lib/igt_kms.c | 206 +++++++++++++++++++------------------- lib/igt_kms.h | 77 ++++++-------- tests/kms_atomic_interruptible.c | 4 +- tests/kms_atomic_transition.c | 2 +- tests/kms_crtc_background_color.c | 2 +- 5 files changed, 136 insertions(+), 155 deletions(-)
lib/igt_kms.c +102 -104
@@ -259,8 +259,8 @@ igt_atomic_fill_connector_props(igt_display_t *display, igt_output_t *output, }static void -igt_atomic_fill_pipe_props (igt_display_t *display,igt_pipe_t *pipe, -int num_crtc_props,const char **crtc_prop_names) +igt_fill_pipe_props (igt_display_t *display,igt_pipe_t *pipe, +int num_crtc_props,const char **crtc_prop_names) {drmModeObjectPropertiesPtr props;int i, j, fd;
@@ -278,7 +278,7 @@ igt_atomic_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,if (strcmp (prop->name, crtc_prop_names[j]) !=0 )continue ; - pipe->atomic_props_crtc[j] = props->props[i]; + pipe->props[j] = props->props[i];break ; }
@@ -1692,7 +1692,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)int p =1 ;int j, type;uint8_t last_plane =0 , n_planes =0 ; -uint64_t prop_value; pipe->crtc_id = resources->crtcs[i]; pipe->display = display;
@@ -1702,29 +1701,12 @@ void igt_display_init(igt_display_t *display, int drm_fd) pipe->planes =NULL ; pipe->out_fence_fd =-1 ; +igt_fill_pipe_props (display, pipe,IGT_NUM_CRTC_PROPS , igt_crtc_prop_names); +get_crtc_property (display->drm_fd, pipe->crtc_id, -"background_color" , - &pipe->background_property, - &prop_value, +"background_color" ,NULL , + &pipe->values[IGT_CRTC_BACKGROUND ],NULL ); - pipe->background = (uint32_t )prop_value; -get_crtc_property (display->drm_fd, pipe->crtc_id, -"DEGAMMA_LUT" , - &pipe->degamma_property, -NULL , -NULL ); -get_crtc_property (display->drm_fd, pipe->crtc_id, -"CTM" , - &pipe->ctm_property, -NULL , -NULL ); -get_crtc_property (display->drm_fd, pipe->crtc_id, -"GAMMA_LUT" , - &pipe->gamma_property, -NULL , -NULL ); - -igt_atomic_fill_pipe_props (display, pipe,IGT_NUM_CRTC_PROPS , igt_crtc_prop_names);/* count number of valid planes */ for (j =0 ; j < plane_resources->count_planes; j++) {
@@ -1809,7 +1791,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)igt_plane_set_prop_changed (plane,IGT_PLANE_CRTC_ID ); } - pipe->mode_changed = true; +igt_pipe_refresh (display, i, false); }/*
@@ -2365,6 +2347,16 @@ static int igt_plane_commit(igt_plane_t *plane, } } +static bool is_atomic_prop (enum igt_atomic_crtc_properties prop) +{ +if (prop ==IGT_CRTC_MODE_ID || + prop ==IGT_CRTC_ACTIVE || + prop ==IGT_CRTC_OUT_FENCE_PTR ) +return true; + +return false; +} +/* * Commit all plane changes to an output. Note that if @s is COMMIT_LEGACY, * enabling/disabling the primary plane will also enable/disable the CRTC.
@@ -2382,19 +2374,9 @@ static int igt_pipe_commit(igt_pipe_t *pipe,int i;int ret; -if (pipe->background_changed) { -igt_crtc_set_property (pipe, pipe->background_property, - pipe->background); - } - -if (pipe->color_mgmt_changed) { -igt_crtc_set_property (pipe, pipe->degamma_property, - pipe->degamma_blob); -igt_crtc_set_property (pipe, pipe->ctm_property, - pipe->ctm_blob); -igt_crtc_set_property (pipe, pipe->gamma_property, - pipe->gamma_blob); - } +for (i =0 ; i <IGT_NUM_CRTC_PROPS ; i++) +if (!is_atomic_prop (i)) +igt_crtc_set_property (pipe, pipe->props[i], pipe->values[i]);for (i =0 ; i < pipe->n_planes; i++) {igt_plane_t *plane = &pipe->planes[i];
@@ -2407,9 +2389,10 @@ static int igt_pipe_commit(igt_pipe_t *pipe, }static void -igt_pipe_replace_blob (igt_pipe_t *pipe,uint64_t *blob,void *ptr,size_t length) +igt_pipe_replace_blob (igt_pipe_t *pipe,enum igt_atomic_crtc_properties prop,void *ptr,size_t length) {igt_display_t *display = pipe->display; +uint64_t *blob = &pipe->values[prop];uint32_t blob_id =0 ;if (*blob !=0 )
@@ -2421,6 +2404,7 @@ igt_pipe_replace_blob(igt_pipe_t *pipe, uint64_t *blob, void *ptr, size_t length ptr, length, &blob_id) == 0); *blob = blob_id; +igt_pipe_obj_set_prop_changed (pipe, prop); }/*
@@ -2428,51 +2412,16 @@ igt_pipe_replace_blob(igt_pipe_t *pipe, uint64_t *blob, void *ptr, size_t length*/ static void igt_atomic_prepare_crtc_commit (igt_pipe_t *pipe_obj,drmModeAtomicReq *req) { -if (pipe_obj->background_changed) -igt_atomic_populate_crtc_req (req, pipe_obj,IGT_CRTC_BACKGROUND , pipe_obj->background); - -if (pipe_obj->color_mgmt_changed) { -igt_atomic_populate_crtc_req (req, pipe_obj,IGT_CRTC_DEGAMMA_LUT , pipe_obj->degamma_blob); -igt_atomic_populate_crtc_req (req, pipe_obj,IGT_CRTC_CTM , pipe_obj->ctm_blob); -igt_atomic_populate_crtc_req (req, pipe_obj,IGT_CRTC_GAMMA_LUT , pipe_obj->gamma_blob); - } - -if (pipe_obj->mode_changed) { -igt_output_t *output =igt_pipe_get_output (pipe_obj); - -if (!output) { -igt_pipe_replace_blob (pipe_obj, &pipe_obj->mode_blob,NULL ,0 ); - -LOG (pipe_obj->display,"%s: Setting NULL mode\n" , -kmstest_pipe_name (pipe_obj->pipe)); - }else { -drmModeModeInfo *mode =igt_output_get_mode (output); - -igt_pipe_replace_blob (pipe_obj, &pipe_obj->mode_blob, mode,sizeof (*mode)); - -LOG (pipe_obj->display,"%s: Setting mode %s from %s\n" , -kmstest_pipe_name (pipe_obj->pipe), - mode->name,igt_output_name (output)); - } +int i; -igt_atomic_populate_crtc_req (req, pipe_obj,IGT_CRTC_MODE_ID , pipe_obj->mode_blob); -igt_atomic_populate_crtc_req (req, pipe_obj,IGT_CRTC_ACTIVE , !!output); - } +for (i =0 ; i <IGT_NUM_CRTC_PROPS ; i++) +if (igt_pipe_obj_is_prop_changed (pipe_obj, i)) +igt_assert_lt (0 ,drmModeAtomicAddProperty (req, pipe_obj->crtc_id, pipe_obj->props[i], pipe_obj->values[i]));if (pipe_obj->out_fence_fd !=-1 ) {close (pipe_obj->out_fence_fd); pipe_obj->out_fence_fd =-1 ; } - -if (pipe_obj->out_fence_requested) - { -igt_atomic_populate_crtc_req (req, pipe_obj,IGT_CRTC_OUT_FENCE_PTR , - (uint64_t )(uintptr_t ) &pipe_obj->out_fence_fd); - } - -/* -* TODO: Add all crtc level properties here -*/ }/*
@@ -2556,15 +2505,19 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s)igt_pipe_t *pipe_obj = &display->pipes[pipe];igt_plane_t *plane; - pipe_obj->color_mgmt_changed = false; - pipe_obj->background_changed = false; +if (s ==COMMIT_ATOMIC ) { +if (igt_pipe_obj_is_prop_changed (pipe_obj,IGT_CRTC_OUT_FENCE_PTR )) +igt_assert (pipe_obj->out_fence_fd >=0 ); -if (s !=COMMIT_UNIVERSAL ) - pipe_obj->mode_changed = false; + pipe_obj->changed =0 ; + }else { +igt_pipe_obj_clear_prop_changed (pipe_obj,IGT_CRTC_BACKGROUND ); +igt_pipe_obj_clear_prop_changed (pipe_obj,IGT_CRTC_CTM ); +igt_pipe_obj_clear_prop_changed (pipe_obj,IGT_CRTC_DEGAMMA_LUT ); +igt_pipe_obj_clear_prop_changed (pipe_obj,IGT_CRTC_GAMMA_LUT ); -if (s ==COMMIT_ATOMIC && pipe_obj->out_fence_requested) { - pipe_obj->out_fence_requested = false; -igt_assert (pipe_obj->out_fence_fd >=0 ); +if (s !=COMMIT_UNIVERSAL ) +igt_pipe_obj_clear_prop_changed (pipe_obj,IGT_CRTC_MODE_ID ); }for_each_plane_on_pipe (display, pipe, plane) {
@@ -2818,37 +2771,87 @@ void igt_output_override_mode(igt_output_t *output, drmModeModeInfo *mode) output->use_override_mode = !!mode; -if (pipe) - pipe->mode_changed = true; +if (pipe) { +if (output->display->is_atomic) +igt_pipe_replace_blob (pipe,IGT_CRTC_MODE_ID ,igt_output_get_mode (output),sizeof (*mode)); +else +igt_pipe_obj_set_prop_changed (pipe,IGT_CRTC_MODE_ID ); + } }void igt_output_set_pipe (igt_output_t *output,enum pipe pipe) {igt_display_t *display = output->display; -igt_pipe_t *old_pipe; +igt_pipe_t *old_pipe =NULL , *pipe_obj =NULL ;;igt_assert (output->name); -if (output->pending_crtc_idx_mask) { +if (output->pending_crtc_idx_mask) old_pipe =igt_output_get_driving_pipe (output); - old_pipe->mode_changed = true; - } -if (pipe ==PIPE_NONE ) {LOG (display,"%s: set_pipe(any)\n" ,igt_output_name (output)); output->pending_crtc_idx_mask =0 ; }else { + pipe_obj = &display->pipes[pipe]; +LOG (display,"%s: set_pipe(%s)\n" ,igt_output_name (output),kmstest_pipe_name (pipe)); output->pending_crtc_idx_mask =1 << pipe; + } + +if (old_pipe) { +igt_output_t *old_output; + + old_output =igt_pipe_get_output (old_pipe); +if (!old_output) { +if (display->is_atomic) +igt_pipe_replace_blob (old_pipe,IGT_CRTC_MODE_ID ,NULL ,0 ); +else +igt_pipe_obj_set_prop_changed (old_pipe,IGT_CRTC_MODE_ID ); - display->pipes[pipe].mode_changed = true; +igt_pipe_obj_set_prop_value (old_pipe,IGT_CRTC_ACTIVE ,0 ); + } }igt_output_set_prop_value (output,IGT_CONNECTOR_CRTC_ID , pipe ==PIPE_NONE ?0 : display->pipes[pipe].crtc_id);igt_output_refresh (output); + +if (pipe_obj) { +if (display->is_atomic) +igt_pipe_replace_blob (pipe_obj,IGT_CRTC_MODE_ID ,igt_output_get_mode (output),sizeof (drmModeModeInfo)); +else +igt_pipe_obj_set_prop_changed (pipe_obj,IGT_CRTC_MODE_ID ); + +igt_pipe_obj_set_prop_value (pipe_obj,IGT_CRTC_ACTIVE ,1 ); + } +} + +/* +* igt_pipe_refresh: +* @display: a pointer to an #igt_display_t structure +* @pipe: Pipe to refresh +* @force: Should be set to true if mode_blob is no longer considered +* to be valid, for example after doing an atomic commit during fork or closing display fd. +* +* Requests the pipe to be part of the state on next update. +* This is useful when state may have been out of sync after +* a fork, or we just want to be sure the pipe is included +* in the next commit. +*/ +void igt_pipe_refresh (igt_display_t *display,enum pipe pipe,bool force) +{ +igt_pipe_t *pipe_obj = &display->pipes[pipe]; + +if (force && display->is_atomic) { +igt_output_t *output =igt_pipe_get_output (pipe_obj); + + pipe_obj->props[IGT_CRTC_MODE_ID ] =0 ; +if (output) +igt_pipe_replace_blob (pipe_obj,IGT_CRTC_MODE_ID ,igt_output_get_mode (output),sizeof (drmModeModeInfo)); + }else +igt_pipe_obj_set_prop_changed (pipe_obj,IGT_CRTC_MODE_ID ); }void igt_output_set_scaling_mode (igt_output_t *output,uint64_t scaling_mode)
@@ -3056,28 +3059,25 @@ void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)*/ void igt_pipe_request_out_fence (igt_pipe_t *pipe) { - pipe->out_fence_requested = true; +igt_pipe_obj_set_prop_value (pipe,IGT_CRTC_OUT_FENCE_PTR , (ptrdiff_t )&pipe->out_fence_fd); }void igt_pipe_set_degamma_lut (igt_pipe_t *pipe,void *ptr,size_t length) { -igt_pipe_replace_blob (pipe, &pipe->degamma_blob, ptr, length); - pipe->color_mgmt_changed =1 ; +igt_pipe_replace_blob (pipe,IGT_CRTC_DEGAMMA_LUT , ptr, length); }void igt_pipe_set_ctm_matrix (igt_pipe_t *pipe,void *ptr,size_t length) { -igt_pipe_replace_blob (pipe, &pipe->ctm_blob, ptr, length); - pipe->color_mgmt_changed =1 ; +igt_pipe_replace_blob (pipe,IGT_CRTC_CTM , ptr, length); }void igt_pipe_set_gamma_lut (igt_pipe_t *pipe,void *ptr,size_t length) { -igt_pipe_replace_blob (pipe, &pipe->gamma_blob, ptr, length); - pipe->color_mgmt_changed =1 ; +igt_pipe_replace_blob (pipe,IGT_CRTC_GAMMA_LUT , ptr, length); }/**
@@ -3098,9 +3098,7 @@ void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background)kmstest_pipe_name (pipe->pipe), pipe->pipe, background); - pipe->background = background; - - pipe->background_changed = true; +igt_pipe_obj_set_prop_value (pipe,IGT_CRTC_BACKGROUND , background); }void igt_wait_for_vblank_count (int drm_fd,enum pipe pipe,int count)
lib/igt_kms.h +30 -47
100 lines not on this page · raw message
tests/kms_atomic_interruptible.c +2 -2
@@ -156,8 +156,8 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_tuint32_t count_props[3 ] = {2 ,1 ,6 };uint32_t props[] = {/* crtc: 2 props */ - plane->pipe->atomic_props_crtc[IGT_CRTC_MODE_ID ], - plane->pipe->atomic_props_crtc[IGT_CRTC_ACTIVE ], + plane->pipe->props[IGT_CRTC_MODE_ID ], + plane->pipe->props[IGT_CRTC_ACTIVE ],/* connector: 1 prop */ output->props[IGT_CONNECTOR_CRTC_ID ],/* plane: remainder props */
tests/kms_atomic_transition.c +1 -1
@@ -633,7 +633,7 @@ static unsigned set_combinations(igt_display_t *display, unsigned mask, struct idrmModeModeInfo *mode =NULL ;if (!(mask & (1 << pipe))) { -if (display->pipes[pipe].mode_blob) { +if (igt_pipe_is_prop_changed (display, pipe,IGT_CRTC_ACTIVE )) { event_mask |=1 << pipe;igt_plane_set_fb (plane,NULL ); }
tests/kms_crtc_background_color.c +1 -1
@@ -137,7 +137,7 @@ static void test_crtc_background(data_t *data)igt_output_set_pipe (output, pipe); plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); -igt_require (plane->pipe->background_property); +igt_require (plane->pipe->props[IGT_CRTC_BACKGROUND ]);prepare_crtc (data, output, pipe, plane,1 ,PURPLE ,BLACK64 );
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/6 igt/kms_rotation_crc : Fix flip tests for sprite plane
In reply to Maarten LankhorstThis test was flipping the primary plane instead of the sprite plane. Flip the correct plane to make the test pass properly.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102691
--- tests/kms_rotation_crc.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
tests/kms_rotation_crc.c +17 -6
@@ -332,6 +332,9 @@ static void test_plane_rotation(data_t *data, int plane_type)enum igt_commit_style commit =COMMIT_LEGACY ;int ret; +if (data->flips && plane_type !=DRM_PLANE_TYPE_PRIMARY ) +igt_require (data->display.is_atomic); +if (plane_type ==DRM_PLANE_TYPE_PRIMARY || plane_type ==DRM_PLANE_TYPE_CURSOR ) commit =COMMIT_UNIVERSAL ;
@@ -390,12 +393,20 @@ static void test_plane_rotation(data_t *data, int plane_type)* check CRC against that one as well. */ if (data->flips) { - ret =drmModePageFlip (data->gfx_fd, - output->config.crtc->crtc_id, - data->fb_flip.fb_id, -DRM_MODE_PAGE_FLIP_EVENT , -NULL ); -igt_assert_eq (ret,0 ); +igt_plane_set_fb (plane, &data->fb_flip); +if (data->rotation ==IGT_ROTATION_90 || data->rotation ==IGT_ROTATION_270 ) +igt_plane_set_size (plane, data->fb.height, data->fb.width); + +if (plane_type !=DRM_PLANE_TYPE_PRIMARY ) { +igt_display_commit_atomic (display,DRM_MODE_PAGE_FLIP_EVENT |DRM_MODE_ATOMIC_NONBLOCK ,NULL ); + }else { + ret =drmModePageFlip (data->gfx_fd, + output->config.crtc->crtc_id, + data->fb_flip.fb_id, +DRM_MODE_PAGE_FLIP_EVENT , +NULL ); +igt_assert_eq (ret,0 ); + }wait_for_pageflip (data->gfx_fd);igt_pipe_crc_collect_crc (data->pipe_crc, &crc_output);
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/6 tests: Rename kms_pipe_color to kms_color
In reply to Maarten LankhorstRename kms_pipe_color to kms_color, and rename the invalid tests to pipe-invalid. To prepare for adding support for plane color management.
---
tests/Makefile.sources | 2 +-
tests/{kms_pipe_color.c => kms_color.c} | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
rename tests/{kms_pipe_color.c => kms_color.c} (99%)tests/Makefile.sources +1 -1
@@ -177,6 +177,7 @@ TESTS_progs = \ kms_busy \ kms_ccs \ kms_chv_cursor_fail \ + kms_color \ kms_concurrent \ kms_crtc_background_color \ kms_cursor_crc \
@@ -197,7 +198,6 @@ TESTS_progs = \ kms_mmio_vs_cs_flip \ kms_panel_fitting \ kms_pipe_b_c_ivb \ - kms_pipe_color \ kms_pipe_crc_basic \ kms_plane \ kms_plane_lowres \
tests/kms_color.c renamed from tests/kms_pipe_color.c +2 -2
@@ -1205,10 +1205,10 @@ igt_mainigt_subtest_group run_tests_for_pipe(&data, pipe); - igt_subtest_f("invalid-lut-sizes") + igt_subtest_f("pipe-invalid-lut-sizes")invalid_lut_sizes (&data); - igt_subtest_f("invalid-ctm-matrix-sizes") + igt_subtest_f("pipe-invalid-ctm-matrix-sizes")invalid_ctm_matrix_sizes (&data); igt_fixture {
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for lib/igt_kms: Convert properties to be more atomic-like.
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: lib/igt_kms: Convert properties to be more atomic-like.
URL : https://patchwork.freedesktop.org/series/30903/
State : failure
== Summary ==
IGT patchset tested on top of latest successful build 2885b10f99b4beeb046e75af8b8488c229f629d3 igt/gem_exec_schedule: Ignore set-priority failures on old kernels
with latest DRM-Tip kernel build CI_DRM_3140c4c623d58e38 drm-tip: 2017y-09m-26d-16h-37m-12s UTC integration manifest
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-atomic:
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m) fdo#100215 +5
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-kbl-7500u)
dmesg-warn -> FAIL (fi-cfl-s) fdo#102294 +8
Subgroup basic-busy-flip-before-cursor-legacy:
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-kbl-7500u)
Subgroup basic-flip-after-cursor-atomic:
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-kbl-7500u)
Subgroup basic-flip-after-cursor-legacy:
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-kbl-7500u)
Subgroup basic-flip-after-cursor-varying-size:
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-kbl-7500u)
Subgroup basic-flip-before-cursor-atomic:
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-kbl-7500u)
Subgroup basic-flip-before-cursor-legacy:
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-kbl-7500u)
Subgroup basic-flip-before-cursor-varying-size:
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-kbl-7500u)fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fdo#102294 https://bugs.freedesktop.org/show_bug.cgi?id=102294
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:445s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:471s fi-blb-e6850 total:289 pass:224 dwarn:1 dfail:0 fail:0 skip:64 time:421s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:536s fi-bwr-2160 total:289 pass:184 dwarn:0 dfail:0 fail:0 skip:105 time:282s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:503s fi-byt-j1900 total:289 pass:254 dwarn:1 dfail:0 fail:0 skip:34 time:505s fi-byt-n2820 total:289 pass:250 dwarn:1 dfail:0 fail:0 skip:38 time:503s fi-cfl-s total:245 pass:188 dwarn:18 dfail:0 fail:8 skip:30 fi-cnl-y total:289 pass:257 dwarn:0 dfail:0 fail:5 skip:27 time:668s fi-elk-e7500 total:289 pass:230 dwarn:0 dfail:0 fail:0 skip:59 time:426s fi-glk-1 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:570s fi-hsw-4770 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:425s fi-hsw-4770r total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:403s fi-ilk-650 total:289 pass:221 dwarn:0 dfail:0 fail:8 skip:60 time:424s fi-ivb-3520m total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:497s fi-ivb-3770 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:465s fi-kbl-7500u total:289 pass:256 dwarn:1 dfail:0 fail:8 skip:24 time:461s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:582s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:589s fi-pnv-d510 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:544s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:462s fi-skl-6700k total:289 pass:257 dwarn:0 dfail:0 fail:8 skip:24 time:739s fi-skl-6770hq total:289 pass:261 dwarn:0 dfail:0 fail:8 skip:20 time:482s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:480s fi-snb-2520m total:289 pass:243 dwarn:0 dfail:0 fail:8 skip:38 time:559s fi-snb-2600 total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:420s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_254/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx