Commit 90254c14 authored by Melissa Wen's avatar Melissa Wen Committed by Arkadiusz Hiler

lib/igt_fb: remove extra parameters from igt_put_cairo_ctx

The function igt_put_cairo_ctx currently requires three parameters, but only
one of them is used in it. This patch removes the useless parameters, making
the code more readable and cohesive. It also applies the change to all
occurrences of the function in the code.
Signed-off-by: Melissa Wen's avatarMelissa Wen <melissa.srw@gmail.com>
Reviewed-by: default avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent 5da80efb
Pipeline #172842 passed with stages
in 11 minutes and 43 seconds
...@@ -1697,7 +1697,7 @@ unsigned int igt_create_color_fb(int fd, int width, int height, ...@@ -1697,7 +1697,7 @@ unsigned int igt_create_color_fb(int fd, int width, int height,
cr = igt_get_cairo_ctx(fd, fb); cr = igt_get_cairo_ctx(fd, fb);
igt_paint_color(cr, 0, 0, width, height, r, g, b); igt_paint_color(cr, 0, 0, width, height, r, g, b);
igt_put_cairo_ctx(fd, fb, cr); igt_put_cairo_ctx(cr);
return fb_id; return fb_id;
} }
...@@ -1734,7 +1734,7 @@ unsigned int igt_create_pattern_fb(int fd, int width, int height, ...@@ -1734,7 +1734,7 @@ unsigned int igt_create_pattern_fb(int fd, int width, int height,
cr = igt_get_cairo_ctx(fd, fb); cr = igt_get_cairo_ctx(fd, fb);
igt_paint_test_pattern(cr, width, height); igt_paint_test_pattern(cr, width, height);
igt_put_cairo_ctx(fd, fb, cr); igt_put_cairo_ctx(cr);
return fb_id; return fb_id;
} }
...@@ -1777,7 +1777,7 @@ unsigned int igt_create_color_pattern_fb(int fd, int width, int height, ...@@ -1777,7 +1777,7 @@ unsigned int igt_create_color_pattern_fb(int fd, int width, int height,
cr = igt_get_cairo_ctx(fd, fb); cr = igt_get_cairo_ctx(fd, fb);
igt_paint_color(cr, 0, 0, width, height, r, g, b); igt_paint_color(cr, 0, 0, width, height, r, g, b);
igt_paint_test_pattern(cr, width, height); igt_paint_test_pattern(cr, width, height);
igt_put_cairo_ctx(fd, fb, cr); igt_put_cairo_ctx(cr);
return fb_id; return fb_id;
} }
...@@ -1820,7 +1820,7 @@ unsigned int igt_create_image_fb(int fd, int width, int height, ...@@ -1820,7 +1820,7 @@ unsigned int igt_create_image_fb(int fd, int width, int height,
cr = igt_get_cairo_ctx(fd, fb); cr = igt_get_cairo_ctx(fd, fb);
igt_paint_image(cr, filename, 0, 0, width, height); igt_paint_image(cr, filename, 0, 0, width, height);
igt_put_cairo_ctx(fd, fb, cr); igt_put_cairo_ctx(cr);
return fb_id; return fb_id;
} }
...@@ -1920,7 +1920,7 @@ unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode, ...@@ -1920,7 +1920,7 @@ unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode,
layout.right.x, layout.right.y, layout.right.x, layout.right.y,
layout.right.width, layout.right.height); layout.right.width, layout.right.height);
igt_put_cairo_ctx(drm_fd, &fb, cr); igt_put_cairo_ctx(cr);
return fb_id; return fb_id;
} }
...@@ -3578,15 +3578,13 @@ cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb) ...@@ -3578,15 +3578,13 @@ cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb)
/** /**
* igt_put_cairo_ctx: * igt_put_cairo_ctx:
* @fd: open i915 drm file descriptor
* @fb: pointer to an #igt_fb structure
* @cr: the cairo context returned by igt_get_cairo_ctx. * @cr: the cairo context returned by igt_get_cairo_ctx.
* *
* This releases the cairo surface @cr returned by igt_get_cairo_ctx() * This releases the cairo surface @cr returned by igt_get_cairo_ctx()
* for @fb, and writes the changes out to the framebuffer if cairo doesn't * for fb, and writes the changes out to the framebuffer if cairo doesn't
* have native support for the format. * have native support for the format.
*/ */
void igt_put_cairo_ctx(int fd, struct igt_fb *fb, cairo_t *cr) void igt_put_cairo_ctx(cairo_t *cr)
{ {
cairo_status_t ret = cairo_status(cr); cairo_status_t ret = cairo_status(cr);
igt_assert_f(ret == CAIRO_STATUS_SUCCESS, "Cairo failed to draw with %s\n", cairo_status_to_string(ret)); igt_assert_f(ret == CAIRO_STATUS_SUCCESS, "Cairo failed to draw with %s\n", cairo_status_to_string(ret));
...@@ -3657,7 +3655,7 @@ unsigned int igt_fb_convert_with_stride(struct igt_fb *dst, struct igt_fb *src, ...@@ -3657,7 +3655,7 @@ unsigned int igt_fb_convert_with_stride(struct igt_fb *dst, struct igt_fb *src,
cr = igt_get_cairo_ctx(dst->fd, dst); cr = igt_get_cairo_ctx(dst->fd, dst);
cairo_set_source_surface(cr, surf, 0, 0); cairo_set_source_surface(cr, surf, 0, 0);
cairo_paint(cr); cairo_paint(cr);
igt_put_cairo_ctx(dst->fd, dst, cr); igt_put_cairo_ctx(cr);
cairo_surface_destroy(surf); cairo_surface_destroy(surf);
......
...@@ -178,7 +178,7 @@ int igt_fb_ccs_to_main_plane(const struct igt_fb *fb, int ccs_plane); ...@@ -178,7 +178,7 @@ int igt_fb_ccs_to_main_plane(const struct igt_fb *fb, int ccs_plane);
cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb); cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb);
cairo_surface_t *igt_cairo_image_surface_create_from_png(const char *filename); cairo_surface_t *igt_cairo_image_surface_create_from_png(const char *filename);
cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb); cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb);
void igt_put_cairo_ctx(int fd, struct igt_fb *fb, cairo_t *cr); void igt_put_cairo_ctx(cairo_t *cr);
void igt_paint_color(cairo_t *cr, int x, int y, int w, int h, void igt_paint_color(cairo_t *cr, int x, int y, int w, int h,
double r, double g, double b); double r, double g, double b);
void igt_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h, void igt_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h,
......
...@@ -134,7 +134,7 @@ static void draw_color(igt_fb_t *fb, double r, double g, double b) ...@@ -134,7 +134,7 @@ static void draw_color(igt_fb_t *fb, double r, double g, double b)
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
igt_paint_color(cr, 0, 0, fb->width, fb->height, r, g, b); igt_paint_color(cr, 0, 0, fb->width, fb->height, r, g, b);
igt_put_cairo_ctx(fb->fd, fb, cr); igt_put_cairo_ctx(cr);
} }
/* Generates the gamma test pattern. */ /* Generates the gamma test pattern. */
...@@ -148,7 +148,7 @@ static void draw_gamma_test(igt_fb_t *fb) ...@@ -148,7 +148,7 @@ static void draw_gamma_test(igt_fb_t *fb)
igt_paint_color_gradient(cr, 0, gh * 2, fb->width, gh, 0, 1, 0); igt_paint_color_gradient(cr, 0, gh * 2, fb->width, gh, 0, 1, 0);
igt_paint_color_gradient(cr, 0, gh * 3, fb->width, gh, 0, 0, 1); igt_paint_color_gradient(cr, 0, gh * 3, fb->width, gh, 0, 0, 1);
igt_put_cairo_ctx(fb->fd, fb, cr); igt_put_cairo_ctx(cr);
} }
/* Sets the degamma LUT. */ /* Sets the degamma LUT. */
......
...@@ -131,7 +131,7 @@ static void paint_rectangles(data_t *data, ...@@ -131,7 +131,7 @@ static void paint_rectangles(data_t *data,
colors[i - 1].r, colors[i - 1].g, colors[i - 1].r, colors[i - 1].g,
colors[i - 1].b); colors[i - 1].b);
igt_put_cairo_ctx(data->drm_fd, fb, cr); igt_put_cairo_ctx(cr);
} }
static void setup_primary(data_t *data) static void setup_primary(data_t *data)
......
...@@ -309,7 +309,7 @@ plane_primary_overlay_mutable_zpos(igt_pipe_t *pipe, igt_output_t *output, ...@@ -309,7 +309,7 @@ plane_primary_overlay_mutable_zpos(igt_pipe_t *pipe, igt_output_t *output,
w_overlay / 2, h_overlay / 2, w_overlay / 2, h_overlay / 2,
0.0, 0.0, 0.0, 0.0); 0.0, 0.0, 0.0, 0.0);
cairo_set_operator(cr, CAIRO_OPERATOR_OVER); cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
igt_put_cairo_ctx(pipe->display->drm_fd, &fb_overlay, cr); igt_put_cairo_ctx(cr);
igt_plane_set_fb(primary, &fb_primary); igt_plane_set_fb(primary, &fb_primary);
igt_plane_set_fb(overlay, &fb_overlay); igt_plane_set_fb(overlay, &fb_overlay);
...@@ -343,7 +343,7 @@ plane_primary_overlay_mutable_zpos(igt_pipe_t *pipe, igt_output_t *output, ...@@ -343,7 +343,7 @@ plane_primary_overlay_mutable_zpos(igt_pipe_t *pipe, igt_output_t *output,
w_overlay, h_overlay, w_overlay, h_overlay,
0.0, 0.0, 0.0, 0.5); 0.0, 0.0, 0.0, 0.5);
cairo_set_operator(cr, CAIRO_OPERATOR_OVER); cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
igt_put_cairo_ctx(pipe->display->drm_fd, &fb_primary, cr); igt_put_cairo_ctx(cr);
igt_info("Committing with a hole in the primary through "\ igt_info("Committing with a hole in the primary through "\
"which the underlay should be seen\n"); "which the underlay should be seen\n");
...@@ -398,7 +398,7 @@ plane_immutable_zpos(igt_display_t *display, igt_pipe_t *pipe, ...@@ -398,7 +398,7 @@ plane_immutable_zpos(igt_display_t *display, igt_pipe_t *pipe,
igt_assert(cairo_status(cr) == 0); igt_assert(cairo_status(cr) == 0);
igt_paint_color(cr, 0, 0, w_lower, h_lower, 0.0, 0.0, 1.0); igt_paint_color(cr, 0, 0, w_lower, h_lower, 0.0, 0.0, 1.0);
igt_paint_color(cr, w_upper / 2, h_upper / 2, w_upper, h_upper, 1.0, 1.0, 0.0); igt_paint_color(cr, w_upper / 2, h_upper / 2, w_upper, h_upper, 1.0, 1.0, 0.0);
igt_put_cairo_ctx(display->drm_fd, &fb_ref, cr); igt_put_cairo_ctx(cr);
igt_plane_set_fb(primary, &fb_ref); igt_plane_set_fb(primary, &fb_ref);
igt_display_commit2(display, COMMIT_ATOMIC); igt_display_commit2(display, COMMIT_ATOMIC);
......
...@@ -96,7 +96,7 @@ static void generate_comparison_crc_list(data_t *data, igt_output_t *output) ...@@ -96,7 +96,7 @@ static void generate_comparison_crc_list(data_t *data, igt_output_t *output)
0.0, 0.0, 0.0); 0.0, 0.0, 0.0);
igt_paint_color(cr, 0, 0, w, h, 1.0, 1.0, 1.0); igt_paint_color(cr, 0, 0, w, h, 1.0, 1.0, 1.0);
igt_assert(cairo_status(cr) == 0); igt_assert(cairo_status(cr) == 0);
igt_put_cairo_ctx(data->gfx_fd, &data->primary_fb, cr); igt_put_cairo_ctx(cr);
primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, &data->primary_fb); igt_plane_set_fb(primary, &data->primary_fb);
...@@ -108,7 +108,7 @@ static void generate_comparison_crc_list(data_t *data, igt_output_t *output) ...@@ -108,7 +108,7 @@ static void generate_comparison_crc_list(data_t *data, igt_output_t *output)
cr = igt_get_cairo_ctx(data->gfx_fd, &data->primary_fb); cr = igt_get_cairo_ctx(data->gfx_fd, &data->primary_fb);
igt_paint_color(cr, 0, 0, mode->hdisplay, mode->vdisplay, 1.0, 1.0, 1.0); igt_paint_color(cr, 0, 0, mode->hdisplay, mode->vdisplay, 1.0, 1.0, 1.0);
igt_put_cairo_ctx(data->gfx_fd, &data->primary_fb, cr); igt_put_cairo_ctx(cr);
igt_plane_set_fb(primary, &data->primary_fb); igt_plane_set_fb(primary, &data->primary_fb);
igt_display_commit2(&data->display, data->commit); igt_display_commit2(&data->display, data->commit);
......
...@@ -246,7 +246,7 @@ static void generate_fb(data_t *data, struct igt_fb *fb, ...@@ -246,7 +246,7 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
cr = igt_get_cairo_ctx(data->drm_fd, fb); cr = igt_get_cairo_ctx(data->drm_fd, fb);
igt_paint_color(cr, 0, 0, width, height, igt_paint_color(cr, 0, 0, width, height,
colors[c].r, colors[c].g, colors[c].b); colors[c].r, colors[c].g, colors[c].b);
igt_put_cairo_ctx(data->drm_fd, fb, cr); igt_put_cairo_ctx(cr);
} }
ret = drmIoctl(data->drm_fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f); ret = drmIoctl(data->drm_fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f);
......
...@@ -57,7 +57,7 @@ void paint_gradient_rectangles(data_t *data, ...@@ -57,7 +57,7 @@ void paint_gradient_rectangles(data_t *data,
colors[i-1].g, colors[i-1].g,
colors[i-1].b); colors[i-1].b);
igt_put_cairo_ctx(data->drm_fd, fb, cr); igt_put_cairo_ctx(cr);
} }
void paint_rectangles(data_t *data, void paint_rectangles(data_t *data,
...@@ -79,7 +79,7 @@ void paint_rectangles(data_t *data, ...@@ -79,7 +79,7 @@ void paint_rectangles(data_t *data,
igt_paint_color(cr, i * l, 0, rows_remaining, mode->vdisplay, igt_paint_color(cr, i * l, 0, rows_remaining, mode->vdisplay,
colors[i-1].r, colors[i-1].g, colors[i-1].b); colors[i-1].r, colors[i-1].g, colors[i-1].b);
igt_put_cairo_ctx(data->drm_fd, fb, cr); igt_put_cairo_ctx(cr);
} }
gamma_lut_t *alloc_lut(int lut_size) gamma_lut_t *alloc_lut(int lut_size)
......
...@@ -126,7 +126,7 @@ create_fb_for_mode_position(data_t *data, drmModeModeInfo *mode, ...@@ -126,7 +126,7 @@ create_fb_for_mode_position(data_t *data, drmModeModeInfo *mode,
rect_w[i], rect_h[i], 0.0, 0.0, 0.0); rect_w[i], rect_h[i], 0.0, 0.0, 0.0);
} }
igt_put_cairo_ctx(data->drm_fd, &data->fb[primary->index], cr); igt_put_cairo_ctx(cr);
} }
static void static void
......
...@@ -69,7 +69,7 @@ paint_background(data_t *data, struct igt_fb *fb, drmModeModeInfo *mode, ...@@ -69,7 +69,7 @@ paint_background(data_t *data, struct igt_fb *fb, drmModeModeInfo *mode,
b = (double) ((background & 0xFF0000) >> 16) / 255.0; b = (double) ((background & 0xFF0000) >> 16) / 255.0;
igt_paint_color_alpha(cr, 0, 0, w, h, r, g, b, alpha); igt_paint_color_alpha(cr, 0, 0, w, h, r, g, b, alpha);
igt_put_cairo_ctx(data->gfx_fd, &data->fb, cr); igt_put_cairo_ctx(cr);
} }
static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
......
...@@ -167,8 +167,7 @@ static void restore_image(data_t *data) ...@@ -167,8 +167,7 @@ static void restore_image(data_t *data)
cairo_set_source_surface(cr, data->surface, 0, 0); cairo_set_source_surface(cr, data->surface, 0, 0);
cairo_rectangle(cr, 0, 0, data->screenw, data->screenh); cairo_rectangle(cr, 0, 0, data->screenw, data->screenh);
cairo_fill(cr); cairo_fill(cr);
igt_put_cairo_ctx(data->drm_fd, igt_put_cairo_ctx(cr);
&data->primary_fb[FRONTBUFFER], cr);
} }
igt_dirty_fb(data->drm_fd, &data->primary_fb[FRONTBUFFER]); igt_dirty_fb(data->drm_fd, &data->primary_fb[FRONTBUFFER]);
} }
...@@ -235,7 +234,7 @@ static void do_single_test(data_t *data, int x, int y) ...@@ -235,7 +234,7 @@ static void do_single_test(data_t *data, int x, int y)
/* Now render the same in software and collect crc */ /* Now render the same in software and collect crc */
cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER]); cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER]);
draw_cursor(cr, x, y, data->curw, data->curh, 1.0); draw_cursor(cr, x, y, data->curw, data->curh, 1.0);
igt_put_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER], cr); igt_put_cairo_ctx(cr);
igt_display_commit(display); igt_display_commit(display);
igt_dirty_fb(data->drm_fd, &data->primary_fb[FRONTBUFFER]); igt_dirty_fb(data->drm_fd, &data->primary_fb[FRONTBUFFER]);
/* Extra vblank wait is because nonblocking cursor ioctl */ /* Extra vblank wait is because nonblocking cursor ioctl */
...@@ -451,8 +450,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, ...@@ -451,8 +450,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
&data->primary_fb[RESTOREBUFFER]); &data->primary_fb[RESTOREBUFFER]);
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
igt_paint_test_pattern(cr, data->screenw, data->screenh); igt_paint_test_pattern(cr, data->screenw, data->screenh);
igt_put_cairo_ctx(data->drm_fd, igt_put_cairo_ctx(cr);
&data->primary_fb[RESTOREBUFFER], cr);
data->drmibo[FRONTBUFFER] = gem_handle_to_libdrm_bo(data->bufmgr, data->drmibo[FRONTBUFFER] = gem_handle_to_libdrm_bo(data->bufmgr,
data->drm_fd, data->drm_fd,
...@@ -493,7 +491,7 @@ static void test_cursor_alpha(data_t *data, double a) ...@@ -493,7 +491,7 @@ static void test_cursor_alpha(data_t *data, double a)
igt_assert(fb_id); igt_assert(fb_id);
cr = igt_get_cairo_ctx(data->drm_fd, &data->fb); cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a); igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
igt_put_cairo_ctx(data->drm_fd, &data->fb, cr); igt_put_cairo_ctx(cr);
/*Hardware Test*/ /*Hardware Test*/
cursor_enable(data); cursor_enable(data);
...@@ -506,7 +504,7 @@ static void test_cursor_alpha(data_t *data, double a) ...@@ -506,7 +504,7 @@ static void test_cursor_alpha(data_t *data, double a)
/*Software Test*/ /*Software Test*/
cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER]); cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER]);
igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a); igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
igt_put_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER], cr); igt_put_cairo_ctx(cr);
igt_display_commit(display); igt_display_commit(display);
igt_wait_for_vblank(data->drm_fd, data->pipe); igt_wait_for_vblank(data->drm_fd, data->pipe);
...@@ -517,7 +515,7 @@ static void test_cursor_alpha(data_t *data, double a) ...@@ -517,7 +515,7 @@ static void test_cursor_alpha(data_t *data, double a)
cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER]); cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER]);
igt_paint_color(cr, 0, 0, data->screenw, data->screenh, igt_paint_color(cr, 0, 0, data->screenw, data->screenh,
0.0, 0.0, 0.0); 0.0, 0.0, 0.0);
igt_put_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER], cr); igt_put_cairo_ctx(cr);
} }
static void test_cursor_transparent(data_t *data) static void test_cursor_transparent(data_t *data)
...@@ -559,7 +557,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h) ...@@ -559,7 +557,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
cr = igt_get_cairo_ctx(data->drm_fd, &data->fb); cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
draw_cursor(cr, 0, 0, cur_w, cur_h, 1.0); draw_cursor(cr, 0, 0, cur_w, cur_h, 1.0);
igt_put_cairo_ctx(data->drm_fd, &data->fb, cr); igt_put_cairo_ctx(cr);
} }
static bool has_nonsquare_cursors(data_t *data) static bool has_nonsquare_cursors(data_t *data)
...@@ -605,7 +603,7 @@ static void test_cursor_size(data_t *data) ...@@ -605,7 +603,7 @@ static void test_cursor_size(data_t *data)
/* Use a solid white rectangle as the cursor */ /* Use a solid white rectangle as the cursor */
cr = igt_get_cairo_ctx(data->drm_fd, &data->fb); cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
igt_paint_color_alpha(cr, 0, 0, cursor_max_size, cursor_max_size, 1.0, 1.0, 1.0, 1.0); igt_paint_color_alpha(cr, 0, 0, cursor_max_size, cursor_max_size, 1.0, 1.0, 1.0, 1.0);
igt_put_cairo_ctx(data->drm_fd, &data->fb, cr); igt_put_cairo_ctx(cr);
/* Hardware test loop */ /* Hardware test loop */
cursor_enable(data); cursor_enable(data);
...@@ -625,7 +623,7 @@ static void test_cursor_size(data_t *data) ...@@ -625,7 +623,7 @@ static void test_cursor_size(data_t *data)
/* Now render the same in software and collect crc */ /* Now render the same in software and collect crc */
cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER]); cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER]);
igt_paint_color_alpha(cr, 0, 0, size, size, 1.0, 1.0, 1.0, 1.0); igt_paint_color_alpha(cr, 0, 0, size, size, 1.0, 1.0, 1.0, 1.0);
igt_put_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER], cr); igt_put_cairo_ctx(cr);
igt_display_commit(display); igt_display_commit(display);
igt_wait_for_vblank(data->drm_fd, data->pipe); igt_wait_for_vblank(data->drm_fd, data->pipe);
...@@ -634,7 +632,7 @@ static void test_cursor_size(data_t *data) ...@@ -634,7 +632,7 @@ static void test_cursor_size(data_t *data)
cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER]); cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER]);
igt_paint_color(cr, 0, 0, data->screenw, data->screenh, igt_paint_color(cr, 0, 0, data->screenw, data->screenh,
0.0, 0.0, 0.0); 0.0, 0.0, 0.0);
igt_put_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER], cr); igt_put_cairo_ctx(cr);
igt_assert_crc_equal(&crc[i], &ref_crc); igt_assert_crc_equal(&crc[i], &ref_crc);
} }
} }
......
...@@ -78,7 +78,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h) ...@@ -78,7 +78,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
else else
igt_paint_color_alpha(cr, 0, 0, data->fb.width, data->fb.height, igt_paint_color_alpha(cr, 0, 0, data->fb.width, data->fb.height,
0.0, 0.0, 0.0, 0.0); 0.0, 0.0, 0.0, 0.0);
igt_put_cairo_ctx(data->drm_fd, &data->fb, cr); igt_put_cairo_ctx(cr);
} }
static void cursor_move(data_t *data, int x, int y, int i) static void cursor_move(data_t *data, int x, int y, int i)
......
...@@ -983,7 +983,7 @@ static void paint_flip_mode(struct igt_fb *fb, bool odd_frame) ...@@ -983,7 +983,7 @@ static void paint_flip_mode(struct igt_fb *fb, bool odd_frame)
cairo_set_source_rgb(cr, 1, 1, 1); cairo_set_source_rgb(cr, 1, 1, 1);
cairo_fill(cr); cairo_fill(cr);
igt_put_cairo_ctx(drm_fd, fb, cr); igt_put_cairo_ctx(cr);
} }
static bool fb_is_bound(struct test_output *o, int fb) static bool fb_is_bound(struct test_output *o, int fb)
......
...@@ -141,7 +141,7 @@ static void draw_hdr_pattern(igt_fb_t *fb) ...@@ -141,7 +141,7 @@ static void draw_hdr_pattern(igt_fb_t *fb)
igt_paint_color(cr, 0, 0, fb->width, fb->height, 1.0, 1.0, 1.0); igt_paint_color(cr, 0, 0, fb->width, fb->height, 1.0, 1.0, 1.0);
igt_paint_test_pattern(cr, fb->width, fb->height); igt_paint_test_pattern(cr, fb->width, fb->height);
igt_put_cairo_ctx(fb->fd, fb, cr); igt_put_cairo_ctx(cr);
} }
/* Prepare test data. */ /* Prepare test data. */
......
...@@ -92,7 +92,7 @@ static void test(data_t *data) ...@@ -92,7 +92,7 @@ static void test(data_t *data)
cr = igt_get_cairo_ctx(data->drm_fd, fb); cr = igt_get_cairo_ctx(data->drm_fd, fb);
igt_paint_test_pattern(cr, fb->width, fb->height); igt_paint_test_pattern(cr, fb->width, fb->height);
igt_put_cairo_ctx(data->drm_fd, fb, cr); igt_put_cairo_ctx(cr);
/* flip to it to make it UC/WC and fully flushed */ /* flip to it to make it UC/WC and fully flushed */
igt_plane_set_fb(data->primary, fb); igt_plane_set_fb(data->primary, fb);
...@@ -135,7 +135,7 @@ static void test(data_t *data) ...@@ -135,7 +135,7 @@ static void test(data_t *data)
* fully flushed */ * fully flushed */
cr = igt_get_cairo_ctx(data->drm_fd, fb); cr = igt_get_cairo_ctx(data->drm_fd, fb);
igt_paint_test_pattern(cr, fb->width, fb->height); igt_paint_test_pattern(cr, fb->width, fb->height);
igt_put_cairo_ctx(data->drm_fd, fb, cr); igt_put_cairo_ctx(cr);
igt_plane_set_fb(data->primary, fb); igt_plane_set_fb(data->primary, fb);
igt_display_commit(display); igt_display_commit(display);
......
...@@ -149,7 +149,7 @@ create_fb_for_mode__position(data_t *data, drmModeModeInfo *mode, ...@@ -149,7 +149,7 @@ create_fb_for_mode__position(data_t *data, drmModeModeInfo *mode,
igt_paint_color(cr, 0, 0, mode->hdisplay, mode->vdisplay, igt_paint_color(cr, 0, 0, mode->hdisplay, mode->vdisplay,
0.0, 1.0, 0.0); 0.0, 1.0, 0.0);
igt_paint_color(cr, rect_x, rect_y, rect_w, rect_h, 0.0, 0.0, 0.0); igt_paint_color(cr, rect_x, rect_y, rect_w, rect_h, 0.0, 0.0, 0.0);
igt_put_cairo_ctx(data->drm_fd, fb, cr); igt_put_cairo_ctx(cr);
} }
enum { enum {
...@@ -284,7 +284,7 @@ create_fb_for_mode__panning(data_t *data, drmModeModeInfo *mode, ...@@ -284,7 +284,7 @@ create_fb_for_mode__panning(data_t *data, drmModeModeInfo *mode,
mode->hdisplay, mode->vdisplay, mode->hdisplay, mode->vdisplay,
0.0, 0.0, 1.0); 0.0, 0.0, 1.0);
igt_put_cairo_ctx(data->drm_fd, fb, cr); igt_put_cairo_ctx(cr);
} }
enum { enum {
...@@ -460,7 +460,7 @@ static void prepare_format_color(data_t *data, enum pipe pipe, ...@@ -460,7 +460,7 @@ static void prepare_format_color(data_t *data, enum pipe pipe,
igt_paint_color(cr, 0, 0, width, height, igt_paint_color(cr, 0, 0, width, height,
c->red, c->green, c->blue); c->red, c->green, c->blue);
igt_put_cairo_ctx(data->drm_fd, fb, cr); igt_put_cairo_ctx(cr);
} else { } else {
igt_create_fb_with_bo_size(data->drm_fd, igt_create_fb_with_bo_size(data->drm_fd,
width + data->crop * 2, width + data->crop * 2,
...@@ -485,7 +485,7 @@ static void prepare_format_color(data_t *data, enum pipe pipe, ...@@ -485,7 +485,7 @@ static void prepare_format_color(data_t *data, enum pipe pipe,
width, height, width, height,
c->red, c->green, c->blue); c->red, c->green, c->blue);
igt_put_cairo_ctx(data->drm_fd, fb, cr); igt_put_cairo_ctx(cr);
} }
igt_plane_set_fb(plane, fb); igt_plane_set_fb(plane, fb);
......
...@@ -60,7 +60,7 @@ static void draw_gradient(struct igt_fb *fb, int w, int h, double a) ...@@ -60,7 +60,7 @@ static void draw_gradient(struct igt_fb *fb, int w, int h, double a)
__draw_gradient(fb, w, h, a, cr); __draw_gradient(fb, w, h, a, cr);
igt_put_cairo_ctx(fb->fd, fb, cr); igt_put_cairo_ctx(cr);
} }
static void draw_gradient_coverage(struct igt_fb *fb, int w, int h, uint8_t a) static void draw_gradient_coverage(struct igt_fb *fb, int w, int h, uint8_t a)
...@@ -76,7 +76,7 @@ static void draw_gradient_coverage(struct igt_fb *fb, int w, int h, uint8_t a) ...@@ -76,7 +76,7 @@ static void draw_gradient_coverage(struct igt_fb *fb, int w, int h, uint8_t a)
for (i = 0; i < w; i++) for (i = 0; i < w; i++)
data[i * 4 + 3] = a; data[i * 4 + 3] = a;
igt_put_cairo_ctx(fb->fd, fb, cr); igt_put_cairo_ctx(cr);
} }
static void draw_squares(struct igt_fb *fb, int w, int h, double a) static void draw_squares(struct igt_fb *fb, int w, int h, double a)
...@@ -90,7 +90,7 @@ static void draw_squares(struct igt_fb *fb, int w, int h, double a) ...@@ -90,7 +90,7 @@ static void draw_squares(struct igt_fb *fb, int w, int h, double a)
igt_paint_color_alpha(cr, w / 2, h / 2, w / 4, h / 2, 1., 1., 1., a); igt_paint_color_alpha(cr, w / 2, h / 2, w / 4, h / 2, 1., 1., 1., a);
igt_paint_color_alpha(cr, 3 * w / 4, h / 2, w / 4, h / 2, 0., 0., 0., a); igt_paint_color_alpha(cr, 3 * w / 4, h / 2, w / 4, h / 2, 0., 0., 0., a);
igt_put_cairo_ctx(fb->fd, fb, cr); igt_put_cairo_ctx(cr);
} }
static void draw_squares_coverage(struct igt_fb *fb, int w, int h, uint8_t as) static void draw_squares_coverage(struct igt_fb *fb, int w, int h, uint8_t as)
...@@ -120,7 +120,7 @@ static void draw_squares_coverage(struct igt_fb *fb, int w, int h, uint8_t as) ...@@ -120,7 +120,7 @@ static void draw_squares_coverage(struct igt_fb *fb, int w, int h, uint8_t as)
data[j * stride + i] = a; data[j * stride + i] = a;
}