Remove Raspberry Pi backend and renderer

This patch completely removes the Raspberry Pi backend and the renderer.

The backend and the renderer were written to use the proprietary
DispmanX API available only on the Raspberry Pi, to demonstrate what the
tiny computer is capable of graphics wise. They were also used to
demonstrate how Wayland and Weston in particular could leverage hardware
compositing capabilities that are not OpenGL. The backend was first
added in e8de35c922, in 2012.

Since then, the major point has been proven. Over time, support for the
rpi-backend diminished, it started to deteriorate and hinder Weston
development. On May 11, I tried to ask if anyone actually cared about
the rpi-backend, but did not get any votes for keeping it:
https://lists.freedesktop.org/archives/wayland-devel/2016-May/028764.html

The rpi-backend is a good example of how using an API that is only
available for specific hardware, even more so as it is only available
with a proprietary driver stack, is not maintainable in the long run.
Most developers working on Weston either just cannot, or cannot bother
to test things also on the RPi. Breakage creeps in without anyone
noticing. If someone actually notices it, fixing it will require a very
specific environment to be able to test. Also the quality of the
proprietary implementation fluctuated. There are reports that RPi
firmware updates randomly broke Weston, and that nowadays it is very
hard to find a RPi firmware version that you could expect to work with
Weston if Weston itself was not broken. We are not even sure what is
broken nowadays.

This removal does not leave Raspberry Pi users cold (for long), though.
There is serious work going on in implementing a FOSS driver stack for
Raspberry Pi, including modern kernel DRM drivers and Mesa drivers. It
might not be fully there yet, but the plan is to be able to use the
standard DRM-backend of Weston on the RPis. See:
http://dri.freedesktop.org/wiki/VC4/

The rpi-backend had its moments. Now, it needs to go. Good riddance!

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
dev
Pekka Paalanen 9 years ago
parent e57056f55c
commit ca52b31d3f
  1. 34
      Makefile.am
  2. 2
      README
  3. 18
      configure.ac
  4. 1
      man/weston.ini.man
  5. 575
      src/compositor-rpi.c
  6. 19
      src/main.c
  7. 327
      src/rpi-bcm-stubs.h
  8. 1830
      src/rpi-renderer.c
  9. 52
      src/rpi-renderer.h

@ -328,40 +328,6 @@ nodist_wayland_backend_la_SOURCES = \
protocol/fullscreen-shell-unstable-v1-client-protocol.h protocol/fullscreen-shell-unstable-v1-client-protocol.h
endif endif
if ENABLE_RPI_COMPOSITOR
if INSTALL_RPI_COMPOSITOR
module_LTLIBRARIES += rpi-backend.la
else
noinst_LTLIBRARIES += rpi-backend.la
endif
rpi_backend_la_LDFLAGS = -module -avoid-version
rpi_backend_la_LIBADD = $(COMPOSITOR_LIBS) \
$(RPI_COMPOSITOR_LIBS) \
$(RPI_BCM_HOST_LIBS) \
$(INPUT_BACKEND_LIBS) \
libsession-helper.la \
libshared.la
rpi_backend_la_CFLAGS = \
$(AM_CFLAGS) \
$(COMPOSITOR_CFLAGS) \
$(RPI_COMPOSITOR_CFLAGS) \
$(RPI_BCM_HOST_CFLAGS)
rpi_backend_la_SOURCES = \
src/compositor-rpi.c \
src/rpi-renderer.c \
src/rpi-renderer.h \
src/rpi-bcm-stubs.h \
shared/helpers.h \
$(INPUT_BACKEND_SOURCES)
if ENABLE_EGL
rpi_backend_la_LIBADD += $(EGL_LIBS)
rpi_backend_la_CFLAGS += $(EGL_CFLAGS)
endif
endif
if ENABLE_HEADLESS_COMPOSITOR if ENABLE_HEADLESS_COMPOSITOR
module_LTLIBRARIES += headless-backend.la module_LTLIBRARIES += headless-backend.la
headless_backend_la_LDFLAGS = -module -avoid-version headless_backend_la_LDFLAGS = -module -avoid-version

@ -138,8 +138,6 @@ would be roughly like this:
- xwayland (depends on X11/xcb libs) - xwayland (depends on X11/xcb libs)
- rpi-backend (depends on DispmanX, libudev, ...)
- fbdev-backend (depends on libudev...) - fbdev-backend (depends on libudev...)
- rdp-backend (depends on freerdp) - rdp-backend (depends on freerdp)

