#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
+extern const struct gbm_backend gbm_dri_backend;
+
struct backend_desc {
const char *name;
const struct gbm_backend *builtin;
};
static const struct backend_desc backends[] = {
- { "gbm_dri.so", NULL },
+ { "gbm_dri.so", &gbm_dri_backend },
{ "gbm_gallium_drm.so", NULL },
{ "gbm_tbm.so", NULL },
};
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <errno.h>
#include "gbm.h"
#include "gbmint.h"
int i;
if (fd < 0 || fstat(fd, &buf) < 0 || !S_ISCHR(buf.st_mode)) {
- fprintf(stderr, "_gbm_mesa_get_device: invalid fd: %d\n", fd);
+ errno = EINVAL;
return NULL;
}
struct stat buf;
if (fd < 0 || fstat(fd, &buf) < 0 || !S_ISCHR(buf.st_mode)) {
- fprintf(stderr, "gbm_create_device: invalid fd: %d\n", fd);
+ errno = EINVAL;
return NULL;
}
* \param bo The buffer object
* \param buf The data to write
* \param count The number of bytes to write
- * \return Returns -1 on error, 0 otherwise
+ * \return Returns 0 on success, otherwise -1 is returned an errno set
*/
GBM_EXPORT int
gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count)
*
* \return A newly allocated buffer that should be freed with gbm_bo_destroy()
* when no longer needed. If an error occurs during allocation %NULL will be
- * returned.
+ * returned and errno set.
*
* \sa enum gbm_bo_format for the list of formats
* \sa enum gbm_bo_flags for the list of usage flags
uint32_t width, uint32_t height,
uint32_t format, uint32_t usage)
{
- if (width == 0 || height == 0)
+ if (width == 0 || height == 0) {
+ errno = EINVAL;
return NULL;
+ }
if (usage & GBM_BO_USE_CURSOR_64X64 &&
(width != 64 || height != 64))
* \param usage The union of the usage flags for this buffer
*
* \return A newly allocated buffer object that should be freed with
- * gbm_bo_destroy() when no longer needed.
+ * gbm_bo_destroy() when no longer needed. On error, %NULL is returned
+ * and errno is set.
*
* \sa enum gbm_bo_flags for the list of usage 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_64X64. but may not work for other
- * combinations.
+ * with GBM_BO_USE_CURSOR. but may not work for other combinations.
*/
GBM_BO_USE_WRITE = (1 << 3),
};
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);