[Mesa-dev] [PATCH 02/13] gbm: remove "struct gbm_drm_bo" abstraction
Emil Velikov
emil.l.velikov at gmail.com
Thu May 11 18:57:46 UTC 2017
From: Emil Velikov <emil.velikov at collabora.com>
The struct is a simple wraper around gbm_bo and brings no actual
benefit.
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
src/egl/drivers/dri2/platform_drm.c | 4 ++--
src/gbm/backends/dri/gbm_dri.c | 48 ++++++++++++++++++-------------------
src/gbm/backends/dri/gbm_driint.h | 6 ++---
src/gbm/main/common_drm.h | 4 ----
4 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 9431d95e0a7..d5dae4a14ad 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -547,7 +547,7 @@ swrast_put_image2(__DRIdrawable *driDrawable,
if (gbm_dri_bo_map_dumb(bo) == NULL)
return;
- internal_stride = bo->base.base.stride;
+ internal_stride = bo->base.stride;
for (i = 0; i < height; i++) {
memcpy(bo->map + (x + i) * internal_stride + y,
@@ -577,7 +577,7 @@ swrast_get_image(__DRIdrawable *driDrawable,
if (gbm_dri_bo_map_dumb(bo) == NULL)
return;
- internal_stride = bo->base.base.stride;
+ internal_stride = bo->base.stride;
stride = width * 4;
for (i = 0; i < height; i++) {
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 8cca35e0e06..9f3fe194170 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -959,19 +959,19 @@ gbm_dri_bo_import(struct gbm_device *gbm,
return NULL;
}
- bo->base.base.gbm = gbm;
- bo->base.base.format = gbm_format;
+ bo->base.gbm = gbm;
+ bo->base.format = gbm_format;
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_WIDTH,
- (int*)&bo->base.base.width);
+ (int*)&bo->base.width);
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HEIGHT,
- (int*)&bo->base.base.height);
+ (int*)&bo->base.height);
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE,
- (int*)&bo->base.base.stride);
+ (int*)&bo->base.stride);
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE,
- &bo->base.base.handle.s32);
+ &bo->base.handle.s32);
- return &bo->base.base;
+ return &bo->base;
}
static bool
@@ -1038,19 +1038,19 @@ create_dumb(struct gbm_device *gbm,
if (ret)
goto free_bo;
- bo->base.base.gbm = gbm;
- bo->base.base.width = width;
- bo->base.base.height = height;
- bo->base.base.stride = create_arg.pitch;
- bo->base.base.format = format;
- bo->base.base.handle.u32 = create_arg.handle;
+ bo->base.gbm = gbm;
+ bo->base.width = width;
+ bo->base.height = height;
+ bo->base.stride = create_arg.pitch;
+ bo->base.format = format;
+ bo->base.handle.u32 = create_arg.handle;
bo->handle = create_arg.handle;
bo->size = create_arg.size;
if (gbm_dri_bo_map_dumb(bo) == NULL)
goto destroy_dumb;
- return &bo->base.base;
+ return &bo->base;
destroy_dumb:
memset(&destroy_arg, 0, sizeof destroy_arg);
@@ -1086,10 +1086,10 @@ gbm_dri_bo_create(struct gbm_device *gbm,
if (bo == NULL)
return NULL;
- bo->base.base.gbm = gbm;
- bo->base.base.width = width;
- bo->base.base.height = height;
- bo->base.base.format = format;
+ bo->base.gbm = gbm;
+ bo->base.width = width;
+ bo->base.height = height;
+ bo->base.format = format;
switch (format) {
case GBM_FORMAT_R8:
@@ -1165,7 +1165,7 @@ gbm_dri_bo_create(struct gbm_device *gbm,
if (bo->image) {
/* The client passed in a list of invalid modifiers */
- assert(gbm_dri_bo_get_modifier(&bo->base.base) != DRM_FORMAT_MOD_INVALID);
+ assert(gbm_dri_bo_get_modifier(&bo->base) != DRM_FORMAT_MOD_INVALID);
}
} else {
bo->image = dri->image->createImage(dri->screen, width, height,
@@ -1176,11 +1176,11 @@ gbm_dri_bo_create(struct gbm_device *gbm,
goto failed;
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE,
- &bo->base.base.handle.s32);
+ &bo->base.handle.s32);
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE,
- (int *) &bo->base.base.stride);
+ (int *) &bo->base.stride);
- return &bo->base.base;
+ return &bo->base;
failed:
free(bo);
@@ -1198,8 +1198,8 @@ gbm_dri_bo_map(struct gbm_bo *_bo,
/* If it's a dumb buffer, we already have a mapping */
if (bo->map) {
- *map_data = (char *)bo->map + (bo->base.base.stride * y) + (x * 4);
- *stride = bo->base.base.stride;
+ *map_data = (char *)bo->map + (bo->base.stride * y) + (x * 4);
+ *stride = bo->base.stride;
return *map_data;
}
diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h
index 49f65b953e8..f060830c0c9 100644
--- a/src/gbm/backends/dri/gbm_driint.h
+++ b/src/gbm/backends/dri/gbm_driint.h
@@ -102,7 +102,7 @@ struct gbm_dri_device {
};
struct gbm_dri_bo {
- struct gbm_drm_bo base;
+ struct gbm_bo base;
__DRIimage *image;
@@ -150,12 +150,12 @@ gbm_dri_bo_map_dumb(struct gbm_dri_bo *bo)
memset(&map_arg, 0, sizeof(map_arg));
map_arg.handle = bo->handle;
- ret = drmIoctl(bo->base.base.gbm->fd, DRM_IOCTL_MODE_MAP_DUMB, &map_arg);
+ ret = drmIoctl(bo->base.gbm->fd, DRM_IOCTL_MODE_MAP_DUMB, &map_arg);
if (ret)
return NULL;
bo->map = mmap(0, bo->size, PROT_WRITE,
- MAP_SHARED, bo->base.base.gbm->fd, map_arg.offset);
+ MAP_SHARED, bo->base.gbm->fd, map_arg.offset);
if (bo->map == MAP_FAILED) {
bo->map = NULL;
return NULL;
diff --git a/src/gbm/main/common_drm.h b/src/gbm/main/common_drm.h
index d28c3f01f48..69e51ef9926 100644
--- a/src/gbm/main/common_drm.h
+++ b/src/gbm/main/common_drm.h
@@ -41,8 +41,4 @@ struct gbm_drm_device {
char *driver_name;
};
-struct gbm_drm_bo {
- struct gbm_bo base;
-};
-
#endif
--
2.12.2
More information about the mesa-dev
mailing list