Skip to content

Commit

Permalink
Merge "hwc: Support swap interval zero"
Browse files Browse the repository at this point in the history
  • Loading branch information
Linux Build Service Account authored and Gerrit - the friendly Code Review server committed Feb 20, 2013
2 parents a348159 + 94baddc commit 3427243
Show file tree
Hide file tree
Showing 24 changed files with 82 additions and 44 deletions.
4 changes: 4 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ ifeq ($(ARCH_ARM_HAVE_NEON),true)
common_flags += -D__ARM_HAVE_NEON
endif

ifeq ($(TARGET_BOARD_PLATFORM), msm8974)
common_flags += -DVENUS_COLOR_FORMAT
endif

common_deps :=
kernel_includes :=

Expand Down
6 changes: 3 additions & 3 deletions libcopybit/Android.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2008 The Android Open Source Project
# Copyright (C) 2012 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.
Expand All @@ -15,15 +15,15 @@
LOCAL_PATH:= $(call my-dir)
include $(LOCAL_PATH)/../common.mk
include $(CLEAR_VARS)

LOCAL_MODULE := copybit.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_SHARED_LIBRARIES := $(common_libs) libdl libmemalloc
LOCAL_CFLAGS := $(common_flags)
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdcopybit\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)


ifeq ($(TARGET_USES_C2D_COMPOSITION),true)
LOCAL_CFLAGS += -DCOPYBIT_Z180=1 -DC2D_SUPPORT_DISPLAY=1
LOCAL_SRC_FILES := copybit_c2d.cpp software_converter.cpp
Expand Down
3 changes: 0 additions & 3 deletions libcopybit/copybit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
* limitations under the License.
*/


#define LOG_TAG "copybit"

#include <cutils/log.h>

#include <linux/msm_mdp.h>
Expand Down
2 changes: 0 additions & 2 deletions libcopybit/copybit_c2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
* limitations under the License.
*/

#define LOG_TAG "copybit_c2d"

#include <cutils/log.h>

#include <stdint.h>
Expand Down
1 change: 0 additions & 1 deletion libcopybit/software_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#define LOG_TAG "copybit"
#include <cutils/log.h>
#include <stdlib.h>
#include <errno.h>
Expand Down
3 changes: 2 additions & 1 deletion libexternal/Android.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
LOCAL_PATH := $(call my-dir)
include $(LOCAL_PATH)/../common.mk
include $(CLEAR_VARS)

LOCAL_MODULE := libexternal
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_SHARED_LIBRARIES := $(common_libs) liboverlay
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"external\"
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdexternal\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := external.cpp

Expand Down
4 changes: 2 additions & 2 deletions libgenlock/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ LOCAL_MODULE := libgenlock
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes)
LOCAL_SHARED_LIBRARIES := liblog libcutils
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"libgenlock\"
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdgenlock\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := genlock.cpp
include $(BUILD_SHARED_LIBRARY)

include $(BUILD_SHARED_LIBRARY)
11 changes: 7 additions & 4 deletions libgralloc/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#gralloc module
# Gralloc module
LOCAL_PATH := $(call my-dir)
include $(LOCAL_PATH)/../common.mk
include $(CLEAR_VARS)
Expand All @@ -23,18 +23,21 @@ LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_SHARED_LIBRARIES := $(common_libs) libmemalloc libgenlock
LOCAL_SHARED_LIBRARIES += libqdutils libGLESv1_CM
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"gralloc\"
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdgralloc\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps)
LOCAL_SRC_FILES := gpu.cpp gralloc.cpp framebuffer.cpp mapper.cpp

include $(BUILD_SHARED_LIBRARY)

#MemAlloc Library
# MemAlloc Library
include $(CLEAR_VARS)

LOCAL_MODULE := libmemalloc
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_SHARED_LIBRARIES := $(common_libs) libgenlock
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"memalloc\"
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdmemalloc\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps)
LOCAL_SRC_FILES := ionalloc.cpp alloc_controller.cpp

include $(BUILD_SHARED_LIBRARY)
8 changes: 8 additions & 0 deletions libgralloc/alloc_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
#include "gr.h"
#include "comptype.h"

#ifdef VENUS_COLOR_FORMAT
#include <media/msm_media_info.h>
#else
#define VENUS_Y_STRIDE(args...) 0
#define VENUS_Y_SCANLINES(args...) 0
#define VENUS_BUFFER_SIZE(args...) 0
#endif

using namespace gralloc;
using namespace qdutils;

