Skip to content

Commit

Permalink
virtio-gpu: use DIV_ROUND_UP
Browse files Browse the repository at this point in the history
I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
  • Loading branch information
elmarco committed Aug 31, 2017
1 parent 2c23ce2 commit e5f9903
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hw/display/virtio-gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static void virtio_gpu_transfer_to_host_2d(VirtIOGPU *g,
}

format = pixman_image_get_format(res->image);
bpp = (PIXMAN_FORMAT_BPP(format) + 7) / 8;
bpp = DIV_ROUND_UP(PIXMAN_FORMAT_BPP(format), 8);
stride = pixman_image_get_stride(res->image);

if (t2d.offset || t2d.r.x || t2d.r.y ||
Expand Down Expand Up @@ -570,7 +570,7 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g,
scanout = &g->scanout[ss.scanout_id];

format = pixman_image_get_format(res->image);
bpp = (PIXMAN_FORMAT_BPP(format) + 7) / 8;
bpp = DIV_ROUND_UP(PIXMAN_FORMAT_BPP(format), 8);
offset = (ss.r.x * bpp) + ss.r.y * pixman_image_get_stride(res->image);
if (!scanout->ds || surface_data(scanout->ds)
!= ((uint8_t *)pixman_image_get_data(res->image) + offset) ||
Expand Down

0 comments on commit e5f9903

Please sign in to comment.