Merge remote-tracking branch 'tuxbox/master'

This commit is contained in:
Stefan Seyfried
2017-02-22 08:44:53 +01:00
13 changed files with 193 additions and 15 deletions

View File

@@ -100,6 +100,7 @@ class CFbAccelCSHD1
inline void paintHLineRel(int x, int dx, int y, const fb_pixel_t col) { paintLine(x, y, x+dx, y, col); };
inline void paintVLineRel(int x, int y, int dy, const fb_pixel_t col) { paintLine(x, y, x, y+dy, col); };
void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL);
void fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y);
void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false);
void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff);
void waitForIdle(const char *func = NULL);
@@ -123,6 +124,7 @@ class CFbAccelCSHD2
void paintHLineRel(int x, int dx, int y, const fb_pixel_t col);
void paintVLineRel(int x, int y, int dy, const fb_pixel_t col);
void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL);
void fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y);
void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false);
void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff);
fb_pixel_t * getBackBufferPointer() const;

View File

@@ -262,6 +262,17 @@ void CFbAccelCSHD1::paintBoxRel(const int x, const int y, const int dx, const in
checkFbArea(x, y, dx, dy, false);
}
void CFbAccelCSHD1::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y)
{
uint32_t w_, h_;
w_ = (width > xRes) ? xRes : width;
h_ = (height > yRes) ? yRes : height;
//printf("\033[33m>>>>\033[0m [CFbAccelCSHD1::%s:%d] fb_copyarea w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y);
printf("\033[31m>>>>\033[0m [CFbAccelCSHD1::%s:%d] sw blit w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y);
CFrameBuffer::fbCopyArea(width, height, dst_x, dst_y, src_x, src_y);
}
void CFbAccelCSHD1::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp)
{
int xc, yc;

View File

@@ -141,6 +141,28 @@ void CFbAccelCSHD2::paintBoxRel(const int x, const int y, const int dx, const in
checkFbArea(x, y, dx, dy, false);
}
void CFbAccelCSHD2::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y)
{
uint32_t w_, h_;
w_ = (width > xRes) ? xRes : width;
h_ = (height > yRes) ? yRes : height;
if(!(w_%4)) {
fb_copyarea area;
area.dx = dst_x;
area.dy = dst_y;
area.width = w_;
area.height = h_;
area.sx = src_x;
area.sy = src_y;
ioctl(fd, FBIO_COPY_AREA, &area);
//printf("\033[33m>>>>\033[0m [CFbAccelCSHD2::%s:%d] fb_copyarea w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y);
return;
}
//printf("\033[31m>>>>\033[0m [CFbAccelCSHD2::%s:%d] sw blit w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y);
CFrameBuffer::fbCopyArea(width, height, dst_x, dst_y, src_x, src_y);
}
void CFbAccelCSHD2::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp)
{
int xc, yc;

View File

@@ -1578,6 +1578,62 @@ void * CFrameBuffer::convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, uns
return int_convertRGB2FB(rgbbuff, x, y, 0, true);
}
void CFrameBuffer::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y)
{
uint32_t w_, h_, i;
fb_pixel_t *fromBuf = NULL, *toBuf = NULL;
fb_pixel_t *dst_p, *src_p;
fb_pixel_t * fbp = getFrameBufferPointer();
fb_pixel_t * bbp = getBackBufferPointer();
w_ = (width > xRes) ? xRes : width;
h_ = (height > yRes) ? yRes : height;
if ((src_y < yRes) && (dst_y < yRes)) { /* copy within framebuffer */
fromBuf = fbp;
toBuf = fbp;
}
else if ((src_y >= yRes) && (dst_y >= yRes)) { /* copy within backbuffer */
fromBuf = bbp;
toBuf = bbp;
dst_y -= yRes;
src_y -= yRes;
}
else if (src_y >= yRes) { /* copy backbuffer => framebuffer */
fromBuf = bbp;
toBuf = fbp;
src_y -= yRes;
}
else if (dst_y >= yRes) { /* copy framebuffer => backbuffer */
fromBuf = fbp;
toBuf = bbp;
dst_y -= yRes;
}
if ((fromBuf == NULL) || (toBuf == NULL)) {
//printf(">>>>> [%s:%d] buff = NULL\n", __func__, __LINE__);
return;
}
if ((src_x == dst_x) && (src_y == dst_y) && (fromBuf == toBuf)) { /* self copy? */
//printf(">>>>> [%s:%d] self copy?\n", __func__, __LINE__);
return;
}
dst_p = toBuf + dst_y*swidth;
src_p = fromBuf + src_y*swidth;
if ((w_ == xRes) && (swidth == xRes)) { /* copy full width */
//printf(">>>>> [%s:%d] copy full width - dst_p: %p, src_p: %p\n", __func__, __LINE__, dst_p, src_p);
memcpy(dst_p, src_p, w_*h_*sizeof(fb_pixel_t));
}
else { /* copy all other */
//printf(">>>>> [%s:%d] copy all other - dst_p: %p, src_p: %p\n", __func__, __LINE__, dst_p, src_p);
uint32_t wMem = w_*sizeof(fb_pixel_t);
for (i = 0; i < h_; i++) {
memcpy(dst_p+dst_x, src_p+src_x, wMem);
dst_p += swidth;
src_p += swidth;
}
}
}
void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool /*transp*/)
{
int xc, yc;

View File

@@ -265,6 +265,7 @@ class CFrameBuffer : public sigc::trackable
void* convertRGB2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y, int transp = 0xFF);
void* convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y);
void displayRGB(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs, bool clearfb = true, int transp = 0xFF);
virtual void fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y);
virtual void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false);
virtual void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff);