Expand Down
2 changes: 1 addition & 1 deletion libgralloc/framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ int mapFrameBufferLocked(struct private_module_t* module)
size_t fbSize = roundUpToPageSize(finfo.line_length * info.yres)*
module->numBuffers;
module->framebuffer = new private_handle_t(fd, fbSize,
private_handle_t::PRIV_FLAGS_USES_PMEM,
private_handle_t::PRIV_FLAGS_USES_ION,
BUFFER_TYPE_UI,
module->fbFormat, info.xres, info.yres);
void* vaddr = mmap(0, fbSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
Expand Down
15 changes: 7 additions & 8 deletions libgralloc/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ int gpu_context_t::gralloc_alloc_framebuffer_locked(size_t size, int usage,
return -ENOMEM;
}

// create a "fake" handles for it
// Set the PMEM flag as well, since adreno
// treats the FB memory as pmem
// create a "fake" handle for it
intptr_t vaddr = intptr_t(m->framebuffer->base);
private_handle_t* hnd = new private_handle_t(dup(m->framebuffer->fd), bufferSize,
private_handle_t::PRIV_FLAGS_USES_PMEM |
private_handle_t::PRIV_FLAGS_FRAMEBUFFER,
BUFFER_TYPE_UI, m->fbFormat, m->info.xres,
m->info.yres);
private_handle_t* hnd = new private_handle_t(
dup(m->framebuffer->fd), bufferSize,
private_handle_t::PRIV_FLAGS_USES_ION |
private_handle_t::PRIV_FLAGS_FRAMEBUFFER,
BUFFER_TYPE_UI, m->fbFormat, m->info.xres,
m->info.yres);

// find a free slot
for (uint32_t i=0 ; i<numBuffers ; i++) {
Expand Down
8 changes: 6 additions & 2 deletions libgralloc/ionalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,18 @@ int IonAlloc::alloc_buffer(alloc_data& data)
struct ion_handle_data handle_data;
struct ion_fd_data fd_data;
struct ion_allocation_data ionAllocData;

void *base = 0;

ionAllocData.len = data.size;
ionAllocData.align = data.align;
ionAllocData.heap_mask = data.flags;
ionAllocData.heap_mask = data.flags & ~ION_SECURE;
ionAllocData.flags = data.uncached ? 0 : ION_FLAG_CACHED;

// ToDo: replace usage of alloc data structure with
// ionallocdata structure.
if (data.flags & ION_SECURE)
ionAllocData.flags |= ION_SECURE;

err = open_device();
if (err)
return err;
Expand Down
6 changes: 3 additions & 3 deletions libhwcomposer/Android.mk
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
LOCAL_PATH := $(call my-dir)
include $(LOCAL_PATH)/../common.mk
include $(CLEAR_VARS)

LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_SHARED_LIBRARIES := $(common_libs) libEGL liboverlay libgenlock \
libexternal libqdutils libhardware_legacy \
libdl libmemalloc libqservice

LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"hwcomposer\"
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdhwcomposer\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := hwc.cpp \
hwc_video.cpp \
hwc_utils.cpp \
hwc_uevents.cpp \
hwc_vsync.cpp \
hwc_fbupdate.cpp \
hwc_mdpcomp.cpp \
hwc_mdpcomp.cpp

include $(BUILD_SHARED_LIBRARY)
2 changes: 1 addition & 1 deletion libhwcomposer/hwc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ static int hwc_prepare_primary(hwc_composer_device_1 *dev,
if(!MDPComp::configure(ctx, list)) {
VideoOverlay::prepare(ctx, list, HWC_DISPLAY_PRIMARY);
FBUpdate::prepare(ctx, fbLayer, HWC_DISPLAY_PRIMARY);
ctx->mLayerCache[HWC_DISPLAY_PRIMARY]->updateLayerCache(list);
}
ctx->mLayerCache[HWC_DISPLAY_PRIMARY]->updateLayerCache(list);
}
}
return 0;
Expand Down
27 changes: 23 additions & 4 deletions libhwcomposer/hwc_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,23 +238,34 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy) {
int count = 0;
int releaseFd = -1;
int fbFd = -1;
bool swapzero = false;
data.flags = MDP_BUF_SYNC_FLAG_WAIT;
data.acq_fen_fd = acquireFd;
data.rel_fen_fd = &releaseFd;
char property[PROPERTY_VALUE_MAX];
if(property_get("debug.egl.swapinterval", property, "1") > 0) {
if(atoi(property) == 0)
swapzero = true;
}

//Accumulate acquireFenceFds
for(uint32_t i = 0; i < list->numHwLayers; i++) {
if((list->hwLayers[i].compositionType == HWC_OVERLAY ||
list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) &&
list->hwLayers[i].acquireFenceFd != -1 ){
acquireFd[count++] = list->hwLayers[i].acquireFenceFd;
if(UNLIKELY(swapzero))
acquireFd[count++] = -1;
else
acquireFd[count++] = list->hwLayers[i].acquireFenceFd;
}
}

data.acq_fen_fd_cnt = count;
fbFd = ctx->dpyAttr[dpy].fd;

//Waits for acquire fences, returns a release fence
ret = ioctl(fbFd, MSMFB_BUFFER_SYNC, &data);
if(LIKELY(!swapzero))
ret = ioctl(fbFd, MSMFB_BUFFER_SYNC, &data);
if(ret < 0) {
ALOGE("ioctl MSMFB_BUFFER_SYNC failed, err=%s",
strerror(errno));
Expand All @@ -269,10 +280,18 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy) {
list->hwLayers[i].acquireFenceFd = -1;
}
//Populate releaseFenceFds.
list->hwLayers[i].releaseFenceFd = dup(releaseFd);
if(UNLIKELY(swapzero))
list->hwLayers[i].releaseFenceFd = -1;
else
list->hwLayers[i].releaseFenceFd = dup(releaseFd);
}
}
list->retireFenceFd = releaseFd;
if(UNLIKELY(swapzero)){
list->retireFenceFd = -1;
close(releaseFd);
} else {
list->retireFenceFd = releaseFd;
}
return ret;
}

