summaryrefslogtreecommitdiffstats
path: root/src/gbm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gbm')
-rw-r--r--src/gbm/backends/dri/gbm_dri.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 1831f137789..d8b1cc78892 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -363,7 +363,7 @@ gbm_dri_bo_import(struct gbm_device *gbm,
struct gbm_dri_bo *bo;
__DRIimage *image;
unsigned dri_use = 0;
- int dri_format, width, height, gbm_format, stride, cpp, offset;
+ int gbm_format;
/* Required for query image WIDTH & HEIGHT */
if (dri->image->base.version < 4)
@@ -376,20 +376,15 @@ gbm_dri_bo_import(struct gbm_device *gbm,
struct wl_drm_buffer *wb = (struct wl_drm_buffer *) buffer;
image = wb->driver_buffer;
- stride = wb->stride[0];
- offset = wb->offset[0];
- cpp = 4;
+
switch (wb->format) {
case WL_DRM_FORMAT_XRGB8888:
- dri_format = __DRI_IMAGE_FORMAT_XRGB8888;
gbm_format = GBM_FORMAT_XRGB8888;
break;
case WL_DRM_FORMAT_ARGB8888:
- dri_format = __DRI_IMAGE_FORMAT_ARGB8888;
gbm_format = GBM_FORMAT_ARGB8888;
break;
case WL_DRM_FORMAT_YUYV:
- dri_format = __DRI_IMAGE_FORMAT_ARGB8888;
gbm_format = GBM_FORMAT_YUYV;
break;
default:
@@ -401,15 +396,15 @@ gbm_dri_bo_import(struct gbm_device *gbm,
case GBM_BO_IMPORT_EGL_IMAGE:
{
+ int dri_format;
if (dri->lookup_image == NULL)
return NULL;
image = dri->lookup_image(dri->screen, buffer, dri->lookup_user_data);
dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_FORMAT, &dri_format);
gbm_format = gbm_dri_to_gbm_format(dri_format);
- dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
- offset = 0;
- cpp = 4;
+ if (gbm_format == 0)
+ return NULL;
break;
}
@@ -422,13 +417,7 @@ gbm_dri_bo_import(struct gbm_device *gbm,
if (bo == NULL)
return NULL;
- dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_WIDTH, &width);
- dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_HEIGHT, &height);
-
- bo->image = dri->image->createSubImage(image,
- width, height, dri_format,
- offset, stride / cpp, NULL);
-
+ bo->image = dri->image->dupImage(image, NULL);
if (usage & GBM_BO_USE_SCANOUT)
dri_use |= __DRI_IMAGE_USE_SCANOUT;
@@ -441,10 +430,14 @@ gbm_dri_bo_import(struct gbm_device *gbm,
}
bo->base.base.gbm = gbm;
- bo->base.base.width = width;
- bo->base.base.height = height;
- bo->base.base.stride = stride;
bo->base.base.format = gbm_format;
+
+ dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_WIDTH,
+ (int*)&bo->base.base.width);
+ dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HEIGHT,
+ (int*)&bo->base.base.height);
+ dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE,
+ (int*)&bo->base.base.stride);
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE,
&bo->base.base.handle.s32);