blob: 1d74774160776a4eefedfdf39b2280a7c30ec6ac [file] [log] [blame]
John Reck704bed02015-11-05 09:22:17 -08001/*
2 * Copyright (C) 2015 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#ifndef DEVICEINFO_H
17#define DEVICEINFO_H
18
John Reck8dc02f92017-07-17 09:55:02 -070019#include <ui/DisplayInfo.h>
Peiyong Lin1f6aa122018-09-10 16:28:08 -070020#include <ui/GraphicTypes.h>
John Reck8dc02f92017-07-17 09:55:02 -070021
John Reck1bcacfd2017-11-03 10:12:19 -070022#include "utils/Macros.h"
John Reck704bed02015-11-05 09:22:17 -080023
24namespace android {
25namespace uirenderer {
26
Derek Sollenberger17662382018-09-13 14:14:00 -040027namespace renderthread {
28 class RenderThread;
29}
30
John Reck704bed02015-11-05 09:22:17 -080031class DeviceInfo {
32 PREVENT_COPY_AND_ASSIGN(DeviceInfo);
John Reck1bcacfd2017-11-03 10:12:19 -070033
John Reck704bed02015-11-05 09:22:17 -080034public:
John Reck704bed02015-11-05 09:22:17 -080035 static const DeviceInfo* get();
36
Derek Sollenberger17662382018-09-13 14:14:00 -040037 // this value is only valid after the GPU has been initialized and there is a valid graphics
38 // context or if you are using the HWUI_NULL_GPU
39 int maxTextureSize() const;
John Reck704bed02015-11-05 09:22:17 -080040
Peiyong Lin1f6aa122018-09-10 16:28:08 -070041 ui::Dataspace getTargetDataSpace() const { return mTargetDataSpace; }
42 ui::PixelFormat getTargetPixelFormat() const { return mTargetPixelFormat; }
John Reck8dc02f92017-07-17 09:55:02 -070043 const DisplayInfo& displayInfo() const { return mDisplayInfo; }
John Reck56428472018-03-16 17:27:17 -070044
John Reck704bed02015-11-05 09:22:17 -080045private:
Derek Sollenberger17662382018-09-13 14:14:00 -040046 friend class renderthread::RenderThread;
47 static void setMaxTextureSize(int maxTextureSize);
Peiyong Lin1f6aa122018-09-10 16:28:08 -070048
Derek Sollenberger17662382018-09-13 14:14:00 -040049 DeviceInfo();
John Reck704bed02015-11-05 09:22:17 -080050
John Reck704bed02015-11-05 09:22:17 -080051 int mMaxTextureSize;
John Reck8dc02f92017-07-17 09:55:02 -070052 DisplayInfo mDisplayInfo;
Derek Sollenberger17662382018-09-13 14:14:00 -040053
Peiyong Lin1f6aa122018-09-10 16:28:08 -070054 // TODO(lpy) Replace below with android_ prefix types.
55 ui::Dataspace mTargetDataSpace;
56 ui::PixelFormat mTargetPixelFormat;
John Reck704bed02015-11-05 09:22:17 -080057};
58
59} /* namespace uirenderer */
60} /* namespace android */
61
62#endif /* DEVICEINFO_H */