neuwld

patched neuwld library (tracked)
git clone https://git.daat.foo/neuwld.git
Log | Files | Refs | README | LICENSE

commit e457fe78b0f5b707ea3ad73d8635cd933e8099f1
parent e00bf119421d916235db7e9b615e50d50d03a66d
Author: Michael Forney <mforney@mforney.org>
Date:   Mon, 13 Jan 2014 03:33:40 -0800

Rename wld_drm_interface -> drm_driver

Diffstat:
Mdrm-private.h | 6+++---
Mdrm.c | 20++++++++++----------
Mdumb.c | 4++--
Mintel.c | 4++--
Minterface/drm.h | 14+++++++-------
5 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drm-private.h b/drm-private.h @@ -29,7 +29,7 @@ typedef int (* drm_export_func_t)(struct wld_drawable * drawable); typedef uint32_t (* drm_get_handle_func_t)(struct wld_drawable * drawable); -struct wld_drm_interface +struct drm_driver { bool (* device_supported)(uint32_t vendor_id, uint32_t device_id); struct wld_context * (* create_context)(int drm_fd); @@ -43,9 +43,9 @@ struct drm_drawable_impl }; #if WITH_DRM_INTEL -extern const struct wld_drm_interface intel_drm; +extern const struct drm_driver intel_drm_driver; #endif -extern const struct wld_drm_interface dumb_drm; +extern const struct drm_driver dumb_drm_driver; extern const struct wld_context_impl * dumb_context_impl; #endif diff --git a/drm.c b/drm.c @@ -24,14 +24,14 @@ #include "drm.h" #include "drm-private.h" -const static struct wld_drm_interface * drm_interfaces[] = { +const static struct drm_driver * drivers[] = { #if WITH_DRM_INTEL - &intel_drm, + &intel_drm_driver, #endif - &dumb_drm + &dumb_drm_driver }; -static const struct wld_drm_interface * find_drm_interface(int fd) +static const struct drm_driver * find_driver(int fd) { char path[64], id[32]; uint32_t vendor_id, device_id; @@ -59,10 +59,10 @@ static const struct wld_drm_interface * find_drm_interface(int fd) fclose(file); device_id = strtoul(id, NULL, 0); - for (index = 0; index < ARRAY_LENGTH(drm_interfaces); ++index) + for (index = 0; index < ARRAY_LENGTH(drivers); ++index) { - if (drm_interfaces[index]->device_supported(vendor_id, device_id)) - return drm_interfaces[index]; + if (drivers[index]->device_supported(vendor_id, device_id)) + return drivers[index]; } return NULL; @@ -71,12 +71,12 @@ static const struct wld_drm_interface * find_drm_interface(int fd) EXPORT struct wld_context * wld_drm_create_context(int fd) { - const struct wld_drm_interface * interface; + const struct drm_driver * driver; - if (!(interface = find_drm_interface(fd))) + if (!(driver = find_driver(fd))) return NULL; - return interface->create_context(fd); + return driver->create_context(fd); } EXPORT diff --git a/dumb.c b/dumb.c @@ -63,12 +63,12 @@ static struct drm_drawable_impl drawable_impl = { }; static bool draw_initialized; -bool drm_device_supported(uint32_t vendor_id, uint32_t device_id) +bool driver_device_supported(uint32_t vendor_id, uint32_t device_id) { return true; } -struct wld_context * drm_create_context(int drm_fd) +struct wld_context * driver_create_context(int drm_fd) { struct dumb_context * context; diff --git a/intel.c b/intel.c @@ -52,12 +52,12 @@ struct intel_drawable #include "interface/drm_drawable.h" IMPL(intel, context) -bool drm_device_supported(uint32_t vendor_id, uint32_t device_id) +bool driver_device_supported(uint32_t vendor_id, uint32_t device_id) { return vendor_id == 0x8086; } -struct wld_context * drm_create_context(int drm_fd) +struct wld_context * driver_create_context(int drm_fd) { struct intel_context * context; diff --git a/interface/drm.h b/interface/drm.h @@ -25,15 +25,15 @@ # error "You must define DRM_DRIVER_NAME before including interface/drm.h" #endif -/* DRM implementation */ -static bool drm_device_supported(uint32_t vendor_id, uint32_t device_id); -static struct wld_context * drm_create_context(int drm_fd); +/* DRM driver */ +static bool driver_device_supported(uint32_t vendor_id, uint32_t device_id); +static struct wld_context * driver_create_context(int drm_fd); #define EXPAND(f, x) f(x) -#define VAR(name) name ## _drm -const struct wld_drm_interface EXPAND(VAR, DRM_DRIVER_NAME) = { - .device_supported = &drm_device_supported, - .create_context = &drm_create_context, +#define VAR(name) name ## _drm_driver +const struct drm_driver EXPAND(VAR, DRM_DRIVER_NAME) = { + .device_supported = &driver_device_supported, + .create_context = &driver_create_context, }; #undef VAR #undef EXPAND