OSDN Git Service

android-x86/external-drm_hwcomposer.git
8 years agodrm_hwcomposer: small feature/style enhancements for seperate_rects
Zach Reizner [Fri, 9 Oct 2015 17:02:54 +0000 (10:02 -0700)]
drm_hwcomposer: small feature/style enhancements for seperate_rects

With C++11, we can condense the double angle brackets.

This commit also includes an integer version of seperate_rects and some
convenience functions for rectangles.

Change-Id: Ide2a6b930cdf30c0f7a58d4199e02c06df492776

8 years agodrm_hwcomposer: use in-class member initializers for AutoEGLDisplayImage
Zach Reizner [Fri, 9 Oct 2015 16:54:42 +0000 (09:54 -0700)]
drm_hwcomposer: use in-class member initializers for AutoEGLDisplayImage

Change-Id: Id78a646d264eb3fab833f279f30570ddc89fadb7

8 years agodrm_hwcomposer: support the PREMULT blending mode in glworker
Haixia Shi [Fri, 9 Oct 2015 22:48:47 +0000 (15:48 -0700)]
drm_hwcomposer: support the PREMULT blending mode in glworker

BUG=24791071
TEST=verify notification icon shade is consistent with or without glworker

Change-Id: Ib7db1ece2e1dd327fdc1ffdbd44c360bd63f76b9

8 years agodrm_hwcomposer: Fix EGL_BAD_DISPLAY errors
Season Li [Thu, 8 Oct 2015 00:47:55 +0000 (17:47 -0700)]
drm_hwcomposer: Fix EGL_BAD_DISPLAY errors

Dont call eglDestroyImageKHR in move construtor
since image_ and display_ are not initialized.

Google Issue: 44452

Change-Id: Ie20be3b021d4562f2cd8a89d2666307afcde1cf2

8 years agodrm_hwcomposer: support virtual displays
Haixia Shi [Mon, 5 Oct 2015 21:35:09 +0000 (14:35 -0700)]
drm_hwcomposer: support virtual displays

Virtual display support is mandatory for HWC version 1.4.

As a minimal implementation, we use frambuffer target and let SF take care of
GLES composition. We still need to handle the acquire and release fences for
both the virtual display and all layers in a separate worker thread.

BUG=24609829
TEST=screen casting to chromecast

Change-Id: Idb962f4b5bb852c9ec9ebcaa1679a653c01737fb

8 years agoMerge "drm_hwcomposer: fill hwc_display_contents retireFenceFd" into mnc-dr-dev
Zachary Reizner [Wed, 7 Oct 2015 22:11:51 +0000 (22:11 +0000)]
Merge "drm_hwcomposer: fill hwc_display_contents retireFenceFd" into mnc-dr-dev

8 years agodrm_hwcomposer: fill hwc_display_contents retireFenceFd
Zach Reizner [Tue, 6 Oct 2015 22:39:09 +0000 (15:39 -0700)]
drm_hwcomposer: fill hwc_display_contents retireFenceFd

This restores the behavior of "drm_hwcomposer: Populate retireFenceFd"

The retire fence is triggered when all releaseFenceFd's of the display's
layers are triggered.

Change-Id: Id06f2df03dcb9638ccbae23f46c42b05551fae6d

8 years agodrm_hwcomposer: Bump the acquire fence timeout to 83ms
Sean Paul [Thu, 1 Oct 2015 17:20:02 +0000 (13:20 -0400)]
drm_hwcomposer: Bump the acquire fence timeout to 83ms

To accomodate peak usage situations.

Change-Id: I46031ce394abf1ec09177089508dd625d7c17aaa
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Process modesets via compositor
Sean Paul [Sat, 19 Sep 2015 13:14:34 +0000 (09:14 -0400)]
drm_hwcomposer: Process modesets via compositor

This patch queues modeset in the compositor for application on
the next frame. This allows us to perform the modeset atomically
with the first frame that comes in after the mode is changed.

Change-Id: I6bb9edd17bbdd6dbee5c0474f2e43599781cc7a7
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: fix crash in hwc_set()
Haixia Shi [Wed, 30 Sep 2015 17:57:54 +0000 (10:57 -0700)]
drm_hwcomposer: fix crash in hwc_set()

For each display context we need to unconditionally call emplace_back()
on layers_indices to ensure that entries in layers_indices correspond to
the correct display.

BUG=24506167
TEST=still builds and boots ok
Change-Id: I6bc0858471c9ec51615c8ed7d8613529f77cb1ab

8 years agodrm_hwcomposer: Set timeouts for fence waits
Sean Paul [Tue, 29 Sep 2015 04:56:00 +0000 (00:56 -0400)]
drm_hwcomposer: Set timeouts for fence waits

Instead of waiting forever for fences, set some reasonable timeouts
so we can move on with life if a fence doesn't signal.

BUG=chrome-os-partner:45868
TEST=Tested on smaug with osmos, recovered from fence timeouts

Change-Id: I7f18d684d483d789f228cbad8d5a3e43ac898a43
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: use GL_TEXTURE_EXTERNAL_OES target for src textures
Haixia Shi [Fri, 25 Sep 2015 18:49:44 +0000 (11:49 -0700)]
drm_hwcomposer: use GL_TEXTURE_EXTERNAL_OES target for src textures

The GL_TEXTURE_EXTERNAL_OES supports format conversion for YUV external
textures, whereas GL_TEXTURE_2D does not.

Convert crop rects to normalized coordinates.

BUG=chrome-os-partner:45761
TEST=run netflix and observe corruption is fixed during animation transition

Change-Id: Iad9a187faad6b58f1c4b1d19edd0d2a5cbc9a561

