From 628af2bc9690f42957f9799dfc0dbd0614d38d4c Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Tue, 9 May 2017 18:47:20 +0100 Subject: gbm: remove unneeded gbm_drm_device abstraction Signed-off-by: Emil Velikov Tested-by: Rob Herring --- src/gbm/Makefile.sources | 1 - src/gbm/backends/dri/gbm_dri.c | 53 +++++++++++++++++++-------------------- src/gbm/backends/dri/gbm_driint.h | 4 +-- src/gbm/main/common_drm.h | 43 ------------------------------- 4 files changed, 27 insertions(+), 74 deletions(-) delete mode 100644 src/gbm/main/common_drm.h (limited to 'src/gbm') diff --git a/src/gbm/Makefile.sources b/src/gbm/Makefile.sources index 7a2d6a43548..461025c1acf 100644 --- a/src/gbm/Makefile.sources +++ b/src/gbm/Makefile.sources @@ -1,7 +1,6 @@ gbm_core_FILES = \ main/backend.c \ main/backend.h \ - main/common_drm.h \ main/gbm.c \ main/gbm.h \ main/gbmint.h diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index ceed0c10ca6..9b08ae31a50 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -456,12 +456,12 @@ dri_screen_create_dri2(struct gbm_dri_device *dri, char *driver_name) return -1; if (dri->dri2->base.version >= 4) { - dri->screen = dri->dri2->createNewScreen2(0, dri->base.base.fd, + dri->screen = dri->dri2->createNewScreen2(0, dri->base.fd, dri->loader_extensions, dri->driver_extensions, &dri->driver_configs, dri); } else { - dri->screen = dri->dri2->createNewScreen(0, dri->base.base.fd, + dri->screen = dri->dri2->createNewScreen(0, dri->base.fd, dri->loader_extensions, &dri->driver_configs, dri); } @@ -527,7 +527,7 @@ dri_screen_create(struct gbm_dri_device *dri) { char *driver_name; - driver_name = loader_get_driver_for_fd(dri->base.base.fd); + driver_name = loader_get_driver_for_fd(dri->base.fd); if (!driver_name) return -1; @@ -790,7 +790,7 @@ gbm_dri_bo_destroy(struct gbm_bo *_bo) gbm_dri_bo_unmap_dumb(bo); memset(&arg, 0, sizeof(arg)); arg.handle = bo->handle; - drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg); + drmIoctl(dri->base.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg); } free(bo); @@ -1034,7 +1034,7 @@ create_dumb(struct gbm_device *gbm, create_arg.width = width; create_arg.height = height; - ret = drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_arg); + ret = drmIoctl(dri->base.fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_arg); if (ret) goto free_bo; @@ -1055,7 +1055,7 @@ create_dumb(struct gbm_device *gbm, destroy_dumb: memset(&destroy_arg, 0, sizeof destroy_arg); destroy_arg.handle = create_arg.handle; - drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_arg); + drmIoctl(dri->base.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_arg); free_bo: free(bo); @@ -1351,26 +1351,25 @@ dri_device_create(int fd) if (!dri) return NULL; - dri->base.base.fd = fd; - dri->base.base.bo_create = gbm_dri_bo_create; - dri->base.base.bo_import = gbm_dri_bo_import; - dri->base.base.bo_map = gbm_dri_bo_map; - dri->base.base.bo_unmap = gbm_dri_bo_unmap; - dri->base.base.is_format_supported = gbm_dri_is_format_supported; - dri->base.base.bo_write = gbm_dri_bo_write; - dri->base.base.bo_get_fd = gbm_dri_bo_get_fd; - dri->base.base.bo_get_planes = gbm_dri_bo_get_planes; - dri->base.base.bo_get_handle = gbm_dri_bo_get_handle_for_plane; - dri->base.base.bo_get_stride = gbm_dri_bo_get_stride; - dri->base.base.bo_get_offset = gbm_dri_bo_get_offset; - dri->base.base.bo_get_modifier = gbm_dri_bo_get_modifier; - dri->base.base.bo_destroy = gbm_dri_bo_destroy; - dri->base.base.destroy = dri_destroy; - dri->base.base.surface_create = gbm_dri_surface_create; - dri->base.base.surface_destroy = gbm_dri_surface_destroy; - - dri->base.type = GBM_DRM_DRIVER_TYPE_DRI; - dri->base.base.name = "drm"; + dri->base.fd = fd; + dri->base.bo_create = gbm_dri_bo_create; + dri->base.bo_import = gbm_dri_bo_import; + dri->base.bo_map = gbm_dri_bo_map; + dri->base.bo_unmap = gbm_dri_bo_unmap; + dri->base.is_format_supported = gbm_dri_is_format_supported; + dri->base.bo_write = gbm_dri_bo_write; + dri->base.bo_get_fd = gbm_dri_bo_get_fd; + dri->base.bo_get_planes = gbm_dri_bo_get_planes; + dri->base.bo_get_handle = gbm_dri_bo_get_handle_for_plane; + dri->base.bo_get_stride = gbm_dri_bo_get_stride; + dri->base.bo_get_offset = gbm_dri_bo_get_offset; + dri->base.bo_get_modifier = gbm_dri_bo_get_modifier; + dri->base.bo_destroy = gbm_dri_bo_destroy; + dri->base.destroy = dri_destroy; + dri->base.surface_create = gbm_dri_surface_create; + dri->base.surface_destroy = gbm_dri_surface_destroy; + + dri->base.name = "drm"; mtx_init(&dri->mutex, mtx_plain); @@ -1386,7 +1385,7 @@ dri_device_create(int fd) if (ret) goto err_dri; - return &dri->base.base; + return &dri->base; err_dri: free(dri); diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h index c4a4794e50d..68220cb85d0 100644 --- a/src/gbm/backends/dri/gbm_driint.h +++ b/src/gbm/backends/dri/gbm_driint.h @@ -34,8 +34,6 @@ #include "gbmint.h" #include "c11/threads.h" -#include "common_drm.h" - #include /* dri_interface needs GL types */ #include "GL/internal/dri_interface.h" @@ -43,7 +41,7 @@ struct gbm_dri_surface; struct gbm_dri_bo; struct gbm_dri_device { - struct gbm_drm_device base; + struct gbm_device base; void *driver; char *driver_name; /* Name of the DRI module, without the _dri suffix */ diff --git a/src/gbm/main/common_drm.h b/src/gbm/main/common_drm.h deleted file mode 100644 index 1cc52ae9314..00000000000 --- a/src/gbm/main/common_drm.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright © 2011 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Benjamin Franzke - */ - -#ifndef _COMMON_DRM_H_ -#define _COMMON_DRM_H_ - -#include "gbmint.h" - -enum gbm_drm_driver_type { - GBM_DRM_DRIVER_TYPE_DRI, - GBM_DRM_DRIVER_TYPE_GALLIUM, -}; - -struct gbm_drm_device { - struct gbm_device base; - enum gbm_drm_driver_type type; -}; - -#endif -- cgit v1.2.3