ld-tool portability fix: MacOS build experience
[lunaix-os.git] / lunaix-os / includes / hal / gfxm.h
1 #ifndef __LUNAIX_GFXM_H
2 #define __LUNAIX_GFXM_H
3
4 #include <lunaix/device.h>
5 #include <usr/lunaix/gfx.h>
6
7 struct gfxa;
8
9 struct disp_profile
10 {
11     struct gfxa_mon mon;
12
13     struct
14     {
15         color_t* val;
16         size_t len;
17     } clut;
18 };
19
20 struct gfxa_ops
21 {
22     int (*update_profile)(struct gfxa*);
23     /**
24      * @brief Read adapter registers
25      *
26      */
27     int (*rreads)(struct gfxa*, u32_t* map, void* rxbuf, size_t map_sz);
28     /**
29      * @brief Write adapter registers
30      *
31      */
32     int (*rwrites)(struct gfxa*, u32_t* map, void* txbuf, size_t map_sz);
33     /**
34      * @brief send data to VRAM
35      *
36      */
37     int (*vmcpy)(struct gfxa*, void*, off_t, size_t);
38     /**
39      * @brief send logical frame buffer to adapter
40      *
41      */
42     int (*lfbcpy)(struct gfxa*, void*, off_t, size_t);
43     /**
44      * @brief Execute hardware dependent ioctl command
45      *
46      */
47     int (*hwioctl)(struct gfxa*, int, va_list);
48 };
49
50 struct gfxa
51 {
52     struct device* dev;
53     struct llist_header gfxas;
54     struct hlist_node gfxas_id;
55     struct disp_profile disp_info;
56     int id;
57     void* hw_obj;
58
59     struct gfxa_ops ops;
60 };
61
62 struct gfxa*
63 gfxm_alloc_adapter(void* hw_obj);
64
65 void
66 gfxm_register(struct gfxa*);
67
68 struct gfxa*
69 gfxm_adapter(int gfxa_id);
70
71 int
72 gfxm_set_lut(struct gfxa*, color_t* lut, size_t len);
73
74 #endif /* __LUNAIX_GFXM_H */