#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
+#include <stdbool.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
static struct dri_extension_match dri_core_extensions[] = {
{ __DRI2_FLUSH, 1, offsetof(struct gbm_dri_device, flush) },
{ __DRI_IMAGE, 1, offsetof(struct gbm_dri_device, image) },
- { __DRI2_FENCE, 2, offsetof(struct gbm_dri_device, fence), 1 },
+ { __DRI2_FENCE, 1, offsetof(struct gbm_dri_device, fence), 1 },
{ __DRI2_INTEROP, 1, offsetof(struct gbm_dri_device, interop), 1 },
{ NULL, 0, 0 }
};
return NULL;
}
- get_extensions_name = dri_get_extensions_name(dri->base.driver_name);
-
+ get_extensions_name = loader_get_extensions_name(dri->base.driver_name);
if (get_extensions_name) {
const __DRIextension **(*get_extensions)(void);
gbm_format = GBM_FORMAT_YUYV;
break;
default:
+ dri->image->destroyImage(image);
return NULL;
}
break;
gbm_format = gbm_dri_to_gbm_format(dri_format);
if (gbm_format == 0) {
errno = EINVAL;
+ dri->image->destroyImage(image);
return NULL;
}
break;
bo = calloc(1, sizeof *bo);
- if (bo == NULL)
+ if (bo == NULL) {
+ dri->image->destroyImage(image);
return NULL;
+ }
bo->image = image;
if (dri->image->base.version >= 2 &&
!dri->image->validateUsage(bo->image, dri_use)) {
errno = EINVAL;
+ dri->image->destroyImage(bo->image);
free(bo);
return NULL;
}
return &bo->base.base;
}
+static bool
+is_planar_format(uint32_t format)
+{
+ switch (format) {
+ case GBM_FORMAT_NV12:
+ case GBM_FORMAT_NV21:
+ case GBM_FORMAT_NV16:
+ case GBM_FORMAT_NV61:
+ case GBM_FORMAT_YUV410:
+ case GBM_FORMAT_YVU410:
+ case GBM_FORMAT_YUV411:
+ case GBM_FORMAT_YVU411:
+ case GBM_FORMAT_YUV420:
+ case GBM_FORMAT_YVU420:
+ case GBM_FORMAT_YUV422:
+ case GBM_FORMAT_YVU422:
+ case GBM_FORMAT_YUV444:
+ case GBM_FORMAT_YVU444:
+ return true;
+ default:
+ return false;
+ }
+
+}
+
static struct gbm_bo *
create_dumb(struct gbm_device *gbm,
uint32_t width, uint32_t height,
return NULL;
}
+ if (is_planar_format(format)) {
+ errno = EINVAL;
+ return NULL;
+ }
+
bo = calloc(1, sizeof *bo);
if (bo == NULL)
return NULL;