OSDN Git Service

Remove choose_drm_modifier
[android-x86/external-IA-Hardware-Composer.git] / os / android / gralloc1bufferhandler.cpp
index 661e1a6..61eac39 100644 (file)
@@ -149,18 +149,15 @@ bool Gralloc1BufferHandler::CreateBuffer(uint32_t w, uint32_t h, int format,
 
   set_format_(gralloc1_dvc, temp->gralloc1_buffer_descriptor_t_, pixel_format);
 #ifdef ENABLE_RBC
+  uint64_t modifier = 0;
   if (set_modifier_) {
-    uint64_t modifier = 0;
     if (preferred_modifier != -1) {
       modifier = preferred_modifier;
-    } else {
-      modifier = choose_drm_modifier(format);
     }
-
     set_modifier_(gralloc1_dvc, temp->gralloc1_buffer_descriptor_t_, modifier);
   }
 
-  if (modifier_used) {
+  if (modifier_used && modifier != DRM_FORMAT_MOD_NONE) {
     *modifier_used = true;
   }
 #else
@@ -179,7 +176,9 @@ bool Gralloc1BufferHandler::CreateBuffer(uint32_t w, uint32_t h, int format,
     usage |= GRALLOC1_CONSUMER_USAGE_HWCOMPOSER |
              GRALLOC1_PRODUCER_USAGE_GPU_RENDER_TARGET |
              GRALLOC1_CONSUMER_USAGE_GPU_TEXTURE;
-  } else if (layer_type == hwcomposer::kLayerVideo) {
+    layer_type = hwcomposer::kLayerNormal;
+  } else if (layer_type == hwcomposer::kLayerVideo ||
+             layer_type == hwcomposer::kLayerProtected) {
     switch (pixel_format) {
       case HAL_PIXEL_FORMAT_YCbCr_422_I:
       case HAL_PIXEL_FORMAT_Y8:
@@ -207,6 +206,7 @@ bool Gralloc1BufferHandler::CreateBuffer(uint32_t w, uint32_t h, int format,
   }
 
   temp->hwc_buffer_ = true;
+  temp->meta_data_.usage_ = (hwcomposer::HWCLayerType)layer_type;
   *handle = temp;
 
   return true;
@@ -298,7 +298,7 @@ int32_t Gralloc1BufferHandler::UnMap(HWCNativeHandle handle,
 }
 
 bool Gralloc1BufferHandler::GetInterlace(HWCNativeHandle handle) const {
-  if (((struct cros_gralloc_handle *)handle->handle_)->is_interlaced > 0)
+  if (((const struct cros_gralloc_handle *)handle->handle_)->is_interlaced > 0)
     return true;
   else
     return false;