13e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza/*
2ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos * Copyright 2015 The Android Open Source Project
33e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza *
43e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza * Licensed under the Apache License, Version 2.0 (the "License");
53e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza * you may not use this file except in compliance with the License.
63e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza * You may obtain a copy of the License at
73e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza *
83e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza *      http://www.apache.org/licenses/LICENSE-2.0
93e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza *
103e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza * Unless required by applicable law or agreed to in writing, software
113e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza * distributed under the License is distributed on an "AS IS" BASIS,
123e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza * See the License for the specific language governing permissions and
143e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza * limitations under the License.
153e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza */
163e96f1982fda358424b0b75f394cbf7c1794a072Dan Stoza
17289ade165e60b5f71734d30e535f16eb1f4313adDan Stoza#include <gui/BufferSlot.h>
18289ade165e60b5f71734d30e535f16eb1f4313adDan Stoza
19289ade165e60b5f71734d30e535f16eb1f4313adDan Stozanamespace android {
20289ade165e60b5f71734d30e535f16eb1f4313adDan Stoza
21ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos
22ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballosconst char* BufferState::string() const {
23ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos
24ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos    if (isShared()) {
25ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos        return "SHARED";
26ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos    }
27ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos
28ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos    if (isFree()) {
29ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos        return "FREE";
30ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos    }
31ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos
32ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos    if (isAcquired()) {
33ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos        return "ACQUIRED";
34ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos    }
35ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos
36ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos    if (isDequeued()) {
37ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos        return "DEQUEUED";
38ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos    }
39ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos
40ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos    if (isQueued()) {
41ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos        return "QUEUED";
42289ade165e60b5f71734d30e535f16eb1f4313adDan Stoza    }
43ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos    return "UNKNOWN";
44289ade165e60b5f71734d30e535f16eb1f4313adDan Stoza}
45289ade165e60b5f71734d30e535f16eb1f4313adDan Stoza
46289ade165e60b5f71734d30e535f16eb1f4313adDan Stoza} // namespace android
47