Skip to content

Commit

Permalink
Merge "hardware/qcom/display: External-only display." into ics_chocolate
Browse files Browse the repository at this point in the history
  • Loading branch information
Linux Build Service Account authored and QuIC Gerrit Code Review committed Mar 8, 2012
2 parents e2e6df1 + e73079c commit 956e042
Show file tree
Hide file tree
Showing 8 changed files with 588 additions and 39 deletions.
5 changes: 4 additions & 1 deletion libgralloc/alloc_controller.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -59,13 +59,16 @@ static bool canFallback(int compositionType, int usage, bool triedSystem)
// 2. Alloc from system heap was already tried
// 3. The heap type is requsted explicitly
// 4. The heap type is protected
// 5. The buffer is meant for external display only

if(compositionType == MDP_COMPOSITION)
return false;
if(triedSystem)
return false;
if(usage & (GRALLOC_HEAP_MASK | GRALLOC_USAGE_PROTECTED))
return false;
if(usage & (GRALLOC_HEAP_MASK | GRALLOC_USAGE_EXTERNAL_ONLY))
return false;
//Return true by default
return true;
}
Expand Down
10 changes: 9 additions & 1 deletion libgralloc/gpu.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
* Copyright (c) 2011-2012 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.
Expand Down Expand Up @@ -164,6 +164,14 @@ int gpu_context_t::gralloc_alloc_buffer(size_t size, int usage,
flags |= private_handle_t::PRIV_FLAGS_UNSYNCHRONIZED;
}

if (usage & GRALLOC_USAGE_EXTERNAL_ONLY) {
flags |= private_handle_t::PRIV_FLAGS_EXTERNAL_ONLY;
//The EXTERNAL_BLOCK flag is always an add-on
if (usage & GRALLOC_USAGE_EXTERNAL_BLOCK) {
flags |= private_handle_t::PRIV_FLAGS_EXTERNAL_BLOCK;
}
}

if (err == 0) {
flags |= data.allocType;
private_handle_t* hnd = new private_handle_t(data.fd, size, flags,
Expand Down
18 changes: 14 additions & 4 deletions libgralloc/gralloc_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,31 @@ enum {

/* Set this for allocating uncached memory (using O_DSYNC)
* cannot be used with noncontiguous heaps */
GRALLOC_USAGE_PRIVATE_UNCACHED = 0x00010000,
GRALLOC_USAGE_PRIVATE_UNCACHED = 0x00100000,

/* This flag needs to be set when using a non-contiguous heap from ION.
* If not set, the system heap is assumed to be coming from ashmem
*/
GRALLOC_USAGE_PRIVATE_ION = 0x00020000,
GRALLOC_USAGE_PRIVATE_ION = 0x00200000,

/* This flag can be set to disable genlock synchronization
* for the gralloc buffer. If this flag is set the caller
* is required to perform explicit synchronization.
* WARNING - flag is outside the standard PRIVATE region
* and may need to be moved if the gralloc API changes
*/
GRALLOC_USAGE_PRIVATE_UNSYNCHRONIZED = 0X00040000,
GRALLOC_USAGE_PRIVATE_UNSYNCHRONIZED = 0X00400000,

/* Set this flag when you need to avoid mapping the memory in userspace */
GRALLOC_USAGE_PRIVATE_DO_NOT_MAP = 0X00080000,
GRALLOC_USAGE_PRIVATE_DO_NOT_MAP = 0X00800000,

/* Buffer content should be displayed on an external display only */
GRALLOC_USAGE_EXTERNAL_ONLY = 0x00010000,

/* Only this buffer content should be displayed on external, even if
* other EXTERNAL_ONLY buffers are available. Used during suspend.
*/
GRALLOC_USAGE_EXTERNAL_BLOCK = 0x00020000,
};

enum {
Expand Down Expand Up @@ -321,6 +329,8 @@ struct private_handle_t {
PRIV_FLAGS_SECURE_BUFFER = 0x00000400,
PRIV_FLAGS_UNSYNCHRONIZED = 0x00000800, // For explicit synchronization
PRIV_FLAGS_NOT_MAPPED = 0x00001000, // Not mapped in userspace
PRIV_FLAGS_EXTERNAL_ONLY = 0x00002000, // Display on external only
PRIV_FLAGS_EXTERNAL_BLOCK = 0x00004000, // Display only this buffer on external
};

// file-descriptors
Expand Down
5 changes: 3 additions & 2 deletions libhwcomposer/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ LOCAL_SHARED_LIBRARIES := liblog libcutils libEGL libhardware libutils liboverla
LOCAL_SHARED_LIBRARIES += libgenlock libQcomUI libmemalloc

LOCAL_SRC_FILES := \
hwcomposer.cpp

hwcomposer.cpp \
external_display_only.h

LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM)
LOCAL_CFLAGS:= -DLOG_TAG=\"$(TARGET_BOARD_PLATFORM).hwcomposer\" -DDEBUG_CALC_FPS

Expand Down
Loading

0 comments on commit 956e042

Please sign in to comment.