blob: 737c903a20fde466b0ca0118487e8cf43cd10c5a [file] [log] [blame]
Cody Schuffelen134ff032019-11-22 00:25:32 -08001#pragma once
2/*
3 * Copyright (C) 2017 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#include "common/vsoc/shm/base.h"
19#include "common/vsoc/shm/circqueue.h"
20
21// Memory layout for region carrying input events from host to guest
22
23namespace vsoc {
24namespace layout {
25
26namespace input_events {
27
28struct InputEventsLayout : public RegionLayout {
29 static constexpr size_t layout_size =
30 CircularPacketQueue<10, 256>::layout_size +
31 2 * CircularPacketQueue<10, 16>::layout_size;
32
33 static const char* region_name;
34 // Event queues for the different input devices supported. Both the power
35 // button and the keyboard need only generate 2 input events for every
36 // 'hardware' event, so 16 bytes are enough, however when the touchscreen has
37 // multitouch enabled the number of generated events is significantly higher.
38 CircularPacketQueue<10, 256> touch_screen_queue;
39 CircularPacketQueue<10, 16> keyboard_queue;
40 CircularPacketQueue<10, 16> power_button_queue;
41};
42ASSERT_SHM_COMPATIBLE(InputEventsLayout);
43
44} // namespace input_events
45} // namespace layout
46} // namespace vsoc