diff --git a/src/backends/native/meta-render-device.c b/src/backends/native/meta-render-device.c index 389724dd0..982f30814 100644 --- a/src/backends/native/meta-render-device.c +++ b/src/backends/native/meta-render-device.c @@ -25,6 +25,7 @@ #include "backends/meta-backend-private.h" #include "backends/meta-egl.h" #include "backends/native/meta-backend-native-types.h" +#include "backends/native/meta-drm-buffer-dumb.h" enum { @@ -381,3 +382,31 @@ meta_render_device_import_dma_buf (MetaRenderDevice *render_device, return NULL; } + +MetaDrmBuffer * +meta_render_device_allocate_dumb_buf (MetaRenderDevice *render_device, + int width, + int height, + uint32_t format, + GError **error) +{ + MetaRenderDevicePrivate *priv = + meta_render_device_get_instance_private (render_device); + MetaDrmBufferDumb *buffer_dumb; + + if (!priv->device_file) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, + "No device file to allocate from"); + return NULL; + } + + buffer_dumb = meta_drm_buffer_dumb_new (priv->device_file, + width, height, + format, + error); + if (!buffer_dumb) + return NULL; + + return META_DRM_BUFFER (buffer_dumb); +} diff --git a/src/backends/native/meta-render-device.h b/src/backends/native/meta-render-device.h index 9428283b9..466681353 100644 --- a/src/backends/native/meta-render-device.h +++ b/src/backends/native/meta-render-device.h @@ -52,4 +52,10 @@ MetaDrmBuffer * meta_render_device_import_dma_buf (MetaRenderDevice *render_dev MetaDrmBuffer *buffer, GError **error); +MetaDrmBuffer * meta_render_device_allocate_dumb_buf (MetaRenderDevice *render_device, + int width, + int height, + uint32_t format, + GError **error); + #endif /* META_RENDER_DEVICE_H */