From: GetAway Date: Wed, 4 Oct 2017 10:41:38 +0000 (+0200) Subject: init backbuffer depending on FSCREENINFO line_length X-Git-Url: https://git.webhop.me/?a=commitdiff_plain;h=ae949464662ce05c75b395a92feeea0b33f8506a;p=tuxwetter.git init backbuffer depending on FSCREENINFO line_length this prevents horizontal cut of OSD with new fb driver bump version 4.06 --- diff --git a/fb_display.c b/fb_display.c index 1d0128c..1af14c6 100644 --- a/fb_display.c +++ b/fb_display.c @@ -113,7 +113,7 @@ int fb_set_gmode(int gmode) return -1; } -// memset(lfb, 0, stride * yRes); +// memset(lfb, 0, swidth * yRes); if (ioctl(fb, FBIOBLANK, FB_BLANK_UNBLANK) < 0) { printf("screen unblanking failed\n"); } @@ -244,19 +244,19 @@ void blit2FB(void *fbbuff, set332map(); } for(i = 0; i < yc; i++){ - memcpy(lbb+(i+yoffs)*stride+xo,cp + (i+yp)*pic_xs+xp,xc*cpp); + memcpy(lbb+(i+yoffs)*swidth+xo,cp + (i+yp)*pic_xs+xp,xc*cpp); } break; case 2: for(i = 0; i < yc; i++){ - memcpy(lbb+(i+yoffs)*stride+xo,sp + (i+yp)*pic_xs+xp, xc*cpp); + memcpy(lbb+(i+yoffs)*swidth+xo,sp + (i+yp)*pic_xs+xp, xc*cpp); } break; case 4: { uint32_t * data = (uint32_t *) fbbuff; - uint32_t * d = (uint32_t *)lbb + xo + stride * yoffs; + uint32_t * d = (uint32_t *)lbb + xo + swidth * yoffs; uint32_t * d2; for (count = 0; count < yc; count++ ) { @@ -279,7 +279,7 @@ void blit2FB(void *fbbuff, d2++; pixpos++; } - d += stride; + d += swidth; } } break; @@ -318,7 +318,7 @@ int x,y; y=cfy; } - unsigned int stride = fix.line_length; + unsigned int swidth = fix.line_length; switch(cpp){ case 2: @@ -336,16 +336,16 @@ int x,y; tl = tvar.transp.length; to = tvar.transp.offset; short black=make16color(0,0,0, rl, ro, gl, go, bl, bo, tl, to); - unsigned short *s_fbbuff = (unsigned short *) malloc(y*stride/2 * sizeof(unsigned short)); + unsigned short *s_fbbuff = (unsigned short *) malloc(y*swidth/2 * sizeof(unsigned short)); if(s_fbbuff==NULL) { printf("Error: malloc\n"); return; } - for(i = 0; i < y*stride/2; i++) + for(i = 0; i < y*swidth/2; i++) s_fbbuff[i] = black; - memcpy(lfb, s_fbbuff, y*stride); + memcpy(lfb, s_fbbuff, y*swidth); free(s_fbbuff); } break; @@ -354,13 +354,13 @@ int x,y; unsigned int col = 0xFF000000; unsigned int * dest = (unsigned int *) lfb; unsigned int i; - for(i = 0; i < stride*y/4; i ++) + for(i = 0; i < swidth*y/4; i ++) dest[i] = col; } break; default: - memset(lfb, 0, stride*y); + memset(lfb, 0, swidth*y); } } @@ -549,9 +549,9 @@ int showBusy(int _sx, int _sy, int width, char r, char g, char b) { for(x=_sx ; x< _sx+width; x++) { - memcpy(busy_buffer_wrk, lbb + y * stride + (x * cpp)/sizeof(uint32_t), cpp); + memcpy(busy_buffer_wrk, lbb + y * swidth + (x * cpp)/sizeof(uint32_t), cpp); busy_buffer_wrk+=cpp; - memcpy(lbb + y * stride + (x * cpp)/sizeof(uint32_t), fb_buffer, cpp); + memcpy(lbb + y * swidth + (x * cpp)/sizeof(uint32_t), fb_buffer, cpp); } } blit(); diff --git a/gfx.c b/gfx.c index 6cfdac7..fcb23da 100644 --- a/gfx.c +++ b/gfx.c @@ -22,7 +22,7 @@ void RenderBox(int rsx, int rsy, int rex, int rey, int rad, int col) { int F,R=rad,ssx=sx+rsx,ssy=sy+rsy,dxx=rex,dyy=rey,rx,ry,wx,wy,count; - uint32_t *pos = lbb + ssx + stride * ssy; + uint32_t *pos = lbb + ssx + swidth * ssy; uint32_t *pos0, *pos1, *pos2, *pos3, *i; uint32_t pix = bgra[col]; @@ -73,10 +73,10 @@ void RenderBox(int rsx, int rsy, int rex, int rey, int rad, int col) rx=R-ssx; ry=R-ssy; - pos0=pos+(dyy-ry)*stride; - pos1=pos+ry*stride; - pos2=pos+rx*stride; - pos3=pos+(dyy-rx)*stride; + pos0=pos+(dyy-ry)*swidth; + pos1=pos+ry*swidth; + pos2=pos+rx*swidth; + pos3=pos+(dyy-rx)*swidth; while (ssx <= ssy) { rx=R-ssx; @@ -94,8 +94,8 @@ void RenderBox(int rsx, int rsy, int rex, int rey, int rad, int col) *i = pix; ssx++; - pos2-=stride; - pos3+=stride; + pos2-=swidth; + pos3+=swidth; if (F<0) { F+=(ssx<<1)-1; @@ -104,18 +104,18 @@ void RenderBox(int rsx, int rsy, int rex, int rey, int rad, int col) { F+=((ssx-ssy)<<1); ssy--; - pos0-=stride; - pos1+=stride; + pos0-=swidth; + pos1+=swidth; } } - pos+=R*stride; + pos+=R*swidth; } for (count=R; count<(dyy-R); count++) { for(i=pos; ixadvance >= _ex) return -1; /* limit to maxwidth */ - uint32_t bgcolor = *(lbb + (sy + _sy - _d - 1) * stride + (sx + _sx + sbit->left)); + uint32_t bgcolor = *(lbb + (sy + _sy - _d - 1) * swidth + (sx + _sx + sbit->left)); uint32_t fgcolor = bgra[color]; uint32_t *colors = lookup_colors(fgcolor, bgcolor); - uint32_t *p = lbb + (sx + _sx + sbit->left + kerning.x) + stride * (sy + _sy - sbit->top - _d); + uint32_t *p = lbb + (sx + _sx + sbit->left + kerning.x) + swidth * (sy + _sy - sbit->top - _d); uint32_t *r = p + (_ex - _sx); /* end of usable box */ for(row = 0; row < sbit->height; row++) { @@ -293,8 +293,8 @@ int RenderChar(FT_ULong currentchar, int _sx, int _sy, int _ex, int color) if (q > r) /* we are past _ex */ break; } - p += stride; - r += stride; + p += swidth; + r += swidth; } } diff --git a/tuxwetter.c b/tuxwetter.c index 64b4677..1501f43 100644 --- a/tuxwetter.c +++ b/tuxwetter.c @@ -44,7 +44,7 @@ #include "gifdecomp.h" #include "icons.h" -#define P_VERSION "4.05" +#define P_VERSION "4.06" #define S_VERSION "" @@ -148,7 +148,7 @@ const char INST_FILE[]="/tmp/rc.locked"; //char LCDL_FILE[]="/tmp/lcd.locked"; int instance=0; int rclocked=0; -int stride; +int swidth; int get_instance(void) { @@ -3170,7 +3170,11 @@ PLISTENTRY pl=&epl; desc.flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT; //init backbuffer - + int stride = fix_screeninfo.line_length; + swidth = stride/sizeof(uint32_t); + if (stride == 7680 && var_screeninfo.xres == 1280) { + var_screeninfo.yres = 1080; + } if(!(lbb = malloc(var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)))) { perror("tuxwetter \n"); @@ -3179,9 +3183,6 @@ PLISTENTRY pl=&epl; munmap(lfb, fix_screeninfo.smem_len); return -1; } - - stride = fix_screeninfo.line_length/sizeof(uint32_t); - memset(lbb, TRANSP, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); startx = sx; diff --git a/tuxwetter.h b/tuxwetter.h index 562aaa9..5151ab4 100644 --- a/tuxwetter.h +++ b/tuxwetter.h @@ -150,7 +150,7 @@ extern int FSIZE_VSMALL; extern int TABULATOR; extern uint32_t bgra[]; -extern int stride; +extern int swidth; extern uint32_t *lfb, *lbb; extern char *proxyadress, *proxyuserpwd;