Linux Audio

Check our new training course

Loading...
v6.2
  1/* SPDX-License-Identifier: MIT */
  2/*
  3 * fbif.h -- Xen virtual frame buffer device
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  4 *
  5 * Copyright (C) 2005 Anthony Liguori <aliguori@us.ibm.com>
  6 * Copyright (C) 2006 Red Hat, Inc., Markus Armbruster <armbru@redhat.com>
  7 */
  8
  9#ifndef __XEN_PUBLIC_IO_FBIF_H__
 10#define __XEN_PUBLIC_IO_FBIF_H__
 11
 12/* Out events (frontend -> backend) */
 13
 14/*
 15 * Out events may be sent only when requested by backend, and receipt
 16 * of an unknown out event is an error.
 17 */
 18
 19/* Event type 1 currently not used */
 20/*
 21 * Framebuffer update notification event
 22 * Capable frontend sets feature-update in xenstore.
 23 * Backend requests it by setting request-update in xenstore.
 24 */
 25#define XENFB_TYPE_UPDATE 2
 26
 27struct xenfb_update {
 28	uint8_t type;		/* XENFB_TYPE_UPDATE */
 29	int32_t x;		/* source x */
 30	int32_t y;		/* source y */
 31	int32_t width;		/* rect width */
 32	int32_t height;		/* rect height */
 33};
 34
 35/*
 36 * Framebuffer resize notification event
 37 * Capable backend sets feature-resize in xenstore.
 38 */
 39#define XENFB_TYPE_RESIZE 3
 40
 41struct xenfb_resize {
 42	uint8_t type;		/* XENFB_TYPE_RESIZE */
 43	int32_t width;		/* width in pixels */
 44	int32_t height;		/* height in pixels */
 45	int32_t stride;		/* stride in bytes */
 46	int32_t depth;		/* depth in bits */
 47	int32_t offset;		/* start offset within framebuffer */
 48};
 49
 50#define XENFB_OUT_EVENT_SIZE 40
 51
 52union xenfb_out_event {
 53	uint8_t type;
 54	struct xenfb_update update;
 55	struct xenfb_resize resize;
 56	char pad[XENFB_OUT_EVENT_SIZE];
 57};
 58
 59/* In events (backend -> frontend) */
 60
 61/*
 62 * Frontends should ignore unknown in events.
 63 * No in events currently defined.
 64 */
 65
 66#define XENFB_IN_EVENT_SIZE 40
 67
 68union xenfb_in_event {
 69	uint8_t type;
 70	char pad[XENFB_IN_EVENT_SIZE];
 71};
 72
 73/* shared page */
 74
 75#define XENFB_IN_RING_SIZE 1024
 76#define XENFB_IN_RING_LEN (XENFB_IN_RING_SIZE / XENFB_IN_EVENT_SIZE)
 77#define XENFB_IN_RING_OFFS 1024
 78#define XENFB_IN_RING(page) \
 79	((union xenfb_in_event *)((char *)(page) + XENFB_IN_RING_OFFS))
 80#define XENFB_IN_RING_REF(page, idx) \
 81	(XENFB_IN_RING((page))[(idx) % XENFB_IN_RING_LEN])
 82
 83#define XENFB_OUT_RING_SIZE 2048
 84#define XENFB_OUT_RING_LEN (XENFB_OUT_RING_SIZE / XENFB_OUT_EVENT_SIZE)
 85#define XENFB_OUT_RING_OFFS (XENFB_IN_RING_OFFS + XENFB_IN_RING_SIZE)
 86#define XENFB_OUT_RING(page) \
 87	((union xenfb_out_event *)((char *)(page) + XENFB_OUT_RING_OFFS))
 88#define XENFB_OUT_RING_REF(page, idx) \
 89	(XENFB_OUT_RING((page))[(idx) % XENFB_OUT_RING_LEN])
 90
 91struct xenfb_page {
 92	uint32_t in_cons, in_prod;
 93	uint32_t out_cons, out_prod;
 94
 95	int32_t width;          /* width of the framebuffer (in pixels) */
 96	int32_t height;         /* height of the framebuffer (in pixels) */
 97	uint32_t line_length;   /* length of a row of pixels (in bytes) */
 98	uint32_t mem_length;    /* length of the framebuffer (in bytes) */
 99	uint8_t depth;          /* depth of a pixel (in bits) */
100
101	/*
102	 * Framebuffer page directory
103	 *
104	 * Each directory page holds PAGE_SIZE / sizeof(*pd)
105	 * framebuffer pages, and can thus map up to PAGE_SIZE *
106	 * PAGE_SIZE / sizeof(*pd) bytes.  With PAGE_SIZE == 4096 and
107	 * sizeof(unsigned long) == 4/8, that's 4 Megs 32 bit and 2
108	 * Megs 64 bit.  256 directories give enough room for a 512
109	 * Meg framebuffer with a max resolution of 12,800x10,240.
110	 * Should be enough for a while with room leftover for
111	 * expansion.
112	 */
113	unsigned long pd[256];
114};
115
116/*
117 * Wart: xenkbd needs to know default resolution.  Put it here until a
118 * better solution is found, but don't leak it to the backend.
119 */
120#ifdef __KERNEL__
121#define XENFB_WIDTH 800
122#define XENFB_HEIGHT 600
123#define XENFB_DEPTH 32
124#endif
125
126#endif
v3.5.6
 
  1/*
  2 * fbif.h -- Xen virtual frame buffer device
  3 *
  4 * Permission is hereby granted, free of charge, to any person obtaining a copy
  5 * of this software and associated documentation files (the "Software"), to
  6 * deal in the Software without restriction, including without limitation the
  7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8 * sell copies of the Software, and to permit persons to whom the Software is
  9 * furnished to do so, subject to the following conditions:
 10 *
 11 * The above copyright notice and this permission notice shall be included in
 12 * all copies or substantial portions of the Software.
 13 *
 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 20 * DEALINGS IN THE SOFTWARE.
 21 *
 22 * Copyright (C) 2005 Anthony Liguori <aliguori@us.ibm.com>
 23 * Copyright (C) 2006 Red Hat, Inc., Markus Armbruster <armbru@redhat.com>
 24 */
 25
 26#ifndef __XEN_PUBLIC_IO_FBIF_H__
 27#define __XEN_PUBLIC_IO_FBIF_H__
 28
 29/* Out events (frontend -> backend) */
 30
 31/*
 32 * Out events may be sent only when requested by backend, and receipt
 33 * of an unknown out event is an error.
 34 */
 35
 36/* Event type 1 currently not used */
 37/*
 38 * Framebuffer update notification event
 39 * Capable frontend sets feature-update in xenstore.
 40 * Backend requests it by setting request-update in xenstore.
 41 */
 42#define XENFB_TYPE_UPDATE 2
 43
 44struct xenfb_update {
 45	uint8_t type;		/* XENFB_TYPE_UPDATE */
 46	int32_t x;		/* source x */
 47	int32_t y;		/* source y */
 48	int32_t width;		/* rect width */
 49	int32_t height;		/* rect height */
 50};
 51
 52/*
 53 * Framebuffer resize notification event
 54 * Capable backend sets feature-resize in xenstore.
 55 */
 56#define XENFB_TYPE_RESIZE 3
 57
 58struct xenfb_resize {
 59	uint8_t type;		/* XENFB_TYPE_RESIZE */
 60	int32_t width;		/* width in pixels */
 61	int32_t height;		/* height in pixels */
 62	int32_t stride;		/* stride in bytes */
 63	int32_t depth;		/* depth in bits */
 64	int32_t offset;		/* start offset within framebuffer */
 65};
 66
 67#define XENFB_OUT_EVENT_SIZE 40
 68
 69union xenfb_out_event {
 70	uint8_t type;
 71	struct xenfb_update update;
 72	struct xenfb_resize resize;
 73	char pad[XENFB_OUT_EVENT_SIZE];
 74};
 75
 76/* In events (backend -> frontend) */
 77
 78/*
 79 * Frontends should ignore unknown in events.
 80 * No in events currently defined.
 81 */
 82
 83#define XENFB_IN_EVENT_SIZE 40
 84
 85union xenfb_in_event {
 86	uint8_t type;
 87	char pad[XENFB_IN_EVENT_SIZE];
 88};
 89
 90/* shared page */
 91
 92#define XENFB_IN_RING_SIZE 1024
 93#define XENFB_IN_RING_LEN (XENFB_IN_RING_SIZE / XENFB_IN_EVENT_SIZE)
 94#define XENFB_IN_RING_OFFS 1024
 95#define XENFB_IN_RING(page) \
 96	((union xenfb_in_event *)((char *)(page) + XENFB_IN_RING_OFFS))
 97#define XENFB_IN_RING_REF(page, idx) \
 98	(XENFB_IN_RING((page))[(idx) % XENFB_IN_RING_LEN])
 99