8 years agodrm_hwcomposer: implement the safe handling of layers
Zach Reizner [Fri, 11 Sep 2015 01:30:54 +0000 (18:30 -0700)]
drm_hwcomposer: implement the safe handling of layers

This is a sweeping change to discard our usage of struct hwc_layer_t outside
hwcomposer.cpp. That was a dangerous struct that was a source of many of our
errors. Replacing it with safer RAII-style classes reduces the amount and
complexity of our code.

Change-Id: I580cafdf89bd1e7e6583f3073858b8e78e6018ba

8 years agoMerge "drm_hwcomposer: limit maximum depth of display composition queue" into mnc...
Sean Paul [Tue, 22 Sep 2015 17:48:30 +0000 (17:48 +0000)]
Merge "drm_hwcomposer: limit maximum depth of display composition queue" into mnc-dr-dev

8 years agodrm_hwcomposer: Make gl worker log tag consistent with rest of hwc
Sean Paul [Mon, 21 Sep 2015 14:05:19 +0000 (10:05 -0400)]
drm_hwcomposer: Make gl worker log tag consistent with rest of hwc

For easy logcat grepping.

Change-Id: I79b82f4d359268a6e116f602f2ffb90885cdb3dd
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Plumb frame number through display composition
Sean Paul [Mon, 21 Sep 2015 14:04:02 +0000 (10:04 -0400)]
drm_hwcomposer: Plumb frame number through display composition

Having frame number in the composition is very useful for
debugging transient issues, plumb it through the drm compositor
stack.

Change-Id: Ibc7555c89bea79c580b3201b11db4ced6360efb9
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: correctly handle rotation + cropping
Haixia Shi [Thu, 10 Sep 2015 22:16:47 +0000 (15:16 -0700)]
drm_hwcomposer: correctly handle rotation + cropping

BUG=chrome-os-partner:44741
TEST=ryu, window transition animation (10x slowdown) in all orientations

Change-Id: Ibeb880a60ecf168e9d15e2f16b5f0b5642d85f1c

8 years agodrm_hwcomposer: use HWC_FRAMEBUFFER_TARGET if all HWC_OVERLAY layers are skipped
Haixia Shi [Wed, 9 Sep 2015 19:08:20 +0000 (12:08 -0700)]
drm_hwcomposer: use HWC_FRAMEBUFFER_TARGET if all HWC_OVERLAY layers are skipped

Apparently there are cases (such as during rotation) where SF will put content
in framebuffer target and set HWC_SKIP_LAYER on all other layers. In this case
we need to use the HWC_FRAMEBUFFER_TARGET layer.

BUG=23936827
TEST=verify on ryu that rotation works

Change-Id: Ice8ee5a023a92fc286dbf837a822fa6f6c0fde6b

8 years agodrm_hwcomposer: Allow NULL crtcs in display composition
Sean Paul [Fri, 4 Sep 2015 05:33:06 +0000 (01:33 -0400)]
drm_hwcomposer: Allow NULL crtcs in display composition

In cases where we have displays which do not have a mode,
the crtc will be NULL. This shouldn't fail the composition
initialization.

Change-Id: I1a6acb72cd3f614b5a7c854ba61be1539efa4bea
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Allow layer transforms
Stéphane Marchesin [Tue, 25 Aug 2015 07:08:10 +0000 (00:08 -0700)]
drm_hwcomposer: Allow layer transforms

They are very much valid now. I think this is just leftover?

BUG=chrome-os-partner:42717
TEST=test rotation, it doesn't lock up

Change-Id: I4cd96ae91c91452ef2be3cb3b07c123ce38ed576

8 years agodrm_hwcomposer: cache the framebuffers given to the GLWorker
Zach Reizner [Thu, 20 Aug 2015 21:52:12 +0000 (14:52 -0700)]
drm_hwcomposer: cache the framebuffers given to the GLWorker

This saves some work in EGL/GL that would normally get repeated every frame.
Because the same framebuffers are generally used every frame, this CL adds a
cache containing all the EGL/GL objects that correspond to the given
GraphicBuffer. The cache initially holds a strong reference while rendering,
but once glFinish is called, only a weak reference is held until rendering
to that same GraphicBuffer starts again. The weak reference is used to check
if that GraphicBuffer has been destroyed, which means the corresponding EGL/GL
resources should be destroyed.

The cache can be disabled with the following command:
$ adb shell setprop hwc.drm.use_framebuffer_cache 0

Change-Id: Iddee1efc5bad67f6c4479e7f402354e229c3b0a2

8 years agodrm_hwcomposer: add properties to disable overlays or to use HWC_FRAMEBUFFER
Zach Reizner [Fri, 14 Aug 2015 18:14:38 +0000 (11:14 -0700)]
drm_hwcomposer: add properties to disable overlays or to use HWC_FRAMEBUFFER

To use SurfaceFlinger's GL compositor, use the setprop command:
$ adb shell setprop hwc.drm.use_framebuffer_target 1

A side effect of using the above property is that drm_hwcomposer will only be
compositing one primary plane.

To disable overlays (to force the GL compositor to be used more often):
$ adb shell setprop hwc.drm.use_overlay_planes 0

The default behavior is the opposite of the above properties.

Change-Id: I86afb533c10a8caa15931e8c292f52bb94e5f6c5

8 years agodrm_hwcomposer: enhance stability using various wrapper classes
Zach Reizner [Thu, 13 Aug 2015 21:53:41 +0000 (14:53 -0700)]
drm_hwcomposer: enhance stability using various wrapper classes

This commit contains a lot of churn because it changes code to use automatic
resource lifetimes as much as possible. As more things get changed, this is
essential to maintaining stability.

In addition, this change changes how layers are passed through the compositor
API. Before each layer was passed down one at a time. Now they are passed in
all at once. This is simpler for the implementation because it makes errors
more atomic and makes decisions easier for the compositors.

