]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/blob - libkms++util/kms++util.h
py: fix scripts when there's no current crtc
[android/external-libkmsxx.git] / libkms++util / kms++util.h
1 #pragma once
3 #include <kms++.h>
5 #include "color.h"
6 #include <cstdio>
7 #include <cstdlib>
9 namespace kms
10 {
11 class IMappedFramebuffer;
13 void draw_rgb_pixel(IMappedFramebuffer& buf, unsigned x, unsigned y, RGB color);
14 void draw_yuv422_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2);
15 void draw_yuv420_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y,
16                                    YUV yuv1, YUV yuv2, YUV yuv3, YUV yuv4);
17 void draw_rect(IMappedFramebuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color);
18 void draw_text(IMappedFramebuffer& buf, uint32_t x, uint32_t y, const std::string& str, RGB color);
20 void draw_color_bar(IMappedFramebuffer& buf, int old_xpos, int xpos, int width);
22 void draw_test_pattern(IMappedFramebuffer &fb);
24 Connector* resolve_connector(Card& card, const std::string& str);
25 }
27 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
29 #define unlikely(x) __builtin_expect(!!(x), 0)
31 #define ASSERT(x) \
32         if (unlikely(!(x))) { \
33                 fprintf(stderr, "%s:%d: %s: ASSERT(%s) failed\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, __STRING(x)); \
34                 abort(); \
35         }
37 #define FAIL(fmt, ...) \
38         do { \
39                 fprintf(stderr, "%s:%d: %s:\n" fmt "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); \
40                 abort(); \
41         } while(0)
43 #define FAIL_IF(x, fmt, ...) \
44         if (unlikely(x)) { \
45                 fprintf(stderr, "%s:%d: %s:\n" fmt "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); \
46                 abort(); \
47         }
49 #define EXIT(fmt, ...) \
50         do { \
51                 fprintf(stderr, fmt "\n", ##__VA_ARGS__); \
52                 exit(-1); \
53         } while(0)