mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-24 00:54:18 +08:00
add new runtime configuration option: min_pixels_using_hwaccl
This commit is contained in:
@@ -76,6 +76,13 @@ async_update=yes
|
||||
# the real engine does not provide WaitWBlank method.
|
||||
# Since 5.0.13.
|
||||
update_interval=15
|
||||
|
||||
# The minimal pixels to use the hardware accelerator.
|
||||
# If the number of pixels to copy is less than this value,
|
||||
# MiniGUI will use the software copy routine to update the real screen,
|
||||
# even if the real device provides a hardware accelerator.
|
||||
# Since 5.0.13.
|
||||
min_pixels_using_hwaccl=4096
|
||||
#}}
|
||||
|
||||
#{{ifdef _MGGAL_DRM
|
||||
@@ -106,6 +113,13 @@ double_buffering=true
|
||||
# Since 5.0.13.
|
||||
update_interval=15
|
||||
|
||||
# The minimal pixels to use the hardware accelerator.
|
||||
# If the number of pixels to copy is less than this value,
|
||||
# MiniGUI will use the software copy routine to update the real screen,
|
||||
# even if the device provides a hardware accelerator.
|
||||
# Since 5.0.13.
|
||||
min_pixels_using_hwaccl=4096
|
||||
|
||||
# The filename of the shared library for the external driver.
|
||||
# The equivalent environment variable: MG_GAL_DRM_DRIVER
|
||||
exdriver=libdrmdrivers.so
|
||||
|
||||
@@ -1275,6 +1275,14 @@ static GAL_VideoDevice *DRM_CreateDevice(int devindex)
|
||||
device->hidden->update_interval = 20;
|
||||
}
|
||||
|
||||
if (GetMgEtcIntValue("drm", "min_pixels_using_hwaccl",
|
||||
&device->hidden->min_pixels_using_hwaccl) < 0) {
|
||||
device->hidden->min_pixels_using_hwaccl = 4096;
|
||||
}
|
||||
else if (device->hidden->min_pixels_using_hwaccl < 0) {
|
||||
device->hidden->min_pixels_using_hwaccl = 4096;
|
||||
}
|
||||
|
||||
char tmp [8];
|
||||
if (GetMgEtcValue ("drm", "double_buffering", tmp, 8) < 0) {
|
||||
device->hidden->dbl_buff = 0;
|
||||
@@ -2440,9 +2448,11 @@ static void update_real_screen_helper(_THIS)
|
||||
RECTW(this->hidden->update_rect),
|
||||
RECTH(this->hidden->update_rect) };
|
||||
|
||||
if (vdata->driver_ops->copy_buff(vdata->driver, shadow_buff, &rect,
|
||||
real_buff, &rect, BLIT_COPY_TRANSLATE) == 0) {
|
||||
hw_ok = TRUE;
|
||||
if ((rect.w * rect.h) >= vdata->min_pixels_using_hwaccl) {
|
||||
if (vdata->driver_ops->copy_buff(vdata->driver, shadow_buff, &rect,
|
||||
real_buff, &rect, BLIT_COPY_TRANSLATE) == 0) {
|
||||
hw_ok = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,6 @@ typedef struct GAL_PrivateVideoData {
|
||||
uint32_t cap_vblank_high_crtc:1;
|
||||
uint32_t dbl_buff:1;
|
||||
uint32_t scanout_buff_id;
|
||||
int update_interval;
|
||||
int crtc_idx;
|
||||
|
||||
void* exdrv_handle;
|
||||
@@ -117,8 +116,11 @@ typedef struct GAL_PrivateVideoData {
|
||||
DrmModeInfo* saved_info;
|
||||
drmModeCrtc* saved_crtc;
|
||||
|
||||
int min_pixels_using_hwaccl;
|
||||
|
||||
/* async updater */
|
||||
int updater_ready;
|
||||
int update_interval;
|
||||
RECT update_rect;
|
||||
pthread_t update_thd;
|
||||
sem_t sync_sem;
|
||||
|
||||
@@ -661,15 +661,17 @@ update_helper(_THIS, GAL_VideoDevice *real_device, RECT *update_rect)
|
||||
dst_rc.h = RECTH(dirty_rect);
|
||||
|
||||
BOOL hw_ok = FALSE;
|
||||
if (real_device->CopyHWSurface) {
|
||||
GAL_Rect src_rc = {
|
||||
update_rect->left, update_rect->top,
|
||||
RECTWP(update_rect), RECTHP(update_rect) };
|
||||
if ((dst_rc.w * dst_rc.h) >= this->hidden->min_pixels_using_hwaccl) {
|
||||
if (real_device->CopyHWSurface) {
|
||||
GAL_Rect src_rc = {
|
||||
update_rect->left, update_rect->top,
|
||||
RECTWP(update_rect), RECTHP(update_rect) };
|
||||
|
||||
if (real_device->CopyHWSurface(real_device,
|
||||
this->screen, &src_rc,
|
||||
real_device->screen, &dst_rc, op) == 0) {
|
||||
hw_ok = TRUE;
|
||||
if (real_device->CopyHWSurface(real_device,
|
||||
this->screen, &src_rc,
|
||||
real_device->screen, &dst_rc, op) == 0) {
|
||||
hw_ok = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1058,6 +1060,14 @@ static int SHADOW_VideoInit (_THIS, GAL_PixelFormat *vformat)
|
||||
}
|
||||
}
|
||||
|
||||
if (GetMgEtcIntValue("shadow", "min_pixels_using_hwaccl",
|
||||
&this->hidden->min_pixels_using_hwaccl) < 0) {
|
||||
this->hidden->min_pixels_using_hwaccl = 4096;
|
||||
}
|
||||
else if (this->hidden->min_pixels_using_hwaccl < 0) {
|
||||
this->hidden->min_pixels_using_hwaccl = 4096;
|
||||
}
|
||||
|
||||
#if 0 /* code for multiple updaters */
|
||||
char nr_updaters[LEN_MODE+1] = "0";
|
||||
if (GetMgEtcValue ("shadow", "nr_updaters",
|
||||
|
||||
@@ -58,9 +58,6 @@ extern "C" {
|
||||
/* Hidden "this" pointer for the video functions */
|
||||
#define _THIS GAL_VideoDevice *this
|
||||
|
||||
#define MAX_NR_UPDATERS 6
|
||||
#define MIN_PIXELS_USING_UPDATER 4096
|
||||
|
||||
typedef struct _ShadowFBHeader {
|
||||
unsigned int info_size;
|
||||
int width;
|
||||
@@ -108,6 +105,8 @@ struct GAL_PrivateVideoData {
|
||||
int semid;
|
||||
#endif
|
||||
|
||||
int min_pixels_using_hwaccl;
|
||||
|
||||
/* async updater */
|
||||
int async_update;
|
||||
int update_interval;
|
||||
|
||||
Reference in New Issue
Block a user