100#define XENFB_OUT_RING_SIZE 2048
101#define XENFB_OUT_RING_LEN (XENFB_OUT_RING_SIZE / XENFB_OUT_EVENT_SIZE)
102#define XENFB_OUT_RING_OFFS (XENFB_IN_RING_OFFS + XENFB_IN_RING_SIZE)
103#define XENFB_OUT_RING(page) \
104	((union xenfb_out_event *)((char *)(page) + XENFB_OUT_RING_OFFS))
105#define XENFB_OUT_RING_REF(page, idx) \
106	(XENFB_OUT_RING((page))[(idx) % XENFB_OUT_RING_LEN])
107
108struct xenfb_page {
109	uint32_t in_cons, in_prod;
110	uint32_t out_cons, out_prod;
111
112	int32_t width;          /* width of the framebuffer (in pixels) */
113	int32_t height;         /* height of the framebuffer (in pixels) */
114	uint32_t line_length;   /* length of a row of pixels (in bytes) */
115	uint32_t mem_length;    /* length of the framebuffer (in bytes) */
116	uint8_t depth;          /* depth of a pixel (in bits) */
117
118	/*
119	 * Framebuffer page directory
120	 *
121	 * Each directory page holds PAGE_SIZE / sizeof(*pd)
122	 * framebuffer pages, and can thus map up to PAGE_SIZE *
123	 * PAGE_SIZE / sizeof(*pd) bytes.  With PAGE_SIZE == 4096 and
124	 * sizeof(unsigned long) == 4/8, that's 4 Megs 32 bit and 2
125	 * Megs 64 bit.  256 directories give enough room for a 512
126	 * Meg framebuffer with a max resolution of 12,800x10,240.
127	 * Should be enough for a while with room leftover for
128	 * expansion.
129	 */
130	unsigned long pd[256];
131};
132
133/*
134 * Wart: xenkbd needs to know default resolution.  Put it here until a
135 * better solution is found, but don't leak it to the backend.
136 */
137#ifdef __KERNEL__
138#define XENFB_WIDTH 800
139#define XENFB_HEIGHT 600
140#define XENFB_DEPTH 32
141#endif
142
143#endif