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

message Trace {
    repeated Increment increment = 1;
}

message Increment {
    required int64 time_stamp = 1;

    oneof increment {
        Transaction        transaction          = 2;
        SurfaceCreation    surface_creation     = 3;
        SurfaceDeletion    surface_deletion     = 4;
        BufferUpdate       buffer_update        = 5;
        VSyncEvent         vsync_event          = 6;
        DisplayCreation    display_creation     = 7;
        DisplayDeletion    display_deletion     = 8;
        PowerModeUpdate    power_mode_update    = 9;
    }
}

message Transaction {
    repeated SurfaceChange surface_change = 1;
    repeated DisplayChange display_change = 2;

    required bool   synchronous      = 3;
    required bool   animation        = 4;
    optional Origin origin           = 5;
    optional uint64 id               = 6;
}

message SurfaceChange {
    required int32 id = 1;
    reserved 7;
    oneof SurfaceChange {
        PositionChange              position                = 2;
        SizeChange                  size                    = 3;
        AlphaChange                 alpha                   = 4;
        LayerChange                 layer                   = 5;
        CropChange                  crop                    = 6;
        MatrixChange                matrix                  = 8;
        TransparentRegionHintChange transparent_region_hint = 10;
        LayerStackChange            layer_stack             = 11;
        HiddenFlagChange            hidden_flag             = 12;
        OpaqueFlagChange            opaque_flag             = 13;
        SecureFlagChange            secure_flag             = 14;
        DeferredTransactionChange   deferred_transaction    = 15;
        CornerRadiusChange          corner_radius           = 16;
        ReparentChange              reparent                = 17;
        RelativeParentChange        relative_parent         = 18;
        ReparentChildrenChange      reparent_children       = 19;
        BackgroundBlurRadiusChange  background_blur_radius  = 20;
        ShadowRadiusChange          shadow_radius           = 21;
        BlurRegionsChange           blur_regions            = 22;
    }
}

message PositionChange {
    required float x = 1;
    required float y = 2;
}

message SizeChange {
    required uint32 w = 1;
    required uint32 h = 2;
}

message AlphaChange {
    required float alpha = 1;
}

message CornerRadiusChange {
    required float corner_radius = 1;
}

message BackgroundBlurRadiusChange {
    required float background_blur_radius = 1;
}

message LayerChange {
    required uint32 layer = 1;
}

message CropChange {
    required Rectangle rectangle = 1;
}

message MatrixChange {
    required float dsdx = 1;
    required float dtdx = 2;
    required float dsdy = 3;
    required float dtdy = 4;
}

message TransparentRegionHintChange {
    repeated Rectangle region = 1;
}

message LayerStackChange {
    required uint32 layer_stack = 1;
}

message HiddenFlagChange {
    required bool hidden_flag = 1;
}

message OpaqueFlagChange {
    required bool opaque_flag = 1;
}

message SecureFlagChange {
    required bool secure_flag = 1;
}

message DeferredTransactionChange {
    required int32  layer_id     = 1;
    required uint64 frame_number = 2;
}

message DisplayChange {
    required int32 id = 1;

    oneof DisplayChange {
        DispSurfaceChange surface     = 2;
        LayerStackChange  layer_stack = 3;
        SizeChange        size        = 4;
        ProjectionChange  projection  = 5;
    }
}

message DispSurfaceChange {
    required uint64 buffer_queue_id   = 1;
    required string buffer_queue_name = 2;
}

message ProjectionChange {
    required int32     orientation = 1;
    required Rectangle viewport    = 2;
    required Rectangle frame       = 3;
}

message Rectangle {
    required int32 left   = 1;
    required int32 top    = 2;
    required int32 right  = 3;
    required int32 bottom = 4;
}

message SurfaceCreation {
    required int32  id   = 1;
    required string name = 2;
    required uint32 w    = 3;
    required uint32 h    = 4;
}

message SurfaceDeletion {
    required int32 id = 1;
}

message BufferUpdate {
    required int32  id           = 1;
    required uint32 w            = 2;
    required uint32 h            = 3;
    required uint64 frame_number = 4;
}

message VSyncEvent {
    required int64 when = 1;
}

message DisplayCreation {
    required int32     id                = 1;
    required string    name              = 2;
    optional uint64    display_id        = 3;
    required bool      is_secure         = 4;
}

message DisplayDeletion {
    required int32 id = 1;
}

message PowerModeUpdate {
    required int32  id   = 1;
    required int32  mode = 2;
}

message ReparentChange {
    required int32 parent_id = 1;
}

message ReparentChildrenChange {
    required int32 parent_id = 1;
}

message RelativeParentChange {
    required int32 relative_parent_id = 1;
    required int32 z = 2;
}

message ShadowRadiusChange {
    required float radius = 1;
}

message BlurRegionsChange {
    repeated BlurRegionChange blur_regions = 1;
}

message BlurRegionChange {
    required uint32 blur_radius = 1;
    required float corner_radius_tl = 2;
    required float corner_radius_tr = 3;
    required float corner_radius_bl = 4;
    required float corner_radius_br = 5;
    required float alpha = 6;
    required int32 left = 7;
    required int32 top = 8;
    required int32 right = 9;
    required int32 bottom = 10;
}

message Origin {
    required int32 pid = 1;
    required int32 uid = 2;
}