/*1* fbif.h -- Xen virtual frame buffer device2*3* Permission is hereby granted, free of charge, to any person obtaining a copy4* of this software and associated documentation files (the "Software"), to5* deal in the Software without restriction, including without limitation the6* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or7* sell copies of the Software, and to permit persons to whom the Software is8* furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice shall be included in11* all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE16* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER17* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING18* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER19* DEALINGS IN THE SOFTWARE.20*21* Copyright (C) 2005 Anthony Liguori <[email protected]>22* Copyright (C) 2006 Red Hat, Inc., Markus Armbruster <[email protected]>23*/2425#ifndef __XEN_PUBLIC_IO_FBIF_H__26#define __XEN_PUBLIC_IO_FBIF_H__2728/* Out events (frontend -> backend) */2930/*31* Out events may be sent only when requested by backend, and receipt32* of an unknown out event is an error.33*/3435/* Event type 1 currently not used */36/*37* Framebuffer update notification event38* Capable frontend sets feature-update in xenstore.39* Backend requests it by setting request-update in xenstore.40*/41#define XENFB_TYPE_UPDATE 24243struct xenfb_update {44uint8_t type; /* XENFB_TYPE_UPDATE */45int32_t x; /* source x */46int32_t y; /* source y */47int32_t width; /* rect width */48int32_t height; /* rect height */49};5051/*52* Framebuffer resize notification event53* Capable backend sets feature-resize in xenstore.54*/55#define XENFB_TYPE_RESIZE 35657struct xenfb_resize {58uint8_t type; /* XENFB_TYPE_RESIZE */59int32_t width; /* width in pixels */60int32_t height; /* height in pixels */61int32_t stride; /* stride in bytes */62int32_t depth; /* depth in bits */63int32_t offset; /* start offset within framebuffer */64};6566#define XENFB_OUT_EVENT_SIZE 406768union xenfb_out_event {69uint8_t type;70struct xenfb_update update;71struct xenfb_resize resize;72char pad[XENFB_OUT_EVENT_SIZE];73};7475/* In events (backend -> frontend) */7677/*78* Frontends should ignore unknown in events.79* No in events currently defined.80*/8182#define XENFB_IN_EVENT_SIZE 408384union xenfb_in_event {85uint8_t type;86char pad[XENFB_IN_EVENT_SIZE];87};8889/* shared page */9091#define XENFB_IN_RING_SIZE 102492#define XENFB_IN_RING_LEN (XENFB_IN_RING_SIZE / XENFB_IN_EVENT_SIZE)93#define XENFB_IN_RING_OFFS 102494#define XENFB_IN_RING(page) \95((union xenfb_in_event *)((char *)(page) + XENFB_IN_RING_OFFS))96#define XENFB_IN_RING_REF(page, idx) \97(XENFB_IN_RING((page))[(idx) % XENFB_IN_RING_LEN])9899#define XENFB_OUT_RING_SIZE 2048100#define XENFB_OUT_RING_LEN (XENFB_OUT_RING_SIZE / XENFB_OUT_EVENT_SIZE)101#define XENFB_OUT_RING_OFFS (XENFB_IN_RING_OFFS + XENFB_IN_RING_SIZE)102#define XENFB_OUT_RING(page) \103((union xenfb_out_event *)((char *)(page) + XENFB_OUT_RING_OFFS))104#define XENFB_OUT_RING_REF(page, idx) \105(XENFB_OUT_RING((page))[(idx) % XENFB_OUT_RING_LEN])106107struct xenfb_page {108uint32_t in_cons, in_prod;109uint32_t out_cons, out_prod;110111int32_t width; /* width of the framebuffer (in pixels) */112int32_t height; /* height of the framebuffer (in pixels) */113uint32_t line_length; /* length of a row of pixels (in bytes) */114uint32_t mem_length; /* length of the framebuffer (in bytes) */115uint8_t depth; /* depth of a pixel (in bits) */116117/*118* Framebuffer page directory119*120* Each directory page holds PAGE_SIZE / sizeof(*pd)121* framebuffer pages, and can thus map up to PAGE_SIZE *122* PAGE_SIZE / sizeof(*pd) bytes. With PAGE_SIZE == 4096 and123* sizeof(unsigned long) == 4/8, that's 4 Megs 32 bit and 2124* Megs 64 bit. 256 directories give enough room for a 512125* Meg framebuffer with a max resolution of 12,800x10,240.126* Should be enough for a while with room leftover for127* expansion.128*/129unsigned long pd[256];130};131132/*133* Wart: xenkbd needs to know default resolution. Put it here until a134* better solution is found, but don't leak it to the backend.135*/136#ifdef __KERNEL__137#define XENFB_WIDTH 800138#define XENFB_HEIGHT 600139#define XENFB_DEPTH 32140#endif141142#endif143144145