sdm: hwc: Add support for GetVisibleDisplayRect
Support the binder API to get the display visible rectangle which is the union of all the app layer's displayframe. Change-Id: I05d750c80dda5b735bac5938410ddeeeb8823dd1
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
cbd56aa4d7
commit
3bd31efc6f
@@ -47,6 +47,7 @@
|
||||
#define DLOGE(format, ...) DLOGE_IF(kTagNone, format, ##__VA_ARGS__)
|
||||
#define DLOGW(format, ...) DLOGW_IF(kTagNone, format, ##__VA_ARGS__)
|
||||
#define DLOGI(format, ...) DLOGI_IF(kTagNone, format, ##__VA_ARGS__)
|
||||
#define DLOGV(format, ...) DLOGV_IF(kTagNone, format, ##__VA_ARGS__)
|
||||
|
||||
#define DTRACE_BEGIN(custom_string) Debug::Get()->BeginTrace(__CLASS__, __FUNCTION__, custom_string)
|
||||
#define DTRACE_END() Debug::Get()->EndTrace()
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <cutils/properties.h>
|
||||
#include <dlfcn.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include "cpuhint.h"
|
||||
#include "hwc_debugger.h"
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <gr.h>
|
||||
#include <alloc_controller.h>
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
#include <core/buffer_allocator.h>
|
||||
|
||||
#include "hwc_debugger.h"
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <sync/sync.h>
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include "hwc_debugger.h"
|
||||
#include "hwc_buffer_sync_handler.h"
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <core/dump_interface.h>
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
#include <core/buffer_allocator.h>
|
||||
#include <private/color_params.h>
|
||||
#include "hwc_buffer_allocator.h"
|
||||
|
||||
@@ -37,19 +37,6 @@
|
||||
#include <cutils/log.h>
|
||||
#include <utils/Trace.h>
|
||||
|
||||
#define DLOG(Macro, format, ...) Macro(__CLASS__ "::%s: " format, __FUNCTION__, ##__VA_ARGS__)
|
||||
|
||||
#define DLOGE(format, ...) DLOG(ALOGE, format, ##__VA_ARGS__)
|
||||
#define DLOGW(format, ...) DLOG(ALOGW, format, ##__VA_ARGS__)
|
||||
#define DLOGI(format, ...) DLOG(ALOGI, format, ##__VA_ARGS__)
|
||||
#define DLOGD(format, ...) DLOG(ALOGI, format, ##__VA_ARGS__)
|
||||
#define DLOGV(format, ...) DLOG(ALOGV, format, ##__VA_ARGS__)
|
||||
|
||||
#define DTRACE_BEGIN(custom_string) HWCDebugHandler::Get()->BeginTrace(__CLASS__, __FUNCTION__, \
|
||||
custom_string)
|
||||
#define DTRACE_END() HWCDebugHandler::Get()->EndTrace()
|
||||
#define DTRACE_SCOPED() ScopeTracer<HWCDebugHandler> scope_tracer(__CLASS__, __FUNCTION__)
|
||||
|
||||
namespace sdm {
|
||||
|
||||
class HWCDebugHandler : public DebugHandler {
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include <gralloc_priv.h>
|
||||
#include <gr.h>
|
||||
#include <utils/constants.h>
|
||||
#include <utils/rect.h>
|
||||
#include <utils/debug.h>
|
||||
#include <sync/sync.h>
|
||||
#include <cutils/properties.h>
|
||||
|
||||
@@ -477,6 +479,7 @@ int HWCDisplay::PrepareLayerStack(hwc_display_contents_1_t *content_list) {
|
||||
|
||||
use_blit_comp_ = false;
|
||||
metadata_refresh_rate_ = 0;
|
||||
display_rect_ = LayerRect();
|
||||
|
||||
// Configure each layer
|
||||
for (size_t i = 0; i < num_hw_layers; i++) {
|
||||
@@ -506,6 +509,11 @@ int HWCDisplay::PrepareLayerStack(hwc_display_contents_1_t *content_list) {
|
||||
}
|
||||
SetComposition(hwc_layer.compositionType, &layer.composition);
|
||||
|
||||
if (hwc_layer.compositionType != HWC_FRAMEBUFFER_TARGET) {
|
||||
display_rect_ = Union(display_rect_, layer.dst_rect);
|
||||
}
|
||||
|
||||
|
||||
// For dim layers, SurfaceFlinger
|
||||
// - converts planeAlpha to per pixel alpha,
|
||||
// - sets RGB color to 000,
|
||||
@@ -1308,6 +1316,21 @@ int HWCDisplay::ColorSVCRequestRoute(const PPDisplayAPIPayload &in_payload,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int HWCDisplay::GetVisibleDisplayRect(hwc_rect_t* visible_rect) {
|
||||
if (!IsValid(display_rect_)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
visible_rect->left = INT(display_rect_.left);
|
||||
visible_rect->top = INT(display_rect_.top);
|
||||
visible_rect->right = INT(display_rect_.right);
|
||||
visible_rect->bottom = INT(display_rect_.bottom);
|
||||
DLOGI("Dpy = %d Visible Display Rect(%d %d %d %d)", visible_rect->left, visible_rect->top,
|
||||
visible_rect->right, visible_rect->bottom);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HWCDisplay::ResetLayerCacheStack() {
|
||||
uint32_t layer_count = layer_stack_cache_.layer_count;
|
||||
for (uint32_t i = 0; i < layer_count; i++) {
|
||||
|
||||
@@ -76,6 +76,7 @@ class HWCDisplay : public DisplayEventHandler {
|
||||
int ColorSVCRequestRoute(const PPDisplayAPIPayload &in_payload,
|
||||
PPDisplayAPIPayload *out_payload,
|
||||
PPPendingParams *pending_action);
|
||||
int GetVisibleDisplayRect(hwc_rect_t* rect);
|
||||
|
||||
protected:
|
||||
enum DisplayStatus {
|
||||
@@ -186,7 +187,8 @@ class HWCDisplay : public DisplayEventHandler {
|
||||
bool skip_prepare_ = false;
|
||||
|
||||
bool solid_fill_enable_ = false;
|
||||
uint32_t solid_fill_color_ = 0;;
|
||||
uint32_t solid_fill_color_ = 0;
|
||||
LayerRect display_rect_;
|
||||
|
||||
private:
|
||||
bool IsFrameBufferScaled();
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <cutils/properties.h>
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include "hwc_display_external.h"
|
||||
#include "hwc_debugger.h"
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <cutils/properties.h>
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
#include <stdarg.h>
|
||||
#include "hwc_display_primary.h"
|
||||
#include "hwc_debugger.h"
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
*/
|
||||
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
#include <sync/sync.h>
|
||||
#include <stdarg.h>
|
||||
#include <gr.h>
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <gr.h>
|
||||
#include <gralloc_priv.h>
|
||||
#include <display_config.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include "hwc_buffer_allocator.h"
|
||||
#include "hwc_buffer_sync_handler.h"
|
||||
@@ -610,6 +611,10 @@ android::status_t HWCSession::notifyCallback(uint32_t command, const android::Pa
|
||||
status = SetPanelBrightness(input_parcel, output_parcel);
|
||||
break;
|
||||
|
||||
case qService::IQService::GET_DISPLAY_VISIBLE_REGION:
|
||||
status = GetVisibleDisplayRect(input_parcel, output_parcel);
|
||||
break;
|
||||
|
||||
default:
|
||||
DLOGW("QService command = %d is not supported", command);
|
||||
return -EINVAL;
|
||||
@@ -1204,5 +1209,31 @@ void HWCSession::HandleSecureDisplaySession(hwc_display_contents_1_t **displays)
|
||||
}
|
||||
}
|
||||
|
||||
android::status_t HWCSession::GetVisibleDisplayRect(const android::Parcel *input_parcel,
|
||||
android::Parcel *output_parcel) {
|
||||
int dpy = input_parcel->readInt32();
|
||||
|
||||
if (dpy < HWC_DISPLAY_PRIMARY || dpy > HWC_DISPLAY_VIRTUAL) {
|
||||
return android::BAD_VALUE;;
|
||||
}
|
||||
|
||||
if (!hwc_display_[dpy]) {
|
||||
return android::NO_INIT;
|
||||
}
|
||||
|
||||
hwc_rect_t visible_rect = {0, 0, 0, 0};
|
||||
int error = hwc_display_[dpy]->GetVisibleDisplayRect(&visible_rect);
|
||||
if (error < 0) {
|
||||
return error;
|
||||
}
|
||||
|
||||
output_parcel->writeInt32(visible_rect.left);
|
||||
output_parcel->writeInt32(visible_rect.top);
|
||||
output_parcel->writeInt32(visible_rect.right);
|
||||
output_parcel->writeInt32(visible_rect.bottom);
|
||||
|
||||
return android::NO_ERROR;
|
||||
}
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
|
||||
@@ -112,6 +112,8 @@ class HWCSession : hwc_composer_device_1_t, public qClient::BnQClient {
|
||||
android::Parcel *output_parcel);
|
||||
android::status_t HandleGetDisplayAttributesForConfig(const android::Parcel *input_parcel,
|
||||
android::Parcel *output_parcel);
|
||||
android::status_t GetVisibleDisplayRect(const android::Parcel *input_parcel,
|
||||
android::Parcel *output_parcel);
|
||||
|
||||
static Locker locker_;
|
||||
CoreInterface *core_intf_ = NULL;
|
||||
|
||||
Reference in New Issue
Block a user