summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2015-03-24 17:35:10 -0300
committerPaulo Zanoni <paulo.r.zanoni@intel.com>2015-05-05 17:29:14 -0300
commitc0ed7d344af4d60d2c9663041233c3e0fbc2dc38 (patch)
treea32d8c4eb66deb373451279ee93581de5f3aff86 /tests
parent235e87de450714df9982fb86fae2dd5a9e8e2980 (diff)
tests/kms_fbc_crc: remove redundant information from data_t
While it is nice to have shorter names for the most-accessed variables, it makes the code more difficult to read since it's not clear to the code reader whether that "gem_handle" is from some FB or something else. The reader also has to audit the code to see if, for example, the value of data->handle[0] stays consistent with data->fb[0].gem_handle all the tame or if at some point the value is replaced with something else. So remove the redundant information, making it explicit that we're using the gem handles and FB IDs of the framebuffers all the time. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/kms_fbc_crc.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index 84597ed9..16f2464f 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -61,13 +61,11 @@ typedef struct {
drm_intel_bufmgr *bufmgr;
drm_intel_context *ctx[2];
uint32_t devid;
- uint32_t handle[2];
igt_display_t display;
igt_output_t *output;
enum pipe pipe;
igt_plane_t *primary;
struct igt_fb fb[2];
- uint32_t fb_id[2];
} data_t;
static const char *test_mode_str(enum test_mode mode)
@@ -214,14 +212,14 @@ static void test_crc(data_t *data, enum test_mode mode)
uint32_t crtc_id = data->output->config.crtc->crtc_id;
igt_pipe_crc_t *pipe_crc = data->pipe_crc;
igt_crc_t crc;
- uint32_t handle = data->handle[0];
+ uint32_t handle = data->fb[0].gem_handle;
igt_assert(fbc_enabled(data));
if (mode >= TEST_PAGE_FLIP_AND_MMAP_CPU) {
- handle = data->handle[1];
+ handle = data->fb[1].gem_handle;
igt_assert(drmModePageFlip(data->drm_fd, crtc_id,
- data->fb_id[1], 0, NULL) == 0);
+ data->fb[1].fb_id, 0, NULL) == 0);
igt_assert(wait_for_fbc_enabled(data));
}
@@ -230,7 +228,7 @@ static void test_crc(data_t *data, enum test_mode mode)
void *ptr;
case TEST_PAGE_FLIP:
igt_assert(drmModePageFlip(data->drm_fd, crtc_id,
- data->fb_id[1], 0, NULL) == 0);
+ data->fb[1].fb_id, 0, NULL) == 0);
break;
case TEST_MMAP_CPU:
case TEST_PAGE_FLIP_AND_MMAP_CPU:
@@ -312,24 +310,21 @@ static bool prepare_test(data_t *data, enum test_mode test_mode)
igt_output_t *output = data->output;
drmModeModeInfo *mode;
igt_pipe_crc_t *pipe_crc;
+ int rc;
data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
mode = igt_output_get_mode(data->output);
- data->fb_id[0] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
- DRM_FORMAT_XRGB8888,
- LOCAL_I915_FORMAT_MOD_X_TILED,
- 0.0, 0.0, 0.0, &data->fb[0]);
- igt_assert(data->fb_id[0]);
- data->fb_id[1] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
- DRM_FORMAT_XRGB8888,
- LOCAL_I915_FORMAT_MOD_X_TILED,
- 0.1, 0.1, 0.1,
- &data->fb[1]);
- igt_assert(data->fb_id[1]);
-
- data->handle[0] = data->fb[0].gem_handle;
- data->handle[1] = data->fb[1].gem_handle;
+ rc = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888,
+ LOCAL_I915_FORMAT_MOD_X_TILED,
+ 0.0, 0.0, 0.0, &data->fb[0]);
+ igt_assert(rc);
+ rc = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888,
+ LOCAL_I915_FORMAT_MOD_X_TILED,
+ 0.1, 0.1, 0.1, &data->fb[1]);
+ igt_assert(rc);
/* scanout = fb[1] */
igt_plane_set_fb(data->primary, &data->fb[1]);
@@ -370,10 +365,10 @@ static bool prepare_test(data_t *data, enum test_mode test_mode)
* Disable FBC RT address for both contexts
* (by "rendering" to a non-scanout buffer).
*/
- exec_nop(data, data->handle[0], data->ctx[1]);
- exec_nop(data, data->handle[0], data->ctx[0]);
- exec_nop(data, data->handle[0], data->ctx[1]);
- exec_nop(data, data->handle[0], data->ctx[0]);
+ exec_nop(data, data->fb[0].gem_handle, data->ctx[1]);
+ exec_nop(data, data->fb[0].gem_handle, data->ctx[0]);
+ exec_nop(data, data->fb[0].gem_handle, data->ctx[1]);
+ exec_nop(data, data->fb[0].gem_handle, data->ctx[0]);
}
/* scanout = fb[0] */