OSDN Git Service

Allow to create FB with preferred format.
authorKalyan Kondapally <kalyan.kondapally@intel.com>
Sun, 10 Dec 2017 12:02:00 +0000 (04:02 -0800)
committerKalyan Kondapally <kalyan.kondapally@intel.com>
Sun, 10 Dec 2017 12:02:00 +0000 (04:02 -0800)
On primary plane, we sometimes fallback to use XRGB format if
ARGB is not supported. As we cache buffers now, we check if fb is
present and if so ignore the request. In this case we should
delete existing fb and create a new one.

Jira: None.
Test: All hwc-val tests pass on Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
common/display/displayqueue.cpp
wsi/drm/drmbuffer.cpp

index b07c9e4..ffe89b1 100644 (file)
@@ -258,7 +258,10 @@ void DisplayQueue::GetCachedLayers(const std::vector<OverlayLayer>& layers,
     } else {
       const OverlayLayer* layer =
           &(*(layers.begin() + last_plane.source_layers().front()));
-      layer->GetBuffer()->CreateFrameBuffer(gpu_fd_);
+      if (layer->GetBuffer()->GetFb() == 0) {
+        layer->GetBuffer()->CreateFrameBuffer(gpu_fd_);
+      }
+
       last_plane.SetOverlayLayer(layer);
       if (layer->HasLayerContentChanged() || layer->HasDimensionsChanged()) {
         ignore_commit = false;
index 533f20d..25902d5 100644 (file)
@@ -240,10 +240,13 @@ void DrmBuffer::SetRecommendedFormat(uint32_t format) {
 
 bool DrmBuffer::CreateFrameBuffer(uint32_t gpu_fd) {
   if (image_.drm_fd_) {
-    // Has been created before
-    return true;
+    ResourceHandle temp;
+    temp.drm_fd_ = image_.drm_fd_;
+    resource_manager_->MarkResourceForDeletion(temp, false);
   }
 
+  image_.drm_fd_ = 0;
+
   int ret = drmModeAddFB2(gpu_fd, width_, height_, frame_buffer_format_,
                           gem_handles_, pitches_, offsets_, &image_.drm_fd_, 0);