diff --git a/src/drm.cpp b/src/drm.cpp index 12aa0e1..112b223 100644 --- a/src/drm.cpp +++ b/src/drm.cpp @@ -167,16 +167,6 @@ static struct plane *find_primary_plane(struct drm_t *drm) if (primary == nullptr) return nullptr; - if (!get_plane_formats(drm, primary, &drm->plane_formats)) { - return nullptr; - } - - g_nDRMFormat = pick_plane_format(&drm->plane_formats); - if ( g_nDRMFormat == DRM_FORMAT_INVALID ) { - fprintf( stderr, "Primary plane doesn't support XRGB8888 nor ARGB8888\n" ); - return nullptr; - } - return primary; } @@ -548,6 +538,16 @@ int init_drm(struct drm_t *drm, const char *device_name) return -1; } + if (!get_plane_formats(drm, drm->plane, &drm->primary_formats)) { + return -1; + } + + g_nDRMFormat = pick_plane_format(&drm->primary_formats); + if ( g_nDRMFormat == DRM_FORMAT_INVALID ) { + fprintf( stderr, "Primary plane doesn't support XRGB8888 nor ARGB8888\n" ); + return -1; + } + drm->kms_in_fence_fd = -1; std::thread flip_handler_thread( flip_handler_thread_run ); diff --git a/src/drm.hpp b/src/drm.hpp index dd6dc43..57f007c 100644 --- a/src/drm.hpp +++ b/src/drm.hpp @@ -79,7 +79,7 @@ struct drm_t { int kms_in_fence_fd; int kms_out_fence_fd; - struct wlr_drm_format_set plane_formats; + struct wlr_drm_format_set primary_formats; drmModeAtomicReq *req; uint32_t flags; diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp index eb3d061..994f4cd 100644 --- a/src/rendervulkan.cpp +++ b/src/rendervulkan.cpp @@ -381,7 +381,7 @@ bool CVulkanTexture::BInit( uint32_t width, uint32_t height, VkFormat format, cr } else { - const struct wlr_drm_format *drmFormatDesc = wlr_drm_format_set_get( &g_DRM.plane_formats, drmFormat ); + const struct wlr_drm_format *drmFormatDesc = wlr_drm_format_set_get( &g_DRM.primary_formats, drmFormat ); assert( drmFormatDesc != nullptr ); possibleModifiers = drmFormatDesc->modifiers; numPossibleModifiers = drmFormatDesc->len;