framebuffer: add accelerator for STi framebuffer

also add a generic helper class for other accelerated
framebuffer implementations


Origin commit data
------------------
Branch: ni/coolstream
Commit: 9fe5dfbe50
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2017-02-05 (Sun, 05 Feb 2017)



------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2017-02-05 21:35:52 +01:00
committed by Michael Liebmann
parent bd9ee5bc45
commit 6635b24aa0
5 changed files with 852 additions and 3 deletions

81
src/driver/fb_accel.h Normal file
View File

@@ -0,0 +1,81 @@
/*
Copyright (C) 2007-2013 Stefan Seyfried
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
private functions for the fbaccel class (only used in CFrameBuffer)
*/
#ifndef __fbaccel__
#define __fbaccel__
#include <config.h>
#include <OpenThreads/Mutex>
#include <OpenThreads/ScopedLock>
#include <OpenThreads/Thread>
#include <OpenThreads/Condition>
#include "fb_generic.h"
#if HAVE_SPARK_HARDWARE
#define PARTIAL_BLIT 1
#endif
class CFbAccel
: public CFrameBuffer
{
public:
CFbAccel();
~CFbAccel();
void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius, int type);
virtual void paintRect(const int x, const int y, const int dx, const int dy, const fb_pixel_t col);
};
class CFbAccelSTi
: public OpenThreads::Thread, public CFbAccel
{
private:
void run(void);
void blit(void);
void _blit(void);
bool blit_thread;
bool blit_pending;
OpenThreads::Condition blit_cond;
OpenThreads::Mutex blit_mutex;
fb_pixel_t *backbuffer;
#ifdef PARTIAL_BLIT
struct {
int xs;
int ys;
int xe;
int ye;
} to_blit;
uint32_t last_xres;
#endif
public:
CFbAccelSTi();
~CFbAccelSTi();
void init(const char * const);
int setMode(unsigned int xRes, unsigned int yRes, unsigned int bpp);
void paintRect(const int x, const int y, const int dx, const int dy, const fb_pixel_t col);
void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp);
void waitForIdle(const char *func = NULL);
void mark(int x, int y, int dx, int dy);
fb_pixel_t * getBackBufferPointer() const;
void setBlendMode(uint8_t);
void setBlendLevel(int);
};
#endif