gralloc: Add support for PRIV_FLAGS_DISP_CONSUMER

On some targets, Venus h/w can support 4k decoding but mdss
can handle only upto 2k.
So, in usecases where the resolution of the video
is more than 2k, venus h/w would downscale the content to 2k
and allocate the output decoded buffers at 2k.

In cases where display(SF) is not the consumer of the
decoded buffers(for ex:transcoding, etc), downscaling
need not happen.

So, video f/w needs a mechanism to identify the consumer
of the decoded buffers and allocate them accordingly.

The buffers would be allocated at the incoming video
resolution by default. During allocation, the gralloc private
flag PRIV_FLAGS_DISP_CONSUMER would be set to indicate to the
video f/w if display is the consumer of the content.

If display happens to be the consumer and the resolution
of the incoming video is more than 2k, video f/w would
cancel the earlier allocated buffers and would allocate
the new buffers at 2k.

Change-Id: Ic6e562d357eadb8d49b166b454746f91ccc85ed8
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index d595a5b..203ab9d 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -143,6 +143,10 @@
             flags |= private_handle_t::PRIV_FLAGS_NON_CPU_WRITER;
         }
 
+        if(usage & GRALLOC_USAGE_HW_COMPOSER) {
+            flags |= private_handle_t::PRIV_FLAGS_DISP_CONSUMER;
+        }
+
         if(false == data.uncached) {
             flags |= private_handle_t::PRIV_FLAGS_CACHED;
         }
diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h
index efc7d67..7a5fc84 100644
--- a/libgralloc/gralloc_priv.h
+++ b/libgralloc/gralloc_priv.h
@@ -203,7 +203,9 @@
             // Buffer rendered using CPU/SW renderer
             PRIV_FLAGS_CPU_RENDERED       = 0x04000000,
             // Buffer is allocated with UBWC alignment
-            PRIV_FLAGS_UBWC_ALIGNED       = 0x08000000
+            PRIV_FLAGS_UBWC_ALIGNED       = 0x08000000,
+            // Buffer allocated will be consumed by SF/HWC
+            PRIV_FLAGS_DISP_CONSUMER      = 0x10000000
         };
 
         // file-descriptors