blob: a3ebd147a3779df6a050f4e88715c6c8e4240aa4 [file] [log] [blame]
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _LIB_OPENGL_RENDER_THREAD_INFO_H
#define _LIB_OPENGL_RENDER_THREAD_INFO_H
#include "RenderContext.h"
#include "WindowSurface.h"
#include "GLESv1Decoder.h"
#include "GLESv2Decoder.h"
#include "renderControl_dec.h"
#include "SyncThread.h"
#include <set>
typedef uint32_t HandleType;
typedef std::set<HandleType> ThreadContextSet;
typedef std::set<HandleType> WindowSurfaceSet;
// A class used to model the state of each RenderThread related
struct RenderThreadInfo {
// Create new instance. Only call this once per thread.
// Future callls to get() will return this instance until
// it is destroyed.
RenderThreadInfo();
// Destructor.
~RenderThreadInfo();
// Return the current thread's instance, if any, or NULL.
static RenderThreadInfo* get();
// Current EGL context, draw surface and read surface.
RenderContextPtr currContext;
WindowSurfacePtr currDrawSurf;
WindowSurfacePtr currReadSurf;
// Decoder states.
GLESv1Decoder m_glDec;
GLESv2Decoder m_gl2Dec;
renderControl_decoder_context_t m_rcDec;
// All the contexts that are created by this render thread.
// New emulator manages contexts in guest process level,
// m_contextSet should be deprecated. It is only kept for
// backward compatibility reason.
ThreadContextSet m_contextSet;
// all the window surfaces that are created by this render thread
WindowSurfaceSet m_windowSet;
// Sync timeline info + sync thread pointer
std::unique_ptr<SyncThread> syncThread;
// The unique id of owner guest process of this render thread
uint64_t m_puid = 0;
};
#endif