1/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package android.frameworks.vr.composer@2.0;
17
18import android.hardware.graphics.common@1.2::BufferUsage;
19import android.hardware.graphics.common@1.2::PixelFormat;
20import android.hardware.graphics.composer@2.3::IComposerClient;
21
22interface IVrComposerClient
23    extends android.hardware.graphics.composer@2.3::IComposerClient {
24    /*
25     * Describes the metadata that describes the buffer.
26     */
27    struct BufferMetadata {
28        /*
29         * Specifies how many columns of pixels are allocated in the buffer. The
30         * rows may be padded.
31         */
32        uint32_t width;
33
34        /*
35         * Specifies how many rows of pixels are allocated in the buffer.
36         */
37        uint32_t height;
38
39        /*
40         * Specifies the size of a row of pixels in the buffer. (width +
41         * padding).
42         */
43        uint32_t stride;
44
45        /*
46         * The number of image layers allocated in the buffer.
47         */
48        uint32_t layerCount;
49
50        /*
51         * Buffer pixel format.
52         */
53        PixelFormat format;
54
55        /*
56         * Buffer usage mask.
57         */
58        bitfield<BufferUsage> usage;
59    };
60
61    /*
62     * SET_LAYER_INFO has this pseudo prototype
63     *
64     * Used to annotate the layer with additional information, which must be
65     * used to describe the content of the layer (ie: notification, permission,
66     * etc) which allows VR window manager to treat certain layer types
67     * specially.
68     *
69     * @param display is the display on which the layer was created.
70     * @param layer is the layer affected by the change.
71     * @param layer_type the type of the layer as described by the window
72     * manager.
73     * @param application_id the application id the layer belongs to.
74     * @return error is NONE upon success. Otherwise,
75     *         BAD_DISPLAY when an invalid display handle was passed in.
76     *         BAD_LAYER when an invalid layer handle was passed in.
77     *
78     * setLayerInfo(Display display,
79     *              Layer layer,
80     *              uint32_t layer_type,
81     *              uint32_t application_id)
82     *     generates(Error error);
83     *
84     * SET_CLIENT_TARGET_METADATA has this pseudo prototype
85     *
86     * Used to set the native buffer handle metadata required to import and use
87     * the buffer as a graphic buffer.
88     *
89     * @param display is the display on which the buffer is used.
90     * @param metadata is the buffer metadata required to import the buffer.
91     * @return error is NONE upon success. Otherwise,
92     *         BAD_DISPLAY when an invalid display handle was passed in.
93     * setClientTargetMetadata(Display display,
94     *                         BufferMetadata metadata)
95     *     generates(Error error);
96     *
97     * SET_LAYER_BUFFER_METADATA has this pseudo prototype
98     *
99     * Used to set the native buffer handle metadata required to import and use
100     * the buffer as a graphic buffer.
101     *
102     * @param display is the display on which the buffer is used.
103     * @param layer is the layer the buffer metadata is associated with.
104     * @param metadata is the buffer metadata required to import the buffer.
105     * @return error is NONE upon success. Otherwise,
106     *         BAD_DISPLAY when an invalid display handle was passed in.
107     *         BAD_LAYER when an invalid layer handle was passed in.
108     *
109     * setLayerBufferMetadata(Display display,
110     *                        Layer layer,
111     *                        BufferMetadata metadata)
112     *     generates(Error error);
113     */
114
115    enum VrCommand : android.hardware.graphics.composer@2.3::IComposerClient.Command {
116        SET_LAYER_INFO                      = 0x800 << OPCODE_SHIFT,
117        SET_CLIENT_TARGET_METADATA          = 0x801 << OPCODE_SHIFT,
118        SET_LAYER_BUFFER_METADATA           = 0x802 << OPCODE_SHIFT,
119    };
120};
121