/*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_update44{45uint8_t type; /* XENFB_TYPE_UPDATE */46int32_t x; /* source x */47int32_t y; /* source y */48int32_t width; /* rect width */49int32_t height; /* rect height */50};5152/*53* Framebuffer resize notification event54* Capable backend sets feature-resize in xenstore.55*/56#define XENFB_TYPE_RESIZE 35758struct xenfb_resize59{60uint8_t type; /* XENFB_TYPE_RESIZE */61int32_t width; /* width in pixels */62int32_t height; /* height in pixels */63int32_t stride; /* stride in bytes */64int32_t depth; /* depth in bits */65int32_t offset; /* offset of the framebuffer in bytes */66};6768#define XENFB_OUT_EVENT_SIZE 406970union xenfb_out_event71{72uint8_t type;73struct xenfb_update update;74struct xenfb_resize resize;75char pad[XENFB_OUT_EVENT_SIZE];76};7778/* In events (backend -> frontend) */7980/*81* Frontends should ignore unknown in events.82*/8384/*85* Framebuffer refresh period advice86* Backend sends it to advise the frontend their preferred period of87* refresh. Frontends that keep the framebuffer constantly up-to-date88* just ignore it. Frontends that use the advice should immediately89* refresh the framebuffer (and send an update notification event if90* those have been requested), then use the update frequency to guide91* their periodical refreshs.92*/93#define XENFB_TYPE_REFRESH_PERIOD 194#define XENFB_NO_REFRESH 09596struct xenfb_refresh_period97{98uint8_t type; /* XENFB_TYPE_UPDATE_PERIOD */99uint32_t period; /* period of refresh, in ms,100* XENFB_NO_REFRESH if no refresh is needed */101};102103#define XENFB_IN_EVENT_SIZE 40104105union xenfb_in_event106{107uint8_t type;108struct xenfb_refresh_period refresh_period;109char pad[XENFB_IN_EVENT_SIZE];110};111112/* shared page */113114#define XENFB_IN_RING_SIZE 1024115#define XENFB_IN_RING_LEN (XENFB_IN_RING_SIZE / XENFB_IN_EVENT_SIZE)116#define XENFB_IN_RING_OFFS 1024117#define XENFB_IN_RING(page) \118((union xenfb_in_event *)((char *)(page) + XENFB_IN_RING_OFFS))119#define XENFB_IN_RING_REF(page, idx) \120(XENFB_IN_RING((page))[(idx) % XENFB_IN_RING_LEN])121122#define XENFB_OUT_RING_SIZE 2048123#define XENFB_OUT_RING_LEN (XENFB_OUT_RING_SIZE / XENFB_OUT_EVENT_SIZE)124#define XENFB_OUT_RING_OFFS (XENFB_IN_RING_OFFS + XENFB_IN_RING_SIZE)125#define XENFB_OUT_RING(page) \126((union xenfb_out_event *)((char *)(page) + XENFB_OUT_RING_OFFS))127#define XENFB_OUT_RING_REF(page, idx) \128(XENFB_OUT_RING((page))[(idx) % XENFB_OUT_RING_LEN])129130struct xenfb_page131{132uint32_t in_cons, in_prod;133uint32_t out_cons, out_prod;134135int32_t width; /* the width of the framebuffer (in pixels) */136int32_t height; /* the height of the framebuffer (in pixels) */137uint32_t line_length; /* the length of a row of pixels (in bytes) */138uint32_t mem_length; /* the length of the framebuffer (in bytes) */139uint8_t depth; /* the depth of a pixel (in bits) */140141/*142* Framebuffer page directory143*144* Each directory page holds PAGE_SIZE / sizeof(*pd)145* framebuffer pages, and can thus map up to PAGE_SIZE *146* PAGE_SIZE / sizeof(*pd) bytes. With PAGE_SIZE == 4096 and147* sizeof(unsigned long) == 4/8, that's 4 Megs 32 bit and 2 Megs148* 64 bit. 256 directories give enough room for a 512 Meg149* framebuffer with a max resolution of 12,800x10,240. Should150* be enough for a while with room leftover for expansion.151*/152unsigned long pd[256];153};154155/*156* Wart: xenkbd needs to know default resolution. Put it here until a157* better solution is found, but don't leak it to the backend.158*/159#ifdef __KERNEL__160#define XENFB_WIDTH 800161#define XENFB_HEIGHT 600162#define XENFB_DEPTH 32163#endif164165#endif166167/*168* Local variables:169* mode: C170* c-file-style: "BSD"171* c-basic-offset: 4172* tab-width: 4173* indent-tabs-mode: nil174* End:175*/176177178