forked from JeffyCN/drm-cursor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrm_common.h
More file actions
64 lines (48 loc) · 1.87 KB
/
drm_common.h
File metadata and controls
64 lines (48 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Copyright (c) 2021, Jeffy Chen <jeffy.chen@rock-chips.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __DRM_COMMON_H_
#define __DRM_COMMON_H_
#include <drm_fourcc.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/time.h>
#define LIBDRM_CURSOR_VERSION "1.2.2~20210804"
#define drm_private __attribute__((visibility("hidden")))
#ifndef DRM_FORMAT_MOD_VENDOR_ARM
#define DRM_FORMAT_MOD_VENDOR_ARM 0x08
#endif
#ifndef DRM_FORMAT_MOD_ARM_AFBC
#define DRM_FORMAT_MOD_ARM_AFBC(__afbc_mode) fourcc_mod_code(ARM, __afbc_mode)
#endif
#ifndef AFBC_FORMAT_MOD_BLOCK_SIZE_16x16
#define AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 (1ULL)
#endif
#ifndef AFBC_FORMAT_MOD_SPARSE
#define AFBC_FORMAT_MOD_SPARSE (((__u64)1) << 6)
#endif
#define DRM_AFBC_MODIFIER \
(DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_SPARSE) | \
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16))
#define DRM_LOG(tag, ...) { \
struct timeval tv; gettimeofday(&tv, NULL); \
fprintf(g_log_fp ?: stderr, "[%05ld.%03ld] " tag ": %s(%d) ", \
tv.tv_sec % 100000, tv.tv_usec / 1000, __func__, __LINE__); \
fprintf(g_log_fp ?: stderr, __VA_ARGS__); fflush(g_log_fp ?: stderr); }
#define DRM_DEBUG(...) \
if (g_drm_debug) DRM_LOG("DRM_DEBUG", __VA_ARGS__)
#define DRM_INFO(...) DRM_LOG("DRM_INFO", __VA_ARGS__)
#define DRM_ERROR(...) DRM_LOG("DRM_ERROR", __VA_ARGS__)
drm_private extern int g_drm_debug;
drm_private FILE *g_log_fp;
#endif