Expand Down
1 change: 1 addition & 0 deletions liblight/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := lights.c
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdlights\"
LOCAL_MODULE := lights.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_TAGS := optional

Expand Down
1 change: 0 additions & 1 deletion liblight/lights.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


// #define LOG_NDEBUG 0
#define LOG_TAG "lights"

#include <cutils/log.h>

Expand Down
3 changes: 2 additions & 1 deletion liboverlay/Android.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
LOCAL_PATH := $(call my-dir)
include $(LOCAL_PATH)/../common.mk
include $(CLEAR_VARS)

LOCAL_MODULE := liboverlay
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_SHARED_LIBRARIES := $(common_libs) libqdutils libmemalloc
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"overlay\"
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdoverlay\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := \
overlay.cpp \
Expand Down
3 changes: 0 additions & 3 deletions liboverlay/overlayMdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
#include "overlayUtils.h"
#include "overlayMdp.h"

#undef ALOG_TAG
#define ALOG_TAG "overlay"

namespace ovutils = overlay::utils;
namespace overlay {

Expand Down
6 changes: 6 additions & 0 deletions liboverlay/overlayMdssRot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
#include "overlayUtils.h"
#include "overlayRotator.h"

#ifdef VENUS_COLOR_FORMAT
#include <media/msm_media_info.h>
#else
#define VENUS_BUFFER_SIZE(args...) 0
#endif

#ifndef MDSS_MDP_ROT_ONLY
#define MDSS_MDP_ROT_ONLY 0x80
#endif
Expand Down
3 changes: 2 additions & 1 deletion libqdutils/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ LOCAL_MODULE := libqdutils
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := $(common_libs)
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_CFLAGS := $(common_flags)
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdutils\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := profiler.cpp mdp_version.cpp \
idle_invalidator.cpp

include $(BUILD_SHARED_LIBRARY)
1 change: 0 additions & 1 deletion libqdutils/profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#define LOG_TAG "CALCFPS"
#define LOG_NDDEBUG 0
#include "profiler.h"

Expand Down
3 changes: 2 additions & 1 deletion libqservice/Android.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
LOCAL_PATH := $(call my-dir)
include $(LOCAL_PATH)/../common.mk
include $(CLEAR_VARS)

LOCAL_MODULE := libqservice
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_SHARED_LIBRARIES := $(common_libs) libexternal libbinder
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qService\"
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdqservice\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := QService.cpp \
IQService.cpp
Expand Down
3 changes: 2 additions & 1 deletion libtilerenderer/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include $(CLEAR_VARS)
ifeq ($(USE_OPENGL_RENDERER),true)
LOCAL_MODULE := libtilerenderer
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS := -DLOG_TAG=\"qdtilerenderer\"
LOCAL_C_INCLUDES := \
frameworks/base/include/utils \
frameworks/base/libs/hwui \
Expand All @@ -15,8 +16,8 @@ LOCAL_C_INCLUDES := \
external/skia/include/utils \
hardware/libhardware/include/hardware \
frameworks/base/opengl/include/GLES2

LOCAL_SHARED_LIBRARIES := $(common_libs) libGLESv2 libhwui
LOCAL_SRC_FILES := tilerenderer.cpp

include $(BUILD_SHARED_LIBRARY)
endif

0 comments on commit 3427243

Please sign in to comment.