Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-drm_hwcomposer: Commit

external/drm_hwcomposer


Commit MetaInfo

Revisión30ee913030f7cb660d329f986b40c1fddcfa5b66 (tree)
Tiempo2018-11-02 15:45:27
AutorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Merge remote-tracking branch 'origin/master' into oreo-x86

Cambiar Resumen

Diferencia incremental

--- a/drmconnector.cpp
+++ b/drmconnector.cpp
@@ -74,7 +74,9 @@ bool DrmConnector::internal() const {
7474 }
7575
7676 bool DrmConnector::external() const {
77- return type_ == DRM_MODE_CONNECTOR_HDMIA;
77+ return type_ == DRM_MODE_CONNECTOR_HDMIA || type_ == DRM_MODE_CONNECTOR_DisplayPort ||
78+ type_ == DRM_MODE_CONNECTOR_DVID || type_ == DRM_MODE_CONNECTOR_DVII ||
79+ type_ == DRM_MODE_CONNECTOR_VGA;
7880 }
7981
8082 bool DrmConnector::valid_type() const {
--- a/drmcrtc.cpp
+++ b/drmcrtc.cpp
@@ -31,12 +31,7 @@ DrmCrtc::DrmCrtc(DrmResources *drm, drmModeCrtcPtr c, unsigned pipe)
3131 id_(c->crtc_id),
3232 pipe_(pipe),
3333 display_(-1),
34- x_(c->x),
35- y_(c->y),
36- width_(c->width),
37- height_(c->height),
38- mode_(&c->mode),
39- mode_valid_(c->mode_valid) {
34+ mode_(&c->mode) {
4035 }
4136
4237 int DrmCrtc::Init() {
--- a/drmcrtc.h
+++ b/drmcrtc.h
@@ -54,13 +54,7 @@ class DrmCrtc {
5454 unsigned pipe_;
5555 int display_;
5656
57- uint32_t x_;
58- uint32_t y_;
59- uint32_t width_;
60- uint32_t height_;
61-
6257 DrmMode mode_;
63- bool mode_valid_;
6458
6559 DrmProperty active_property_;
6660 DrmProperty mode_property_;
--- a/drmdisplaycompositor.cpp
+++ b/drmdisplaycompositor.cpp
@@ -600,8 +600,6 @@ int DrmDisplayCompositor::CommitFrame(DrmDisplayComposition *display_comp,
600600 std::vector<DrmHwcLayer> &layers = display_comp->layers();
601601 std::vector<DrmCompositionPlane> &comp_planes =
602602 display_comp->composition_planes();
603- std::vector<DrmCompositionRegion> &pre_comp_regions =
604- display_comp->pre_comp_regions();
605603 uint64_t out_fences[drm_->crtcs().size()];
606604
607605 DrmConnector *connector = drm_->GetConnectorForDisplay(display_);
@@ -632,6 +630,13 @@ int DrmDisplayCompositor::CommitFrame(DrmDisplayComposition *display_comp,
632630 }
633631
634632 if (mode_.needs_modeset) {
633+ ret = drmModeAtomicAddProperty(pset, crtc->id(), crtc->active_property().id(), 1);
634+ if (ret < 0) {
635+ ALOGE("Failed to add crtc active to pset\n");
636+ drmModeAtomicFree(pset);
637+ return ret;
638+ }
639+
635640 ret = drmModeAtomicAddProperty(pset, crtc->id(), crtc->mode_property().id(),
636641 mode_.blob_id) < 0 ||
637642 drmModeAtomicAddProperty(pset, connector->id(),
@@ -694,7 +699,7 @@ int DrmDisplayCompositor::CommitFrame(DrmDisplayComposition *display_comp,
694699 else
695700 rotation |= DRM_MODE_ROTATE_0;
696701
697- if (fence_fd < 0) {
702+ if (fence_fd >= 0) {
698703 int prop_id = plane->in_fence_fd_property().id();
699704 if (prop_id == 0) {
700705 ALOGE("Failed to get IN_FENCE_FD property id");
@@ -791,7 +796,6 @@ int DrmDisplayCompositor::CommitFrame(DrmDisplayComposition *display_comp,
791796 }
792797 }
793798
794-out:
795799 if (!ret) {
796800 uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
797801 if (test_only)
--- a/drmencoder.cpp
+++ b/drmencoder.cpp
@@ -27,7 +27,6 @@ DrmEncoder::DrmEncoder(drmModeEncoderPtr e, DrmCrtc *current_crtc,
2727 const std::vector<DrmCrtc *> &possible_crtcs)
2828 : id_(e->encoder_id),
2929 crtc_(current_crtc),
30- type_(e->encoder_type),
3130 possible_crtcs_(possible_crtcs) {
3231 }
3332
--- a/drmencoder.h
+++ b/drmencoder.h
@@ -45,8 +45,6 @@ class DrmEncoder {
4545 uint32_t id_;
4646 DrmCrtc *crtc_;
4747
48- uint32_t type_;
49-
5048 std::vector<DrmCrtc *> possible_crtcs_;
5149 };
5250 }
--- a/drmhwctwo.cpp
+++ b/drmhwctwo.cpp
@@ -242,7 +242,6 @@ HWC2::Error DrmHwcTwo::HwcDisplay::RegisterVsyncCallback(
242242
243243 HWC2::Error DrmHwcTwo::HwcDisplay::AcceptDisplayChanges() {
244244 supported(__func__);
245- uint32_t num_changes = 0;
246245 for (std::pair<const hwc2_layer_t, DrmHwcTwo::HwcLayer> &l : layers_)
247246 l.second.accept_type_change();
248247 return HWC2::Error::None;
@@ -614,7 +613,7 @@ HWC2::Error DrmHwcTwo::HwcDisplay::SetActiveConfig(hwc2_config_t config) {
614613 HWC2::Error DrmHwcTwo::HwcDisplay::SetClientTarget(buffer_handle_t target,
615614 int32_t acquire_fence,
616615 int32_t dataspace,
617- hwc_region_t damage) {
616+ hwc_region_t /*damage*/) {
618617 supported(__func__);
619618 UniqueFd uf(acquire_fence);
620619
--- a/glworker.cpp
+++ b/glworker.cpp
@@ -446,7 +446,6 @@ int GLWorkerCompositor::Init() {
446446 const char *egl_extensions;
447447 const char *gl_extensions;
448448 EGLint num_configs;
449- EGLint attribs[] = {EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE, EGL_NONE};
450449 EGLConfig egl_config;
451450
452451 // clang-format off
--- a/platform.cpp
+++ b/platform.cpp
@@ -142,8 +142,8 @@ int PlanStageProtected::ProvisionPlanes(
142142
143143 int PlanStagePrecomp::ProvisionPlanes(
144144 std::vector<DrmCompositionPlane> *composition,
145- std::map<size_t, DrmHwcLayer *> &layers, DrmCrtc *crtc,
146- std::vector<DrmPlane *> *planes) {
145+ std::map<size_t, DrmHwcLayer *> &layers, DrmCrtc * /*crtc*/,
146+ std::vector<DrmPlane *> * /*planes*/) {
147147 DrmCompositionPlane *precomp = GetPrecomp(composition);
148148 if (!precomp || precomp->source_layers().empty())
149149 return 0;
--- a/separate_rects.cpp
+++ b/separate_rects.cpp
@@ -315,102 +315,3 @@ void separate_rects_64(const std::vector<Rect<int>> &in,
315315 }
316316
317317 } // namespace separate_rects
318-
319-#ifdef RECTS_TEST
320-
321-using namespace separate_rects;
322-
323-int main(int argc, char **argv) {
324-#define RectSet RectSet<TId, TNum>
325-#define Rect Rect<TNum>
326-#define IdSet IdSet<TId>
327- typedef uint64_t TId;
328- typedef float TNum;
329-
330- std::vector<Rect> in;
331- std::vector<RectSet> out;
332- std::vector<RectSet> expected_out;
333-
334- in.push_back({0, 0, 4, 5});
335- in.push_back({2, 0, 6, 6});
336- in.push_back({4, 0, 8, 5});
337- in.push_back({0, 7, 8, 9});
338-
339- in.push_back({10, 0, 18, 5});
340- in.push_back({12, 0, 16, 5});
341-
342- in.push_back({20, 11, 24, 17});
343- in.push_back({22, 13, 26, 21});
344- in.push_back({32, 33, 36, 37});
345- in.push_back({30, 31, 38, 39});
346-
347- in.push_back({40, 43, 48, 45});
348- in.push_back({44, 41, 46, 47});
349-
350- in.push_back({50, 51, 52, 53});
351- in.push_back({50, 51, 52, 53});
352- in.push_back({50, 51, 52, 53});
353-
354- in.push_back({0, 0, 0, 10});
355- in.push_back({0, 0, 10, 0});
356- in.push_back({10, 0, 0, 10});
357- in.push_back({0, 10, 10, 0});
358-
359- for (int i = 0; i < 100000; i++) {
360- out.clear();
361- separate_rects(in, &out);
362- }
363-
364- for (int i = 0; i < out.size(); i++) {
365- std::cout << out[i].id_set << "(" << out[i].rect << ")" << std::endl;
366- }
367-
368- std::cout << "# of rects: " << out.size() << std::endl;
369-
370- expected_out.push_back(RectSet(IdSet(0), Rect(0, 0, 2, 5)));
371- expected_out.push_back(RectSet(IdSet(1), Rect(2, 5, 6, 6)));
372- expected_out.push_back(RectSet(IdSet(1) | 0, Rect(2, 0, 4, 5)));
373- expected_out.push_back(RectSet(IdSet(1) | 2, Rect(4, 0, 6, 5)));
374- expected_out.push_back(RectSet(IdSet(2), Rect(6, 0, 8, 5)));
375- expected_out.push_back(RectSet(IdSet(3), Rect(0, 7, 8, 9)));
376- expected_out.push_back(RectSet(IdSet(4), Rect(10, 0, 12, 5)));
377- expected_out.push_back(RectSet(IdSet(5) | 4, Rect(12, 0, 16, 5)));
378- expected_out.push_back(RectSet(IdSet(4), Rect(16, 0, 18, 5)));
379- expected_out.push_back(RectSet(IdSet(6), Rect(20, 11, 22, 17)));
380- expected_out.push_back(RectSet(IdSet(6) | 7, Rect(22, 13, 24, 17)));
381- expected_out.push_back(RectSet(IdSet(6), Rect(22, 11, 24, 13)));
382- expected_out.push_back(RectSet(IdSet(7), Rect(22, 17, 24, 21)));
383- expected_out.push_back(RectSet(IdSet(7), Rect(24, 13, 26, 21)));
384- expected_out.push_back(RectSet(IdSet(9), Rect(30, 31, 32, 39)));
385- expected_out.push_back(RectSet(IdSet(8) | 9, Rect(32, 33, 36, 37)));
386- expected_out.push_back(RectSet(IdSet(9), Rect(32, 37, 36, 39)));
387- expected_out.push_back(RectSet(IdSet(9), Rect(32, 31, 36, 33)));
388- expected_out.push_back(RectSet(IdSet(9), Rect(36, 31, 38, 39)));
389- expected_out.push_back(RectSet(IdSet(10), Rect(40, 43, 44, 45)));
390- expected_out.push_back(RectSet(IdSet(10) | 11, Rect(44, 43, 46, 45)));
391- expected_out.push_back(RectSet(IdSet(11), Rect(44, 41, 46, 43)));
392- expected_out.push_back(RectSet(IdSet(11), Rect(44, 45, 46, 47)));
393- expected_out.push_back(RectSet(IdSet(10), Rect(46, 43, 48, 45)));
394- expected_out.push_back(RectSet(IdSet(12) | 13 | 14, Rect(50, 51, 52, 53)));
395-
396- for (int i = 0; i < expected_out.size(); i++) {
397- RectSet &ex_out = expected_out[i];
398- if (std::find(out.begin(), out.end(), ex_out) == out.end()) {
399- std::cout << "Missing Rect: " << ex_out.id_set << "(" << ex_out.rect
400- << ")" << std::endl;
401- }
402- }
403-
404- for (int i = 0; i < out.size(); i++) {
405- RectSet &actual_out = out[i];
406- if (std::find(expected_out.begin(), expected_out.end(), actual_out) ==
407- expected_out.end()) {
408- std::cout << "Extra Rect: " << actual_out.id_set << "(" << actual_out.rect
409- << ")" << std::endl;
410- }
411- }
412-
413- return 0;
414-}
415-
416-#endif
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -3,10 +3,12 @@ LOCAL_PATH := $(call my-dir)
33 include $(CLEAR_VARS)
44
55 LOCAL_SRC_FILES := \
6+ separate_rects_test.cpp \
67 worker_test.cpp
78
89 LOCAL_MODULE := hwc-drm-tests
910 LOCAL_STATIC_LIBRARIES := libdrmhwc_utils
11+LOCAL_SHARED_LIBRARIES := hwcomposer.drm
1012 LOCAL_C_INCLUDES := external/drm_hwcomposer
1113
1214 include $(BUILD_NATIVE_TEST)
--- /dev/null
+++ b/tests/separate_rects_test.cpp
@@ -0,0 +1,100 @@
1+#include <gtest/gtest.h>
2+#include <hardware/hardware.h>
3+
4+#include "separate_rects.h"
5+
6+using namespace separate_rects;
7+
8+#define RectSet RectSet<TId, TNum>
9+#define Rect Rect<TNum>
10+#define IdSet IdSet<TId>
11+typedef uint64_t TId;
12+typedef float TNum;
13+
14+struct SeparateRectTest : public testing::Test {
15+ bool IsEquality(std::vector<RectSet> &out,
16+ std::vector<RectSet> &expected_out) {
17+ // Test for rects missing from out
18+ for (size_t i = 0; i < expected_out.size(); i++) {
19+ RectSet &ex_out = expected_out[i];
20+ if (std::find(out.begin(), out.end(), ex_out) == out.end()) {
21+ return false;
22+ }
23+ }
24+
25+ // Test for presence of unexpected rects in out
26+ for (size_t i = 0; i < out.size(); i++) {
27+ RectSet &actual_out = out[i];
28+ if (std::find(expected_out.begin(), expected_out.end(), actual_out) ==
29+ expected_out.end()) {
30+ return false;
31+ }
32+ }
33+
34+ return true;
35+ }
36+};
37+
38+TEST_F(SeparateRectTest, test_separate_rect) {
39+ std::vector<Rect> in;
40+ std::vector<RectSet> out;
41+ std::vector<RectSet> expected_out;
42+
43+ in.push_back({0, 0, 4, 5});
44+ in.push_back({2, 0, 6, 6});
45+ in.push_back({4, 0, 8, 5});
46+ in.push_back({0, 7, 8, 9});
47+
48+ in.push_back({10, 0, 18, 5});
49+ in.push_back({12, 0, 16, 5});
50+
51+ in.push_back({20, 11, 24, 17});
52+ in.push_back({22, 13, 26, 21});
53+ in.push_back({32, 33, 36, 37});
54+ in.push_back({30, 31, 38, 39});
55+
56+ in.push_back({40, 43, 48, 45});
57+ in.push_back({44, 41, 46, 47});
58+
59+ in.push_back({50, 51, 52, 53});
60+ in.push_back({50, 51, 52, 53});
61+ in.push_back({50, 51, 52, 53});
62+
63+ in.push_back({0, 0, 0, 10});
64+ in.push_back({0, 0, 10, 0});
65+ in.push_back({10, 0, 0, 10});
66+ in.push_back({0, 10, 10, 0});
67+
68+ for (int i = 0; i < 100000; i++) {
69+ out.clear();
70+ separate_frects_64(in, &out);
71+ }
72+
73+ expected_out.push_back(RectSet(IdSet(0), Rect(0, 0, 2, 5)));
74+ expected_out.push_back(RectSet(IdSet(1), Rect(2, 5, 6, 6)));
75+ expected_out.push_back(RectSet(IdSet(1) | 0, Rect(2, 0, 4, 5)));
76+ expected_out.push_back(RectSet(IdSet(1) | 2, Rect(4, 0, 6, 5)));
77+ expected_out.push_back(RectSet(IdSet(2), Rect(6, 0, 8, 5)));
78+ expected_out.push_back(RectSet(IdSet(3), Rect(0, 7, 8, 9)));
79+ expected_out.push_back(RectSet(IdSet(4), Rect(10, 0, 12, 5)));
80+ expected_out.push_back(RectSet(IdSet(5) | 4, Rect(12, 0, 16, 5)));
81+ expected_out.push_back(RectSet(IdSet(4), Rect(16, 0, 18, 5)));
82+ expected_out.push_back(RectSet(IdSet(6), Rect(20, 11, 22, 17)));
83+ expected_out.push_back(RectSet(IdSet(6) | 7, Rect(22, 13, 24, 17)));
84+ expected_out.push_back(RectSet(IdSet(6), Rect(22, 11, 24, 13)));
85+ expected_out.push_back(RectSet(IdSet(7), Rect(22, 17, 24, 21)));
86+ expected_out.push_back(RectSet(IdSet(7), Rect(24, 13, 26, 21)));
87+ expected_out.push_back(RectSet(IdSet(9), Rect(30, 31, 32, 39)));
88+ expected_out.push_back(RectSet(IdSet(8) | 9, Rect(32, 33, 36, 37)));
89+ expected_out.push_back(RectSet(IdSet(9), Rect(32, 37, 36, 39)));
90+ expected_out.push_back(RectSet(IdSet(9), Rect(32, 31, 36, 33)));
91+ expected_out.push_back(RectSet(IdSet(9), Rect(36, 31, 38, 39)));
92+ expected_out.push_back(RectSet(IdSet(10), Rect(40, 43, 44, 45)));
93+ expected_out.push_back(RectSet(IdSet(10) | 11, Rect(44, 43, 46, 45)));
94+ expected_out.push_back(RectSet(IdSet(11), Rect(44, 41, 46, 43)));
95+ expected_out.push_back(RectSet(IdSet(11), Rect(44, 45, 46, 47)));
96+ expected_out.push_back(RectSet(IdSet(10), Rect(46, 43, 48, 45)));
97+ expected_out.push_back(RectSet(IdSet(12) | 13 | 14, Rect(50, 51, 52, 53)));
98+
99+ ASSERT_TRUE(IsEquality(out, expected_out));
100+}
--- a/tests/worker_test.cpp
+++ b/tests/worker_test.cpp
@@ -66,7 +66,7 @@ struct WorkerTest : public testing::Test {
6666 };
6767
6868 TEST_F(WorkerTest, test_worker) {
69- // already isInitialized so should fail
69+ // already isInitialized so should succeed
7070 ASSERT_TRUE(worker.initialized());
7171
7272 int val = worker.value;
Show on old repository browser