1 /* 2 * Copyright 2009-2014, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Alexander von Gluck IV, kallisti5@unixzen.com 7 */ 8 #ifndef HGL_CONTEXT_H 9 #define HGL_CONTEXT_H 10 11 #include "os/os_thread.h" 12 #include "pipe/p_format.h" 13 #include "pipe/p_compiler.h" 14 #include "pipe/p_screen.h" 15 #include "postprocess/filters.h" 16 17 #include "frontend/api.h" 18 19 #include "bitmap_wrapper.h" 20 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 27 #define CONTEXT_MAX 32 28 29 typedef int64 context_id; 30 31 32 struct hgl_buffer 33 { 34 struct st_framebuffer_iface *stfbi; 35 struct st_visual* visual; 36 37 unsigned width; 38 unsigned height; 39 unsigned mask; 40 41 struct pipe_screen* screen; 42 void* winsysContext; 43 44 enum pipe_texture_target target; 45 struct pipe_resource* textures[ST_ATTACHMENT_COUNT]; 46 47 void *map; 48 }; 49 50 51 struct hgl_display 52 { 53 mtx_t mutex; 54 55 struct st_api* api; 56 struct st_manager* manager; 57 }; 58 59 60 struct hgl_context 61 { 62 struct hgl_display* display; 63 struct st_context_iface* st; 64 struct st_visual* stVisual; 65 66 // Post processing 67 struct pp_queue_t* postProcess; 68 unsigned int postProcessEnable[PP_FILTERS]; 69 70 // Desired viewport size 71 unsigned width; 72 unsigned height; 73 74 mtx_t fbMutex; 75 76 struct hgl_buffer* buffer; 77 }; 78 79 // hgl_buffer from statetracker interface 80 struct hgl_buffer* hgl_st_framebuffer(struct st_framebuffer_iface *stfbi); 81 82 // hgl frontend 83 struct st_api* hgl_create_st_api(void); 84 85 // hgl framebuffer 86 struct hgl_buffer* hgl_create_st_framebuffer(struct hgl_context* context, void *winsysContext); 87 void hgl_destroy_st_framebuffer(struct hgl_buffer *buffer); 88 89 // hgl manager 90 struct st_manager* hgl_create_st_manager(struct hgl_context* screen); 91 void hgl_destroy_st_manager(struct st_manager *manager); 92 93 // hgl visual 94 struct st_visual* hgl_create_st_visual(ulong options); 95 void hgl_destroy_st_visual(struct st_visual* visual); 96 97 // hgl display 98 struct hgl_display* hgl_create_display(struct pipe_screen* screen); 99 void hgl_destroy_display(struct hgl_display *display); 100 101 102 #ifdef __cplusplus 103 } 104 #endif 105 106 #endif /* HGL_CONTEXT_H */ 107