62 lines
1.5 KiB
C++
62 lines
1.5 KiB
C++
/*
|
|
* Copyright (C) 2024 Amlogic Corporation.
|
|
*
|
|
* 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 DRM_PROPERTY_H
|
|
#define DRM_PROPERTY_H
|
|
|
|
#include <stdint.h>
|
|
#include <string>
|
|
#include <xf86drmMode.h>
|
|
#include <drm/drm_mode.h>
|
|
#include "DrmProperties.h"
|
|
|
|
class DrmProperty {
|
|
public:
|
|
DrmProperty(int drvFd, drmModePropertyPtr p, uint32_t objectId, uint64_t value);
|
|
~DrmProperty();
|
|
|
|
uint32_t getId() { return mPropRes.prop_id; }
|
|
|
|
int setValue(uint64_t val);
|
|
uint64_t getValue();
|
|
|
|
/*get prop data*/
|
|
int getBlobData(std::vector<uint8_t> & blob);
|
|
int getEnumValueWithName(const char *name, uint64_t & val);
|
|
int getRangeValue(uint64_t & min, uint64_t & max);
|
|
|
|
bool isImmutable() {return mPropRes.flags & DRM_MODE_PROP_IMMUTABLE;}
|
|
|
|
int apply(drmModeAtomicReqPtr req);
|
|
|
|
void dump(std::string &dumpstr) { }
|
|
|
|
protected:
|
|
int32_t getBlobData(std::vector<uint8_t> & blob, uint32_t blobId);
|
|
|
|
protected:
|
|
int mDrvFd;
|
|
|
|
uint64_t mValue;
|
|
uint32_t mType;
|
|
uint32_t mComponentId;
|
|
|
|
drmModePropertyRes mPropRes;
|
|
};
|
|
|
|
#endif
|
|
|