commit e457fe7

Michael Forney  ·  2014-01-13 11:33:40 +0000 UTC
parent e00bf11
Rename wld_drm_interface -> drm_driver
5 files changed,  +24, -24
M drm.c
M dumb.c
+3, -3
 1@@ -29,7 +29,7 @@
 2 typedef int (* drm_export_func_t)(struct wld_drawable * drawable);
 3 typedef uint32_t (* drm_get_handle_func_t)(struct wld_drawable * drawable);
 4 
 5-struct wld_drm_interface
 6+struct drm_driver
 7 {
 8     bool (* device_supported)(uint32_t vendor_id, uint32_t device_id);
 9     struct wld_context * (* create_context)(int drm_fd);
10@@ -43,9 +43,9 @@ struct drm_drawable_impl
11 };
12 
13 #if WITH_DRM_INTEL
14-extern const struct wld_drm_interface intel_drm;
15+extern const struct drm_driver intel_drm_driver;
16 #endif
17-extern const struct wld_drm_interface dumb_drm;
18+extern const struct drm_driver dumb_drm_driver;
19 extern const struct wld_context_impl * dumb_context_impl;
20 
21 #endif
M drm.c
+10, -10
 1@@ -24,14 +24,14 @@
 2 #include "drm.h"
 3 #include "drm-private.h"
 4 
 5-const static struct wld_drm_interface * drm_interfaces[] = {
 6+const static struct drm_driver * drivers[] = {
 7 #if WITH_DRM_INTEL
 8-    &intel_drm,
 9+    &intel_drm_driver,
10 #endif
11-    &dumb_drm
12+    &dumb_drm_driver
13 };
14 
15-static const struct wld_drm_interface * find_drm_interface(int fd)
16+static const struct drm_driver * find_driver(int fd)
17 {
18     char path[64], id[32];
19     uint32_t vendor_id, device_id;
20@@ -59,10 +59,10 @@ static const struct wld_drm_interface * find_drm_interface(int fd)
21     fclose(file);
22     device_id = strtoul(id, NULL, 0);
23 
24-    for (index = 0; index < ARRAY_LENGTH(drm_interfaces); ++index)
25+    for (index = 0; index < ARRAY_LENGTH(drivers); ++index)
26     {
27-        if (drm_interfaces[index]->device_supported(vendor_id, device_id))
28-            return drm_interfaces[index];
29+        if (drivers[index]->device_supported(vendor_id, device_id))
30+            return drivers[index];
31     }
32 
33     return NULL;
34@@ -71,12 +71,12 @@ static const struct wld_drm_interface * find_drm_interface(int fd)
35 EXPORT
36 struct wld_context * wld_drm_create_context(int fd)
37 {
38-    const struct wld_drm_interface * interface;
39+    const struct drm_driver * driver;
40 
41-    if (!(interface = find_drm_interface(fd)))
42+    if (!(driver = find_driver(fd)))
43         return NULL;
44 
45-    return interface->create_context(fd);
46+    return driver->create_context(fd);
47 }
48 
49 EXPORT
M dumb.c
+2, -2
 1@@ -63,12 +63,12 @@ static struct drm_drawable_impl drawable_impl = {
 2 };
 3 static bool draw_initialized;
 4 
 5-bool drm_device_supported(uint32_t vendor_id, uint32_t device_id)
 6+bool driver_device_supported(uint32_t vendor_id, uint32_t device_id)
 7 {
 8     return true;
 9 }
10 
11-struct wld_context * drm_create_context(int drm_fd)
12+struct wld_context * driver_create_context(int drm_fd)
13 {
14     struct dumb_context * context;
15 
+2, -2
 1@@ -52,12 +52,12 @@ struct intel_drawable
 2 #include "interface/drm_drawable.h"
 3 IMPL(intel, context)
 4 
 5-bool drm_device_supported(uint32_t vendor_id, uint32_t device_id)
 6+bool driver_device_supported(uint32_t vendor_id, uint32_t device_id)
 7 {
 8     return vendor_id == 0x8086;
 9 }
10 
11-struct wld_context * drm_create_context(int drm_fd)
12+struct wld_context * driver_create_context(int drm_fd)
13 {
14     struct intel_context * context;
15 
+7, -7
 1@@ -25,15 +25,15 @@
 2 #   error "You must define DRM_DRIVER_NAME before including interface/drm.h"
 3 #endif
 4 
 5-/* DRM implementation */
 6-static bool drm_device_supported(uint32_t vendor_id, uint32_t device_id);
 7-static struct wld_context * drm_create_context(int drm_fd);
 8+/* DRM driver */
 9+static bool driver_device_supported(uint32_t vendor_id, uint32_t device_id);
10+static struct wld_context * driver_create_context(int drm_fd);
11 
12 #define EXPAND(f, x) f(x)
13-#define VAR(name) name ## _drm
14-const struct wld_drm_interface EXPAND(VAR, DRM_DRIVER_NAME) = {
15-    .device_supported = &drm_device_supported,
16-    .create_context = &drm_create_context,
17+#define VAR(name) name ## _drm_driver
18+const struct drm_driver EXPAND(VAR, DRM_DRIVER_NAME) = {
19+    .device_supported = &driver_device_supported,
20+    .create_context = &driver_create_context,
21 };
22 #undef VAR
23 #undef EXPAND