Greg Hartman | 86b114a | 2017-11-03 21:04:14 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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 | */ |
| 16 | |
Greg Hartman | 86b114a | 2017-11-03 21:04:14 -0700 | [diff] [blame] | 17 | #include <gflags/gflags.h> |
Jorge E. Moreira | 4b9bbb1 | 2017-12-28 15:49:06 -0800 | [diff] [blame] | 18 | #include <glog/logging.h> |
Greg Hartman | 4cbb6ab | 2017-12-04 18:31:37 -0800 | [diff] [blame] | 19 | |
| 20 | #include "common/vsoc/lib/fb_bcast_region_view.h" |
Jorge E. Moreira | a88badf | 2017-11-13 16:55:08 -0800 | [diff] [blame] | 21 | #include "host/commands/launch/pre_launch_initializers.h" |
Greg Hartman | 6da4302 | 2017-12-05 11:16:02 -0800 | [diff] [blame] | 22 | #include "host/libs/config/host_config.h" |
Greg Hartman | 86b114a | 2017-11-03 21:04:14 -0700 | [diff] [blame] | 23 | |
Jorge E. Moreira | a88badf | 2017-11-13 16:55:08 -0800 | [diff] [blame] | 24 | DEFINE_int32(x_res, 720, "Width of the screen in pixels"); |
| 25 | DEFINE_int32(y_res, 1280, "Height of the screen in pixels"); |
Greg Hartman | 86b114a | 2017-11-03 21:04:14 -0700 | [diff] [blame] | 26 | DEFINE_int32(dpi, 160, "Pixels per inch for the screen"); |
Jorge E. Moreira | 9334f3d | 2018-01-23 14:55:00 -0800 | [diff] [blame] | 27 | DEFINE_int32(refresh_rate_hz, 60, "Screen refresh rate in Hertz"); |
Greg Hartman | 86b114a | 2017-11-03 21:04:14 -0700 | [diff] [blame] | 28 | |
Jorge E. Moreira | a88badf | 2017-11-13 16:55:08 -0800 | [diff] [blame] | 29 | void InitializeFBBroadcastRegion() { |
Ryan Haining | 59063a9 | 2018-02-08 17:32:22 -0800 | [diff] [blame^] | 30 | auto region = vsoc::framebuffer::FBBroadcastRegionView::GetInstance( |
Jorge E. Moreira | 4b9bbb1 | 2017-12-28 15:49:06 -0800 | [diff] [blame] | 31 | vsoc::GetDomain().c_str()); |
| 32 | if (!region) { |
Greg Hartman | 86b114a | 2017-11-03 21:04:14 -0700 | [diff] [blame] | 33 | LOG(INFO) << "Framebuffer region was not found"; |
| 34 | return; |
| 35 | } |
Jorge E. Moreira | 4b9bbb1 | 2017-12-28 15:49:06 -0800 | [diff] [blame] | 36 | auto dest = region->data(); |
Greg Hartman | 86b114a | 2017-11-03 21:04:14 -0700 | [diff] [blame] | 37 | dest->x_res = FLAGS_x_res; |
| 38 | dest->y_res = FLAGS_y_res; |
| 39 | dest->dpi = FLAGS_dpi; |
Jorge E. Moreira | 9334f3d | 2018-01-23 14:55:00 -0800 | [diff] [blame] | 40 | dest->refresh_rate_hz = FLAGS_refresh_rate_hz; |
Greg Hartman | 86b114a | 2017-11-03 21:04:14 -0700 | [diff] [blame] | 41 | } |