drm-buffer: Make the "types" actual types

There is no reason why we should have an internal type enum when we have
all the infrastructure to just use multiple GObject types. Also there
was no code sharing between the old "types", the only common API was
getting the framebuffer ID, so lets make that a vfunc.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/584
This commit is contained in:
Jonas Ådahl
2019-05-20 22:08:35 +02:00
committed by Georges Basile Stavracas Neto
parent ed56edc7ba
commit 91ac64bb44
8 changed files with 419 additions and 268 deletions

View File

@ -22,28 +22,25 @@
#ifndef META_DRM_BUFFER_H
#define META_DRM_BUFFER_H
#include "backends/native/meta-gpu-kms.h"
#include <gbm.h>
#include <glib-object.h>
#include <stdint.h>
#define META_TYPE_DRM_BUFFER (meta_drm_buffer_get_type ())
G_DECLARE_FINAL_TYPE (MetaDrmBuffer,
meta_drm_buffer,
META, DRM_BUFFER,
GObject)
G_DECLARE_DERIVABLE_TYPE (MetaDrmBuffer,
meta_drm_buffer,
META, DRM_BUFFER,
GObject)
MetaDrmBuffer *
meta_drm_buffer_new_from_gbm (MetaGpuKms *gpu_kms,
struct gbm_surface *gbm_surface,
gboolean use_modifiers,
GError **error);
struct _MetaDrmBufferClass
{
GObjectClass parent_class;
uint32_t (* get_fb_id) (MetaDrmBuffer *buffer);
};
MetaDrmBuffer *
meta_drm_buffer_new_from_dumb (uint32_t dumb_fb_id);
uint32_t meta_drm_buffer_get_fb_id (const MetaDrmBuffer *buffer);
struct gbm_bo *meta_drm_buffer_get_bo (const MetaDrmBuffer *buffer);
uint32_t meta_drm_buffer_get_fb_id (MetaDrmBuffer *buffer);
#endif /* META_DRM_BUFFER_H */