Change-Id: Ic3e6b5d0089fb1631ea256adcce9910ed8f38366

8 years agodrm_hwcomposer: style fixes
Zach Reizner [Thu, 13 Aug 2015 21:32:09 +0000 (14:32 -0700)]
drm_hwcomposer: style fixes

Change-Id: Id04a088a895f8372a32623713589d43d5e0495ef

8 years agodrm_hwcomposer: duplicate buffer_handles before hwc_set returns
Zach Reizner [Fri, 7 Aug 2015 23:00:01 +0000 (16:00 -0700)]
drm_hwcomposer: duplicate buffer_handles before hwc_set returns

This is needed because SF will sometimes release buffer_handles before GL gets
to using them for composition.

Change-Id: I01db0975cc82d6b59bf4f9521a24071baf89c38a

8 years agodrm_hwcomposer: fix buffer leak when using the GL compositor inside DrmDisplayCompositor
Zach Reizner [Thu, 30 Jul 2015 15:10:14 +0000 (08:10 -0700)]
drm_hwcomposer: fix buffer leak when using the GL compositor inside DrmDisplayCompositor

Change-Id: Id3a6deea9fc0f97640b34dacb25d36f3793f2d4e

8 years agoRevert "Revert "drm_hwcomposer: remove compositor interface""
Zach Reizner [Fri, 31 Jul 2015 22:12:49 +0000 (15:12 -0700)]
Revert "Revert "drm_hwcomposer: remove compositor interface""

This reverts commit 1c5e55680d9165d8f9bb2bc6e2c4261574b5d41d.

8 years agoRevert "Revert "drm_hwcomposer: remove GLCompositor and the GLWorker thread""
Zach Reizner [Fri, 31 Jul 2015 22:12:47 +0000 (15:12 -0700)]
Revert "Revert "drm_hwcomposer: remove GLCompositor and the GLWorker thread""

This reverts commit d078e4cab78f81057cd25355199caba5a147342e.

8 years agoRevert "Revert "drm_hwcomposer: have DrmDisplayCompositor do its own OpenGL composition""
Zach Reizner [Fri, 31 Jul 2015 22:12:44 +0000 (15:12 -0700)]
Revert "Revert "drm_hwcomposer: have DrmDisplayCompositor do its own OpenGL composition""

This reverts commit cbe9c01336e23a63259db65d22d63d6a697b8813.

8 years agoRevert "drm_hwcomposer: have DrmDisplayCompositor do its own OpenGL composition"
Puneet Kumar [Thu, 30 Jul 2015 03:38:11 +0000 (03:38 +0000)]
Revert "drm_hwcomposer: have DrmDisplayCompositor do its own OpenGL composition"

This reverts commit 2317bb19d8663efc31e6fcd8cf7fd2a73577253d.

For now until we figure out a more stable SF/hwc

Change-Id: Ia5ca089610a487bf036a1ddd5fb62e504e02ad98

8 years agoMerge "Revert "drm_hwcomposer: remove GLCompositor and the GLWorker thread"" into...
Sean Paul [Thu, 30 Jul 2015 13:18:30 +0000 (13:18 +0000)]
Merge "Revert "drm_hwcomposer: remove GLCompositor and the GLWorker thread"" into mnc-dr-dev

8 years agoRevert "drm_hwcomposer: remove GLCompositor and the GLWorker thread"
Puneet Kumar [Thu, 30 Jul 2015 03:36:46 +0000 (03:36 +0000)]
Revert "drm_hwcomposer: remove GLCompositor and the GLWorker thread"

This reverts commit abebc7a78fe8a4df6495c8e5064719dc92b04004.

For now until we figure out a more stable solution for SF/hwc

Change-Id: I7a505fc67873f943704e8b48db4167b9beca7691

8 years agoRevert "drm_hwcomposer: remove compositor interface"
Puneet Kumar [Thu, 30 Jul 2015 03:35:38 +0000 (03:35 +0000)]
Revert "drm_hwcomposer: remove compositor interface"

This reverts commit 7912438911de042dc035cf1ea39daaf4e56bf9f3.

For now until we can get back to a stable SF/compositor.

Change-Id: I2ba7cab4f1cccfe44b3d35fb18c7784125e88fd6

8 years agodrm_hwcomposer: limit maximum depth of display composition queue
Zach Reizner [Tue, 28 Jul 2015 22:33:07 +0000 (15:33 -0700)]
drm_hwcomposer: limit maximum depth of display composition queue

SurfaceFlinger will destroy our layer handles if we don't use them after about
a second. To get around this issue, we block SurfaceFlinger on hwc_set if the
display composition queue is getting too large. This often happens during
the init of the GLWorker or during heavy GPU usage.

Change-Id: Idb4a3a81e0d3a2caf7f94e5515a19ec16a1c67e3

8 years agodrm_hwcomposer: remove compositor interface
Zach Reizner [Wed, 22 Jul 2015 22:01:37 +0000 (15:01 -0700)]
drm_hwcomposer: remove compositor interface

The compositor interface had only one implementation and one user. The
compositor interface also needs to change to accomodate some changes for
fences to work optimally.

Change-Id: I02d21b0a0e86fa21b3c5f4ad84ff571611643994

8 years agodrm_hwcomposer: remove GLCompositor and the GLWorker thread
Zach Reizner [Tue, 21 Jul 2015 22:06:16 +0000 (15:06 -0700)]
drm_hwcomposer: remove GLCompositor and the GLWorker thread

They are dead code now that DrmDisplayCompositor uses GL directly.

Change-Id: Ie4beeab60440a51bd87486847b5453e20288d1d8

