From b2bb565402143c2b63d00ac8c89e3197ffe5354f Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 29 Jul 2018 14:30:59 +0100 Subject: remove broken surface handlers for ABLE and linux framebuffer interface --- Makefile | 8 -- README | 8 +- src/surface/Makefile | 2 - src/surface/able.c | 59 ----------- src/surface/linux.c | 272 --------------------------------------------------- 5 files changed, 5 insertions(+), 344 deletions(-) delete mode 100644 src/surface/able.c delete mode 100644 src/surface/linux.c diff --git a/Makefile b/Makefile index fed9b5d..f956e6a 100644 --- a/Makefile +++ b/Makefile @@ -48,14 +48,6 @@ $(eval $(call pkg_config_package_available,NSFB_SDL_AVAILABLE,sdl)) $(eval $(call pkg_config_package_available,NSFB_XCB_AVAILABLE,$(NSFB_XCB_PKG_NAMES))) $(eval $(call pkg_config_package_available,NSFB_WLD_AVAILABLE,wayland-client)) -# surfaces not detectable via pkg-config -NSFB_ABLE_AVAILABLE := no -ifeq ($(findstring linux,$(HOST)),linux) - NSFB_LINUX_AVAILABLE := yes -else - NSFB_LINUX_AVAILABLE := no -endif - # Flags and setup for each support library ifeq ($(NSFB_SDL_AVAILABLE),yes) $(eval $(call pkg_config_package_add_flags,sdl,CFLAGS)) diff --git a/README b/README index 732e850..b4a1685 100644 --- a/README +++ b/README @@ -16,10 +16,12 @@ Requirements + GNU make or compatible + Pkg-config - Libnsfb also requires the following libraries to be installed: + The following libraries may also be installed: - + SDL 1.2 (for the SDL backend) - + libxcb* (for the X11 backend) + + SDL 1.2 (for the SDL surface) + + libxcb* (for the X11 surface) + * wayland-client (for wayland surface) + * libvncserver (for vnc surface) Compilation ----------- diff --git a/src/surface/Makefile b/src/surface/Makefile index ad23cc4..848c3d4 100644 --- a/src/surface/Makefile +++ b/src/surface/Makefile @@ -4,8 +4,6 @@ SURFACE_HANDLER_yes := surface.c ram.c # optional surface handlers -SURFACE_HANDLER_$(NSFB_ABLE_AVAILABLE) += able.c -SURFACE_HANDLER_$(NSFB_LINUX_AVAILABLE) += linux.c SURFACE_HANDLER_$(NSFB_SDL_AVAILABLE) += sdl.c SURFACE_HANDLER_$(NSFB_XCB_AVAILABLE) += x.c SURFACE_HANDLER_$(NSFB_VNC_AVAILABLE) += vnc.c diff --git a/src/surface/able.c b/src/surface/able.c deleted file mode 100644 index dd4c340..0000000 --- a/src/surface/able.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2009 Vincent Sanders - * - * This file is part of libnsfb, http://www.netsurf-browser.org/ - * Licenced under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - */ - -#include -#include - -#include "libnsfb.h" -#include "libnsfb_plot.h" -#include "libnsfb_event.h" -#include "nsfb.h" -#include "surface.h" - -#define UNUSED(x) ((x) = (x)) - -static int able_set_geometry(nsfb_t *nsfb, int width, int height, enum nsfb_format_e format) -{ - if (nsfb->surface_priv != NULL) - return -1; /* if were already initialised fail */ - - nsfb->width = width; - nsfb->height = height; - nsfb->format = format; - - return 0; -} - -static int able_initialise(nsfb_t *nsfb) -{ - UNUSED(nsfb); - return 0; -} - -static int able_finalise(nsfb_t *nsfb) -{ - UNUSED(nsfb); - return 0; -} - -static bool able_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout) -{ - UNUSED(nsfb); - UNUSED(event); - UNUSED(timeout); - return false; -} - -const nsfb_surface_rtns_t able_rtns = { - .initialise = able_initialise, - .finalise = able_finalise, - .input = able_input, - .geometry = able_set_geometry, -}; - -NSFB_SURFACE_DEF(able, NSFB_SURFACE_ABLE, &able_rtns) diff --git a/src/surface/linux.c b/src/surface/linux.c deleted file mode 100644 index b5bf8ad..0000000 --- a/src/surface/linux.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright 2012 Vincent Sanders - * - * This file is part of libnsfb, http://www.netsurf-browser.org/ - * Licenced under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - - -#include "libnsfb.h" -#include "libnsfb_event.h" -#include "libnsfb_plot.h" -#include "libnsfb_plot_util.h" - -#include "nsfb.h" -#include "plot.h" -#include "surface.h" -#include "cursor.h" - - - -#define UNUSED(x) ((x) = (x)) - -#define FB_NAME "/dev/fb0" - -struct lnx_priv { - struct fb_fix_screeninfo FixInfo; - struct fb_var_screeninfo VarInfo; - int fd; -}; - -static int linux_set_geometry(nsfb_t *nsfb, int width, int height, enum nsfb_format_e format) -{ - if (nsfb->surface_priv != NULL) { - return -1; /* if we are already initialised fail */ - } - - nsfb->width = width; - nsfb->height = height; - nsfb->format = format; - - /* select default sw plotters for bpp */ - if (select_plotters(nsfb) != true) { - return -1; - } - - return 0; -} - -static enum nsfb_format_e -format_from_lstate(struct lnx_priv *lstate) -{ - enum nsfb_format_e fmt = NSFB_FMT_ANY; - - switch(lstate->VarInfo.bits_per_pixel) { - case 32: - if (lstate->VarInfo.transp.length == 0) - fmt = NSFB_FMT_XBGR8888; - else - fmt = NSFB_FMT_ABGR8888; - break; - - case 24: - fmt = NSFB_FMT_RGB888; - break; - - case 16: - fmt = NSFB_FMT_RGB565; - break; - - case 8: - fmt = NSFB_FMT_I8; - break; - - case 1: - fmt = NSFB_FMT_RGB565; - break; - - } - - - return fmt; -} - -static int linux_initialise(nsfb_t *nsfb) -{ - int iFrameBufferSize; - struct lnx_priv *lstate; - enum nsfb_format_e lformat; - - if (nsfb->surface_priv != NULL) - return -1; - - lstate = calloc(1, sizeof(struct lnx_priv)); - if (lstate == NULL) { - return -1; - } - - /* Open the framebuffer device in read write */ - lstate->fd = open(FB_NAME, O_RDWR); - if (lstate->fd < 0) { - printf("Unable to open %s.\n", FB_NAME); - free(lstate); - return -1; - } - - /* Do Ioctl. Retrieve fixed screen info. */ - if (ioctl(lstate->fd, FBIOGET_FSCREENINFO, &lstate->FixInfo) < 0) { - printf("get fixed screen info failed: %s\n", - strerror(errno)); - close(lstate->fd); - free(lstate); - return -1; - } - - /* Do Ioctl. Get the variable screen info. */ - if (ioctl(lstate->fd, FBIOGET_VSCREENINFO, &lstate->VarInfo) < 0) { - printf("Unable to retrieve variable screen info: %s\n", - strerror(errno)); - close(lstate->fd); - free(lstate); - return -1; - } - - /* Calculate the size to mmap */ - iFrameBufferSize = lstate->FixInfo.line_length * lstate->VarInfo.yres; - - /* Now mmap the framebuffer. */ - nsfb->ptr = mmap(NULL, iFrameBufferSize, PROT_READ | PROT_WRITE, - MAP_SHARED, lstate->fd, 0); - if (nsfb->ptr == NULL) { - printf("mmap failed:\n"); - close(lstate->fd); - free(lstate); - return -1; - } - - nsfb->linelen = lstate->FixInfo.line_length; - - nsfb->width = lstate->VarInfo.xres; - nsfb->height = lstate->VarInfo.yres; - - lformat = format_from_lstate(lstate); - - if (nsfb->format != lformat) { - nsfb->format = lformat; - - /* select default sw plotters for format */ - if (select_plotters(nsfb) != true) { - munmap(nsfb->ptr, 0); - close(lstate->fd); - free(lstate); - return -1; - } - } - - nsfb->surface_priv = lstate; - - return 0; -} - -static int linux_finalise(nsfb_t *nsfb) -{ - struct lnx_priv *lstate = nsfb->surface_priv; - - if (lstate != NULL) { - munmap(nsfb->ptr, 0); - close(lstate->fd); - free(lstate); - } - - return 0; -} - -static bool linux_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout) -{ - UNUSED(nsfb); - UNUSED(event); - UNUSED(timeout); - return false; -} - -static int linux_claim(nsfb_t *nsfb, nsfb_bbox_t *box) -{ - struct nsfb_cursor_s *cursor = nsfb->cursor; - - if ((cursor != NULL) && - (cursor->plotted == true) && - (nsfb_plot_bbox_intersect(box, &cursor->loc))) { - - nsfb->plotter_fns->bitmap(nsfb, - &cursor->savloc, - cursor->sav, - cursor->sav_width, - cursor->sav_height, - cursor->sav_width, - false); - cursor->plotted = false; - } - return 0; -} - -static int linux_cursor(nsfb_t *nsfb, struct nsfb_cursor_s *cursor) -{ - nsfb_bbox_t sclip; - - if ((cursor != NULL) && (cursor->plotted == true)) { - sclip = nsfb->clip; - - nsfb->plotter_fns->set_clip(nsfb, NULL); - - nsfb->plotter_fns->bitmap(nsfb, - &cursor->savloc, - cursor->sav, - cursor->sav_width, - cursor->sav_height, - cursor->sav_width, - false); - - nsfb_cursor_plot(nsfb, cursor); - - nsfb->clip = sclip; - } - return true; -} - - -static int linux_update(nsfb_t *nsfb, nsfb_bbox_t *box) -{ - struct nsfb_cursor_s *cursor = nsfb->cursor; - - UNUSED(box); - - if ((cursor != NULL) && (cursor->plotted == false)) { - nsfb_cursor_plot(nsfb, cursor); - } - - return 0; -} - -const nsfb_surface_rtns_t linux_rtns = { - .initialise = linux_initialise, - .finalise = linux_finalise, - .input = linux_input, - .claim = linux_claim, - .update = linux_update, - .cursor = linux_cursor, - .geometry = linux_set_geometry, -}; - -NSFB_SURFACE_DEF(linux, NSFB_SURFACE_LINUX, &linux_rtns) - -/* - * Local variables: - * c-basic-offset: 4 - * tab-width: 8 - * End: - */ -- cgit v1.2.3