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