8 years agoMerge "drm_hwcomposer: Populate retireFenceFd" into mnc-dr-dev
Sean Paul [Wed, 22 Jul 2015 10:45:40 +0000 (10:45 +0000)]
Merge "drm_hwcomposer: Populate retireFenceFd" into mnc-dr-dev

8 years agodrm_hwcomposer: Populate retireFenceFd
Sean Paul [Thu, 16 Jul 2015 19:59:24 +0000 (15:59 -0400)]
drm_hwcomposer: Populate retireFenceFd

Join all layer releaseFenceFd fences together to get the
retireFenceFd for the display.

Change-Id: I431ee227a62397b1900adb0caaf8b16b319a99cd
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: have DrmDisplayCompositor do its own OpenGL composition
Zach Reizner [Thu, 16 Jul 2015 17:14:26 +0000 (10:14 -0700)]
drm_hwcomposer: have DrmDisplayCompositor do its own OpenGL composition

To accomplish this a few things changed:
- DrmComposition::GetRemainingLayers always returns the number of planes needed
- DrmComposition::AddLayer succeeds even if no DrmPlane was found for it
- DrmDisplayComposition::AddLayer has overload that imports the given buffer
- GLWorkerCompositor has a function to finish its composite before returning

Put together this change makes DrmComposition always accepts all layers given to
it even if it means some of those layers are assigned a NULL DrmPlane. The
DrmDisplayCompositor will scan its given layers for any that are missing planes.
In such a case, a DrmPlane is stolen from the last layer to receive a plane.
Then all layers in the DrmDisplayComposition that have no planes (including the
one stolen from) are composited synchronously using a GLWorkerCompositor and a
new layer is generated from the results. That layer is added to the
DrmDisplayComposition using the new import AddLayer function and the stolen
DrmPlane. DrmDisplayCompostior then continues as usual.

Change-Id: Ia6477c210c8f1307a4e537bec46889110d79ca18

8 years agodrm_hwcomposer: make sure all fences are released for DrmDisplayComposition
Zach Reizner [Fri, 17 Jul 2015 21:13:28 +0000 (14:13 -0700)]
drm_hwcomposer: make sure all fences are released for DrmDisplayComposition

This change will release the layers passed back to SurfaceFlinger even on an
error in the compositor thread.

Change-Id: I22f622855c8c953a058b4a08d0af1ae427e4cbbd

8 years agodrm_hwcomposer: clang-format style and gcc warning fixes
Zach Reizner [Fri, 17 Jul 2015 21:10:03 +0000 (14:10 -0700)]
drm_hwcomposer: clang-format style and gcc warning fixes

The warning I fixed was unitialized rotation variable. The check for error
followed by a break satisfied the compiler.

Change-Id: Ia1a1a01da252a10aa245e45d588b3aeb91ebf58a

8 years agoMerge "drm_hwcomposer: add transform support to OpenGL compositor" into mnc-dr-dev
Zach Reizner [Fri, 17 Jul 2015 00:22:59 +0000 (00:22 +0000)]
Merge "drm_hwcomposer: add transform support to OpenGL compositor" into mnc-dr-dev

8 years agodrm_hwcomposer: add transform support to OpenGL compositor
Zach Reizner [Thu, 16 Jul 2015 23:53:41 +0000 (16:53 -0700)]
drm_hwcomposer: add transform support to OpenGL compositor

The GL compositor will respect the layer.transform enum. However, using a
non-identity transform with source cropping is untested, and the documentation
is unclear on what the expected results should be anyways.

Change-Id: I10007743d5b17c611671b647e8f404fdbe1ab4a5

8 years agoMerge "drm_hwcomposer: style fixes with clang-format" into mnc-dr-dev
Zach Reizner [Thu, 16 Jul 2015 21:45:44 +0000 (21:45 +0000)]
Merge "drm_hwcomposer: style fixes with clang-format" into mnc-dr-dev

8 years agoMerge "drm_hwcomposer: make the gl worker compositor not nested" into mnc-dr-dev
Zach Reizner [Thu, 16 Jul 2015 21:45:10 +0000 (21:45 +0000)]
Merge "drm_hwcomposer: make the gl worker compositor not nested" into mnc-dr-dev

8 years agodrm_hwcomposer: Add rotation support for hw planes
Sean Paul [Tue, 14 Jul 2015 19:51:52 +0000 (15:51 -0400)]
drm_hwcomposer: Add rotation support for hw planes

This patch adds support for transformed layers by using the
rotation property on drm planes.

Bug: chrome-os-partner:42093
Test: On smaug using
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:<R>

Change-Id: I86bb8ef2f77b5d046a5fddd57db4b87070b5801f
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: style fixes with clang-format
Zach Reizner [Thu, 16 Jul 2015 16:45:59 +0000 (09:45 -0700)]
drm_hwcomposer: style fixes with clang-format

Change-Id: I020072a782dde7551ae940d12f3925b8680ba0af

8 years agodrm_hwcomposer: make the gl worker compositor not nested
Zach Reizner [Thu, 16 Jul 2015 01:44:37 +0000 (18:44 -0700)]
drm_hwcomposer: make the gl worker compositor not nested

Change-Id: I06b75644408a570044499a9f603a478f3199661f

8 years agoMerge "drm_hwcomposer: Dump active composition plane/crtc/dimension info" into mnc...
Sean Paul [Wed, 15 Jul 2015 19:19:40 +0000 (19:19 +0000)]
Merge "drm_hwcomposer: Dump active composition plane/crtc/dimension info" into mnc-dr-dev

8 years agodrm_hwcomposer: Convert src_x,src_y to 16.16 fixed
Sean Paul [Wed, 15 Jul 2015 16:36:48 +0000 (12:36 -0400)]
drm_hwcomposer: Convert src_x,src_y to 16.16 fixed

