Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38929e14 authored by Nataniel Borges's avatar Nataniel Borges Committed by Android (Google) Code Review
Browse files

Merge "Update SF dump to use proto3"

parents 7127e800 dcc0bab7
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -2081,11 +2081,15 @@ void Layer::writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet)
    auto parent = useDrawing ? mDrawingParent.promote() : mCurrentParent.promote();
    auto parent = useDrawing ? mDrawingParent.promote() : mCurrentParent.promote();
    if (parent != nullptr) {
    if (parent != nullptr) {
        layerInfo->set_parent(parent->sequence);
        layerInfo->set_parent(parent->sequence);
    } else {
        layerInfo->set_parent(-1);
    }
    }


    auto zOrderRelativeOf = state.zOrderRelativeOf.promote();
    auto zOrderRelativeOf = state.zOrderRelativeOf.promote();
    if (zOrderRelativeOf != nullptr) {
    if (zOrderRelativeOf != nullptr) {
        layerInfo->set_z_order_relative_of(zOrderRelativeOf->sequence);
        layerInfo->set_z_order_relative_of(zOrderRelativeOf->sequence);
    } else {
        layerInfo->set_z_order_relative_of(-1);
    }
    }


    auto buffer = mActiveBuffer;
    auto buffer = mActiveBuffer;
