187b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara/*
287b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara * Copyright (C) 2017 The Android Open Source Project
387b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara *
487b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara * Licensed under the Apache License, Version 2.0 (the "License");
587b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara * you may not use this file except in compliance with the License.
687b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara * You may obtain a copy of the License at
787b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara *
887b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara *      http://www.apache.org/licenses/LICENSE-2.0
987b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara *
1087b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara * Unless required by applicable law or agreed to in writing, software
1187b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara * distributed under the License is distributed on an "AS IS" BASIS,
1287b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1387b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara * See the License for the specific language governing permissions and
1487b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara * limitations under the License.
1587b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara */
1687b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoarapackage android.frameworks.vr.composer@1.0;
1787b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara
18aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoaraimport android.hardware.graphics.common@1.0::BufferUsage;
19aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoaraimport android.hardware.graphics.common@1.0::PixelFormat;
2087b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoaraimport android.hardware.graphics.composer@2.1::IComposerClient;
2187b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara
2287b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoarainterface IVrComposerClient
2387b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara    extends android.hardware.graphics.composer@2.1::IComposerClient {
2487b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara    /*
25aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * Describes the metadata that describes the buffer.
26aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     */
27aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara    struct BufferMetadata {
28aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        /*
29aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         * Specifies how many columns of pixels are allocated in the buffer. The
30aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         * rows may be padded.
31aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         */
32aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        uint32_t width;
33aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara
34aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        /*
35aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         * Specifies how many rows of pixels are allocated in the buffer.
36aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         */
37aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        uint32_t height;
38aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara
39aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        /*
40aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         * Specifies the size of a row of pixels in the buffer. (width +
41aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         * padding).
42aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         */
43aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        uint32_t stride;
44aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara
45aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        /*
46aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         * The number of image layers allocated in the buffer.
47aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         */
48aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        uint32_t layerCount;
49aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara
50aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        /*
51aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         * Buffer pixel format.
52aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         */
53aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        PixelFormat format;
54aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara
55aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        /*
56aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         * Buffer usage mask.
57aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara         */
58aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        bitfield<BufferUsage> usage;
59aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara    };
60aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara
61aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara    /*
62aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * SET_LAYER_INFO has this pseudo prototype
63aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *
6487b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     * Used to annotate the layer with additional information, which must be
6587b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     * used to describe the content of the layer (ie: notification, permission,
6687b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     * etc) which allows VR window manager to treat certain layer types
6787b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     * specially.
6887b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     *
6987b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     * @param display is the display on which the layer was created.
7087b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     * @param layer is the layer affected by the change.
7187b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     * @param layer_type the type of the layer as described by the window
7287b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     * manager.
7387b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     * @param application_id the application id the layer belongs to.
7487b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     * @return error is NONE upon success. Otherwise,
7587b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     *         BAD_DISPLAY when an invalid display handle was passed in.
7687b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     *         BAD_LAYER when an invalid layer handle was passed in.
7787b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     *
7887b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     * setLayerInfo(Display display,
7987b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     *              Layer layer,
8087b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     *              uint32_t layer_type,
8187b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     *              uint32_t application_id)
8287b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     *     generates(Error error);
83aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *
84aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * SET_CLIENT_TARGET_METADATA has this pseudo prototype
85aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *
86aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * Used to set the native buffer handle metadata required to import and use
87aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * the buffer as a graphic buffer.
88aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *
89aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * @param display is the display on which the buffer is used.
90aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * @param metadata is the buffer metadata required to import the buffer.
91aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * @return error is NONE upon success. Otherwise,
92aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *         BAD_DISPLAY when an invalid display handle was passed in.
93aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * setClientTargetMetadata(Display display,
94aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *                         BufferMetadata metadata)
95aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *     generates(Error error);
96aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *
97aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * SET_LAYER_BUFFER_METADATA has this pseudo prototype
98aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *
99aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * Used to set the native buffer handle metadata required to import and use
100aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * the buffer as a graphic buffer.
101aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *
102aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * @param display is the display on which the buffer is used.
103aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * @param layer is the layer the buffer metadata is associated with.
104aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * @param metadata is the buffer metadata required to import the buffer.
105aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * @return error is NONE upon success. Otherwise,
106aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *         BAD_DISPLAY when an invalid display handle was passed in.
107aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *         BAD_LAYER when an invalid layer handle was passed in.
108aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *
109aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     * setLayerBufferMetadata(Display display,
110aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *                        Layer layer,
111aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *                        BufferMetadata metadata)
112aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara     *     generates(Error error);
11387b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara     */
11487b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara
11587b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara    enum VrCommand : android.hardware.graphics.composer@2.1::IComposerClient.Command {
116aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        SET_LAYER_INFO                      = 0x800 << OPCODE_SHIFT,
117aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        SET_CLIENT_TARGET_METADATA          = 0x801 << OPCODE_SHIFT,
118aa7f3aff17baf33cada375d97a327b381650ed60Daniel Nicoara        SET_LAYER_BUFFER_METADATA           = 0x802 << OPCODE_SHIFT,
11987b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara    };
12087b1d8e2a7172654b7f2ed34fd75b358a2705857Daniel Nicoara};
121