使用gralloc_priv.h文件编译时出错

时间:2012-08-12 15:54:54

标签: c++

编程新手对我来说很容易。编译AOSP rom时收到错误。我在Ubuntu 12.04内核3.2.0.29上做了所有这些,如果这有帮助的话。

这是我收到的错误:

  

device / lge / c800 / include / gralloc_priv.h:在成员函数'T& Queue :: getHeadValue()\>常量“:   device / lge / c800 / include / gralloc_priv.h:169:55:错误:'LOGE'没有参数>取决于模板参数,因此'LOGE'的声明必须可用[-fpermissive]   device / lge / c800 / include / gralloc_priv.h:169:55:注意:(如果使用'-fpermissive',G ++将>接受您的代码,但不允许使用未声明的名称)

这是与头文件相关的代码部分:

/*
 * Copyright (C) 2008 The Android Open Source Project
 * Copyright (c) 2011-2012, Code Aurora Forum. 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.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef GRALLOC_PRIV_H_
#define GRALLOC_PRIV_H_

#include <stdint.h>
#include <limits.h>
#include <sys/cdefs.h>
#include <hardware/gralloc.h>
#include <pthread.h>
#include <errno.h>
#include <unistd.h>

#include <cutils/native_handle.h>

#include <linux/fb.h>

#if defined(__cplusplus) && defined(HDMI_DUAL_DISPLAY)
#include "overlayLib.h"
using namespace overlay;
#endif

enum {
    /* gralloc usage bits indicating the type
     * of allocation that should be used */

    /* ADSP heap is deprecated, use only if using pmem */
    GRALLOC_USAGE_PRIVATE_ADSP_HEAP       =       GRALLOC_USAGE_PRIVATE_0,
    /* SF heap is used for application buffers, is not secured */
    GRALLOC_USAGE_PRIVATE_UI_CONTIG_HEAP  =       GRALLOC_USAGE_PRIVATE_1,
    /* SMI heap is deprecated, use only if using pmem */
    GRALLOC_USAGE_PRIVATE_SMI_HEAP        =       GRALLOC_USAGE_PRIVATE_2,
    /* SYSTEM heap comes from kernel vmalloc,
     * can never be uncached, is not secured*/
    GRALLOC_USAGE_PRIVATE_SYSTEM_HEAP     =       GRALLOC_USAGE_PRIVATE_3,
    /* IOMMU heap comes from manually allocated pages,
     * can be cached/uncached, is not secured */
    GRALLOC_USAGE_PRIVATE_IOMMU_HEAP      =       0x01000000,
    /* MM heap is a carveout heap for video, can be secured*/
    GRALLOC_USAGE_PRIVATE_MM_HEAP         =       0x02000000,
    /* WRITEBACK heap is a carveout heap for writeback, can be secured*/
    GRALLOC_USAGE_PRIVATE_WRITEBACK_HEAP  =       0x04000000,
    /* CAMERA heap is a carveout heap for camera, is not secured*/
    GRALLOC_USAGE_PRIVATE_CAMERA_HEAP     =       0x08000000,

    /* Set this for allocating uncached memory (using O_DSYNC)
     * cannot be used with noncontiguous heaps */
    GRALLOC_USAGE_PRIVATE_UNCACHED        =       0x00100000,

    /* This flag needs to be set when using a non-contiguous heap from ION.
     * If not set, the system heap is assumed to be coming from ashmem
     */
    GRALLOC_USAGE_PRIVATE_ION             =       0x00200000,

    /* This flag can be set to disable genlock synchronization
     * for the gralloc buffer. If this flag is set the caller
     * is required to perform explicit synchronization.
     * WARNING - flag is outside the standard PRIVATE region
     * and may need to be moved if the gralloc API changes
     */
    GRALLOC_USAGE_PRIVATE_UNSYNCHRONIZED  =       0X00400000,

    /* Set this flag when you need to avoid mapping the memory in userspace */
    GRALLOC_USAGE_PRIVATE_DO_NOT_MAP      =       0X00800000,

    /* Buffer content should be displayed on an external display only */
    GRALLOC_USAGE_EXTERNAL_ONLY           =       0x00010000,

    /* Only this buffer content should be displayed on external, even if
     * other EXTERNAL_ONLY buffers are available. Used during suspend.
     */
    GRALLOC_USAGE_EXTERNAL_BLOCK          =       0x00020000,
};

enum {
    /* Gralloc perform enums
    */
    GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER = 0x080000001,
};


enum {
    GPU_COMPOSITION,
    C2D_COMPOSITION,
    MDP_COMPOSITION,
    CPU_COMPOSITION,
};

/* numbers of max buffers for page flipping */
#define NUM_FRAMEBUFFERS_MIN 2
#define NUM_FRAMEBUFFERS_MAX 3

/* number of default bufers for page flipping */
#define NUM_DEF_FRAME_BUFFERS 2
#define NO_SURFACEFLINGER_SWAPINTERVAL
#define INTERLACE_MASK 0x80
#define S3D_FORMAT_MASK 0xFF000
#define COLOR_FORMAT(x) (x & 0xFFF) // Max range for colorFormats is 0 - FFF
#define DEVICE_PMEM "/dev/pmem"
#define DEVICE_PMEM_ADSP "/dev/pmem_adsp"
#define DEVICE_PMEM_SMIPOOL "/dev/pmem_smipool"
/*****************************************************************************/
#ifdef __cplusplus

//XXX: Remove framebuffer specific classes and defines to a different header
template <class T>
struct Node
{
    T data;
    Node<T> *next;
};


template <class T>
struct Node
{
    T data;
    Node<T> *next;
};

template <class T>
class Queue
{
public:
    Queue(): front(NULL), back(NULL), len(0) {dummy = new T;}
    ~Queue()
    {
        clear();
        delete dummy;
    }
    void push(const T& item)   //add an item to the back of the queue
    {
        if(len != 0) {         //if the queue is not empty
            back->next = new Node<T>; //create a new node
            back = back->next; //set the new node as the back node
            back->data = item;
            back->next = NULL;
        } else {
            back = new Node<T>;
            back->data = item;
            back->next = NULL;
            front = back;
       }
       len++;
    }
    void pop()                 //remove the first item from the queue
    {
        if (isEmpty())
            return;            //if the queue is empty, no node to dequeue
        T item = front->data;
        Node<T> *tmp = front;
        front = front->next;
        delete tmp;
        if(front == NULL)      //if the queue is empty, update the back pointer
            back = NULL;
        len--;
        return;
    }
    T& getHeadValue() const    //return the value of the first item in the queue
    {                          //without modification to the structure
        if (isEmpty()) {
            LOGE("Error can't get head of empty queue");
            return *dummy;
        }
        return front->data;
    }

    bool isEmpty() const       //returns true if no elements are in the queue
    {
        return (front == NULL);
    }

    size_t size() const        //returns the amount of elements in the queue
    {
        return len;
    }

如果有人可以帮助解决此错误并向我解释,那将非常有帮助。如果需要更多信息,我会发布任何需要的信息。我可能会在这里发布更多错误,但想看看我如何处理这个第一篇文章。感谢所有提前。

1 个答案:

答案 0 :(得分:0)

您可以尝试在#include <cutils/log.h>之前的代码中加入gralloc_priv.h吗?

或使用参数-fpermissive进行编译,如错误输出所示。