We convert src_w,src_h, but failed to convert src_x.src_y. This
has the effect of never indexing into fb's properly.

Bug: chrome-os-parter:42311
Test: On smaug, open up the add google account screen, it should
      not be shifted

Change-Id: Ic5cf654d93ea6c89c2cbd23c1d847fbc412a7d19
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Dump active composition plane/crtc/dimension info
Sean Paul [Mon, 13 Jul 2015 16:41:37 +0000 (12:41 -0400)]
drm_hwcomposer: Dump active composition plane/crtc/dimension info

Should help with debugging if we can compare the SF layer info with
what drm_hwc is doing.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: I333848b2141dff4c533f6dc22194826fdcf25dff

8 years agoMerge "drm_hwcomposer: Print fps as float in dump()" into mnc-dr-dev
Stéphane Marchesin [Mon, 13 Jul 2015 23:40:12 +0000 (23:40 +0000)]
Merge "drm_hwcomposer: Print fps as float in dump()" into mnc-dr-dev

8 years agoMerge "drm_hwcomposer: Convert v_refresh() to float" into mnc-dr-dev
Stéphane Marchesin [Mon, 13 Jul 2015 23:39:52 +0000 (23:39 +0000)]
Merge "drm_hwcomposer: Convert v_refresh() to float" into mnc-dr-dev

8 years agoam e850fa2e: (-s ours) drm_hwcomposer: Process DPMS requests through compositor
Sean Paul [Mon, 13 Jul 2015 23:00:14 +0000 (23:00 +0000)]
am e850fa2e: (-s ours) drm_hwcomposer: Process DPMS requests through compositor

* commit 'e850fa2e39da03695e03c1824a08f8be9b4cfdbf':
  drm_hwcomposer: Process DPMS requests through compositor
  drm_hwcomposer: Free failed composition in QueueComposition

8 years agoam 1abf5c3f: (-s ours) drm_hwcomposer: Add composition type to DrmComposition
Sean Paul [Mon, 13 Jul 2015 22:53:58 +0000 (22:53 +0000)]
am 1abf5c3f: (-s ours) drm_hwcomposer: Add composition type to DrmComposition

* commit '1abf5c3fd61c1698e1ef7f9794cac5e22609a58c':
  drm_hwcomposer: Add composition type to DrmComposition

8 years agoam e86fcfbb: (-s ours) drm_hwcomposer: Split the drm compositor into per-display...
Sean Paul [Mon, 13 Jul 2015 22:42:09 +0000 (22:42 +0000)]
am e86fcfbb: (-s ours) drm_hwcomposer: Split the drm compositor into per-display threads

* commit 'e86fcfbb5c3f857efbcccb335c9a1a72a7a101cb':
  drm_hwcomposer: Split the drm compositor into per-display threads

8 years agodrm_hwcomposer: Print fps as float in dump()
Stéphane Marchesin [Mon, 13 Jul 2015 19:35:41 +0000 (12:35 -0700)]
drm_hwcomposer: Print fps as float in dump()

This is more accurate than using ints which helps with profiling work.

Change-Id: I9ba8cc8a2b0e9c1fa02bc217444d4001f0e19009

8 years agodrm_hwcomposer: Convert v_refresh() to float
Stéphane Marchesin [Sun, 5 Jul 2015 09:00:08 +0000 (02:00 -0700)]
drm_hwcomposer: Convert v_refresh() to float

We convert v_refresh() to return a float and instead of storing it,
compute it on the fly from the pixel clock + htotal/vtotal. This makes
the synthetic vblank computation much more accurate.

Change-Id: I2a0becf75eaca8ace30d176fdc813f3b57ba23a5

8 years agodrm_hwcomposer: Use vector for overlay planes
Sean Paul [Thu, 9 Jul 2015 21:51:50 +0000 (17:51 -0400)]
drm_hwcomposer: Use vector for overlay planes

For two reasons:
1- Because we don't need to use deque
2- Because we'll need to erase from the middle in the future,
   and deque makes that difficult while iterating

BUG=chrome-os-parter:42311
TEST=Tested on smaug, turned on/off bunch of times, no dup icons

Change-Id: I306bdea15d7165f63afeb3b1e06774e2e9a1785f
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Disable unused planes
Sean Paul [Thu, 9 Jul 2015 21:22:22 +0000 (17:22 -0400)]
drm_hwcomposer: Disable unused planes

Right before queuing up a composition, go through the
list of unused planes and add disable markers such
that they don't remain active when the new frame is
posted.

BUG=chrome-os-parter:42311
TEST=Tested on smaug, turned on/off bunch of times, no dup icons

Change-Id: Ic2e5e210873efb6dc41fd43682fe00db33c2a28e
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Process DPMS requests through compositor
Sean Paul [Thu, 25 Jun 2015 01:46:05 +0000 (18:46 -0700)]
drm_hwcomposer: Process DPMS requests through compositor

This patch changes the behavior of DPMS in hwcomposer from
applying asynchronously/immediately, to queuing in the
compositor and being processed in order. This is desirable
for a couple of reasons:
  1- It ensures all frames set before set_power_mode are
     shown on the screen before it turns off
  2- We make sure we don't rmfb a framebuffer that is
     currently applied to a disabled crtc.

The second reason above can cause the display to turn back
off once it's on since the fb will dereference to zero in
the kernel and it will disable the pipe without notifying
us.

Change-Id: I2aab9ee0353b12fecced46766ed2dbb64f0aef4b
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Free failed composition in QueueComposition
Sean Paul [Fri, 10 Jul 2015 20:43:06 +0000 (16:43 -0400)]
drm_hwcomposer: Free failed composition in QueueComposition

Rather than maintaining ownership of the composition in the
caller, free the DrmComposition in QueueComposition on failure.

