Simon Glass | d5099b4 | 2025-04-02 06:29:41 +1300 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright (c) 2013 Google, Inc. |
| 4 | */ |
| 5 | |
| 6 | #ifndef __TEST_VIDEO_H |
| 7 | #define __TEST_VIDEO_H |
| 8 | |
| 9 | #include <stdbool.h> |
| 10 | |
| 11 | struct udevice; |
| 12 | struct unit_test_state; |
| 13 | |
| 14 | /** |
| 15 | * video_compress_fb() - Compress the frame buffer and return its size |
| 16 | * |
| 17 | * We want to write tests which perform operations on the video console and |
| 18 | * check that the frame buffer ends up with the correct contents. But it is |
| 19 | * painful to store 'known good' images for comparison with the frame |
| 20 | * buffer. As an alternative, we can compress the frame buffer and check the |
| 21 | * size of the compressed data. This provides a pretty good level of |
| 22 | * certainty and the resulting tests need only check a single value. |
| 23 | * |
| 24 | * @uts: Test state |
| 25 | * @dev: Video device |
| 26 | * @use_copy: Use copy frame buffer if available |
| 27 | * Return: compressed size of the frame buffer, or -ve on error |
| 28 | */ |
| 29 | int video_compress_fb(struct unit_test_state *uts, struct udevice *dev, |
| 30 | bool use_copy); |
| 31 | |
| 32 | /** |
| 33 | * check_copy_frame_buffer() - Compare main frame buffer to copy |
| 34 | * |
| 35 | * If the copy frame buffer is enabled, this compares it to the main |
| 36 | * frame buffer. Normally they should have the same contents after a |
| 37 | * sync. |
| 38 | * |
| 39 | * @uts: Test state |
| 40 | * @dev: Video device |
| 41 | * Return: 0, or -ve on error |
| 42 | */ |
| 43 | int video_check_copy_fb(struct unit_test_state *uts, struct udevice *dev); |
| 44 | |
| 45 | #endif |