neuwld

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

commit 2ad8b5b0f74e1fc76f754f206e87269e3dfad1cf
parent 2424d25affbf310f565b9a309b2031eaee428a48
Author: Michael Forney <mforney@mforney.org>
Date:   Thu,  5 Sep 2013 00:44:06 -0700

Don't expose driver specific API

Diffstat:
MMakefile.am | 1-
Mintel.c | 26+++++++++++++++++---------
Dintel.h | 59-----------------------------------------------------------
3 files changed, 17 insertions(+), 69 deletions(-)

diff --git a/Makefile.am b/Makefile.am @@ -34,7 +34,6 @@ if ENABLE_INTEL AM_CFLAGS += $(drm_intel_CFLAGS) $(intelbatch_CFLAGS) libwld_la_SOURCES += intel.c libwld_la_LIBADD += $(drm_intel_LIBS) $(intelbatch_LIBS) - pkginclude_HEADERS += intel.h endif if ENABLE_PIXMAN diff --git a/intel.c b/intel.c @@ -21,7 +21,6 @@ * SOFTWARE. */ -#include "intel.h" #include "drm-private.h" #include "wld-private.h" @@ -49,6 +48,7 @@ struct intel_drawable _Static_assert(offsetof(struct intel_drawable, drm) == 0, "Non-zero offset of base field"); +/* Drawable implementation */ static void intel_fill_rectangle(struct wld_drawable * drawable, uint32_t color, int32_t x, int32_t y, uint32_t width, uint32_t height); @@ -65,6 +65,14 @@ static void intel_draw_text_utf8(struct wld_drawable * drawable, static void intel_flush(struct wld_drawable * drawable); static void intel_destroy(struct wld_drawable * drawable); +/* DRM implementation */ +static struct wld_intel_context * intel_create_context(int drm_fd); +static void intel_destroy_context(struct wld_intel_context * context); +static bool intel_device_supported(uint32_t vendor_id, uint32_t device_id); +static struct drm_drawable * intel_create_drawable + (struct wld_intel_context * context, uint32_t width, uint32_t height, + uint32_t format); + const static struct wld_draw_interface intel_draw = { .fill_rectangle = &intel_fill_rectangle, .fill_region = &default_fill_region, @@ -76,18 +84,18 @@ const static struct wld_draw_interface intel_draw = { }; const struct wld_drm_interface intel_drm = { - .device_supported = &wld_intel_device_supported, - .create_context = (drm_create_context_func_t) &wld_intel_create_context, - .destroy_context = (drm_destroy_context_func_t) &wld_intel_destroy_context, - .create_drawable = (drm_create_drawable_func_t) &wld_intel_create_drawable, + .device_supported = &intel_device_supported, + .create_context = (drm_create_context_func_t) &intel_create_context, + .destroy_context = (drm_destroy_context_func_t) &intel_destroy_context, + .create_drawable = (drm_create_drawable_func_t) &intel_create_drawable, }; -bool wld_intel_device_supported(uint32_t vendor_id, uint32_t device_id) +bool intel_device_supported(uint32_t vendor_id, uint32_t device_id) { return vendor_id == 0x8086; } -struct wld_intel_context * wld_intel_create_context(int drm_fd) +struct wld_intel_context * intel_create_context(int drm_fd) { struct wld_intel_context * context; @@ -102,13 +110,13 @@ struct wld_intel_context * wld_intel_create_context(int drm_fd) return context; } -void wld_intel_destroy_context(struct wld_intel_context * context) +void intel_destroy_context(struct wld_intel_context * context) { drm_intel_bufmgr_destroy(context->bufmgr); free(context); } -struct wld_drawable * wld_intel_create_drawable +struct wld_drawable * intel_create_drawable (struct wld_intel_context * context, uint32_t width, uint32_t height, uint32_t format) { diff --git a/intel.h b/intel.h @@ -1,59 +0,0 @@ -/* wld: intel.h - * - * Copyright (c) 2013 Michael Forney - * - * 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 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. - */ - -#ifndef WLD_INTEL_H -#define WLD_INTEL_H 1 - -#include <stdbool.h> -#include <stdint.h> - -struct wld_intel_context; -struct wld_drawable; -enum wld_format; - -/** - * Create a new drawing context which uses Intel Graphics hardware accelerated - * operations. - */ -struct wld_intel_context * wld_intel_create_context(int drm_fd); - -/** - * Destroy an Intel context - */ -void wld_intel_destroy_context(struct wld_intel_context * context); - -/** - * Check if the device with the given vendor and device ID is supported by the - * Intel drawing backend. - */ -bool wld_intel_device_supported(uint32_t vendor_id, uint32_t device_id); - -/** - * Create a new Intel drawable with the specified dimensions. - */ -struct wld_drawable * wld_intel_create_drawable - (struct wld_intel_context * context, uint32_t width, uint32_t height, - enum wld_format format); - -#endif -