Hwc2TestClientTarget.h revision f18cfb0a780c69f12439457ccc3f5272db767fdd
1f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall/*
2f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall * Copyright (C) 2016 The Android Open Source Project
3f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall *
4f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall * Licensed under the Apache License, Version 2.0 (the "License");
5f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall * you may not use this file except in compliance with the License.
6f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall * You may obtain a copy of the License at
7f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall *
8f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall *      http://www.apache.org/licenses/LICENSE-2.0
9f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall *
10f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall * Unless required by applicable law or agreed to in writing, software
11f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall * distributed under the License is distributed on an "AS IS" BASIS,
12f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall * See the License for the specific language governing permissions and
14f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall * limitations under the License.
15f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall */
16f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
17f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall#ifndef _HWC2_TEST_CLIENT_TARGET_H
18f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall#define _HWC2_TEST_CLIENT_TARGET_H
19f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
20f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall#include <set>
21f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
22f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall#define HWC2_INCLUDE_STRINGIFICATION
23f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall#define HWC2_USE_CPP11
24f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall#include <hardware/hwcomposer2.h>
25f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall#undef HWC2_INCLUDE_STRINGIFICATION
26f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall#undef HWC2_USE_CPP11
27f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
28f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall#include "Hwc2TestProperties.h"
29f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall#include "Hwc2TestLayers.h"
30f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
31f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall/* Generates client target buffers from client composition layers */
32f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wallclass Hwc2TestClientTarget {
33f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wallpublic:
34f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    int getBuffer(const Hwc2TestLayers& layers,
35f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall            const std::set<hwc2_layer_t>& clientLayers,
36f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall            const std::set<hwc2_layer_t>& clearLayers,
37f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall            bool clearClientTarget, const Area& displayArea,
38f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall            buffer_handle_t* outHandle, int32_t* outAcquireFence);
39f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
40f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wallprivate:
41f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    Hwc2TestClientTargetBuffer mBuffer;
42f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall};
43f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
44f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall/* Generates valid client targets to test which ones the device will support */
45f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wallclass Hwc2TestClientTargetSupport {
46f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wallpublic:
47f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    Hwc2TestClientTargetSupport(Hwc2TestCoverage coverage,
48f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall            const Area& displayArea);
49f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
50f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    std::string dump() const;
51f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
52f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    void reset();
53f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    bool advance();
54f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
55f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    Area getBufferArea() const;
56f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    android_dataspace_t getDataspace() const;
57f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    const hwc_region_t getSurfaceDamage() const;
58f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
59f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wallprivate:
60f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    std::array<Hwc2TestContainer*, 3> properties = {{
61f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall        &mDataspace, &mSurfaceDamage, &mBufferArea
62f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    }};
63f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
64f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    Hwc2TestBufferArea mBufferArea;
65f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    Hwc2TestDataspace mDataspace;
66f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall    Hwc2TestSurfaceDamage mSurfaceDamage;
67f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall};
68f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall
69f18cfb0a780c69f12439457ccc3f5272db767fddMarissa Wall#endif /* ifndef _HWC2_TEST_CLIENT_TARGET_H */
70