[Mesa-dev] [PATCH 5/6] st/egl: Add a experimental drm egl state tracker

Jakob Bornecrantz wallbraker at gmail.com
Sat May 29 05:56:33 PDT 2010


This currently doesn't use the native interface or the common
egl state tracker code. This is to allow rapid experimentation
and testing features that might fail.
---
 src/gallium/state_trackers/egl/Makefile          |   15 ++-
 src/gallium/state_trackers/egl/drm/Makefile      |   19 +++
 src/gallium/state_trackers/egl/drm/drm_context.c |   92 +++++++++++++
 src/gallium/state_trackers/egl/drm/drm_display.c |  153 ++++++++++++++++++++++
 src/gallium/state_trackers/egl/drm/drm_image.c   |   86 ++++++++++++
 src/gallium/state_trackers/egl/drm/drm_surface.c |  149 +++++++++++++++++++++
 src/gallium/state_trackers/egl/drm/drm_tracker.h |  128 ++++++++++++++++++
 src/gallium/targets/Makefile.egl                 |    6 +
 8 files changed, 645 insertions(+), 3 deletions(-)
 create mode 100644 src/gallium/state_trackers/egl/drm/Makefile
 create mode 100644 src/gallium/state_trackers/egl/drm/drm_context.c
 create mode 100644 src/gallium/state_trackers/egl/drm/drm_display.c
 create mode 100644 src/gallium/state_trackers/egl/drm/drm_image.c
 create mode 100644 src/gallium/state_trackers/egl/drm/drm_surface.c
 create mode 100644 src/gallium/state_trackers/egl/drm/drm_tracker.h

diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile
index a3c1bb4..dc2dbfd 100644
--- a/src/gallium/state_trackers/egl/Makefile
+++ b/src/gallium/state_trackers/egl/Makefile
@@ -29,10 +29,13 @@ kms_INCLUDES = $(shell pkg-config --cflags-only-I libdrm)
 kms_SOURCES = $(wildcard kms/*.c)
 kms_OBJECTS = $(kms_SOURCES:.c=.o)
 
+drm_INCLUDES = $(shell pkg-config --cflags-only-I libdrm)
+drm_SOURCES = $(wildcard drm/*.c)
+drm_OBJECTS = $(drm_SOURCES:.c=.o)
 
-ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(kms_INCLUDES)
-ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(kms_SOURCES)
-ALL_OBJECTS = $(common_OBJECTS) $(x11_OBJECTS) $(kms_OBJECTS)
+ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(kms_INCLUDES) $(drm_INCLUDES)
+ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(kms_SOURCES) $(drm_SOURCES)
+ALL_OBJECTS = $(common_OBJECTS) $(x11_OBJECTS) $(kms_OBJECTS) $(drm_OBJECTS)
 
 ##### TARGETS #####
 
@@ -47,6 +50,9 @@ libeglx11.a: $(x11_OBJECTS) $(common_OBJECTS) Makefile
 libeglkms.a: $(kms_OBJECTS) $(common_OBJECTS) Makefile
 	$(MKLIB) -o eglkms -static $(kms_OBJECTS) $(common_OBJECTS)
 
+libegldrm.a: $(drm_OBJECTS) Makefile
+	$(MKLIB) -o egldrm -static $(drm_OBJECTS)
+
 depend: 
 	rm -f depend
 	touch depend
@@ -72,4 +78,7 @@ $(x11_OBJECTS): %.o: %.c
 $(kms_OBJECTS): %.o: %.c
 	$(CC) -c $(common_INCLUDES) $(kms_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
 
+$(drm_OBJECTS): %.o: %.c
+	$(CC) -c $(common_INCLUDES) $(drm_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
+
 sinclude depend
diff --git a/src/gallium/state_trackers/egl/drm/Makefile b/src/gallium/state_trackers/egl/drm/Makefile
new file mode 100644
index 0000000..4a59b7f
--- /dev/null
+++ b/src/gallium/state_trackers/egl/drm/Makefile
@@ -0,0 +1,19 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = egldrm
+
+LIBRARY_INCLUDES = \
+	-I$(TOP)/src/gallium/auxiliary \
+	-I$(TOP)/src/gallium/include \
+	-I$(TOP)/src/egl/main \
+	-I$(TOP)/include \
+         $(shell pkg-config --cflags-only-I libdrm)
+
+C_SOURCES = \
+	drm_image.c \
+	drm_context.c \
+	drm_surface.c \
+	drm_display.c
+
+include ../../Makefile.template
diff --git a/src/gallium/state_trackers/egl/drm/drm_context.c b/src/gallium/state_trackers/egl/drm/drm_context.c
new file mode 100644
index 0000000..8e5f1e1
--- /dev/null
+++ b/src/gallium/state_trackers/egl/drm/drm_context.c
@@ -0,0 +1,92 @@
+
+
+#include "egllog.h"
+#include "eglcurrent.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
+
+#include "drm_tracker.h"
+
+#include "state_tracker/st_api.h"
+#include "state_tracker/drm_api.h"
+
+#include "util/u_debug.h"
+
+_EGLContext *
+drm_create_context(_EGLDriver *drv, _EGLDisplay *dpy,
+                   _EGLConfig *config, _EGLContext *share_list,
+                   const EGLint *attrib)
+{
+   struct drm_device *dev = lookup_drm_device(dpy);
+   struct drm_config *conf = lookup_drm_config(config);
+   struct drm_context *ctx;
+   int i;
+
+   for (i = 0; attrib && attrib[i] != EGL_NONE; i++) {
+      switch (attrib[i]) {
+      /* no attribs defined for now */
+      default:
+         _eglError(EGL_BAD_ATTRIBUTE, "eglCreateContext");
+         return EGL_NO_CONTEXT;
+      }
+   }
+
+   ctx = (struct drm_context *) calloc(1, sizeof(struct drm_context));
+   if (!ctx)
+      goto err_out;
+
+   _eglInitContext(&ctx->base, dpy, config, attrib);
+
+   ctx->st = dev->api->create_context(dev->api, &dev->manager, &conf->visual, NULL);
+
+   if (!ctx->st)
+      goto err_free;
+
+   return &ctx->base;
+
+err_free:
+   free(ctx);
+err_out:
+   return NULL;
+}
+
+EGLBoolean
+drm_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *context)
+{
+   struct drm_context *ctx = lookup_drm_context(context);
+   if (!_eglIsContextBound(context)) {
+      ctx->st->destroy(ctx->st);
+      free(ctx);
+   }
+   return EGL_TRUE;
+}
+
+EGLBoolean
+drm_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
+                 _EGLSurface *draw, _EGLSurface *read,
+                 _EGLContext *context)
+{
+   struct drm_surface *readSurf = lookup_drm_surface(read);
+   struct drm_surface *drawSurf = lookup_drm_surface(draw);
+   struct drm_context *ctx = lookup_drm_context(context);
+   struct drm_context *old_ctx = NULL;
+   struct drm_device *dev = lookup_drm_device(dpy);
+   boolean ret;
+
+   /* bind the new context and return the "orphaned" one */
+   if (!_eglBindContext(&context, &draw, &read))
+      return EGL_FALSE;
+
+   old_ctx = lookup_drm_context(context);
+
+   if (ctx) {
+      ret = dev->api->make_current(dev->api, ctx->st,
+                                   &drawSurf->fb,
+                                   &readSurf->fb);
+   } else {
+      ret = dev->api->make_current(dev->api, NULL, NULL, NULL);
+   }
+
+   return (EGLBoolean)ret;
+}
diff --git a/src/gallium/state_trackers/egl/drm/drm_display.c b/src/gallium/state_trackers/egl/drm/drm_display.c
new file mode 100644
index 0000000..5692f79
--- /dev/null
+++ b/src/gallium/state_trackers/egl/drm/drm_display.c
@@ -0,0 +1,153 @@
+
+
+#include <stdio.h>
+#include <fcntl.h>
+
+#include "drm_tracker.h"
+
+#include "egllog.h"
+#include "state_tracker/drm_api.h"
+
+#include "pipe/p_screen.h"
+#include "util/u_memory.h"
+
+/**
+ * Called by libEGL just prior to unloading/closing the driver.
+ */
+static void
+drm_unload(_EGLDriver *drv)
+{
+   FREE(drv);
+}
+
+/**
+ * The bootstrap function.  Return a new drm_driver object and
+ * plug in API functions.
+ * libEGL finds this function with dlopen()/dlsym() and calls it from
+ * "load driver" function.
+ */
+_EGLDriver *
+_eglMain(const char *args)
+{
+   _EGLDriver *drv;
+
+   drv = (_EGLDriver *)MALLOC(sizeof(_EGLDriver));
+   if (!drv)
+      return NULL;
+
+   /* First fill in the dispatch table with defaults */
+   _eglInitDriverFallbacks(drv);
+   drv->API.Initialize = drm_initialize;
+   drv->API.Terminate = drm_terminate;
+   drv->API.CreateContext = drm_create_context;
+   drv->API.DestroyContext = drm_destroy_context;
+   drv->API.MakeCurrent = drm_make_current;
+   drv->API.SwapBuffers = drm_swap_buffers;
+   drv->API.CreatePbufferSurface = drm_create_pbuffer_surface;
+   drv->API.DestroySurface = drm_destroy_surface;
+
+   drv->API.CreateImageKHR = drm_create_image;
+   drv->API.DestroyImageKHR = drm_destroy_image;
+
+   drv->Name = "DRM/Gallium/Win";
+   drv->Unload = drm_unload;
+
+   return drv;
+}
+
+static int drm_open_minor(int minor)
+{
+   char buf[64];
+
+   sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor);
+   return open(buf, O_RDWR, 0);
+}
+
+/**
+ * Called by libEGL to initialize the device.
+ */
+EGLBoolean
+drm_initialize(_EGLDriver *drv, _EGLDisplay *dpy, EGLint *major, EGLint *minor)
+{
+   struct drm_device *dev;
+   struct drm_config *conf;
+   _EGLConfig *config;
+
+   dev = CALLOC_STRUCT(drm_device);
+   if (!dev)
+      return EGL_FALSE;
+
+   dev->display = dpy;
+   dev->driver = drm_api_create();
+   dev->api = st_api_create_OpenGL();
+
+   /* try the first node */
+   dev->fd = drm_open_minor(0);
+   if (dev->fd < 0) {
+      _eglLog(_EGL_WARNING, "could not open fd");
+      goto err_free;
+   }
+
+   dev->manager.get_egl_image = drm_get_egl_image;
+   dev->manager.screen = dev->driver->create_screen(dev->driver, dev->fd, NULL);
+   if (!dev->manager.screen)
+      goto err_close;
+
+   dpy->DriverData = dev;
+
+   /* for now we only have one config */
+   conf = CALLOC_STRUCT(drm_config);
+   config = &conf->base;
+   _eglInitConfig(config, dpy, 1);
+   SET_CONFIG_ATTRIB(config, EGL_RED_SIZE, 8);
+   SET_CONFIG_ATTRIB(config, EGL_GREEN_SIZE, 8);
+   SET_CONFIG_ATTRIB(config, EGL_BLUE_SIZE, 8);
+   SET_CONFIG_ATTRIB(config, EGL_ALPHA_SIZE, 8);
+   SET_CONFIG_ATTRIB(config, EGL_BUFFER_SIZE, 32);
+   SET_CONFIG_ATTRIB(config, EGL_DEPTH_SIZE, 24);
+   SET_CONFIG_ATTRIB(config, EGL_STENCIL_SIZE, 8);
+   SET_CONFIG_ATTRIB(config, EGL_SURFACE_TYPE, EGL_PBUFFER_BIT);
+   SET_CONFIG_ATTRIB(config, EGL_CONFORMANT, EGL_OPENGL_BIT);
+   SET_CONFIG_ATTRIB(config, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT);
+   conf->visual.buffer_mask = ST_ATTACHMENT_BACK_LEFT_MASK |
+                              ST_ATTACHMENT_DEPTH_STENCIL;
+   conf->visual.render_buffer = ST_ATTACHMENT_BACK_LEFT;
+   conf->visual.color_format = PIPE_FORMAT_B8G8R8A8_UNORM;
+   conf->visual.depth_stencil_format = PIPE_FORMAT_Z24_UNORM_S8_USCALED;
+   _eglAddConfig(dpy, config);
+
+   /* just assume */
+   dpy->ClientAPIsMask = EGL_OPENGL_BIT;
+
+   dpy->Extensions.KHR_image_base = EGL_TRUE;
+
+   *major = 1;
+   *minor = 4;
+
+   return EGL_TRUE;
+
+err_close:
+   drmClose(dev->fd);
+err_free:
+   free(dev);
+   return EGL_FALSE;
+}
+
+EGLBoolean
+drm_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
+{
+   struct drm_device *dev = lookup_drm_device(dpy);
+
+   _eglReleaseDisplayResources(drv, dpy);
+   _eglCleanupDisplay(dpy);
+
+   dev->manager.screen->destroy(dev->manager.screen);
+
+   drmClose(dev->fd);
+
+   dev->driver->destroy(dev->driver);
+   free(dev);
+   dpy->DriverData = NULL;
+
+   return EGL_TRUE;
+}
diff --git a/src/gallium/state_trackers/egl/drm/drm_image.c b/src/gallium/state_trackers/egl/drm/drm_image.c
new file mode 100644
index 0000000..a25f486
--- /dev/null
+++ b/src/gallium/state_trackers/egl/drm/drm_image.c
@@ -0,0 +1,86 @@
+
+
+#include "eglcurrent.h"
+
+#include "drm_tracker.h"
+
+#include "util/u_memory.h"
+
+/*
+ * Stub
+ */
+_EGLImage *
+drm_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
+                 EGLenum target, EGLClientBuffer buffer,
+                 const EGLint *attribs)
+{
+   struct pipe_resource *res;
+   struct drm_device *dev = lookup_drm_device(dpy);
+   struct drm_image *img;
+
+   img = CALLOC_STRUCT(drm_image);
+   if (!img)
+      return EGL_NO_IMAGE_KHR;
+
+   if (!_eglInitImage(&img->base, dpy, attribs))
+      goto out_free;
+
+   switch (target) {
+   default:
+      res = NULL;
+   }
+
+   if (!res)
+      goto out_free;
+
+   img->res = res;
+
+   return &img->base;
+
+out_free:
+   FREE(img);
+   return EGL_NO_IMAGE_KHR;
+}
+
+EGLBoolean
+drm_destroy_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image)
+{
+   struct drm_image *img = lookup_drm_image(image);
+
+   pipe_resource_reference(&img->res, NULL);
+   FREE(img);
+
+   return EGL_TRUE;
+}
+
+boolean
+drm_get_egl_image(struct st_manager *manager,
+                  struct st_context_iface *stctxi,
+                  void *egl_image, struct st_egl_image *stimg)
+{
+   struct drm_device *dev = (struct drm_device *)manager;
+   EGLImageKHR handle = (EGLImageKHR) egl_image;
+   _EGLImage *image;
+   struct drm_image *img;
+
+   /* this is called from state trackers */
+   _eglLockMutex(&dev->display->Mutex);
+
+   image = _eglLookupImage(handle, dev->display);
+   if (!image) {
+      _eglUnlockMutex(&dev->display->Mutex);
+      return FALSE;
+   }
+
+   img = lookup_drm_image(image);
+
+   stimg->texture = NULL;
+   pipe_resource_reference(&stimg->texture, img->res);
+   stimg->face = 0;
+   stimg->level = 0;
+   stimg->zslice = 0;
+
+   _eglUnlockMutex(&dev->display->Mutex);
+
+   return TRUE;
+}
diff --git a/src/gallium/state_trackers/egl/drm/drm_surface.c b/src/gallium/state_trackers/egl/drm/drm_surface.c
new file mode 100644
index 0000000..0001264
--- /dev/null
+++ b/src/gallium/state_trackers/egl/drm/drm_surface.c
@@ -0,0 +1,149 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "egllog.h"
+#include "eglcurrent.h"
+
+#include "util/u_inlines.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_context.h"
+
+#include "state_tracker/drm_api.h"
+
+#include "util/u_format.h"
+#include "util/u_rect.h"
+
+#include "drm_tracker.h"
+
+static boolean
+drm_flush_front(struct st_framebuffer_iface *fbi,
+                enum st_attachment_type statt)
+{
+   return TRUE; /* noop */
+}
+
+static boolean
+drm_validate(struct st_framebuffer_iface *fbi,
+             const enum st_attachment_type *atts,
+             unsigned count,
+             struct pipe_resource **out)
+{
+   struct drm_surface *surf = (struct drm_surface *)fbi->st_manager_private;
+   struct drm_device *dev = lookup_drm_device(surf->base.Resource.Display);
+   struct pipe_screen *screen = dev->manager.screen;
+   struct pipe_resource templ;
+   int i, att = count;
+
+   for (i = 0; i < count; i++) {
+      out[i] = NULL;
+      if (atts[i] == ST_ATTACHMENT_BACK_LEFT)
+         att = i;
+   }
+
+   if (att == count)
+      return TRUE;
+
+
+   memset(&templ, 0, sizeof(templ));
+   templ.target = PIPE_TEXTURE_2D;
+   templ.last_level = 0;
+   templ.width0 = surf->base.Width;
+   templ.height0 = surf->base.Height;
+   templ.depth0 = 1;
+   templ.format = surf->visual.color_format;
+   templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
+
+   out[att] = screen->resource_create(screen, &templ);
+
+   return TRUE;
+}
+
+/**
+ * Called by libEGL's eglCreatePbufferSurface().
+ */
+_EGLSurface *
+drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
+                           _EGLConfig *config, const EGLint *attrib_list)
+{
+   struct drm_device *dev = lookup_drm_device(dpy);
+   struct drm_config *conf = lookup_drm_config(config);
+   struct drm_surface *surf = NULL;
+   int width = -1;
+   int height = -1;
+   int i;
+
+   for (i = 0; attrib_list[i] != EGL_NONE; i++) {
+      switch (attrib_list[i]) {
+      case EGL_WIDTH:
+         width = attrib_list[++i];
+         break;
+      case EGL_HEIGHT:
+         height = attrib_list[++i];
+         break;
+      default:
+         _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePbufferSurface");
+         return EGL_NO_SURFACE;
+      }
+   }
+
+   if (width < 1 || height < 1) {
+      _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePbufferSurface");
+      return NULL;
+   }
+
+   surf = (struct drm_surface *) calloc(1, sizeof(struct drm_surface));
+   if (!surf)
+      goto err_out;
+
+   if (!_eglInitSurface(&surf->base, dpy, EGL_PBUFFER_BIT, config, attrib_list))
+      goto err_free;
+
+   surf->visual = conf->visual;
+   surf->base.Width = width;
+   surf->base.Height = height;
+   surf->fb.visual = &surf->visual; /* set pointer */
+   surf->fb.flush_front = drm_flush_front;
+   surf->fb.validate = drm_validate;
+   surf->fb.st_manager_private = surf;
+   (void)dev;
+
+   return &surf->base;
+
+err_free:
+   free(surf);
+err_out:
+   return NULL;
+}
+
+/**
+ * Called by libEGL's eglDestroySurface().
+ */
+EGLBoolean
+drm_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface)
+{
+   struct drm_surface *surf = lookup_drm_surface(surface);
+
+   if (!_eglIsSurfaceBound(&surf->base)) {
+      free(surf);
+   }
+
+   return EGL_TRUE;
+}
+
+/**
+ * Called by libEGL's eglSwapBuffers().
+ */
+EGLBoolean
+drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw)
+{
+   struct drm_surface *surf = lookup_drm_surface(draw);
+
+   if (!surf)
+      return EGL_FALSE;
+
+   /* only support pbuffers don't have a front buffer */
+
+   return EGL_TRUE;
+}
diff --git a/src/gallium/state_trackers/egl/drm/drm_tracker.h b/src/gallium/state_trackers/egl/drm/drm_tracker.h
new file mode 100644
index 0000000..987833b
--- /dev/null
+++ b/src/gallium/state_trackers/egl/drm/drm_tracker.h
@@ -0,0 +1,128 @@
+
+#ifndef _EGL_TRACKER_H_
+#define _EGL_TRACKER_H_
+
+#include <stdint.h>
+
+#include "eglconfig.h"
+#include "eglcontext.h"
+#include "egldisplay.h"
+#include "egldriver.h"
+#include "eglglobals.h"
+#include "eglmode.h"
+#include "eglscreen.h"
+#include "eglsurface.h"
+#include "eglimage.h"
+
+#include "xf86drm.h"
+
+#include "pipe/p_compiler.h"
+
+#include "state_tracker/st_api.h"
+
+struct pipe_winsys;
+struct pipe_screen;
+struct pipe_context;
+struct state_tracker;
+
+struct drm_screen;
+struct drm_context;
+
+struct drm_device {
+   struct st_manager manager;
+
+   _EGLDisplay *display;
+
+   struct drm_api *driver;
+   struct st_api *api;
+
+   int fd;
+};
+
+struct drm_config {
+   _EGLConfig base;
+   struct st_visual visual;
+};
+
+struct drm_surface {
+   _EGLSurface base; /* base class/object */
+   struct st_framebuffer_iface fb;
+
+   struct st_visual visual;
+
+   struct pipe_resource *res[ST_ATTACHMENT_COUNT];
+};
+
+struct drm_context {
+   _EGLContext base; /* base class/object */
+
+   struct st_api *api;
+   struct st_context_iface *st;
+   struct pipe_context *pipe;
+};
+
+struct drm_image {
+   _EGLImage base;
+   struct pipe_resource *res;
+};
+
+
+static INLINE struct drm_device *
+lookup_drm_device(_EGLDisplay *d)
+{
+   return (struct drm_device *)d->DriverData;
+}
+
+static INLINE struct drm_config *
+lookup_drm_config(_EGLConfig *c)
+{
+   return (struct drm_config *)c;
+}
+
+static INLINE struct drm_surface *
+lookup_drm_surface(_EGLSurface *s)
+{
+   return (struct drm_surface *)s;
+}
+
+static INLINE struct drm_context *
+lookup_drm_context(_EGLContext *c)
+{
+   return (struct drm_context *)c;
+}
+
+static INLINE struct drm_image *
+lookup_drm_image(_EGLImage *i)
+{
+   return (struct drm_image *)i;
+}
+
+
+/**
+ * Functions exported via st_api interface.
+ */
+/* drm_image.c */
+boolean drm_get_egl_image(struct st_manager *m, struct st_context_iface *s, void *img, struct st_egl_image *stimg);
+
+/**
+ * All function exported to the egl side.
+ */
+/*@{*/
+/* drm_display.c */
+EGLBoolean drm_initialize(_EGLDriver *drv, _EGLDisplay *dpy, EGLint *major, EGLint *minor);
+EGLBoolean drm_terminate(_EGLDriver *drv, _EGLDisplay *dpy);
+/* drm_context.c */
+_EGLContext *drm_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, _EGLContext *share_list, const EGLint *attrib_list);
+EGLBoolean drm_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *context);
+EGLBoolean drm_make_current(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *context);
+EGLBoolean drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw);
+/* drm_surface.c */
+_EGLSurface *drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attrib_list);
+EGLBoolean drm_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface);
+/* drm_image.c */
+_EGLImage *drm_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attribs);
+EGLBoolean drm_destroy_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image);
+EGLBoolean drm_get_image_attrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *img, EGLenum attrib, EGLint *out);
+/*@}*/
+
+#endif
diff --git a/src/gallium/targets/Makefile.egl b/src/gallium/targets/Makefile.egl
index 4fa13e8..7d8d85b 100644
--- a/src/gallium/targets/Makefile.egl
+++ b/src/gallium/targets/Makefile.egl
@@ -43,6 +43,9 @@ INCLUDES = \
 	-I$(TOP)/src/egl/main \
 	$(LIBDRM_CFLAGS)
 
+drm_ST = $(TOP)/src/gallium/state_trackers/egl/libegldrm.a
+drm_LIBS = $(common_LIBS)
+
 ##### RULES #####
 
 .c.o:
@@ -75,6 +78,9 @@ egl_x11_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(x11_ST) $(EGL_DRIVER_PIPE
 egl_kms_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(kms_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
 	$(call mklib-egl,kms)
 
+egl_drm_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(drm_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
+	$(call mklib-egl,drm)
+
 clean:
 	-rm -f $(EGL_DRIVER_OBJECTS)
 	-rm -f $(EGL_DISPLAY_DRIVERS)
-- 
1.7.0.4



More information about the mesa-dev mailing list