blob: d58dcc21b10f873c6b6af33916d3ac99f8f5a47f [file] [log] [blame]
Greg Hartman86b114a2017-11-03 21:04:14 -07001/*
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 Hartman86b114a2017-11-03 21:04:14 -070017#include <gflags/gflags.h>
Jorge E. Moreira4b9bbb12017-12-28 15:49:06 -080018#include <glog/logging.h>
Greg Hartman4cbb6ab2017-12-04 18:31:37 -080019
20#include "common/vsoc/lib/fb_bcast_region_view.h"
Jorge E. Moreiraa88badf2017-11-13 16:55:08 -080021#include "host/commands/launch/pre_launch_initializers.h"
Greg Hartman6da43022017-12-05 11:16:02 -080022#include "host/libs/config/host_config.h"
Greg Hartman86b114a2017-11-03 21:04:14 -070023
Jorge E. Moreiraa88badf2017-11-13 16:55:08 -080024DEFINE_int32(x_res, 720, "Width of the screen in pixels");
25DEFINE_int32(y_res, 1280, "Height of the screen in pixels");
Greg Hartman86b114a2017-11-03 21:04:14 -070026DEFINE_int32(dpi, 160, "Pixels per inch for the screen");
Jorge E. Moreira9334f3d2018-01-23 14:55:00 -080027DEFINE_int32(refresh_rate_hz, 60, "Screen refresh rate in Hertz");
Greg Hartman86b114a2017-11-03 21:04:14 -070028
Jorge E. Moreiraa88badf2017-11-13 16:55:08 -080029void InitializeFBBroadcastRegion() {
Ryan Haining59063a92018-02-08 17:32:22 -080030 auto region = vsoc::framebuffer::FBBroadcastRegionView::GetInstance(
Jorge E. Moreira4b9bbb12017-12-28 15:49:06 -080031 vsoc::GetDomain().c_str());
32 if (!region) {
Greg Hartman86b114a2017-11-03 21:04:14 -070033 LOG(INFO) << "Framebuffer region was not found";
34 return;
35 }
Jorge E. Moreira4b9bbb12017-12-28 15:49:06 -080036 auto dest = region->data();
Greg Hartman86b114a2017-11-03 21:04:14 -070037 dest->x_res = FLAGS_x_res;
38 dest->y_res = FLAGS_y_res;
39 dest->dpi = FLAGS_dpi;
Jorge E. Moreira9334f3d2018-01-23 14:55:00 -080040 dest->refresh_rate_hz = FLAGS_refresh_rate_hz;
Greg Hartman86b114a2017-11-03 21:04:14 -070041}