-
Notifications
You must be signed in to change notification settings - Fork 0
/
ge_gfxdriver.c
130 lines (98 loc) · 4.01 KB
/
ge_gfxdriver.c
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
* This file is based on the GLES2 driver from DirectFB2
*/
#include <core/graphics_driver.h>
#include <core/system.h>
#include <systems/drmkms/drmkms_system.h>
#include <misc/conf.h>
#include "ge_gfxdriver.h"
D_DEBUG_DOMAIN( GE_Driver, "GE/Driver", "MStar/Sigmastar GE Driver" );
DFB_GRAPHICS_DRIVER( ge )
/**********************************************************************************************************************/
extern const GraphicsDeviceFuncs geGraphicsDeviceFuncs;
/**********************************************************************************************************************/
static int
driver_probe()
{
DRMKMSData *drmkms = dfb_system_data();
printf("%s()\n", __FUNCTION__ );
if (!drmkms->shared->use_prime_fd) {
D_INFO( "GE/driver: \"drmkms-use-prime-fd\" not enabled, not possible to use GE\n");
return 0;
}
return 1;
}
static void
driver_get_info( GraphicsDriverInfo *info )
{
info->version.major = 0;
info->version.minor = 1;
snprintf( info->name, DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH, "GE" );
snprintf( info->vendor, DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH, "linux-chenxing" );
info->driver_data_size = sizeof(GEDriverData);
info->device_data_size = sizeof(GEDeviceData);
}
static DFBResult
driver_init_driver( GraphicsDeviceFuncs *funcs,
void *driver_data,
void *device_data,
CoreDFB *core )
{
D_DEBUG_AT( GE_Driver, "%s()\n", __FUNCTION__ );
dfb_config->font_format = DSPF_ARGB;
*funcs = geGraphicsDeviceFuncs;
return DFB_OK;
}
static DFBResult
driver_init_device( GraphicsDeviceInfo *device_info,
void *driver_data,
void *device_data )
{
GEDeviceData *dev = device_data;
D_DEBUG_AT( GE_Driver, "%s()\n", __FUNCTION__ );
if (libge_open(&dev->ge))
goto fail;
D_INFO( "GE/driver: Opened GE, caps 0x%x\n", dev->ge.info.caps);
/* Fill device information. */
snprintf( device_info->name, DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "ge");
snprintf( device_info->vendor, DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "MStar/SigmaStar" );
device_info->caps.flags = 0;
device_info->caps.accel = DFXL_FILLRECTANGLE |
DFXL_DRAWRECTANGLE |
DFXL_DRAWLINE |
DFXL_BLIT |
DFXL_STRETCHBLIT;
device_info->caps.blitting = /* rotation */
DSBLIT_ROTATE90 |
DSBLIT_ROTATE180 |
DSBLIT_ROTATE270 |
/* flipping */
DSBLIT_FLIP_HORIZONTAL |
DSBLIT_FLIP_VERTICAL;
device_info->caps.drawing = 0;
//device_info->caps.flags = CCF_CLIPPING | CCF_RENDEROPTS;
//device_info->caps.accel = DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | DFXL_DRAWLINE | DFXL_FILLTRIANGLE |
// DFXL_BLIT | DFXL_STRETCHBLIT;
//device_info->caps.blitting = DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA |
// DSBLIT_SRC_COLORKEY | DSBLIT_SRC_PREMULTIPLY | DSBLIT_SRC_PREMULTCOLOR |
// DSBLIT_ROTATE180;
//device_info->caps.drawing = DSDRAW_BLEND | DSDRAW_SRC_PREMULTIPLY;
device_info->limits.dst_max.w = 4096;
device_info->limits.dst_max.h = 4096;
return DFB_OK;
fail:
return DFB_INIT;
}
static void
driver_close_device( void *driver_data,
void *device_data )
{
GEDeviceData *dev = device_data;
D_DEBUG_AT( GE_Driver, "%s()\n", __FUNCTION__ );
libge_close(&dev->ge);
}
static void
driver_close_driver( void *driver_data )
{
D_DEBUG_AT( GE_Driver, "%s()\n", __FUNCTION__ );
}