hardware/qcom/display: support for QCOM tiled rendering
Tiled rendering implementation. Change-Id: I1d1361b175fdb6f64b47df85b8f68bebd7d1eea5
This commit is contained in:
		| @@ -1,4 +1,4 @@ | ||||
| #Enables the listed display HAL modules | ||||
| display-hals := libhwcomposer liboverlay libgralloc libgenlock libcopybit | ||||
| display-hals := libhwcomposer liboverlay libgralloc libgenlock libcopybit libtilerenderer | ||||
| include $(call all-named-subdir-makefiles,$(display-hals)) | ||||
|  | ||||
|   | ||||
							
								
								
									
										26
									
								
								libtilerenderer/Android.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								libtilerenderer/Android.mk
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| LOCAL_PATH := $(call my-dir) | ||||
| include $(CLEAR_VARS) | ||||
|  | ||||
| ifeq ($(USE_OPENGL_RENDERER),true) | ||||
| LOCAL_PRELINK_MODULE := false | ||||
| LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES) | ||||
| LOCAL_SHARED_LIBRARIES := libutils libcutils libGLESv2 libhwui | ||||
|  | ||||
| LOCAL_C_INCLUDES += \ | ||||
| 	frameworks/base/include/utils \ | ||||
| 	frameworks/base/libs/hwui \ | ||||
| 	external/skia/include/core \ | ||||
| 	external/skia/include/effects \ | ||||
| 	external/skia/include/images \ | ||||
| 	external/skia/src/ports \ | ||||
| 	external/skia/include/utils \ | ||||
| 	hardware/libhardware/include/hardware \ | ||||
| 	frameworks/base/opengl/include/GLES2 | ||||
|  | ||||
| LOCAL_SRC_FILES := 	\ | ||||
| 	tilerenderer.cpp | ||||
|  | ||||
| LOCAL_MODULE := libtilerenderer | ||||
| LOCAL_MODULE_TAGS := optional | ||||
| include $(BUILD_SHARED_LIBRARY) | ||||
| endif | ||||
							
								
								
									
										103
									
								
								libtilerenderer/tilerenderer.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								libtilerenderer/tilerenderer.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,103 @@ | ||||
| /* | ||||
|  * Copyright (C) 2010 The Android Open Source Project | ||||
|  * Copyright (c) 2011 Code Aurora Forum. All rights reserved. | ||||
|  * | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| #include <GLES2/gl2.h> | ||||
| #include <EGL/egl.h> | ||||
| #include <gl2ext.h> | ||||
| #include <OpenGLRenderer.h> | ||||
| #include "tilerenderer.h" | ||||
|  | ||||
| namespace android { | ||||
| ANDROID_SINGLETON_STATIC_INSTANCE(uirenderer::TileRenderer) ; | ||||
| namespace uirenderer { | ||||
|  | ||||
| TileRenderer::TileRenderer() { | ||||
|     mIsTiled = false; | ||||
| } | ||||
|  | ||||
| TileRenderer::~TileRenderer() { | ||||
| } | ||||
|  | ||||
| void TileRenderer::startTileRendering(OpenGLRenderer* renderer, | ||||
|                                       int left, int top, | ||||
|                                       int right, int bottom) { | ||||
|     int width = 0; | ||||
|     int height = 0; | ||||
|     GLenum status = GL_NO_ERROR; | ||||
|  | ||||
|     if (renderer != NULL) { | ||||
|         renderer->getViewport(width, height); | ||||
|     } | ||||
|  | ||||
|     if (!left && !right && !top && !bottom) { | ||||
|         left = 0; | ||||
|         top = 0; | ||||
|         right = width; | ||||
|         bottom = height; | ||||
|     } | ||||
|  | ||||
|     if (!left && !right && !top && !bottom) { | ||||
|         //can't do tile rendering | ||||
|         LOGE("can't tile render; drity region, width, height not available"); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     int l = left, t = (height - bottom), w = (right - left), h = (bottom - top), preserve = 0; | ||||
|  | ||||
|     if (l < 0 || t < 0) { | ||||
|         l = (l < 0) ? 0 : l; | ||||
|         t = (t < 0) ? 0 : t; | ||||
|         preserve = 1; | ||||
|     } | ||||
|  | ||||
|     if (w > width || h > height) { | ||||
|         w = (w > width) ? width : w; | ||||
|         h = (h > height) ? height : h; | ||||
|         preserve = 1; | ||||
|     } | ||||
|  | ||||
|     //clear off all errors before tiling, if any | ||||
|     while ((status = glGetError()) != GL_NO_ERROR) { | ||||
|         LOGE("glStartTilingQCOM: 0x%x", status); | ||||
|     } | ||||
|  | ||||
|     if (preserve) | ||||
|         glStartTilingQCOM(l, t, w, h, GL_COLOR_BUFFER_BIT0_QCOM); | ||||
|     else | ||||
|         glStartTilingQCOM(l, t, w, h, GL_NONE); | ||||
|  | ||||
|     status = glGetError(); | ||||
|     if (status == GL_NO_ERROR) | ||||
|         mIsTiled = true; | ||||
|     else | ||||
|         LOGE("glStartTilingQCOM: 0x%x", status); | ||||
| } | ||||
|  | ||||
| void TileRenderer::endTileRendering(OpenGLRenderer*) { | ||||
|     if (!mIsTiled) { | ||||
|         return; | ||||
|     } | ||||
|     glEndTilingQCOM(GL_COLOR_BUFFER_BIT0_QCOM); | ||||
|     mIsTiled = false; | ||||
|     GLenum status = GL_NO_ERROR; | ||||
|     while ((status = glGetError()) != GL_NO_ERROR) { | ||||
|         LOGE("glEndTilingQCOM: 0x%x", status); | ||||
|     } | ||||
| } | ||||
|  | ||||
| }; // namespace uirenderer | ||||
| }; // namespace android | ||||
							
								
								
									
										42
									
								
								libtilerenderer/tilerenderer.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								libtilerenderer/tilerenderer.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| /* | ||||
|  * Copyright (C) 2010 The Android Open Source Project | ||||
|  * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | ||||
|  * | ||||
|  * 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 ANDROID_TILE_RENDERER_H | ||||
| #define ANDROID_TILE_RENDERER_H | ||||
|  | ||||
| #include <utils/Singleton.h> | ||||
|  | ||||
| namespace android { | ||||
| namespace uirenderer { | ||||
|  | ||||
| class OpenGLRenderer; | ||||
|  | ||||
| class TileRenderer: public Singleton<TileRenderer> { | ||||
| public: | ||||
|     TileRenderer(); | ||||
|     ~TileRenderer(); | ||||
|  | ||||
|     void startTileRendering(OpenGLRenderer* renderer, int left, int top, int right, int bottom); | ||||
|     void endTileRendering(OpenGLRenderer*); | ||||
|  | ||||
| private: | ||||
|     bool mIsTiled; | ||||
| }; | ||||
|  | ||||
| }; // namespace uirenderer | ||||
| }; // namespace android | ||||
|  | ||||
| #endif | ||||
		Reference in New Issue
	
	Block a user