bool DrmPlane::Initialize(uint32_t gpu_fd,
const std::vector<uint32_t>& formats) {
supported_formats_ = formats;
+ uint32_t total_size = supported_formats_.size();
+ for (uint32_t j = 0; j < total_size; j++) {
+ uint32_t format = supported_formats_.at(j);
+ switch (format) {
+ case DRM_FORMAT_NV12:
+ case DRM_FORMAT_YVU420: // YV12
+ case DRM_FORMAT_YUV420: // I420
+ case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YUV444:
+ case DRM_FORMAT_YUYV: // YUY2
+ prefered_video_format_ = format;
+ break;
+ }
+ }
+
+ if (prefered_video_format_ == 0) {
+ for (uint32_t j = 0; j < total_size; j++) {
+ uint32_t format = supported_formats_.at(j);
+ switch (format) {
+ case DRM_FORMAT_RGB888:
+ case DRM_FORMAT_XRGB8888:
+ case DRM_FORMAT_XBGR8888:
+ case DRM_FORMAT_RGBX8888:
+ case DRM_FORMAT_ABGR8888:
+ case DRM_FORMAT_RGBA8888:
+ prefered_video_format_ = format;
+ break;
+ }
+ }
+ }
ScopedDrmObjectPropertyPtr plane_props(
drmModeObjectGetProperties(gpu_fd, id_, DRM_MODE_OBJECT_PLANE));
return format;
}
+uint32_t DrmPlane::GetPreferredVideoFormat() const {
+ return prefered_video_format_;
+}
+
void DrmPlane::Dump() const {
DUMPTRACE("Plane Information Starts. -------------");
DUMPTRACE("Plane ID: %d", id_);
if (in_fence_fd_prop_.id != 0)
DUMPTRACE("IN_FENCE_FD is supported.");
+ DUMPTRACE("Preferred Video Formar: %4.4s", (char*)&(prefered_video_format_));
+
DUMPTRACE("Plane Information Ends. -------------");
}
bool IsSupportedFormat(uint32_t format) override;
uint32_t GetFormatForFrameBuffer(uint32_t format) override;
+ uint32_t GetPreferredVideoFormat() const override;
void Dump() const override;
std::vector<uint32_t> supported_formats_;
int32_t kms_fence_ = 0;
+ uint32_t prefered_video_format_ = 0;
};
} // namespace hwcomposer