summaryrefslogtreecommitdiffstats
path: root/src/gbm/backends
diff options
context:
space:
mode:
Diffstat (limited to 'src/gbm/backends')
-rw-r--r--src/gbm/backends/dri/gbm_dri.c30
-rw-r--r--src/gbm/backends/dri/gbm_driint.h15
2 files changed, 45 insertions, 0 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 1e02287651c..5398e3dd400 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -387,6 +387,34 @@ gbm_dri_bo_create(struct gbm_device *gbm,
return &bo->base.base;
}
+static struct gbm_surface *
+gbm_dri_surface_create(struct gbm_device *gbm,
+ uint32_t width, uint32_t height,
+ uint32_t format, uint32_t flags)
+{
+ struct gbm_dri_surface *surf;
+
+ surf = calloc(1, sizeof *surf);
+ if (surf == NULL)
+ return NULL;
+
+ surf->base.gbm = gbm;
+ surf->base.width = width;
+ surf->base.height = height;
+ surf->base.format = format;
+ surf->base.flags = flags;
+
+ return &surf->base;
+}
+
+static void
+gbm_dri_surface_destroy(struct gbm_surface *_surf)
+{
+ struct gbm_dri_surface *surf = gbm_dri_surface(_surf);
+
+ free(surf);
+}
+
static void
dri_destroy(struct gbm_device *gbm)
{
@@ -414,6 +442,8 @@ dri_device_create(int fd)
dri->base.base.is_format_supported = gbm_dri_is_format_supported;
dri->base.base.bo_destroy = gbm_dri_bo_destroy;
dri->base.base.destroy = dri_destroy;
+ dri->base.base.surface_create = gbm_dri_surface_create;
+ dri->base.base.surface_destroy = gbm_dri_surface_destroy;
dri->base.type = GBM_DRM_DRIVER_TYPE_DRI;
dri->base.base.name = "drm";
diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h
index d801a081375..514b5a620c1 100644
--- a/src/gbm/backends/dri/gbm_driint.h
+++ b/src/gbm/backends/dri/gbm_driint.h
@@ -61,6 +61,15 @@ struct gbm_dri_bo {
__DRIimage *image;
};
+struct gbm_dri_surface {
+ struct gbm_surface base;
+
+ __DRIbuffer *(*get_front_buffer)(struct gbm_dri_surface *, void *);
+ void (*release_buffer)(struct gbm_dri_surface *, __DRIbuffer *, void *);
+ int (*has_free_buffers)(void *);
+ void *dri_private;
+};
+
static inline struct gbm_dri_device *
gbm_dri_device(struct gbm_device *gbm)
{
@@ -73,6 +82,12 @@ gbm_dri_bo(struct gbm_bo *bo)
return (struct gbm_dri_bo *) bo;
}
+static inline struct gbm_dri_surface *
+gbm_dri_surface(struct gbm_surface *surface)
+{
+ return (struct gbm_dri_surface *) surface;
+}
+
char *
dri_fd_get_driver_name(int fd);