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

Commit a559a12b authored by Jim Shargo's avatar Jim Shargo Committed by Android (Google) Code Review
Browse files

Merge changes Ia63685ac,I9c32ac17,I6ca17dda into main

* changes:
  bufferstreams: Present times are no longer Instants.
  bufferstreams: Make BufferOwner Send+Sync
  bufferstreams: Add AIDL interfaces/parcelables for stream types
parents c8693d4c 0c3ff29b
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
// Copyright (C) 2024 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

aidl_interface {
    name: "android.graphics.bufferstreams",
    unstable: true,
    flags: ["-Werror"],
    srcs: ["android/graphics/bufferstreams/*.aidl"],
    headers: [
        "HardwareBuffer_aidl",
    ],
    imports: [
        "android.hardware.common-V2",
    ],
    backend: {
        cpp: {
            enabled: false,
        },
        java: {
            enabled: false,
        },
        ndk: {
            enabled: false,
        },
        rust: {
            enabled: true,
            additional_rustlibs: [
                "libnativewindow_rs",
            ],
        },
    },
}
+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.graphics.bufferstreams;

import android.graphics.bufferstreams.IBufferOwner;
import android.hardware.HardwareBuffer;

// Single mapping between a buffer reference and heavy-weight data (like the
// buffer itself) and data that is stable between frames.
parcelable BufferAttachment {
    // The HardwareBuffer itself.
    //
    // This field is @nullable for codegen, since HardwareBuffer doesn't implement Default in Rust.
    // In practice, it should never be null.
    @nullable HardwareBuffer buffer;
    // The buffer owner to which this buffer should be returned.
    IBufferOwner owner;
}
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.graphics.bufferstreams;

import android.graphics.bufferstreams.BufferAttachment;

// A event that changes the state downstream buffer caches. Clients are responsible for forwarding
// these messages to their clients.
union BufferCacheUpdate {
    // Event requiring downstream caches to add new entries.
    CacheBuffers cacheBuffers;
    // Event requiring downstream caches to remove entries.
    ForgetBuffers forgetBuffers;

    parcelable CacheBuffers {
        // Attachments to add.
        List<BufferAttachment> attachments;
    }

    parcelable ForgetBuffers {
        // References to remove.
        long[] bufferIds;
    }
}
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.graphics.bufferstreams;

import android.os.ParcelFileDescriptor;

// A Frame represents a single buffer passing through the stream.
parcelable Frame {
    // The service must have provided an associated BufferAttachment and the client is required to
    // maintain a cache between the two.
    long bufferId;
    // The expected present time of this frame, or -1 if immediate.
    long presentTimeNs;
    // The acquire fence of the buffer for this frame.
    @nullable ParcelFileDescriptor fence;
}
+25 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.graphics.bufferstreams;

import android.os.ParcelFileDescriptor;

// Interface from a client back to the owner of a buffer.
interface IBufferOwner {
    // Called when the buffer is done being processed by the stream to return its owner.
    oneway void onBufferReleased(in long bufferId, in @nullable ParcelFileDescriptor releaseFence);
}
Loading