View File

@@ -177,6 +177,27 @@ bool CRCInput::checkdev()
bool CRCInput::checkpath(in_dev id)
{
for (std::vector<in_dev>::iterator it = indev.begin(); it != indev.end(); ++it) {
#ifdef BOXMODEL_CS_HD2
if ((id.type == DT_LNK) || ((*it).type == DT_LNK)) {
std::string check1, check2;
if (id.type == DT_LNK)
check1 = readLink(id.path);
else
check1 = id.path;
if ((*it).type == DT_LNK)
check2 = readLink((*it).path);
else
check2 = (*it).path;
if ((!check1.empty()) && (!check2.empty()) && (check1 == check2)) {
printf("[rcinput:%s] skipping already opened %s => %s\n", __func__, id.path.c_str(), check1.c_str());
return true;
}
else
return false;
}
#endif
if ((*it).path == id.path) {
printf("[rcinput:%s] skipping already opened %s\n", __func__, id.path.c_str());
return true;
@@ -185,6 +206,25 @@ bool CRCInput::checkpath(in_dev id)
return false;
}
#ifdef BOXMODEL_CS_HD2
bool CRCInput::checkLnkDev(std::string lnk)
{
static struct stat info;
if (lstat(lnk.c_str(), &info) != -1) {
if (S_ISLNK(info.st_mode)) {
std::string tmp = readLink(lnk);
if (!tmp.empty()) {
if (lstat(tmp.c_str(), &info) != -1) {
if (S_ISCHR(info.st_mode))
return true;
}
}
}
}
return false;
}
#endif
/* if recheck == true, only not already opened devices are opened, if not, close then (re)open all */
void CRCInput::open(bool recheck)
{
@@ -205,10 +245,22 @@ void CRCInput::open(bool recheck)
while ((dentry = readdir(dir)) != NULL)
{
if (dentry->d_type != DT_CHR) {
if ((dentry->d_type != DT_CHR)
#ifdef BOXMODEL_CS_HD2
&& (dentry->d_type != DT_LNK)
#endif
) {
d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name);
continue;
}
#ifdef BOXMODEL_CS_HD2
if ((dentry->d_type == DT_LNK) && (!checkLnkDev("/dev/input/" + std::string(dentry->d_name)))) {
d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name);
continue;
}
id.type = dentry->d_type;
#endif
d_printf("[rcinput:%s] considering '%s'\n", __func__, dentry->d_name);
id.path = "/dev/input/" + std::string(dentry->d_name);
if (checkpath(id))
@@ -1764,7 +1816,11 @@ void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address)
}
int fd = -1;
for (std::vector<in_dev>::iterator it = indev.begin(); it != indev.end(); ++it) {
if ((*it).path == "/dev/input/nevis_ir") {
if (((*it).path == "/dev/input/nevis_ir")
#ifdef BOXMODEL_CS_HD2
|| ((*it).path == "/dev/input/input0")
#endif
){
fd = (*it).fd;
break;
}

View File

@@ -145,6 +145,9 @@ class CRCInput
{
int fd;
std::string path;
#ifdef BOXMODEL_CS_HD2
int type;
#endif
};
uint32_t timerid;
@@ -167,6 +170,9 @@ class CRCInput
void open(bool recheck = false);
bool checkpath(in_dev id);
bool checkdev();
#ifdef BOXMODEL_CS_HD2
bool checkLnkDev(std::string lnk);
#endif
void close();
int translate(int code);
void calculateMaxFd(void);

View File

@@ -160,7 +160,7 @@ bool CEpgScan::AddSelected()
void CEpgScan::AddTransponders()
{
if(bouquetList->Bouquets.empty())
if(!bouquetList || bouquetList->Bouquets.empty())
return;
if (current_mode != g_settings.epg_scan) {