Change-Id: Id70e98ae1a8eef400bc29460bfc5a89c4707d617
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Add composition type to DrmComposition
Sean Paul [Thu, 25 Jun 2015 01:43:01 +0000 (18:43 -0700)]
drm_hwcomposer: Add composition type to DrmComposition

This allows us to have different types of compositions. This will
enable injection of non-frame related compositions such as dpms
and mode.

Change-Id: Ia62421c114c0c6bebccef3ce6ae936366b6aafe2
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Split the drm compositor into per-display threads
Sean Paul [Wed, 24 Jun 2015 21:38:49 +0000 (14:38 -0700)]
drm_hwcomposer: Split the drm compositor into per-display threads

This patch splits out the current single drm compositor with
per-display compositors, each with their own thread.

The per-display compositors are hidden behind a singleton
drm compositor. This allows us to maintain a whole-world view
of all displays involved in a frame. This becomes useful if
we start switching up crtcs/encoders for the displays.
This also allows us to issue one DrmComposition when the
frame is being assembled.

The single DrmComposition handles the plane allocation (since they
might switch between displays), and contains per-display compositions
which are used to store the layer->plane/crtc information for each
frame. The display compositors use the per-display compositions to
display the frame on their output.

Each display compositor receives a shared pointer to the frame's
DrmComposition on QueueComposition. As a result, both the composition,
and the per-display compositions, live for as long as any one
display is still using it. While this is sub-optimal (since a display
might never update again), this is probably fine for now.

Finally, splitting things up per-display will allow us to inject
non-compositing jobs into the composite queue. An example would be
turning the display off, or setting the mode. This ensures that all
frames in the composite queue are displayed before the mode changes
or the display is disabled.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: I8a233ea64710b238f70acbcde1f6d771e297b069

8 years agodrm_hwcomposer: Process DPMS requests through compositor
Sean Paul [Thu, 25 Jun 2015 01:46:05 +0000 (18:46 -0700)]
drm_hwcomposer: Process DPMS requests through compositor

This patch changes the behavior of DPMS in hwcomposer from
applying asynchronously/immediately, to queuing in the
compositor and being processed in order. This is desirable
for a couple of reasons:
  1- It ensures all frames set before set_power_mode are
     shown on the screen before it turns off
  2- We make sure we don't rmfb a framebuffer that is
     currently applied to a disabled crtc.

The second reason above can cause the display to turn back
off once it's on since the fb will dereference to zero in
the kernel and it will disable the pipe without notifying
us.

Change-Id: I2aab9ee0353b12fecced46766ed2dbb64f0aef4b
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Free failed composition in QueueComposition
Sean Paul [Fri, 10 Jul 2015 20:43:06 +0000 (16:43 -0400)]
drm_hwcomposer: Free failed composition in QueueComposition

Rather than maintaining ownership of the composition in the
caller, free the DrmComposition in QueueComposition on failure.

Change-Id: Id70e98ae1a8eef400bc29460bfc5a89c4707d617
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Add composition type to DrmComposition
Sean Paul [Thu, 25 Jun 2015 01:43:01 +0000 (18:43 -0700)]
drm_hwcomposer: Add composition type to DrmComposition

This allows us to have different types of compositions. This will
enable injection of non-frame related compositions such as dpms
and mode.

Change-Id: Ia62421c114c0c6bebccef3ce6ae936366b6aafe2
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Split the drm compositor into per-display threads
Sean Paul [Wed, 24 Jun 2015 21:38:49 +0000 (14:38 -0700)]
drm_hwcomposer: Split the drm compositor into per-display threads

This patch splits out the current single drm compositor with
per-display compositors, each with their own thread.

The per-display compositors are hidden behind a singleton
drm compositor. This allows us to maintain a whole-world view
of all displays involved in a frame. This becomes useful if
we start switching up crtcs/encoders for the displays.
This also allows us to issue one DrmComposition when the
frame is being assembled.

The single DrmComposition handles the plane allocation (since they
might switch between displays), and contains per-display compositions
which are used to store the layer->plane/crtc information for each
frame. The display compositors use the per-display compositions to
display the frame on their output.

Each display compositor receives a shared pointer to the frame's
DrmComposition on QueueComposition. As a result, both the composition,
and the per-display compositions, live for as long as any one
display is still using it. While this is sub-optimal (since a display
might never update again), this is probably fine for now.

Finally, splitting things up per-display will allow us to inject
non-compositing jobs into the composite queue. An example would be
turning the display off, or setting the mode. This ensures that all
frames in the composite queue are displayed before the mode changes
or the display is disabled.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: I8a233ea64710b238f70acbcde1f6d771e297b069

8 years agoMerge "drm_hwcomposer: Add glworker" into mnc-dev
Zach Reizner [Wed, 8 Jul 2015 23:45:04 +0000 (23:45 +0000)]
Merge "drm_hwcomposer: Add glworker" into mnc-dev

8 years agodrm_hwcomposer: Add glworker
Zach Reizner [Sat, 27 Jun 2015 01:25:38 +0000 (18:25 -0700)]
drm_hwcomposer: Add glworker

The glworker allows signalling the fence synchronously once the GL
work is done. It also helps performance by putting all GL in a
separate thread, which avoids (costly on some GPUs) makecurrent.

Change-Id: Ia4ee137df5c9a4b1afcf6180407371d6ba7f699a

8 years agodrm_hwcomposer: Add blob property type
Sean Paul [Wed, 8 Jul 2015 14:43:54 +0000 (10:43 -0400)]
drm_hwcomposer: Add blob property type

The blob property type doesn't use the values_ vector, instead
just storing the blob id directly in value_.