@ -208,23 +208,6 @@ if test x$enable_headless_compositor = xyes; then
fi fi
AC_ARG_ENABLE(rpi-compositor,
AS_HELP_STRING([--disable-rpi-compositor],
[do not build the Raspberry Pi backend]),,
enable_rpi_compositor=yes)
AM_CONDITIONAL(ENABLE_RPI_COMPOSITOR, test "x$enable_rpi_compositor" = "xyes")
have_bcm_host="no"
if test "x$enable_rpi_compositor" = "xyes"; then
AC_DEFINE([BUILD_RPI_COMPOSITOR], [1], [Build the compositor for Raspberry Pi])
PKG_CHECK_MODULES(RPI_COMPOSITOR, [libudev >= 136 mtdev >= 1.1.0])
PKG_CHECK_MODULES(RPI_BCM_HOST, [bcm_host],
[have_bcm_host="yes"
AC_DEFINE([HAVE_BCM_HOST], [1], [have Raspberry Pi BCM headers])],
[AC_MSG_WARN([Raspberry Pi BCM host libraries not found, will use stubs instead.])])
fi
AM_CONDITIONAL(INSTALL_RPI_COMPOSITOR, test "x$have_bcm_host" = "xyes")
AC_ARG_ENABLE([fbdev-compositor], [ --enable-fbdev-compositor],, AC_ARG_ENABLE([fbdev-compositor], [ --enable-fbdev-compositor],,
enable_fbdev_compositor=yes) enable_fbdev_compositor=yes)
AM_CONDITIONAL([ENABLE_FBDEV_COMPOSITOR], AM_CONDITIONAL([ENABLE_FBDEV_COMPOSITOR],
@ -678,7 +661,6 @@ AC_MSG_RESULT([
X11 Compositor ${enable_x11_compositor} X11 Compositor ${enable_x11_compositor}
Wayland Compositor ${enable_wayland_compositor} Wayland Compositor ${enable_wayland_compositor}
Headless Compositor ${enable_headless_compositor} Headless Compositor ${enable_headless_compositor}
RPI Compositor ${enable_rpi_compositor}
FBDEV Compositor ${enable_fbdev_compositor} FBDEV Compositor ${enable_fbdev_compositor}
RDP Compositor ${enable_rdp_compositor} RDP Compositor ${enable_rdp_compositor}
Screen Sharing ${enable_screen_sharing} Screen Sharing ${enable_screen_sharing}

@ -130,7 +130,6 @@ directory are:
.BR fbdev-backend.so .BR fbdev-backend.so
.BR headless-backend.so .BR headless-backend.so
.BR rdp-backend.so .BR rdp-backend.so
.BR rpi-backend.so
.BR wayland-backend.so .BR wayland-backend.so
.BR x11-backend.so .BR x11-backend.so
.fi .fi

@ -1,575 +0,0 @@
/*
* Copyright © 2008-2011 Kristian Høgsberg
* Copyright © 2011 Intel Corporation
* Copyright © 2012-2013 Raspberry Pi Foundation
*
* 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.
*/
#include "config.h"
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <libudev.h>
#ifdef HAVE_BCM_HOST
# include <bcm_host.h>
#else
# include "rpi-bcm-stubs.h"
#endif
#include "shared/helpers.h"
#include "compositor.h"
#include "rpi-renderer.h"
#include "launcher-util.h"
#include "libinput-seat.h"
#include "presentation-time-server-protocol.h"
#if 0
#define DBG(...) \
weston_log(__VA_ARGS__)
#else
#define DBG(...) do {} while (0)
#endif
struct rpi_backend;
struct rpi_output;
struct rpi_flippipe {
int readfd;
int writefd;
clockid_t clk_id;
struct wl_event_source *source;
};
struct rpi_output {
struct rpi_backend *backend;
struct weston_output base;
int single_buffer;
struct weston_mode mode;
struct rpi_flippipe flippipe;
DISPMANX_DISPLAY_HANDLE_T display;
};
struct rpi_seat {
struct weston_seat base;
struct wl_list devices_list;
struct udev_monitor *udev_monitor;
struct wl_event_source *udev_monitor_source;
char *seat_id;
};
struct rpi_backend {
struct weston_backend base;
struct weston_compositor *compositor;
uint32_t prev_state;
struct udev *udev;
struct udev_input input;
struct wl_listener session_listener;
int single_buffer;
};
static inline struct rpi_output *
to_rpi_output(struct weston_output *base)
{
return container_of(base, struct rpi_output, base);
}
static inline struct rpi_seat *
to_rpi_seat(struct weston_seat *base)
{
return container_of(base, struct rpi_seat, base);
}
static inline struct rpi_backend *
to_rpi_backend(struct weston_compositor *c)
{
return container_of(c->backend, struct rpi_backend, base);
}
static void
rpi_flippipe_update_complete(DISPMANX_UPDATE_HANDLE_T update, void *data)
{
/* This function runs in a different thread. */
struct rpi_flippipe *flippipe = data;
struct timespec ts;
ssize_t ret;
/* manufacture flip completion timestamp */
clock_gettime(flippipe->clk_id, &ts);
ret = write(flippipe->writefd, &ts, sizeof ts);
if (ret != sizeof ts)
weston_log("ERROR: %s failed to write, ret %zd, errno %d\n",
__func__, ret, errno);
}
static int
rpi_dispmanx_update_submit(DISPMANX_UPDATE_HANDLE_T update,
struct rpi_output *output)
{
/*
* The callback registered here will eventually be called
* in a different thread context. Therefore we cannot call
* the usual functions from rpi_flippipe_update_complete().
* Instead, we have a pipe for passing the message from the
* thread, waking up the Weston main event loop, calling
* rpi_flippipe_handler(), and then ending up in
* rpi_output_update_complete() in the main thread context,
* where we can do the frame finishing work.
*/
return vc_dispmanx_update_submit(update, rpi_flippipe_update_complete,
&output->flippipe);
}
static void
rpi_output_update_complete(struct rpi_output *output,
const struct timespec *stamp);
static int
rpi_flippipe_handler(int fd, uint32_t mask, void *data)
{
struct rpi_output *output = data;
ssize_t ret;
struct timespec ts;
if (mask != WL_EVENT_READABLE)
weston_log("ERROR: unexpected mask 0x%x in %s\n",
mask, __func__);
ret = read(fd, &ts, sizeof ts);
if (ret != sizeof ts) {
weston_log("ERROR: %s failed to read, ret %zd, errno %d\n",
__func__, ret, errno);
}
rpi_output_update_complete(output, &ts);
return 1;
}
static int
rpi_flippipe_init(struct rpi_flippipe *flippipe, struct rpi_output *output)
{
struct weston_compositor *compositor = output->backend->compositor;
struct wl_event_loop *loop;
int fd[2];
if (pipe2(fd, O_CLOEXEC) == -1)
return -1;
flippipe->readfd = fd[0];
flippipe->writefd = fd[1];
flippipe->clk_id = compositor->presentation_clock;
loop = wl_display_get_event_loop(compositor->wl_display);
flippipe->source = wl_event_loop_add_fd(loop, flippipe->readfd,
WL_EVENT_READABLE,
rpi_flippipe_handler, output);
if (!flippipe->source) {
close(flippipe->readfd);
close(flippipe->writefd);
return -1;
}
return 0;
}
static void
rpi_flippipe_release(struct rpi_flippipe *flippipe)
{
wl_event_source_remove(flippipe->source);
close(flippipe->readfd);
close(flippipe->writefd);
}
static void
rpi_output_start_repaint_loop(struct weston_output *output)
{
struct timespec ts;
/* XXX: do a phony dispmanx update and trigger on its completion? */
weston_compositor_read_presentation_clock(output->compositor, &ts);
weston_output_finish_frame(output, &ts, WP_PRESENTATION_FEEDBACK_INVALID);
}
static int
rpi_output_repaint(struct weston_output *base, pixman_region32_t *damage)
{
struct rpi_output *output = to_rpi_output(base);
struct weston_compositor *compositor = output->backend->compositor;
struct weston_plane *primary_plane = &compositor->primary_plane;
DISPMANX_UPDATE_HANDLE_T update;
DBG("frame update start\n");
/* Update priority higher than in rpi-renderer's
* output destroy function, see rpi_output_destroy().
*/
update = vc_dispmanx_update_start(1);
rpi_renderer_set_update_handle(&output->base, update);
compositor->renderer->repaint_output(&output->base, damage);
pixman_region32_subtract(&primary_plane->damage,
&primary_plane->damage, damage);
/* schedule callback to rpi_output_update_complete() */
rpi_dispmanx_update_submit(update, output);
DBG("frame update submitted\n");
return 0;
}
static void
rpi_output_update_complete(struct rpi_output *output,
const struct timespec *stamp)
{
uint32_t flags = WP_PRESENTATION_FEEDBACK_KIND_VSYNC |
WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION;
DBG("frame update complete(%ld.%09ld)\n",
(long)stamp->tv_sec, (long)stamp->tv_nsec);
rpi_renderer_finish_frame(&output->base);
weston_output_finish_frame(&output->base, stamp, flags);
}
static void
rpi_output_destroy(struct weston_output *base)
{
struct rpi_output *output = to_rpi_output(base);
DBG("%s\n", __func__);
rpi_renderer_output_destroy(base);
/* rpi_renderer_output_destroy() will schedule a removal of
* all Dispmanx Elements, and wait for the update to complete.
* Assuming updates are sequential, the wait should guarantee,
* that any pending rpi_flippipe_update_complete() callbacks
* have happened already. Therefore we can destroy the flippipe
* now.
*/
rpi_flippipe_release(&output->flippipe);
weston_output_destroy(&output->base);
vc_dispmanx_display_close(output->display);
free(output);
}
static int
rpi_output_create(struct rpi_backend *backend, uint32_t transform)
{
struct rpi_output *output;
DISPMANX_MODEINFO_T modeinfo;
int ret;
float mm_width, mm_height;
output = zalloc(sizeof *output);
if (output == NULL)
return -1;
output->backend = backend;
output->single_buffer = backend->single_buffer;
if (rpi_flippipe_init(&output->flippipe, output) < 0) {
weston_log("Creating message pipe failed.\n");
goto out_free;
}
output->display = vc_dispmanx_display_open(DISPMANX_ID_HDMI);
if (!output->display) {
weston_log("Failed to open dispmanx HDMI display.\n");
goto out_pipe;
}
ret = vc_dispmanx_display_get_info(output->display, &modeinfo);
if (ret < 0) {
weston_log("Failed to get display mode information.\n");
goto out_dmx_close;
}
output->base.start_repaint_loop = rpi_output_start_repaint_loop;
output->base.repaint = rpi_output_repaint;
output->base.destroy = rpi_output_destroy;
output->base.assign_planes = NULL;
output->base.set_backlight = NULL;
output->base.set_dpms = NULL;
output->base.switch_mode = NULL;
/* XXX: use tvservice to get information from and control the
* HDMI and SDTV outputs. See:
* /opt/vc/include/interface/vmcs_host/vc_tvservice.h
*/
/* only one static mode in list */
output->mode.flags =
WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
output->mode.width = modeinfo.width;
output->mode.height = modeinfo.height;
output->mode.refresh = 60000;
wl_list_init(&output->base.mode_list);
wl_list_insert(&output->base.mode_list, &output->mode.link);
output->base.current_mode = &output->mode;
output->base.subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN;
output->base.make = "unknown";
output->base.model = "unknown";
output->base.name = strdup("rpi");
/* guess 96 dpi */
mm_width = modeinfo.width * (25.4f / 96.0f);
mm_height = modeinfo.height * (25.4f / 96.0f);
weston_output_init(&output->base, backend->compositor,
0, 0, round(mm_width), round(mm_height),
transform, 1);
if (rpi_renderer_output_create(&output->base, output->display) < 0)
goto out_output;
weston_compositor_add_output(backend->compositor, &output->base);
weston_log("Raspberry Pi HDMI output %dx%d px\n",
output->mode.width, output->mode.height);
weston_log_continue(STAMP_SPACE "guessing %d Hz and 96 dpi\n",
output->mode.refresh / 1000);
weston_log_continue(STAMP_SPACE "orientation: %s\n",
weston_transform_to_string(output->base.transform));
if (!strncmp(weston_transform_to_string(output->base.transform),
"flipped", 7))
weston_log("warning: flipped output transforms may not work\n");
return 0;
out_output:
weston_output_destroy(&output->base);
out_dmx_close:
vc_dispmanx_display_close(output->display);
out_pipe:
rpi_flippipe_release(&output->flippipe);
out_free:
free(output);
return -1;
}
static void
rpi_backend_destroy(struct weston_compositor *base)
{
struct rpi_backend *backend = to_rpi_backend(base);
udev_input_destroy(&backend->input);
/* destroys outputs, too */
weston_compositor_shutdown(base);
weston_launcher_destroy(base->launcher);
bcm_host_deinit();
free(backend);
}
static void
session_notify(struct wl_listener *listener, void *data)
{
struct weston_compositor *compositor = data;
struct rpi_backend *backend = to_rpi_backend(compositor);
struct weston_output *output;
if (compositor->session_active) {
weston_log("activating session\n");
compositor->state = backend->prev_state;
weston_compositor_damage_all(compositor);
udev_input_enable(&backend->input);
} else {
weston_log("deactivating session\n");
udev_input_disable(&backend->input);
backend->prev_state = compositor->state;
weston_compositor_offscreen(compositor);
/* If we have a repaint scheduled (either from a
* pending pageflip or the idle handler), make sure we
* cancel that so we don't try to pageflip when we're
* vt switched away. The OFFSCREEN state will prevent
* further attemps at repainting. When we switch
* back, we schedule a repaint, which will process
* pending frame callbacks. */
wl_list_for_each(output,
&compositor->output_list, link) {
output->repaint_needed = 0;
}
};
}
static void
rpi_restore(struct weston_compositor *compositor)
{
weston_launcher_restore(compositor->launcher);
}
struct rpi_parameters {
int tty;
struct rpi_renderer_parameters renderer;
uint32_t output_transform;
};
static struct rpi_backend *
rpi_backend_create(struct weston_compositor *compositor,
struct rpi_parameters *param)
{
struct rpi_backend *backend;
weston_log("initializing Raspberry Pi backend\n");
backend = zalloc(sizeof *backend);
if (backend == NULL)
return NULL;
if (weston_compositor_set_presentation_clock_software(
compositor) < 0)
goto out_compositor;
backend->udev = udev_new();
if (backend->udev == NULL) {
weston_log("Failed to initialize udev context.\n");
goto out_compositor;
}
backend->session_listener.notify = session_notify;
wl_signal_add(&compositor->session_signal,
&backend->session_listener);
compositor->launcher =
weston_launcher_connect(compositor, param->tty, "seat0", false);
if (!compositor->launcher) {
weston_log("Failed to initialize tty.\n");
goto out_udev;
}
backend->base.destroy = rpi_backend_destroy;
backend->base.restore = rpi_restore;
backend->compositor = compositor;
backend->prev_state = WESTON_COMPOSITOR_ACTIVE;
backend->single_buffer = param->renderer.single_buffer;
weston_log("Dispmanx planes are %s buffered.\n",
backend->single_buffer ? "single" : "double");
weston_setup_vt_switch_bindings(compositor);
/*
* bcm_host_init() creates threads.
* Therefore we must have all signal handlers set and signals blocked
* before calling it. Otherwise the signals may end in the bcm
* threads and cause the default behaviour there. For instance,
* SIGUSR1 used for VT switching caused Weston to terminate there.
*/
bcm_host_init();
if (rpi_renderer_create(compositor, &param->renderer) < 0)
goto out_launcher;
if (rpi_output_create(backend, param->output_transform) < 0)
goto out_launcher;
if (udev_input_init(&backend->input,
compositor,
backend->udev, "seat0") != 0) {
weston_log("Failed to initialize udev input.\n");
goto out_launcher;
}
compositor->backend = &backend->base;
return backend;
out_launcher:
weston_launcher_destroy(compositor->launcher);
out_udev:
udev_unref(backend->udev);
out_compositor:
weston_compositor_shutdown(compositor);
bcm_host_deinit();
free(backend);
return NULL;
}
WL_EXPORT int
backend_init(struct weston_compositor *compositor,
int *argc, char *argv[],
struct weston_config *config,
struct weston_backend_config *config_base)
{
const char *transform = "normal";
struct rpi_backend *b;
struct rpi_parameters param = {
.tty = 0, /* default to current tty */
.renderer.single_buffer = 0,
.output_transform = WL_OUTPUT_TRANSFORM_NORMAL,
.renderer.opaque_regions = 0,
};
const struct weston_option rpi_options[] = {
{ WESTON_OPTION_INTEGER, "tty", 0, &param.tty },
{ WESTON_OPTION_BOOLEAN, "single-buffer", 0,
&param.renderer.single_buffer },
{ WESTON_OPTION_STRING, "transform", 0, &transform },
{ WESTON_OPTION_BOOLEAN, "opaque-regions", 0,
&param.renderer.opaque_regions },
};
parse_options(rpi_options, ARRAY_LENGTH(rpi_options), argc, argv);
if (weston_parse_transform(transform, &param.output_transform) < 0)
weston_log("invalid transform \"%s\"\n", transform);
b = rpi_backend_create(compositor, &param);
if (b == NULL)
return -1;
return 0;
}

@ -252,9 +252,6 @@ usage(int error_code)
#if defined(BUILD_RDP_COMPOSITOR) #if defined(BUILD_RDP_COMPOSITOR)
"\t\t\t\trdp-backend.so\n" "\t\t\t\trdp-backend.so\n"
#endif #endif
#if defined(BUILD_RPI_COMPOSITOR) && defined(HAVE_BCM_HOST)
"\t\t\t\trpi-backend.so\n"
#endif
#if defined(BUILD_WAYLAND_COMPOSITOR) #if defined(BUILD_WAYLAND_COMPOSITOR)
"\t\t\t\twayland-backend.so\n" "\t\t\t\twayland-backend.so\n"
#endif #endif
@ -313,18 +310,6 @@ usage(int error_code)
"\n"); "\n");
#endif #endif
#if defined(BUILD_RPI_COMPOSITOR) && defined(HAVE_BCM_HOST)
fprintf(stderr,
"Options for rpi-backend.so:\n\n"
" --tty=TTY\t\tThe tty to use\n"
" --single-buffer\tUse single-buffered Dispmanx elements.\n"
" --transform=TR\tThe output transformation, TR is one of:\n"
"\tnormal 90 180 270 flipped flipped-90 flipped-180 flipped-270\n"
" --opaque-regions\tEnable support for opaque regions, can be "
"very slow without support in the GPU firmware.\n"
"\n");
#endif
#if defined(BUILD_WAYLAND_COMPOSITOR) #if defined(BUILD_WAYLAND_COMPOSITOR)
fprintf(stderr, fprintf(stderr,
"Options for wayland-backend.so:\n\n" "Options for wayland-backend.so:\n\n"
@ -1264,10 +1249,6 @@ load_backend(struct weston_compositor *compositor, const char *backend,
return load_x11_backend(compositor, backend, argc, argv, config); return load_x11_backend(compositor, backend, argc, argv, config);
else if (strstr(backend, "wayland-backend.so")) else if (strstr(backend, "wayland-backend.so"))
return load_wayland_backend(compositor, backend, argc, argv, config); return load_wayland_backend(compositor, backend, argc, argv, config);
#if 0
else if (strstr(backend, "rpi-backend.so"))
return load_rpi_backend(compositor, backend, argc, argv, config);
#endif
return load_backend_old(compositor, backend, argc, argv, config); return load_backend_old(compositor, backend, argc, argv, config);
} }

@ -1,327 +0,0 @@
/*
Copyright (c) 2012, Broadcom Europe Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This file provides just enough types and stubs, so that the rpi-backend
* can be built without the real headers and libraries of the Raspberry Pi.
*
* This file CANNOT be used to build a working rpi-backend, it is intended
* only for build-testing, when the proper headers are not available.
*/
#ifndef RPI_BCM_STUBS
#define RPI_BCM_STUBS
#include <stdint.h>
/* from /opt/vc/include/bcm_host.h */
static inline void bcm_host_init(void) {}
static inline void bcm_host_deinit(void) {}
/* from /opt/vc/include/interface/vmcs_host/vc_dispservice_defs.h */
#define TRANSFORM_HFLIP (1<<0)
#define TRANSFORM_VFLIP (1<<1)
#define TRANSFORM_TRANSPOSE (1<<2)
/* from /opt/vc/include/interface/vctypes/vc_display_types.h */
typedef enum
{
VCOS_DISPLAY_INPUT_FORMAT_INVALID = 0,
} DISPLAY_INPUT_FORMAT_T;
/* from /opt/vc/include/interface/vctypes/vc_image_types.h */
typedef struct tag_VC_RECT_T {
int32_t x;
int32_t y;
int32_t width;
int32_t height;
} VC_RECT_T;
typedef enum {
VC_IMAGE_ROT0,
/* these are not the right values: */
VC_IMAGE_ROT90,
VC_IMAGE_ROT180,
VC_IMAGE_ROT270,
VC_IMAGE_MIRROR_ROT0,
VC_IMAGE_MIRROR_ROT90,
VC_IMAGE_MIRROR_ROT180,
VC_IMAGE_MIRROR_ROT270,
} VC_IMAGE_TRANSFORM_T;
typedef enum
{
VC_IMAGE_MIN = 0,
/* these are not the right values: */
VC_IMAGE_ARGB8888,
VC_IMAGE_XRGB8888,
VC_IMAGE_RGB565,
} VC_IMAGE_TYPE_T;
/* from /opt/vc/include/interface/vmcs_host/vc_dispmanx_types.h */
typedef uint32_t DISPMANX_DISPLAY_HANDLE_T;
typedef uint32_t DISPMANX_UPDATE_HANDLE_T;
typedef uint32_t DISPMANX_ELEMENT_HANDLE_T;
typedef uint32_t DISPMANX_RESOURCE_HANDLE_T;
typedef uint32_t DISPMANX_PROTECTION_T;
#define DISPMANX_NO_HANDLE 0
#define DISPMANX_PROTECTION_NONE 0
#define DISPMANX_ID_HDMI 2
typedef enum {
/* Bottom 2 bits sets the alpha mode */
DISPMANX_FLAGS_ALPHA_FROM_SOURCE = 0,
DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS = 1,
DISPMANX_FLAGS_ALPHA_FIXED_NON_ZERO = 2,
DISPMANX_FLAGS_ALPHA_FIXED_EXCEED_0X07 = 3,
DISPMANX_FLAGS_ALPHA_PREMULT = 1 << 16,
DISPMANX_FLAGS_ALPHA_MIX = 1 << 17
} DISPMANX_FLAGS_ALPHA_T;
typedef struct {
DISPMANX_FLAGS_ALPHA_T flags;
uint32_t opacity;
DISPMANX_RESOURCE_HANDLE_T mask;
} VC_DISPMANX_ALPHA_T;
typedef struct {
int32_t width;
int32_t height;
VC_IMAGE_TRANSFORM_T transform;
DISPLAY_INPUT_FORMAT_T input_format;
} DISPMANX_MODEINFO_T;
typedef enum {
DISPMANX_NO_ROTATE = 0,
DISPMANX_ROTATE_90 = 1,
DISPMANX_ROTATE_180 = 2,
DISPMANX_ROTATE_270 = 3,
DISPMANX_FLIP_HRIZ = 1 << 16,
DISPMANX_FLIP_VERT = 1 << 17
} DISPMANX_TRANSFORM_T;
typedef struct {
uint32_t dummy;
} DISPMANX_CLAMP_T;
typedef void (*DISPMANX_CALLBACK_FUNC_T)(DISPMANX_UPDATE_HANDLE_T u,
void *arg);
/* from /opt/vc/include/interface/vmcs_host/vc_dispmanx.h */
static inline int
vc_dispmanx_rect_set(VC_RECT_T *rect, uint32_t x_offset, uint32_t y_offset,
uint32_t width, uint32_t height)
{
rect->x = x_offset;
rect->y = y_offset;
rect->width = width;
rect->height = height;
return 0;
}
static inline DISPMANX_RESOURCE_HANDLE_T
vc_dispmanx_resource_create(VC_IMAGE_TYPE_T type, uint32_t width,
uint32_t height, uint32_t *native_image_handle)
{
return DISPMANX_NO_HANDLE;
}
static inline int
vc_dispmanx_resource_write_data(DISPMANX_RESOURCE_HANDLE_T res,
VC_IMAGE_TYPE_T src_type,
int src_pitch,
void *src_address,
const VC_RECT_T *rect)
{
return -1;
}
static inline int
vc_dispmanx_resource_write_data_rect(DISPMANX_RESOURCE_HANDLE_T handle,
VC_IMAGE_TYPE_T src_type,
int src_pitch,
void *src_address,
const VC_RECT_T *src_rect,
uint32_t dst_x,
uint32_t dst_y)
{
return -1;
}
static inline int
vc_dispmanx_resource_read_data(DISPMANX_RESOURCE_HANDLE_T handle,
const VC_RECT_T *p_rect,
void *dst_address,
uint32_t dst_pitch)
{
return -1;
}
static inline int
vc_dispmanx_resource_delete(DISPMANX_RESOURCE_HANDLE_T res)
{
return -1;
}
static inline DISPMANX_DISPLAY_HANDLE_T
vc_dispmanx_display_open(uint32_t device)
{
return DISPMANX_NO_HANDLE;
}
static inline int
vc_dispmanx_display_close(DISPMANX_DISPLAY_HANDLE_T display)
{
return -1;
}
static inline int
vc_dispmanx_display_get_info(DISPMANX_DISPLAY_HANDLE_T display,
DISPMANX_MODEINFO_T *pinfo)
{
return -1;
}
static inline DISPMANX_UPDATE_HANDLE_T
vc_dispmanx_update_start(int32_t priority)
{
return DISPMANX_NO_HANDLE;
}
static inline DISPMANX_ELEMENT_HANDLE_T
vc_dispmanx_element_add(DISPMANX_UPDATE_HANDLE_T update,
DISPMANX_DISPLAY_HANDLE_T display,
int32_t layer,
const VC_RECT_T *dest_rect,
DISPMANX_RESOURCE_HANDLE_T src,
const VC_RECT_T *src_rect,
DISPMANX_PROTECTION_T protection,
VC_DISPMANX_ALPHA_T *alpha,
DISPMANX_CLAMP_T *clamp,
DISPMANX_TRANSFORM_T transform)
{
return DISPMANX_NO_HANDLE;
}
static inline int
vc_dispmanx_element_change_source(DISPMANX_UPDATE_HANDLE_T update,
DISPMANX_ELEMENT_HANDLE_T element,
DISPMANX_RESOURCE_HANDLE_T src)
{
return -1;
}
static inline int
vc_dispmanx_element_modified(DISPMANX_UPDATE_HANDLE_T update,
DISPMANX_ELEMENT_HANDLE_T element,
const VC_RECT_T *rect)
{
return -1;
}
static inline int
vc_dispmanx_element_remove(DISPMANX_UPDATE_HANDLE_T update,
DISPMANX_ELEMENT_HANDLE_T element)
{
return -1;
}
static inline int
vc_dispmanx_update_submit(DISPMANX_UPDATE_HANDLE_T update,
DISPMANX_CALLBACK_FUNC_T cb_func, void *cb_arg)
{
return -1;
}
static inline int
vc_dispmanx_update_submit_sync(DISPMANX_UPDATE_HANDLE_T update)
{
return -1;
}
static inline int
vc_dispmanx_element_change_attributes(DISPMANX_UPDATE_HANDLE_T update,
DISPMANX_ELEMENT_HANDLE_T element,
uint32_t change_flags,
int32_t layer,
uint8_t opacity,
const VC_RECT_T *dest_rect,
const VC_RECT_T *src_rect,
DISPMANX_RESOURCE_HANDLE_T mask,
VC_IMAGE_TRANSFORM_T transform)
{
return -1;
}
static inline int
vc_dispmanx_snapshot(DISPMANX_DISPLAY_HANDLE_T display,
DISPMANX_RESOURCE_HANDLE_T snapshot_resource,
VC_IMAGE_TRANSFORM_T transform)
{
return -1;
}
struct wl_resource;
static inline DISPMANX_RESOURCE_HANDLE_T
vc_dispmanx_get_handle_from_wl_buffer(struct wl_resource *_buffer)
{
return DISPMANX_NO_HANDLE;
}
static inline void
vc_dispmanx_set_wl_buffer_in_use(struct wl_resource *_buffer, int in_use)
{
}
static inline int
vc_dispmanx_element_set_opaque_rect(DISPMANX_UPDATE_HANDLE_T update,
DISPMANX_ELEMENT_HANDLE_T element,
const VC_RECT_T *opaque_rect)
{
return -1;
}
/* from /opt/vc/include/EGL/eglplatform.h */
typedef struct {
DISPMANX_ELEMENT_HANDLE_T element;
int width;
int height;
} EGL_DISPMANX_WINDOW_T;
#endif /* RPI_BCM_STUBS */

File diff suppressed because it is too large Load Diff

@ -1,52 +0,0 @@
/*
* Copyright © 2013 Raspberry Pi Foundation
*
* 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.
*/
#ifndef RPI_RENDERER_H
#define RPI_RENDERER_H
struct rpi_renderer_parameters {
int single_buffer;
int opaque_regions;
};
int
rpi_renderer_create(struct weston_compositor *compositor,
const struct rpi_renderer_parameters *params);
int
rpi_renderer_output_create(struct weston_output *base,
DISPMANX_DISPLAY_HANDLE_T display);
void
rpi_renderer_output_destroy(struct weston_output *base);
void
rpi_renderer_set_update_handle(struct weston_output *base,
DISPMANX_UPDATE_HANDLE_T handle);
void
rpi_renderer_finish_frame(struct weston_output *base);
#endif /* RPI_RENDERER_H */
Loading…
Cancel
Save