1 // Copyright 2016 The Fuchsia Authors
2 // Copyright (c) 2008-2010 Travis Geiselbrecht
3 //
4 // Use of this source code is governed by a MIT-style
5 // license that can be found in the LICENSE file or at
6 // https://opensource.org/licenses/MIT
7 
8 #pragma once
9 
10 #include <zircon/compiler.h>
11 #include <zircon/pixelformat.h>
12 
13 #include <stdbool.h>
14 #include <sys/types.h>
15 #include <inttypes.h>
16 #include <zircon/types.h>
17 
18 int display_init(void *framebuffer);
19 int display_enable(bool enable);
20 void display_pre_freq_change(void);
21 void display_post_freq_change(void);
22 
23 // Has no effect if DISPLAY_FLAG_CRASH_FRAMEBUFFER is set
24 #define DISPLAY_FLAG_HW_FRAMEBUFFER    (1<<0)
25 #define DISPLAY_FLAG_NEEDS_CACHE_FLUSH (1<<1)
26 
27 // gfxconsole will not allocate a backing buffer
28 // or do any other allocations
29 #define DISPLAY_FLAG_CRASH_FRAMEBUFFER (1<<2)
30 
31 struct display_info {
32     void *framebuffer;
33     zx_pixel_format_t format;
34     uint width;
35     uint height;
36     uint stride;
37 
38     uint32_t flags;
39 
40     // Update function
41     void (*flush)(uint starty, uint endy);
42 };
43 
44 __BEGIN_CDECLS
45 zx_status_t display_get_info(struct display_info *info);
46 __END_CDECLS
47