+2 −2
Original line number Original line Diff line number Diff line
@@ -199,13 +199,13 @@ void LayerProtoParser::updateChildrenAndRelative(const LayerProto& layerProto,
        }
        }
    }
    }


    if (layerProto.has_parent()) {
    if (layerProto.parent() != -1) {
        if (layerMap.count(layerProto.parent()) > 0) {
        if (layerMap.count(layerProto.parent()) > 0) {
            currLayer->parent = layerMap[layerProto.parent()];
            currLayer->parent = layerMap[layerProto.parent()];
        }
        }
    }
    }


    if (layerProto.has_z_order_relative_of()) {
    if (layerProto.z_order_relative_of() != -1) {
        if (layerMap.count(layerProto.z_order_relative_of()) > 0) {
        if (layerMap.count(layerProto.z_order_relative_of()) > 0) {
            currLayer->zOrderRelativeOf = layerMap[layerProto.z_order_relative_of()];
            currLayer->zOrderRelativeOf = layerMap[layerProto.z_order_relative_of()];
        }
        }
+74 −74
Original line number Original line Diff line number Diff line
// Definitions for SurfaceFlinger layers.
// Definitions for SurfaceFlinger layers.


syntax = "proto2";
syntax = "proto3";
option optimize_for = LITE_RUNTIME;
option optimize_for = LITE_RUNTIME;
package android.surfaceflinger;
package android.surfaceflinger;


// Contains a list of all layers.
// Contains a list of all layers.
message LayersProto {
message LayersProto {
  repeated LayerProto layers = 1;
  repeated LayerProto layers = 1;
  optional SizeProto resolution = 2;
  SizeProto resolution = 2;
  optional string color_mode = 3;
  string color_mode = 3;
  optional string color_transform = 4;
  string color_transform = 4;
  optional int32 global_transform = 5;
  int32 global_transform = 5;
}
}


// Information about each layer.
// Information about each layer.
message LayerProto {
message LayerProto {
  // unique id per layer.
  // unique id per layer.
  optional int32 id = 1;
  int32 id = 1;
  // unique name per layer.
  // unique name per layer.
  optional string name = 2;
  string name = 2;
  // list of children this layer may have. May be empty.
  // list of children this layer may have. May be empty.
  repeated int32 children = 3;
  repeated int32 children = 3;
  // list of layers that are z order relative to this layer.
  // list of layers that are z order relative to this layer.
  repeated int32 relatives = 4;
  repeated int32 relatives = 4;
  // The type of layer, ex Color, Layer
  // The type of layer, ex Color, Layer
  optional string type = 5;
  string type = 5;
  optional RegionProto transparent_region = 6;
  RegionProto transparent_region = 6;
  optional RegionProto visible_region = 7;
  RegionProto visible_region = 7;
  optional RegionProto damage_region = 8;
  RegionProto damage_region = 8;
  optional uint32 layer_stack = 9;
  uint32 layer_stack = 9;
  // The layer's z order. Can be z order in layer stack, relative to parent,
  // The layer's z order. Can be z order in layer stack, relative to parent,
  // or relative to another layer specified in zOrderRelative.
  // or relative to another layer specified in zOrderRelative.
  optional int32 z = 10;
  int32 z = 10;
  // The layer's position on the display.
  // The layer's position on the display.
  optional PositionProto position = 11;
  PositionProto position = 11;
  // The layer's requested position.
  // The layer's requested position.
  optional PositionProto requested_position = 12;
  PositionProto requested_position = 12;
  // The layer's size.
  // The layer's size.
  optional SizeProto size = 13;
  SizeProto size = 13;
  // The layer's crop in it's own bounds.
  // The layer's crop in it's own bounds.
  optional RectProto crop = 14;
  RectProto crop = 14;
  // The layer's crop in it's parent's bounds.
  // The layer's crop in it's parent's bounds.
  optional RectProto final_crop = 15 [deprecated=true];
  RectProto final_crop = 15 [deprecated=true];
  optional bool is_opaque = 16;
  bool is_opaque = 16;
  optional bool invalidate = 17;
  bool invalidate = 17;
  optional string dataspace = 18;
  string dataspace = 18;
  optional string pixel_format = 19;
  string pixel_format = 19;
  // The layer's actual color.
  // The layer's actual color.
  optional ColorProto color = 20;
  ColorProto color = 20;
  // The layer's requested color.
  // The layer's requested color.
  optional ColorProto requested_color = 21;
  ColorProto requested_color = 21;
  // Can be any combination of
  // Can be any combination of
  //    hidden = 0x01
  //    hidden = 0x01
  //    opaque = 0x02,
  //    opaque = 0x02,
  //    secure = 0x80,
  //    secure = 0x80,
  optional uint32 flags = 22;
  uint32 flags = 22;
  // The layer's actual transform
  // The layer's actual transform
  optional TransformProto transform = 23;
  TransformProto transform = 23;
  // The layer's requested transform.
  // The layer's requested transform.
  optional TransformProto requested_transform = 24;
  TransformProto requested_transform = 24;
  // The parent layer. This value can be null if there is no parent.
  // The parent layer. This value can be null if there is no parent.
  optional int32 parent = 25 [default = -1];
  int32 parent = 25;
  // The layer that this layer has a z order relative to. This value can be null.
  // The layer that this layer has a z order relative to. This value can be null.
  optional int32 z_order_relative_of = 26 [default = -1];
  int32 z_order_relative_of = 26;
  // This value can be null if there's nothing to draw.
  // This value can be null if there's nothing to draw.
  optional ActiveBufferProto active_buffer = 27;
  ActiveBufferProto active_buffer = 27;
  // The number of frames available.
  // The number of frames available.
  optional int32 queued_frames = 28;
  int32 queued_frames = 28;
  optional bool refresh_pending = 29;
  bool refresh_pending = 29;
  // The layer's composer backend destination frame
  // The layer's composer backend destination frame
  optional RectProto hwc_frame = 30;
  RectProto hwc_frame = 30;
  // The layer's composer backend source crop
  // The layer's composer backend source crop
  optional FloatRectProto hwc_crop = 31;
  FloatRectProto hwc_crop = 31;
  // The layer's composer backend transform
  // The layer's composer backend transform
  optional int32 hwc_transform = 32;
  int32 hwc_transform = 32;
  optional int32 window_type = 33 [deprecated=true];
  int32 window_type = 33 [deprecated=true];
  optional int32 app_id = 34 [deprecated=true];
  int32 app_id = 34 [deprecated=true];
  // The layer's composition type
  // The layer's composition type
  optional int32 hwc_composition_type = 35;
  int32 hwc_composition_type = 35;
  // If it's a buffer layer, indicate if the content is protected
  // If it's a buffer layer, indicate if the content is protected
  optional bool is_protected = 36;
  bool is_protected = 36;
  // Current frame number being rendered.
  // Current frame number being rendered.
  optional uint64 curr_frame = 37;
  uint64 curr_frame = 37;
  // A list of barriers that the layer is waiting to update state.
  // A list of barriers that the layer is waiting to update state.
  repeated BarrierLayerProto barrier_layer = 38;
  repeated BarrierLayerProto barrier_layer = 38;
  // If active_buffer is not null, record its transform.
  // If active_buffer is not null, record its transform.
  optional TransformProto buffer_transform = 39;
  TransformProto buffer_transform = 39;
  optional int32 effective_scaling_mode = 40;
  int32 effective_scaling_mode = 40;
  // Layer's corner radius.
  // Layer's corner radius.
  optional float corner_radius = 41;
  float corner_radius = 41;
  // Metadata map. May be empty.
  // Metadata map. May be empty.
  map<int32, bytes> metadata = 42;
  map<int32, bytes> metadata = 42;


  optional TransformProto effective_transform = 43;
  TransformProto effective_transform = 43;
  optional FloatRectProto source_bounds = 44;
  FloatRectProto source_bounds = 44;
  optional FloatRectProto bounds = 45;
  FloatRectProto bounds = 45;
  optional FloatRectProto screen_bounds = 46;
  FloatRectProto screen_bounds = 46;
}
}


message PositionProto {
message PositionProto {
  optional float x = 1;
  float x = 1;
  optional float y = 2;
  float y = 2;
}
}


message SizeProto {
message SizeProto {
  optional int32 w = 1;
  int32 w = 1;
  optional int32 h = 2;
  int32 h = 2;
}
}


message TransformProto {
message TransformProto {
  optional float dsdx = 1;
  float dsdx = 1;
  optional float dtdx = 2;
  float dtdx = 2;
  optional float dsdy = 3;
  float dsdy = 3;
  optional float dtdy = 4;
  float dtdy = 4;
}
}


message RegionProto {
message RegionProto {
  optional uint64 id = 1;
  uint64 id = 1;
  repeated RectProto rect = 2;
  repeated RectProto rect = 2;
}
}


message RectProto {
message RectProto {
  optional int32 left   = 1;
  int32 left   = 1;
  optional int32 top    = 2;
  int32 top    = 2;
  optional int32 right  = 3;
  int32 right  = 3;
  optional int32 bottom = 4;
  int32 bottom = 4;
}
}


message FloatRectProto {
message FloatRectProto {
  optional float left = 1;
  float left = 1;
  optional float top = 2;
  float top = 2;
  optional float right = 3;
  float right = 3;
  optional float bottom = 4;
  float bottom = 4;
}
}


message ActiveBufferProto {
message ActiveBufferProto {
  optional uint32 width = 1;
  uint32 width = 1;
  optional uint32 height = 2;
  uint32 height = 2;
  optional uint32 stride = 3;
  uint32 stride = 3;
  optional int32 format = 4;
  int32 format = 4;
}
}


message ColorProto {
message ColorProto {
  optional float r = 1;
  float r = 1;
  optional float g = 2;
  float g = 2;
  optional float b = 3;
  float b = 3;
  optional float a = 4;
  float a = 4;
}
}


message BarrierLayerProto {
message BarrierLayerProto {
  // layer id the barrier is waiting on.
  // layer id the barrier is waiting on.
  optional int32 id = 1;
  int32 id = 1;
  // frame number the barrier is waiting on.
  // frame number the barrier is waiting on.
  optional uint64 frame_number = 2;
  uint64 frame_number = 2;
}
}