1/* 2 * Copyright 2009, 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 GALLIUMCONTEXT_H 9#define GALLIUMCONTEXT_H 10 11 12#include <stddef.h> 13#include <kernel/image.h> 14 15#include "pipe/p_compiler.h" 16#include "pipe/p_screen.h" 17#include "postprocess/filters.h" 18#include "hgl_context.h" 19#include "sw/hgl/hgl_sw_winsys.h" 20 21 22class BBitmap; 23 24class GalliumContext { 25public: 26 GalliumContext(ulong options); 27 ~GalliumContext(); 28 29 void Lock(); 30 void Unlock(); 31 32 context_id CreateContext(HGLWinsysContext *wsContext); 33 void DestroyContext(context_id contextID); 34 context_id GetCurrentContext() { return fCurrentContext; }; 35 status_t SetCurrentContext(bool set, context_id contextID); 36 37 status_t SwapBuffers(context_id contextID); 38 void Draw(context_id contextID, BRect updateRect); 39 40 bool Validate(uint32 width, uint32 height); 41 void Invalidate(uint32 width, uint32 height); 42 43private: 44 status_t CreateDisplay(); 45 void DestroyDisplay(); 46 void Flush(); 47 48 ulong fOptions; 49 static int32 fDisplayRefCount; 50 static hgl_display* fDisplay; 51 52 // Context Management 53 struct hgl_context* fContext[CONTEXT_MAX]; 54 context_id fCurrentContext; 55 mtx_t fMutex; 56}; 57 58 59#endif /* GALLIUMCONTEXT_H */ 60