Add support for swrast to the DRM EGL platform
[mesa.git] / src / gbm / main / gbm.h
index 16489f36bba6c8261cf56013516ddba761bc7afc..7b23c2609f9034e61199e796b5d0b7f5ff15a08a 100644 (file)
@@ -192,15 +192,23 @@ enum gbm_bo_flags {
     */
    GBM_BO_USE_SCANOUT      = (1 << 0),
    /**
-    * Buffer is going to be used as cursor - the dimensions for the buffer
-    * must be 64x64 if this flag is passed.
+    * Buffer is going to be used as cursor
     */
-   GBM_BO_USE_CURSOR_64X64 = (1 << 1),
+   GBM_BO_USE_CURSOR       = (1 << 1),
+   /**
+    * Deprecated
+    */
+   GBM_BO_USE_CURSOR_64X64 = GBM_BO_USE_CURSOR,
    /**
     * Buffer is to be used for rendering - for example it is going to be used
     * as the storage for a color buffer
     */
    GBM_BO_USE_RENDERING    = (1 << 2),
+   /**
+    * Buffer can be used for gbm_bo_write.  This is guaranteed to work
+    * with GBM_BO_USE_CURSOR. but may not work for other combinations.
+    */
+   GBM_BO_USE_WRITE    = (1 << 3),
 };
 
 int
@@ -224,11 +232,21 @@ gbm_bo_create(struct gbm_device *gbm,
               uint32_t width, uint32_t height,
               uint32_t format, uint32_t flags);
 
+#define GBM_BO_IMPORT_WL_BUFFER         0x5501
+#define GBM_BO_IMPORT_EGL_IMAGE         0x5502
+#define GBM_BO_IMPORT_FD                0x5503
+
+struct gbm_import_fd_data {
+   int fd;
+   uint32_t width;
+   uint32_t height;
+   uint32_t stride;
+   uint32_t format;
+};
+
 struct gbm_bo *
-gbm_bo_create_from_egl_image(struct gbm_device *gbm,
-                             void *egl_dpy, void *egl_img,
-                             uint32_t width, uint32_t height,
-                             uint32_t usage);
+gbm_bo_import(struct gbm_device *gbm, uint32_t type,
+              void *buffer, uint32_t usage);
 
 uint32_t
 gbm_bo_get_width(struct gbm_bo *bo);
@@ -237,14 +255,23 @@ uint32_t
 gbm_bo_get_height(struct gbm_bo *bo);
 
 uint32_t
-gbm_bo_get_pitch(struct gbm_bo *bo);
+gbm_bo_get_stride(struct gbm_bo *bo);
 
 uint32_t
 gbm_bo_get_format(struct gbm_bo *bo);
 
+struct gbm_device *
+gbm_bo_get_device(struct gbm_bo *bo);
+
 union gbm_bo_handle
 gbm_bo_get_handle(struct gbm_bo *bo);
 
+int
+gbm_bo_get_fd(struct gbm_bo *bo);
+
+int
+gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
+
 void
 gbm_bo_set_user_data(struct gbm_bo *bo, void *data,
                     void (*destroy_user_data)(struct gbm_bo *, void *));
@@ -260,6 +287,9 @@ gbm_surface_create(struct gbm_device *gbm,
                    uint32_t width, uint32_t height,
                   uint32_t format, uint32_t flags);
 
+int
+gbm_surface_needs_lock_front_buffer(struct gbm_surface *surface);
+
 struct gbm_bo *
 gbm_surface_lock_front_buffer(struct gbm_surface *surface);