Change-Id: Ibde7c64cb7fe515ece9e9f396866de2da518707f
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Add tracing for the main functions
Stéphane Marchesin [Tue, 23 Jun 2015 23:18:10 +0000 (16:18 -0700)]
drm_hwcomposer: Add tracing for the main functions

This will help the profiling efforts, now that all the low-hanging
fruit is gone.

BUG=none
TEST=run systrace, see tracing

Change-Id: I9a149afdea8b84837c19f8e224ce8a7e2db1dd9a

8 years agodrm_hwcomposer: Switch to triple buffering
Stéphane Marchesin [Fri, 19 Jun 2015 21:50:45 +0000 (14:50 -0700)]
drm_hwcomposer: Switch to triple buffering

This increases the performance of the UI (30->40 fps).

BUG=none
TEST=boot to UI, swipe between desktops, measure fps

Change-Id: Ie0ff4b51c3db402a40c9676d3f09d48d85097bce

8 years agodrm_hwcomposer: Use atomic modeset to set crtc timing
Sean Paul [Wed, 3 Jun 2015 18:08:27 +0000 (14:08 -0400)]
drm_hwcomposer: Use atomic modeset to set crtc timing

Use the new drm blob ioctl and atomic modeset properties to
do atomic modesetting, as opposed to the old setCrtc call.

This allows us to set timing as soon as the system layer requests
a new active config, as opposed to delaying it until we have
an fb. Aside from reducing complexity, this should help with
event control requests as we'll be able to service them with
hw vblanks instead of synthesized sleeps.

Change-Id: I9c80d44f52f52881a3a25b2ae518973d468bc110
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agoMerge "drm_hwcomposer: integrate GLCompositor with hwcomposer" into mnc-dev
Zach Reizner [Fri, 12 Jun 2015 00:19:48 +0000 (00:19 +0000)]
Merge "drm_hwcomposer: integrate GLCompositor with hwcomposer" into mnc-dev

8 years agodrm_hwcomposer: integrate GLCompositor with hwcomposer
Zach Reizner [Wed, 10 Jun 2015 23:03:01 +0000 (16:03 -0700)]
drm_hwcomposer: integrate GLCompositor with hwcomposer

This patch makes it such that HWC will always composite all layers even if
there are too few HW planes. Any layers that do not fit in a plane get
rendered into a screen sized buffer by GLCompositor, the result of which uses
up one of the available HW planes.

Change-Id: Ibd560ae4c536632ac32d965152ceacd92bbba39f

8 years agoMerge "drm_hwcomposer: correct alpha channel output on gl framebuffers" into mnc-dev
Zach Reizner [Thu, 11 Jun 2015 20:07:09 +0000 (20:07 +0000)]
Merge "drm_hwcomposer: correct alpha channel output on gl framebuffers" into mnc-dev

8 years agoMerge "drm_hwcomposer: Use HW overlay planes" into mnc-dev
Sean Paul [Thu, 11 Jun 2015 19:22:04 +0000 (19:22 +0000)]
Merge "drm_hwcomposer: Use HW overlay planes" into mnc-dev

8 years agoMerge "drm_hwcomposer: make GLCompositor delete bo with Importer" into mnc-dev
Zach Reizner [Thu, 11 Jun 2015 18:58:52 +0000 (18:58 +0000)]
Merge "drm_hwcomposer: make GLCompositor delete bo with Importer" into mnc-dev

8 years agoMerge "drm_hwcomposer: fix misc style issues in gl_compositor.cpp" into mnc-dev
Zach Reizner [Thu, 11 Jun 2015 18:58:41 +0000 (18:58 +0000)]
Merge "drm_hwcomposer: fix misc style issues in gl_compositor.cpp" into mnc-dev

8 years agodrm_hwcomposer: correct alpha channel output on gl framebuffers
Zach Reizner [Thu, 11 Jun 2015 18:30:20 +0000 (11:30 -0700)]
drm_hwcomposer: correct alpha channel output on gl framebuffers

Change-Id: I1ca8f2f7edb7fbb8691c4ba37c859bf60dcea77a

8 years agodrm_hwcomposer: make GLCompositor delete bo with Importer
Zach Reizner [Thu, 11 Jun 2015 18:28:48 +0000 (11:28 -0700)]
drm_hwcomposer: make GLCompositor delete bo with Importer

Change-Id: I4ec6111372381701c238d5333aa1c56baf301e02

8 years agodrm_hwcomposer: fix misc style issues in gl_compositor.cpp
Zach Reizner [Thu, 11 Jun 2015 18:40:18 +0000 (11:40 -0700)]
drm_hwcomposer: fix misc style issues in gl_compositor.cpp

Change-Id: I9b3adf7979ff86eb1b89de03f3d8fe8bd1e35dc4

8 years agoMerge "drm_hwcomposer: Reference count NvImporter buffers" into mnc-dev
Sean Paul [Thu, 11 Jun 2015 14:01:23 +0000 (14:01 +0000)]
Merge "drm_hwcomposer: Reference count NvImporter buffers" into mnc-dev

8 years agoMerge "drm_hwcomposer: Implement Dump() for DrmCompositor" into mnc-dev
Sean Paul [Thu, 11 Jun 2015 13:42:11 +0000 (13:42 +0000)]
Merge "drm_hwcomposer: Implement Dump() for DrmCompositor" into mnc-dev

8 years agoMerge "drm_hwcomposer: Add Dump() to the Compositor interface" into mnc-dev
Sean Paul [Thu, 11 Jun 2015 13:42:03 +0000 (13:42 +0000)]
Merge "drm_hwcomposer: Add Dump() to the Compositor interface" into mnc-dev

8 years agodrm_hwcomposer: Implement Dump() for DrmCompositor
Sean Paul [Wed, 10 Jun 2015 21:29:05 +0000 (17:29 -0400)]
drm_hwcomposer: Implement Dump() for DrmCompositor

