Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea95959e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "revert-16516081-HRSPWANTKB"

* changes:
  Revert "Added FuzzableDataspaces.h"
  Revert "Group surfaceflinger mock files for use in fuzzers"
  Revert "Added surfaceflinger_fuzzer"
  Revert "Added surfaceflinger_displayhardware_fuzzer"
parents 87f867eb 2b846d5f
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -29,11 +29,6 @@ license {
    ],
}

cc_library_headers {
    name: "libui_fuzzableDataspaces_headers",
    export_include_dirs: ["include/ui/fuzzer/"],
}

cc_defaults {
    name: "libui-defaults",
    clang: true,
+0 −80
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <ui/GraphicTypes.h>
using namespace android;

constexpr ui::Dataspace kDataspaces[] = {
        ui::Dataspace::UNKNOWN,
        ui::Dataspace::ARBITRARY,
        ui::Dataspace::STANDARD_UNSPECIFIED,
        ui::Dataspace::STANDARD_BT709,
        ui::Dataspace::STANDARD_BT601_625,
        ui::Dataspace::STANDARD_BT601_625_UNADJUSTED,
        ui::Dataspace::STANDARD_BT601_525,
        ui::Dataspace::STANDARD_BT601_525_UNADJUSTED,
        ui::Dataspace::STANDARD_BT2020,
        ui::Dataspace::STANDARD_BT2020_CONSTANT_LUMINANCE,
        ui::Dataspace::STANDARD_BT470M,
        ui::Dataspace::STANDARD_FILM,
        ui::Dataspace::STANDARD_DCI_P3,
        ui::Dataspace::STANDARD_ADOBE_RGB,
        ui::Dataspace::TRANSFER_UNSPECIFIED,
        ui::Dataspace::TRANSFER_LINEAR,
        ui::Dataspace::TRANSFER_SRGB,
        ui::Dataspace::TRANSFER_SMPTE_170M,
        ui::Dataspace::TRANSFER_GAMMA2_2,
        ui::Dataspace::TRANSFER_GAMMA2_6,
        ui::Dataspace::TRANSFER_GAMMA2_8,
        ui::Dataspace::TRANSFER_ST2084,
        ui::Dataspace::TRANSFER_HLG,
        ui::Dataspace::RANGE_UNSPECIFIED,
        ui::Dataspace::RANGE_FULL,
        ui::Dataspace::RANGE_LIMITED,
        ui::Dataspace::RANGE_EXTENDED,
        ui::Dataspace::SRGB_LINEAR,
        ui::Dataspace::V0_SRGB_LINEAR,
        ui::Dataspace::V0_SCRGB_LINEAR,
        ui::Dataspace::SRGB,
        ui::Dataspace::V0_SRGB,
        ui::Dataspace::V0_SCRGB,
        ui::Dataspace::JFIF,
        ui::Dataspace::V0_JFIF,
        ui::Dataspace::BT601_625,
        ui::Dataspace::V0_BT601_625,
        ui::Dataspace::BT601_525,
        ui::Dataspace::V0_BT601_525,
        ui::Dataspace::BT709,
        ui::Dataspace::V0_BT709,
        ui::Dataspace::DCI_P3_LINEAR,
        ui::Dataspace::DCI_P3,
        ui::Dataspace::DISPLAY_P3_LINEAR,
        ui::Dataspace::DISPLAY_P3,
        ui::Dataspace::ADOBE_RGB,
        ui::Dataspace::BT2020_LINEAR,
        ui::Dataspace::BT2020,
        ui::Dataspace::BT2020_PQ,
        ui::Dataspace::DEPTH,
        ui::Dataspace::SENSOR,
        ui::Dataspace::BT2020_ITU,
        ui::Dataspace::BT2020_ITU_PQ,
        ui::Dataspace::BT2020_ITU_HLG,
        ui::Dataspace::BT2020_HLG,
        ui::Dataspace::DISPLAY_BT2020,
        ui::Dataspace::DYNAMIC_DEPTH,
        ui::Dataspace::JPEG_APP_SEGMENTS,
        ui::Dataspace::HEIF,
};
+0 −94
Original line number Diff line number Diff line
/*
 * Copyright 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

cc_defaults {
    name: "surfaceflinger_fuzz_defaults",
    include_dirs: [
        "frameworks/native/services/surfaceflinger/tests/unittests",
    ],
    static_libs: [
        "android.hardware.graphics.composer@2.1-resources",
        "libgmock",
        "libgui_mocks",
        "libgmock_ndk",
        "libgmock_main",
        "libgtest_ndk_c++",
        "libgmock_main_ndk",
        "librenderengine_mocks",
        "perfetto_trace_protos",
        "libcompositionengine_mocks",
        "perfetto_trace_protos",
    ],
    shared_libs: [
        "libprotoutil",
        "libstatssocket",
        "libstatspull",
        "libtimestats",
        "libtimestats_proto",
        "libprotobuf-cpp-full",
        "android.hardware.graphics.mapper@2.0",
        "android.hardware.graphics.mapper@3.0",
        "android.hardware.graphics.mapper@4.0",
    ],
    srcs: [
        ":libsurfaceflinger_sources",
        ":libsurfaceflinger_mock_sources",
    ],
    defaults: [
        "libsurfaceflinger_defaults",
    ],
    header_libs: [
        "libui_fuzzableDataspaces_headers",
        "libsurfaceflinger_headers",
        "libui_headers",
    ],
    cflags: [
        "-Wno-unused-result",
        "-Wno-conversion",
        "-Wno-sign-compare",
    ],
    fuzz_config: {
        cc: [
            "android-media-fuzzing-reports@google.com",
        ],
        componentid: 155276,
    },
}

cc_fuzz {
    name: "surfaceflinger_fuzzer",
    defaults: [
        "surfaceflinger_fuzz_defaults",
    ],
    srcs: [
        "surfaceflinger_fuzzer.cpp",
    ],
}

cc_fuzz {
    name: "surfaceflinger_displayhardware_fuzzer",
    defaults: [
        "surfaceflinger_fuzz_defaults",
    ],
    srcs: [
        "surfaceflinger_displayhardware_fuzzer.cpp",
    ],
    header_libs: [
        "android.hardware.graphics.composer@2.4-command-buffer",
        "android.hardware.graphics.composer@2.4-hal",
    ],
}
+0 −53
Original line number Diff line number Diff line
# Fuzzers for SurfaceFlinger
## Table of contents
+ [SurfaceFlinger](#SurfaceFlinger)
+ [DisplayHardware](#DisplayHardware)

# <a name="SurfaceFlinger"></a> Fuzzer for SurfaceFlinger

SurfaceFlinger supports the following data sources:
1. Pixel Formats (parameter name: `defaultCompositionPixelFormat`)
2. Data Spaces (parameter name: `defaultCompositionDataspace`)
3. Rotations (parameter name: `internalDisplayOrientation`)
3. Surface composer tags (parameter name: `onTransact`)

You can find the possible values in the fuzzer's source code.

#### Steps to run
1. Build the fuzzer
```
  $ mm -j$(nproc) surfaceflinger_fuzzer
```
2. To run on device
```
  $ adb sync data
  $ adb shell /data/fuzz/arm64/surfaceflinger_fuzzer/surfaceflinger_fuzzer
```

# <a name="DisplayHardware"></a> Fuzzer for DisplayHardware

DisplayHardware supports the following parameters:
1. Hal Capability (parameter name: `hasCapability`)
2. Hal BlendMode (parameter name: `setBlendMode`)
3. Hal Composition (parameter name: `setCompositionType`)
4. Hal Display Capability (parameter name: `hasDisplayCapability`)
5. Composition Types (parameter name: `prepareFrame`)
6. Color Modes (parameter name: `setActiveColorMode`)
7. Render Intents (parameter name: `setActiveColorMode`)
8. Power Modes (parameter name: `setPowerMode`)
9. Content Types (parameter name: `setContentType`)
10. Data Space (parameter name: `setDataspace`)
11. Transforms (parameter name: `setLayerTransform`)

You can find the possible values in the fuzzer's source code.

#### Steps to run
1. Build the fuzzer
```
  $ mm -j$(nproc) surfaceflinger_displayhardware_fuzzer
```
2. Run on device
```
  $ adb sync data
  $ adb shell /data/fuzz/arm64/surfaceflinger_displayhardware_fuzzer/surfaceflinger_displayhardware_fuzzer
```
+0 −662

File deleted.

Preview size limit exceeded, changes collapsed.

Loading