commit 2ad8b5b
Michael Forney
·
2013-09-05 07:44:06 +0000 UTC
parent 2424d25
Don't expose driver specific API
3 files changed,
+17,
-69
+0,
-1
1@@ -34,7 +34,6 @@ if ENABLE_INTEL
2 AM_CFLAGS += $(drm_intel_CFLAGS) $(intelbatch_CFLAGS)
3 libwld_la_SOURCES += intel.c
4 libwld_la_LIBADD += $(drm_intel_LIBS) $(intelbatch_LIBS)
5- pkginclude_HEADERS += intel.h
6 endif
7
8 if ENABLE_PIXMAN
M
intel.c
+17,
-9
1@@ -21,7 +21,6 @@
2 * SOFTWARE.
3 */
4
5-#include "intel.h"
6 #include "drm-private.h"
7 #include "wld-private.h"
8
9@@ -49,6 +48,7 @@ struct intel_drawable
10 _Static_assert(offsetof(struct intel_drawable, drm) == 0,
11 "Non-zero offset of base field");
12
13+/* Drawable implementation */
14 static void intel_fill_rectangle(struct wld_drawable * drawable, uint32_t color,
15 int32_t x, int32_t y,
16 uint32_t width, uint32_t height);
17@@ -65,6 +65,14 @@ static void intel_draw_text_utf8(struct wld_drawable * drawable,
18 static void intel_flush(struct wld_drawable * drawable);
19 static void intel_destroy(struct wld_drawable * drawable);
20
21+/* DRM implementation */
22+static struct wld_intel_context * intel_create_context(int drm_fd);
23+static void intel_destroy_context(struct wld_intel_context * context);
24+static bool intel_device_supported(uint32_t vendor_id, uint32_t device_id);
25+static struct drm_drawable * intel_create_drawable
26+ (struct wld_intel_context * context, uint32_t width, uint32_t height,
27+ uint32_t format);
28+
29 const static struct wld_draw_interface intel_draw = {
30 .fill_rectangle = &intel_fill_rectangle,
31 .fill_region = &default_fill_region,
32@@ -76,18 +84,18 @@ const static struct wld_draw_interface intel_draw = {
33 };
34
35 const struct wld_drm_interface intel_drm = {
36- .device_supported = &wld_intel_device_supported,
37- .create_context = (drm_create_context_func_t) &wld_intel_create_context,
38- .destroy_context = (drm_destroy_context_func_t) &wld_intel_destroy_context,
39- .create_drawable = (drm_create_drawable_func_t) &wld_intel_create_drawable,
40+ .device_supported = &intel_device_supported,
41+ .create_context = (drm_create_context_func_t) &intel_create_context,
42+ .destroy_context = (drm_destroy_context_func_t) &intel_destroy_context,
43+ .create_drawable = (drm_create_drawable_func_t) &intel_create_drawable,
44 };
45
46-bool wld_intel_device_supported(uint32_t vendor_id, uint32_t device_id)
47+bool intel_device_supported(uint32_t vendor_id, uint32_t device_id)
48 {
49 return vendor_id == 0x8086;
50 }
51
52-struct wld_intel_context * wld_intel_create_context(int drm_fd)
53+struct wld_intel_context * intel_create_context(int drm_fd)
54 {
55 struct wld_intel_context * context;
56
57@@ -102,13 +110,13 @@ struct wld_intel_context * wld_intel_create_context(int drm_fd)
58 return context;
59 }
60
61-void wld_intel_destroy_context(struct wld_intel_context * context)
62+void intel_destroy_context(struct wld_intel_context * context)
63 {
64 drm_intel_bufmgr_destroy(context->bufmgr);
65 free(context);
66 }
67
68-struct wld_drawable * wld_intel_create_drawable
69+struct wld_drawable * intel_create_drawable
70 (struct wld_intel_context * context, uint32_t width, uint32_t height,
71 uint32_t format)
72 {
D
intel.h
+0,
-59
1@@ -1,59 +0,0 @@
2-/* wld: intel.h
3- *
4- * Copyright (c) 2013 Michael Forney
5- *
6- * Permission is hereby granted, free of charge, to any person obtaining a copy
7- * of this software and associated documentation files (the "Software"), to deal
8- * in the Software without restriction, including without limitation the rights
9- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10- * copies of the Software, and to permit persons to whom the Software is
11- * furnished to do so, subject to the following conditions:
12- *
13- * The above copyright notice and this permission notice shall be included in
14- * all copies or substantial portions of the Software.
15- *
16- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22- * SOFTWARE.
23- */
24-
25-#ifndef WLD_INTEL_H
26-#define WLD_INTEL_H 1
27-
28-#include <stdbool.h>
29-#include <stdint.h>
30-
31-struct wld_intel_context;
32-struct wld_drawable;
33-enum wld_format;
34-
35-/**
36- * Create a new drawing context which uses Intel Graphics hardware accelerated
37- * operations.
38- */
39-struct wld_intel_context * wld_intel_create_context(int drm_fd);
40-
41-/**
42- * Destroy an Intel context
43- */
44-void wld_intel_destroy_context(struct wld_intel_context * context);
45-
46-/**
47- * Check if the device with the given vendor and device ID is supported by the
48- * Intel drawing backend.
49- */
50-bool wld_intel_device_supported(uint32_t vendor_id, uint32_t device_id);
51-
52-/**
53- * Create a new Intel drawable with the specified dimensions.
54- */
55-struct wld_drawable * wld_intel_create_drawable
56- (struct wld_intel_context * context, uint32_t width, uint32_t height,
57- enum wld_format format);
58-
59-#endif
60-