diff options
Diffstat (limited to 'msm8909/libgralloc/gr.h')
-rw-r--r-- | msm8909/libgralloc/gr.h | 95 |
1 files changed, 77 insertions, 18 deletions
diff --git a/msm8909/libgralloc/gr.h b/msm8909/libgralloc/gr.h index 1f902a55..dad4a38a 100644 --- a/msm8909/libgralloc/gr.h +++ b/msm8909/libgralloc/gr.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2008 The Android Open Source Project - * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. + * Copyright (c) 2011 - 2017, The Linux Foundation. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,11 @@ #include <hardware/gralloc.h> #include <pthread.h> #include <errno.h> +#include <unistd.h> #include <cutils/native_handle.h> #include <utils/Singleton.h> +#include "adreno_utils.h" /*****************************************************************************/ @@ -34,7 +36,7 @@ struct private_module_t; struct private_handle_t; inline unsigned int roundUpToPageSize(unsigned int x) { - return (x + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1); + return (x + (getpagesize()-1)) & ~(getpagesize()-1); } template <class Type> @@ -52,15 +54,6 @@ unsigned int getBufferSizeAndDimensions(int width, int height, int format, unsigned int getBufferSizeAndDimensions(int width, int height, int format, int& alignedw, int &alignedh); - -// Attributes include aligned width, aligned height, tileEnabled and size of the buffer -void getBufferAttributes(int width, int height, int format, int usage, - int& alignedw, int &alignedh, - int& tileEnabled, unsigned int &size); - - -bool isMacroTileEnabled(int format, int usage); - int decideBufferHandlingMechanism(int format, const char *compositionUsed, int hasBlitEngine, int *needConversion, int *useBufferDirectly); @@ -70,7 +63,17 @@ int decideBufferHandlingMechanism(int format, const char *compositionUsed, int alloc_buffer(private_handle_t **pHnd, int w, int h, int format, int usage); void free_buffer(private_handle_t *hnd); int getYUVPlaneInfo(private_handle_t* pHnd, struct android_ycbcr* ycbcr); +int getRgbDataAddress(private_handle_t* pHnd, void** rgb_data); +// To query if UBWC is enabled, based on format and usage flags +bool isUBwcEnabled(int format, int usage); + +// Function to check if the format is an RGB format +bool isUncompressedRgbFormat(int format); + +// Returns number of planes, stride and offset of each plane for a given w,h,f +int getBufferLayout(private_handle_t *hnd, uint32_t stride[4], + uint32_t offset[4], uint32_t *num_planes); /*****************************************************************************/ class Locker { @@ -106,23 +109,54 @@ class AdrenoMemInfo : public android::Singleton <AdrenoMemInfo> ~AdrenoMemInfo(); /* + * Function to compute aligned width and aligned height based on + * width, height, format and usage flags. + * + * @return aligned width, aligned height + */ + void getAlignedWidthAndHeight(int width, int height, int format, + int usage, int& aligned_w, int& aligned_h); + + /* + * Function to compute aligned width and aligned height based on + * private handle + * + * @return aligned width, aligned height + */ + void getAlignedWidthAndHeight(const private_handle_t *hnd, int& aligned_w, int& aligned_h); + + /* * Function to compute the adreno aligned width and aligned height * based on the width and format. * * @return aligned width, aligned height */ - void getAlignedWidthAndHeight(int width, int height, int format, + void getGpuAlignedWidthHeight(int width, int height, int format, int tileEnabled, int& alignedw, int &alignedh); /* - * Function to return whether GPU support MacroTile feature + * Function to compute unaligned width and unaligned height based on + * private handle * - * @return >0 : supported - * 0 : not supported + * @return unaligned width, unaligned height + */ + void getUnalignedWidthAndHeight(const private_handle_t *hnd, int& unaligned_w, + int& unaligned_h); + /* + * Function to query whether GPU supports UBWC for given HAL format + * @return > 0 : supported + * 0 : not supported */ - int isMacroTilingSupportedByGPU(); + int isUBWCSupportedByGPU(int format); + + /* + * Function to get the corresponding Adreno format for given HAL format + */ + ADRENOPIXELFORMAT getGpuPixelFormat(int hal_format); private: + // Overriding flag to disable UBWC alloc for graphics stack + int gfx_ubwc_disable; // Pointer to the padding library. void *libadreno_utils; @@ -141,8 +175,6 @@ class AdrenoMemInfo : public android::Singleton <AdrenoMemInfo> int *aligned_w, int *aligned_h); - int (*LINK_adreno_isMacroTilingSupportedByGpu) (void); - void(*LINK_adreno_compute_compressedfmt_aligned_width_and_height)( int width, int height, @@ -154,6 +186,33 @@ class AdrenoMemInfo : public android::Singleton <AdrenoMemInfo> int *aligned_h, int *bpp); + int (*LINK_adreno_isUBWCSupportedByGpu) (ADRENOPIXELFORMAT format); + unsigned int (*LINK_adreno_get_gpu_pixel_alignment) (); }; + + +class MDPCapabilityInfo : public android::Singleton <MDPCapabilityInfo> +{ + int isUBwcSupported = 0; + int isWBUBWCSupported = 0; + + public: + MDPCapabilityInfo(); + /* + * Function to return whether MDP supports UBWC feature + * + * @return 1 : supported + * 0 : not supported + */ + int isUBwcSupportedByMDP() { return isUBwcSupported; } + /* + * Function to return whether MDP WB block outputs UBWC format + * + * @return 1 : supported + * 0 : not supported + */ + int isWBUBWCSupportedByMDP() { return isWBUBWCSupported; } +}; + #endif /* GR_H_ */ |