From a7664c409c620ed6edb3e84622ff854f682ad967 Mon Sep 17 00:00:00 2001 From: Ander Conselvan de Oliveira Date: Wed, 14 Dec 2011 12:00:02 +0200 Subject: gbm: implement basic gbm_surface on dri backend Make gbm_surface_create return something that the drm egl platform can use. --- src/gbm/backends/dri/gbm_dri.c | 16 +++++++++++++++- src/gbm/backends/dri/gbm_driint.h | 10 ++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index ec5dad5ca6..c1c0bede86 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -340,12 +340,26 @@ gbm_dri_surface_create(struct gbm_device *gbm, uint32_t width, uint32_t height, enum gbm_bo_format format) { - return NULL; + 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; + + 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 struct gbm_bo * diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h index d801a08137..d04ae6be75 100644 --- a/src/gbm/backends/dri/gbm_driint.h +++ b/src/gbm/backends/dri/gbm_driint.h @@ -61,6 +61,10 @@ struct gbm_dri_bo { __DRIimage *image; }; +struct gbm_dri_surface { + struct gbm_surface base; +}; + static inline struct gbm_dri_device * gbm_dri_device(struct gbm_device *gbm) { @@ -73,6 +77,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); -- cgit v1.2.3