CFbAccelARM::paintRect readded and for MIPS also added

Origin commit data
------------------
Branch: ni/coolstream
Commit: 06088b5820
Author: redblue-pkt <redblue-pkt@orange.pl>
Date: 2020-06-11 (Thu, 11 Jun 2020)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
redblue-pkt
2020-06-11 13:10:40 +02:00
committed by vanhofen
parent e9fa743dc8
commit efb8b5ccd3
5 changed files with 345 additions and 14 deletions

View File

@@ -39,11 +39,13 @@
#include <stdlib.h>
#include <driver/abstime.h>
#include <system/set_threadname.h>
#include <gui/color.h>
#define LOGTAG "[fb_accel_arm] "
#define FBIO_BLIT 0x22
#define FBIO_ACCEL 0x23
static unsigned int displaylist[1024];
@@ -56,7 +58,6 @@ static bool supportblendingflags = true;
static int fb_fd = -1;
static int exec_list(void);
#if BOXMODEL_HD51 || BOXMODEL_HD60 || BOXMODEL_BRE2ZE4K || BOXMODEL_H7
static bool accumulateoperations = false;
bool bcm_accel_has_alphablending()
@@ -89,7 +90,6 @@ int bcm_accel_sync()
return retval;
}
#if 0
void bcm_accel_blit(
int src_addr, int src_width, int src_height, int src_stride, int src_format,
int dst_addr, int dst_width, int dst_height, int dst_stride,
@@ -160,7 +160,6 @@ void bcm_accel_blit(
if (!accumulateoperations) exec_list();
}
#endif //if 0
void bcm_accel_fill(
int dst_addr, int dst_width, int dst_height, int dst_stride,
@@ -224,7 +223,6 @@ void bcm_accel_fill(
if (!accumulateoperations) exec_list();
}
#endif
static int exec_list(void)
{
@@ -246,6 +244,7 @@ static int exec_list(void)
CFbAccelARM::CFbAccelARM()
{
blit_thread = false;
fb_name = "armbox framebuffer";
fb_fd = open(FB_DEVICE, O_RDWR);
if (fb_fd < 0)
@@ -268,10 +267,18 @@ CFbAccelARM::CFbAccelARM()
/* hardware doesn't allow us to detect whether the opcode is working */
supportblendingflags = false;
#endif
OpenThreads::Thread::start();
}
CFbAccelARM::~CFbAccelARM()
{
if (blit_thread)
{
blit_thread = false;
blit(); /* wakes up the thread */
OpenThreads::Thread::join();
}
if (fb_fd >= 0)
{
close(fb_fd);
@@ -390,16 +397,71 @@ bool CFbAccelARM::fullHdAvailable()
return false;
}
#define BLIT_INTERVAL_MIN 40
#define BLIT_INTERVAL_MAX 250
void CFbAccelARM::run()
{
printf(LOGTAG "run start\n");
int64_t last_blit = 0;
blit_pending = false;
blit_thread = true;
blit_mutex.lock();
set_threadname("armfb::autoblit");
while (blit_thread) {
blit_cond.wait(&blit_mutex, blit_pending ? BLIT_INTERVAL_MIN : BLIT_INTERVAL_MAX);
int64_t now = time_monotonic_ms();
if (now - last_blit < BLIT_INTERVAL_MIN)
{
blit_pending = true;
//printf(LOGTAG "run: skipped, time %" PRId64 "\n", now - last_blit);
}
else
{
blit_pending = false;
blit_mutex.unlock();
_blit();
blit_mutex.lock();
last_blit = now;
}
}
blit_mutex.unlock();
printf(LOGTAG "run end\n");
}
void CFbAccelARM::blit()
{
//printf(LOGTAG "blit\n");
blit_mutex.lock();
blit_cond.signal();
blit_mutex.unlock();
}
void CFbAccelARM::_blit()
{
if (ioctl(fd, FBIO_BLIT) < 0)
printf("FBIO_BLIT");
}
#if ENABLE_ARM_ACC
#if BOXMODEL_HD51 || BOXMODEL_HD60 || BOXMODEL_BRE2ZE4K || BOXMODEL_H7
void CFbAccelARM::paintRect(const int x, const int y, const int dx, const int dy, const fb_pixel_t col)
{
if(dx <1 || dy <1 )
return;
bcm_accel_fill(fix.smem_start, screeninfo.xres, screeninfo.yres, stride,x, y, dx, dy,col);
int line = 0;
fb_pixel_t *fbp = getFrameBufferPointer() + (swidth * y);
int pos;
while (line < dy)
{
for (pos = x; pos < x + dx; pos++)
*(fbp + pos) = col;
fbp += swidth;
line++;
}
mark(x, y, x+dx, y+dy);
blit();
}
#endif
#endif