1 /* SPDX-License-Identifier: MIT */ 1 /* SPDX-License-Identifier: MIT */ 2 /* 2 /* 3 * fbif.h -- Xen virtual frame buffer device 3 * fbif.h -- Xen virtual frame buffer device 4 * 4 * 5 * Copyright (C) 2005 Anthony Liguori <aliguor 5 * Copyright (C) 2005 Anthony Liguori <aliguori@us.ibm.com> 6 * Copyright (C) 2006 Red Hat, Inc., Markus Ar 6 * Copyright (C) 2006 Red Hat, Inc., Markus Armbruster <armbru@redhat.com> 7 */ 7 */ 8 8 9 #ifndef __XEN_PUBLIC_IO_FBIF_H__ 9 #ifndef __XEN_PUBLIC_IO_FBIF_H__ 10 #define __XEN_PUBLIC_IO_FBIF_H__ 10 #define __XEN_PUBLIC_IO_FBIF_H__ 11 11 12 /* Out events (frontend -> backend) */ 12 /* Out events (frontend -> backend) */ 13 13 14 /* 14 /* 15 * Out events may be sent only when requested 15 * Out events may be sent only when requested by backend, and receipt 16 * of an unknown out event is an error. 16 * of an unknown out event is an error. 17 */ 17 */ 18 18 19 /* Event type 1 currently not used */ 19 /* Event type 1 currently not used */ 20 /* 20 /* 21 * Framebuffer update notification event 21 * Framebuffer update notification event 22 * Capable frontend sets feature-update in xen 22 * Capable frontend sets feature-update in xenstore. 23 * Backend requests it by setting request-upda 23 * Backend requests it by setting request-update in xenstore. 24 */ 24 */ 25 #define XENFB_TYPE_UPDATE 2 25 #define XENFB_TYPE_UPDATE 2 26 26 27 struct xenfb_update { 27 struct xenfb_update { 28 uint8_t type; /* XENFB_TYPE_ 28 uint8_t type; /* XENFB_TYPE_UPDATE */ 29 int32_t x; /* source x */ 29 int32_t x; /* source x */ 30 int32_t y; /* source y */ 30 int32_t y; /* source y */ 31 int32_t width; /* rect width 31 int32_t width; /* rect width */ 32 int32_t height; /* rect height 32 int32_t height; /* rect height */ 33 }; 33 }; 34 34 35 /* 35 /* 36 * Framebuffer resize notification event 36 * Framebuffer resize notification event 37 * Capable backend sets feature-resize in xens 37 * Capable backend sets feature-resize in xenstore. 38 */ 38 */ 39 #define XENFB_TYPE_RESIZE 3 39 #define XENFB_TYPE_RESIZE 3 40 40 41 struct xenfb_resize { 41 struct xenfb_resize { 42 uint8_t type; /* XENFB_TYPE_ 42 uint8_t type; /* XENFB_TYPE_RESIZE */ 43 int32_t width; /* width in pi 43 int32_t width; /* width in pixels */ 44 int32_t height; /* height in p 44 int32_t height; /* height in pixels */ 45 int32_t stride; /* stride in b 45 int32_t stride; /* stride in bytes */ 46 int32_t depth; /* depth in bi 46 int32_t depth; /* depth in bits */ 47 int32_t offset; /* start offse 47 int32_t offset; /* start offset within framebuffer */ 48 }; 48 }; 49 49 50 #define XENFB_OUT_EVENT_SIZE 40 50 #define XENFB_OUT_EVENT_SIZE 40 51 51 52 union xenfb_out_event { 52 union xenfb_out_event { 53 uint8_t type; 53 uint8_t type; 54 struct xenfb_update update; 54 struct xenfb_update update; 55 struct xenfb_resize resize; 55 struct xenfb_resize resize; 56 char pad[XENFB_OUT_EVENT_SIZE]; 56 char pad[XENFB_OUT_EVENT_SIZE]; 57 }; 57 }; 58 58 59 /* In events (backend -> frontend) */ 59 /* In events (backend -> frontend) */ 60 60 61 /* 61 /* 62 * Frontends should ignore unknown in events. 62 * Frontends should ignore unknown in events. 63 * No in events currently defined. 63 * No in events currently defined. 64 */ 64 */ 65 65 66 #define XENFB_IN_EVENT_SIZE 40 66 #define XENFB_IN_EVENT_SIZE 40 67 67 68 union xenfb_in_event { 68 union xenfb_in_event { 69 uint8_t type; 69 uint8_t type; 70 char pad[XENFB_IN_EVENT_SIZE]; 70 char pad[XENFB_IN_EVENT_SIZE]; 71 }; 71 }; 72 72 73 /* shared page */ 73 /* shared page */ 74 74 75 #define XENFB_IN_RING_SIZE 1024 75 #define XENFB_IN_RING_SIZE 1024 76 #define XENFB_IN_RING_LEN (XENFB_IN_RING_SIZE 76 #define XENFB_IN_RING_LEN (XENFB_IN_RING_SIZE / XENFB_IN_EVENT_SIZE) 77 #define XENFB_IN_RING_OFFS 1024 77 #define XENFB_IN_RING_OFFS 1024 78 #define XENFB_IN_RING(page) \ 78 #define XENFB_IN_RING(page) \ 79 ((union xenfb_in_event *)((char *)(pag 79 ((union xenfb_in_event *)((char *)(page) + XENFB_IN_RING_OFFS)) 80 #define XENFB_IN_RING_REF(page, idx) \ 80 #define XENFB_IN_RING_REF(page, idx) \ 81 (XENFB_IN_RING((page))[(idx) % XENFB_I 81 (XENFB_IN_RING((page))[(idx) % XENFB_IN_RING_LEN]) 82 82 83 #define XENFB_OUT_RING_SIZE 2048 83 #define XENFB_OUT_RING_SIZE 2048 84 #define XENFB_OUT_RING_LEN (XENFB_OUT_RING_SIZ 84 #define XENFB_OUT_RING_LEN (XENFB_OUT_RING_SIZE / XENFB_OUT_EVENT_SIZE) 85 #define XENFB_OUT_RING_OFFS (XENFB_IN_RING_OFF 85 #define XENFB_OUT_RING_OFFS (XENFB_IN_RING_OFFS + XENFB_IN_RING_SIZE) 86 #define XENFB_OUT_RING(page) \ 86 #define XENFB_OUT_RING(page) \ 87 ((union xenfb_out_event *)((char *)(pa 87 ((union xenfb_out_event *)((char *)(page) + XENFB_OUT_RING_OFFS)) 88 #define XENFB_OUT_RING_REF(page, idx) \ 88 #define XENFB_OUT_RING_REF(page, idx) \ 89 (XENFB_OUT_RING((page))[(idx) % XENFB_ 89 (XENFB_OUT_RING((page))[(idx) % XENFB_OUT_RING_LEN]) 90 90 91 struct xenfb_page { 91 struct xenfb_page { 92 uint32_t in_cons, in_prod; 92 uint32_t in_cons, in_prod; 93 uint32_t out_cons, out_prod; 93 uint32_t out_cons, out_prod; 94 94 95 int32_t width; /* width of th 95 int32_t width; /* width of the framebuffer (in pixels) */ 96 int32_t height; /* height of t 96 int32_t height; /* height of the framebuffer (in pixels) */ 97 uint32_t line_length; /* length of a 97 uint32_t line_length; /* length of a row of pixels (in bytes) */ 98 uint32_t mem_length; /* length of t 98 uint32_t mem_length; /* length of the framebuffer (in bytes) */ 99 uint8_t depth; /* depth of a 99 uint8_t depth; /* depth of a pixel (in bits) */ 100 100 101 /* 101 /* 102 * Framebuffer page directory 102 * Framebuffer page directory 103 * 103 * 104 * Each directory page holds PAGE_SIZE 104 * Each directory page holds PAGE_SIZE / sizeof(*pd) 105 * framebuffer pages, and can thus map 105 * framebuffer pages, and can thus map up to PAGE_SIZE * 106 * PAGE_SIZE / sizeof(*pd) bytes. Wit 106 * PAGE_SIZE / sizeof(*pd) bytes. With PAGE_SIZE == 4096 and 107 * sizeof(unsigned long) == 4/8, that' 107 * sizeof(unsigned long) == 4/8, that's 4 Megs 32 bit and 2 108 * Megs 64 bit. 256 directories give 108 * Megs 64 bit. 256 directories give enough room for a 512 109 * Meg framebuffer with a max resoluti 109 * Meg framebuffer with a max resolution of 12,800x10,240. 110 * Should be enough for a while with r 110 * Should be enough for a while with room leftover for 111 * expansion. 111 * expansion. 112 */ 112 */ 113 unsigned long pd[256]; 113 unsigned long pd[256]; 114 }; 114 }; 115 115 116 /* 116 /* 117 * Wart: xenkbd needs to know default resoluti 117 * Wart: xenkbd needs to know default resolution. Put it here until a 118 * better solution is found, but don't leak it 118 * better solution is found, but don't leak it to the backend. 119 */ 119 */ 120 #ifdef __KERNEL__ 120 #ifdef __KERNEL__ 121 #define XENFB_WIDTH 800 121 #define XENFB_WIDTH 800 122 #define XENFB_HEIGHT 600 122 #define XENFB_HEIGHT 600 123 #define XENFB_DEPTH 32 123 #define XENFB_DEPTH 32 124 #endif 124 #endif 125 125 126 #endif 126 #endif 127 127
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.