summaryrefslogtreecommitdiff
path: root/drmdisplaycompositor.h
diff options
context:
space:
mode:
authorZach Reizner <zachr@google.com>2015-07-16 10:14:26 -0700
committerZach Reizner <zachr@google.com>2015-07-20 19:45:40 -0700
commit2317bb19d8663efc31e6fcd8cf7fd2a73577253d (patch)
tree40ee67dc139346c62533ea00a2a5542b05e86c7c /drmdisplaycompositor.h
parentece04894ab2d2fc3d5001a9e50a242b2d3f765da (diff)
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
Diffstat (limited to 'drmdisplaycompositor.h')
-rw-r--r--drmdisplaycompositor.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/drmdisplaycompositor.h b/drmdisplaycompositor.h
index 9f50664..46d71ae 100644
--- a/drmdisplaycompositor.h
+++ b/drmdisplaycompositor.h
@@ -20,6 +20,7 @@
#include "drm_hwcomposer.h"
#include "drmcomposition.h"
#include "drmcompositorworker.h"
+#include "drmframebuffer.h"
#include <pthread.h>
#include <queue>
@@ -28,8 +29,12 @@
#include <hardware/hardware.h>
#include <hardware/hwcomposer.h>
+#define DRM_DISPLAY_BUFFERS 2
+
namespace android {
+class GLWorkerCompositor;
+
class DrmDisplayCompositor {
public:
DrmDisplayCompositor();
@@ -46,6 +51,7 @@ class DrmDisplayCompositor {
private:
DrmDisplayCompositor(const DrmDisplayCompositor &) = delete;
+ int ApplyPreComposite(DrmDisplayComposition *display_comp);
int ApplyFrame(DrmDisplayComposition *display_comp);
int ApplyDpms(DrmDisplayComposition *display_comp);
@@ -62,6 +68,10 @@ class DrmDisplayCompositor {
bool initialized_;
bool active_;
+ int framebuffer_index_;
+ DrmFramebuffer framebuffers_[DRM_DISPLAY_BUFFERS];
+ std::unique_ptr<GLWorkerCompositor> pre_compositor_;
+
// mutable since we need to acquire in HaveQueuedComposites
mutable pthread_mutex_t lock_;