Output simple fps information from the DrmCompositor on Dump().

Change-Id: Ic1f4f922fa2cd15e1fc7c6fdb412baa33611676f
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Add Dump() to the Compositor interface
Sean Paul [Wed, 10 Jun 2015 21:27:47 +0000 (17:27 -0400)]
drm_hwcomposer: Add Dump() to the Compositor interface

Add a Dump() function to the Compositor base class and pipe it
through hwcomposer. This can be invoked from the shell by
running "dumpsys SurfaceFlinger".

Change-Id: I87646f4e926ac6d52a04ba130957abdfab99c491
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Use HW overlay planes
Sean Paul [Wed, 10 Jun 2015 18:32:51 +0000 (14:32 -0400)]
drm_hwcomposer: Use HW overlay planes

Now that buffers are sticking around while hwc wants them,
turn on use of HW overlay planes in the drm compositor.

Change-Id: I05fb0bfa54933c009168bfc7292d134e5e987542
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Reference count NvImporter buffers
Sean Paul [Wed, 10 Jun 2015 18:30:47 +0000 (14:30 -0400)]
drm_hwcomposer: Reference count NvImporter buffers

Instead of directly freeing buffers from the NvImporter
release callback, use reference counting to ensure that
we:
    (a) don't free the buffer while NvGralloc is still using it
    (b) don't free the buffer while HWC is still using it

Before this patch, we weren't satisifying (b). This would
cause us to free a buffer before and while it was on the
screen.

Change-Id: I6bbc541c72df4d5f12a8734de2f2e68168b73a07
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Don't compile all importers at once
Sean Paul [Mon, 8 Jun 2015 20:03:33 +0000 (16:03 -0400)]
drm_hwcomposer: Don't compile all importers at once

Choose based on the BoardConfig flags.

I'd like to revert this once drm_gralloc is available
in all working branches.

Change-Id: I171d8f9146bdca0f0671092b8e539031c2f64f0f
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Initialize DrmProperty type_ member
Sean Paul [Tue, 19 May 2015 15:10:50 +0000 (08:10 -0700)]
drm_hwcomposer: Initialize DrmProperty type_ member

Initialize it to an invalid value instead of INT.

Change-Id: I5d75b9a3696a748d6352d918263b482034a22001
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Fix case on DrmCrtc mode_valid_ member variable
Sean Paul [Mon, 18 May 2015 15:31:06 +0000 (08:31 -0700)]
drm_hwcomposer: Fix case on DrmCrtc mode_valid_ member variable

Change-Id: If2a431a4a18ea7908654a4a92a4a6acca8ed92d1
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Move event worker into VSyncWorker
Sean Paul [Wed, 13 May 2015 13:23:09 +0000 (06:23 -0700)]
drm_hwcomposer: Move event worker into VSyncWorker

Using the new Worker interface, split out the event worker
now that it just handles vsyncs.

Change-Id: I7ebc6237b10411fdba3b8826935921b8c83c4b6c
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Use hw planes + drm atomic interface
Sean Paul [Wed, 13 May 2015 13:33:23 +0000 (06:33 -0700)]
drm_hwcomposer: Use hw planes + drm atomic interface

Replace the basic, single overlay, modeset/flip implementation with
a new Compositor instantiation for drm. The new compositor uses the
drm atomic interface to composite layers to multiple hardware planes.

This change also introduces an importer argument in
Compositor::CreateComposition. By specifying the importer, Compositor
instances are responsible for cleaning up buffer objects submitted
via Composition::AddLayer.

Change-Id: Ic292829cd93475d754294b00428de132301092b2
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Add Importer to CreateComposition()
Sean Paul [Wed, 3 Jun 2015 19:50:21 +0000 (15:50 -0400)]
drm_hwcomposer: Add Importer to CreateComposition()

The Compositor will be responsible for releasing buffers that
are successfully added to a composition using AddLayer. To achieve
this, the Importer of the buffers must be provided to Compositor/Composition.

Change-Id: I1f0acd70c245b7a2b6c93649f247e30e7f2e9dc4
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Wrap the importers in a class
Sean Paul [Mon, 1 Jun 2015 18:11:52 +0000 (14:11 -0400)]
drm_hwcomposer: Wrap the importers in a class

This will allow us to move the importer functionality into the
drmcompositor.

Change-Id: I4274ebd1776c4d7879342c54a2b7c4095ebc50f4
Signed-off-by: Sean Paul <seanpaul@chromium.org>
8 years agodrm_hwcomposer: Allow importer to be specified from BoardConfig
Tomasz Figa [Wed, 3 Jun 2015 14:46:14 +0000 (10:46 -0400)]
drm_hwcomposer: Allow importer to be specified from BoardConfig

Use BOARD_DRM_HWCOMPOSER_BUFFER_IMPORTER from BoardConfig to
determine which importer to use.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: Ia081628830b78187ea1f8a3e3e4260188e130324

8 years agodrm_hwcomposer: add overlapping rectangle seperation algorithm
Zach Reizner [Wed, 1 Apr 2015 00:56:36 +0000 (17:56 -0700)]
drm_hwcomposer: add overlapping rectangle seperation algorithm

Change-Id: I40734ce77191ac37fb2a2c156d6010530df0434b

9 years agodrm_hwcomposer: Add Worker class to abstract thread nasties
Sean Paul [Wed, 13 May 2015 13:22:10 +0000 (06:22 -0700)]
drm_hwcomposer: Add Worker class to abstract thread nasties

This will allow us to spin up threads more easily.

Change-Id: I74add3d20ab14a61f3c646877a3ee17d0bd99ac4
Signed-off-by: Sean Paul <seanpaul@chromium.org>