HWComposer.h revision 22da60c3e64cd57535cbba063c07127814a2b52f
1a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian/* 2a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * Copyright (C) 2010 The Android Open Source Project 3a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * 4a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * Licensed under the Apache License, Version 2.0 (the "License"); 5a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * you may not use this file except in compliance with the License. 6a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * You may obtain a copy of the License at 7a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * 8a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * http://www.apache.org/licenses/LICENSE-2.0 9a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * 10a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * Unless required by applicable law or agreed to in writing, software 11a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * distributed under the License is distributed on an "AS IS" BASIS, 12a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * See the License for the specific language governing permissions and 14a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian * limitations under the License. 15a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian */ 16a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 17a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian#ifndef ANDROID_SF_HWCOMPOSER_H 18a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian#define ANDROID_SF_HWCOMPOSER_H 19a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 20a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian#include <stdint.h> 21a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian#include <sys/types.h> 22a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 23a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian#include <EGL/egl.h> 24a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 25a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian#include <hardware/hwcomposer.h> 26a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 27c7d14e247117392fbd44aa454622778a25c076aeMathias Agopian#include <utils/StrongPointer.h> 2822da60c3e64cd57535cbba063c07127814a2b52fMathias Agopian#include <utils/Vector.h> 29c7d14e247117392fbd44aa454622778a25c076aeMathias Agopian 30a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopiannamespace android { 31a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian// --------------------------------------------------------------------------- 32a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 338372785879d329f592f6883620b5a32d80d74691Mathias Agopianclass String8; 34c7d14e247117392fbd44aa454622778a25c076aeMathias Agopianclass SurfaceFlinger; 3522da60c3e64cd57535cbba063c07127814a2b52fMathias Agopianclass LayerBase; 368372785879d329f592f6883620b5a32d80d74691Mathias Agopian 37a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopianclass HWComposer 38a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian{ 39a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopianpublic: 40a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 41c7d14e247117392fbd44aa454622778a25c076aeMathias Agopian HWComposer(const sp<SurfaceFlinger>& flinger); 42a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian ~HWComposer(); 43a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 44a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian status_t initCheck() const; 45a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 46a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian // tells the HAL what the framebuffer is 47a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian void setFrameBuffer(EGLDisplay dpy, EGLSurface sur); 48a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 49a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian // create a work list for numLayers layer 50a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian status_t createWorkList(size_t numLayers); 51a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 52a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian // Asks the HAL what it can do 53a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian status_t prepare() const; 54a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 557ee4cd5556cef1878e1d4729f1b389f186311027Mathias Agopian // disable hwc until next createWorkList 567ee4cd5556cef1878e1d4729f1b389f186311027Mathias Agopian status_t disable(); 577ee4cd5556cef1878e1d4729f1b389f186311027Mathias Agopian 58a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian // commits the list 59a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian status_t commit() const; 60a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 61f5f2712854599b4970643c6000fe6ae950a08ba9Antti Hatala // release hardware resources 62f5f2712854599b4970643c6000fe6ae950a08ba9Antti Hatala status_t release() const; 63a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 6445721773e1a68e96da4b6cc04cef276bae7ca3e9Mathias Agopian size_t getNumLayers() const; 6545721773e1a68e96da4b6cc04cef276bae7ca3e9Mathias Agopian hwc_layer_t* getLayers() const; 66a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 678372785879d329f592f6883620b5a32d80d74691Mathias Agopian // for debugging 6822da60c3e64cd57535cbba063c07127814a2b52fMathias Agopian void dump(String8& out, char* scratch, size_t SIZE, 6922da60c3e64cd57535cbba063c07127814a2b52fMathias Agopian const Vector< sp<LayerBase> >& visibleLayersSortedByZ) const; 708372785879d329f592f6883620b5a32d80d74691Mathias Agopian 71a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopianprivate: 72c7d14e247117392fbd44aa454622778a25c076aeMathias Agopian struct cb_context { 73c7d14e247117392fbd44aa454622778a25c076aeMathias Agopian hwc_procs_t procs; 74c7d14e247117392fbd44aa454622778a25c076aeMathias Agopian HWComposer* hwc; 75c7d14e247117392fbd44aa454622778a25c076aeMathias Agopian }; 76c7d14e247117392fbd44aa454622778a25c076aeMathias Agopian static void hook_invalidate(struct hwc_procs* procs); 77c7d14e247117392fbd44aa454622778a25c076aeMathias Agopian void invalidate(); 78c7d14e247117392fbd44aa454622778a25c076aeMathias Agopian 79c7d14e247117392fbd44aa454622778a25c076aeMathias Agopian sp<SurfaceFlinger> mFlinger; 80a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian hw_module_t const* mModule; 81a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian hwc_composer_device_t* mHwc; 82a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian hwc_layer_list_t* mList; 8345721773e1a68e96da4b6cc04cef276bae7ca3e9Mathias Agopian size_t mCapacity; 84a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian hwc_display_t mDpy; 85a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian hwc_surface_t mSur; 86c7d14e247117392fbd44aa454622778a25c076aeMathias Agopian cb_context mCBContext; 87a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian}; 88a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 89a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 90a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian// --------------------------------------------------------------------------- 91a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian}; // namespace android 92a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian 93a350ff98692b3a50cad5cc93f9f83221242ca86aMathias Agopian#endif // ANDROID_SF_HWCOMPOSER_H 94