mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 03:20:46 -05:00
onscreen/native: Add API to check whether buffer is scanout compatible
While this is fairly incomplete, as to check things fully we need to use TEST_ONLY in atomic to try out a complete assignment on the device, but this works well enough for legacy non-modifier cases. https://gitlab.gnome.org/GNOME/mutter/merge_requests/798
This commit is contained in:
parent
3dd8861fbf
commit
b9fe9c736a
@ -2220,6 +2220,48 @@ meta_renderer_native_create_dma_buf (CoglRenderer *cogl_renderer,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_onscreen_native_is_buffer_scanout_compatible (CoglOnscreen *onscreen,
|
||||||
|
uint32_t drm_format,
|
||||||
|
uint64_t drm_modifier,
|
||||||
|
uint32_t stride)
|
||||||
|
{
|
||||||
|
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||||
|
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
||||||
|
MetaDrmBuffer *fb;
|
||||||
|
struct gbm_bo *gbm_bo;
|
||||||
|
|
||||||
|
if (onscreen_native->crtc->config->transform != META_MONITOR_TRANSFORM_NORMAL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (onscreen_native->secondary_gpu_state)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!onscreen_native->gbm.surface)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
fb = onscreen_native->gbm.current_fb ? onscreen_native->gbm.current_fb
|
||||||
|
: onscreen_native->gbm.next_fb;
|
||||||
|
if (!fb)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!META_IS_DRM_BUFFER_GBM (fb))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
gbm_bo = meta_drm_buffer_gbm_get_bo (META_DRM_BUFFER_GBM (fb));
|
||||||
|
|
||||||
|
if (gbm_bo_get_format (gbm_bo) != drm_format)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (gbm_bo_get_modifier (gbm_bo) != drm_modifier)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (gbm_bo_get_stride (gbm_bo) != stride)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
|
meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
|
||||||
CoglScanout *scanout)
|
CoglScanout *scanout)
|
||||||
|
@ -57,4 +57,9 @@ void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native);
|
|||||||
|
|
||||||
int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native);
|
int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native);
|
||||||
|
|
||||||
|
gboolean meta_onscreen_native_is_buffer_scanout_compatible (CoglOnscreen *onscreen,
|
||||||
|
uint32_t drm_format,
|
||||||
|
uint64_t drm_modifier,
|
||||||
|
uint32_t stride);
|
||||||
|
|
||||||
#endif /* META_RENDERER_NATIVE_H */
|
#endif /* META_RENDERER_NATIVE_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user