Skip to content

Commit

Permalink
hwc2: Protect AcceptDisplayChanges with the hwc session lock
Browse files Browse the repository at this point in the history
Bug: 32221503
Change-Id: Ia3a0842e12e5553537959d2b53b6c8faefb162e6
  • Loading branch information
naseer authored and spfetsch committed Oct 21, 2016
1 parent daeb2e6 commit 42e0437
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion msm8996/sdm/libs/hwc2/hwc_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ HWC2::Error HWCDisplay::AcceptDisplayChanges() {
auto composition = change.second;

if (hwc_layer == nullptr) {
DLOGI("Null layer in HWCDisplay::AcceptDisplayChanges.");
DLOGW("Null layer: %" PRIu64, change.first);
} else {
hwc_layer->UpdateClientCompositionType(composition);
}
Expand Down
6 changes: 4 additions & 2 deletions msm8996/sdm/libs/hwc2/hwc_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ static hwc2_function_pointer_t AsFP(T function) {
// HWC2 functions returned in GetFunction
// Defined in the same order as in the HWC2 header

static int32_t AcceptDisplayChanges(hwc2_device_t *device, hwc2_display_t display) {
int32_t HWCSession::AcceptDisplayChanges(hwc2_device_t *device,
hwc2_display_t display) {
SCOPE_LOCK(locker_);
return HWCSession::CallDisplayFunction(device, display, &HWCDisplay::AcceptDisplayChanges);
}

Expand Down Expand Up @@ -590,7 +592,7 @@ hwc2_function_pointer_t HWCSession::GetFunction(struct hwc2_device *device,

switch (descriptor) {
case HWC2::FunctionDescriptor::AcceptDisplayChanges:
return AsFP<HWC2_PFN_ACCEPT_DISPLAY_CHANGES>(AcceptDisplayChanges);
return AsFP<HWC2_PFN_ACCEPT_DISPLAY_CHANGES>(HWCSession::AcceptDisplayChanges);
case HWC2::FunctionDescriptor::CreateLayer:
return AsFP<HWC2_PFN_CREATE_LAYER>(CreateLayer);
case HWC2::FunctionDescriptor::CreateVirtualDisplay:
Expand Down
1 change: 1 addition & 0 deletions msm8996/sdm/libs/hwc2/hwc_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class HWCSession : hwc2_device_t, public qClient::BnQClient {

// HWC2 Functions that require a concrete implementation in hwc session
// and hence need to be member functions
static int32_t AcceptDisplayChanges(hwc2_device_t *device, hwc2_display_t display);
static int32_t CreateLayer(hwc2_device_t *device, hwc2_display_t display,
hwc2_layer_t *out_layer_id);
static int32_t CreateVirtualDisplay(hwc2_device_t *device, uint32_t width, uint32_t height,
Expand Down

0 comments on commit 42e0437

Please sign in to comment.