summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>2011-12-14 12:00:02 +0200
committerRobert Bragg <robert@linux.intel.com>2012-01-16 13:45:27 +0000
commita7664c409c620ed6edb3e84622ff854f682ad967 (patch)
tree95bfc3126436c8e48032c1073fe31c69768d9d8f /src
parenta5a4634872099c34b91cf04f35123cf9580499f9 (diff)
gbm: implement basic gbm_surface on dri backend
Make gbm_surface_create return something that the drm egl platform can use.
Diffstat (limited to 'src')
-rw-r--r--src/gbm/backends/dri/gbm_dri.c16
-rw-r--r--src/gbm/backends/dri/gbm_driint.h10
2 files changed, 25 insertions, 1 deletions
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);