From c0d031bf735559ad1d49ce4d3773ef4788f5a096 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 25 Jan 2016 00:01:55 +0000 Subject: [PATCH 1/5] Make the palette-mapped state relate to the rendering layer rather than globally. This means we can still render in 32-bit mode internally when the destination isn't the screen. NB: bitmap_render is currently freezing when the screen is in palette-mapped mode (old bug, pre-dates this change), so for now we skip this routine in that scenario. --- amiga/bitmap.c | 20 +++++++++++--------- amiga/gui.c | 15 ++++++++------- amiga/gui.h | 2 +- amiga/history_local.c | 2 +- amiga/plotters.c | 34 +++++++++++++++++----------------- amiga/plotters.h | 3 ++- amiga/print.c | 3 ++- amiga/tree.c | 2 +- 8 files changed, 43 insertions(+), 38 deletions(-) diff --git a/amiga/bitmap.c b/amiga/bitmap.c index ae9479d26..dd6a91b67 100644 --- a/amiga/bitmap.c +++ b/amiga/bitmap.c @@ -534,11 +534,7 @@ struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap, static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content) { - int plot_width; - int plot_height; - struct MinList shared_pens; - struct gui_globals bm_globals; - struct gui_globals *temp_gg = glob; + if(ami_plot_screen_is_palettemapped() == true) return NSERROR_OK; struct redraw_context ctx = { .interactive = false, @@ -546,13 +542,18 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content) .plot = &amiplot }; + int plot_width; + int plot_height; + struct gui_globals bm_globals; + struct gui_globals *temp_gg = glob; +// struct MinList *shared_pens = ami_AllocMinList(); + plot_width = MIN(content_get_width(content), bitmap->width); plot_height = ((plot_width * bitmap->height) + (bitmap->width / 2)) / bitmap->width; - ami_init_layers(&bm_globals, bitmap->width, bitmap->height); - ami_NewMinList(&shared_pens); - bm_globals.shared_pens = &shared_pens; + ami_init_layers(&bm_globals, bitmap->width, bitmap->height, true); +// bm_globals.shared_pens = shared_pens; glob = &bm_globals; ami_clearclipreg(&bm_globals); @@ -582,7 +583,8 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content) to try to avoid re-conversion (at the expense of memory) */ ami_free_layers(&bm_globals); - ami_plot_release_pens(&shared_pens); +// ami_plot_release_pens(shared_pens); +// FreeVec(shared_pens); amiga_bitmap_set_opaque(bitmap, true); /* Restore previous render area. This is set when plotting starts, diff --git a/amiga/gui.c b/amiga/gui.c index efb825272..fab5d14d5 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -809,7 +809,7 @@ static void ami_openscreen(void) static void ami_openscreenfirst(void) { ami_openscreen(); - if(!browserglob.bm) ami_init_layers(&browserglob, 0, 0); + if(!browserglob.bm) ami_init_layers(&browserglob, 0, 0, false); ami_theme_throbber_setup(); } @@ -2859,7 +2859,7 @@ void ami_switch_tab(struct gui_window_2 *gwin, bool redraw) return; } - ami_plot_release_pens(&gwin->shared_pens); + ami_plot_release_pens(gwin->shared_pens); ami_update_buttons(gwin); ami_menu_update_disabled(gwin->gw, browser_window_get_content(gwin->gw->bw)); @@ -3495,7 +3495,7 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy, int tile_x_scale = (int)(tile_size_x / gwin->gw->scale); int tile_y_scale = (int)(tile_size_y / gwin->gw->scale); - browserglob.shared_pens = &gwin->shared_pens; /* do we need this?? */ + browserglob.shared_pens = gwin->shared_pens; /* do we need this?? */ if(top < 0) { height += top; @@ -3869,7 +3869,7 @@ gui_window_create(struct browser_window *bw, return NULL; } - ami_NewMinList(&g->shared->shared_pens); + g->shared->shared_pens = ami_AllocMinList(); g->shared->scrollerhook.h_Entry = (void *)ami_scroller_hook; g->shared->scrollerhook.h_Data = g->shared; @@ -4492,7 +4492,8 @@ static void gui_window_destroy(struct gui_window *g) return; } - ami_plot_release_pens(&g->shared->shared_pens); + ami_plot_release_pens(g->shared->shared_pens); + FreeVec(g->shared->shared_pens); ami_schedule_redraw_remove(g->shared); ami_schedule(-1, ami_gui_refresh_favicon, g->shared); @@ -4831,7 +4832,7 @@ static void ami_do_redraw(struct gui_window_2 *gwin) } else { - browserglob.shared_pens = &gwin->shared_pens; + browserglob.shared_pens = gwin->shared_pens; temprp = browserglob.rp; browserglob.rp = gwin->win->RPort; clip.x0 = bbox->Left; @@ -5202,7 +5203,7 @@ static void gui_window_new_content(struct gui_window *g) g->shared->oldh = 0; g->shared->oldv = 0; g->favicon = NULL; - ami_plot_release_pens(&g->shared->shared_pens); + ami_plot_release_pens(g->shared->shared_pens); ami_menu_update_disabled(g, c); ami_gui_update_hotlist_button(g->shared); ami_gui_scroller_update(g->shared); diff --git a/amiga/gui.h b/amiga/gui.h index 436991936..38eee52bf 100644 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -138,7 +138,7 @@ struct gui_window_2 { gui_drag_type drag_op; struct IBox *ptr_lock; struct AppWindow *appwin; - struct MinList shared_pens; + struct MinList *shared_pens; gui_pointer_shape mouse_pointer; struct Menu *imenu; /* Intuition menu */ struct VisualInfo *vi; /* For GadTools menu */ diff --git a/amiga/history_local.c b/amiga/history_local.c index 20d54386f..f11c78473 100755 --- a/amiga/history_local.c +++ b/amiga/history_local.c @@ -117,7 +117,7 @@ void ami_history_open(struct gui_window *gw) { gw->hw = ami_misc_allocvec_clear(sizeof(struct history_window), 0); - ami_init_layers(&gw->hw->gg, scrn->Width, scrn->Height); + ami_init_layers(&gw->hw->gg, scrn->Width, scrn->Height, false); gw->hw->gw = gw; browser_window_history_size(gw->bw, &width, &height); diff --git a/amiga/plotters.c b/amiga/plotters.c index 95c285c60..bb69dce24 100644 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -70,7 +70,6 @@ struct bez_point { float y; }; -static bool palette_mapped = false; static int init_layers_count = 0; static APTR pool_pens = NULL; @@ -90,7 +89,7 @@ static APTR pool_pens = NULL; /* Define the below to get additional debug */ #undef AMI_PLOTTER_DEBUG -void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) +void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool force32bit) { /* init shared bitmaps * * Height is set to screen width to give enough space for thumbnails * @@ -99,22 +98,23 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) int depth = 32; struct BitMap *friend = NULL; - depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH); + if(force32bit == false) depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH); LOG("Screen depth = %d", depth); if(depth < 16) { - palette_mapped = true; + gg->palette_mapped = true; } else { - palette_mapped = false; + gg->palette_mapped = false; } #ifndef __amigaos4__ #warning OS3 locked to palette-mapped modes - palette_mapped = true; + gg->palette_mapped = true; if(depth > 8) depth = 8; #endif - if(palette_mapped == true) nsoption_set_bool(font_antialiasing, false); + /* Probably need to fix this next line */ + if(gg->palette_mapped == true) nsoption_set_bool(font_antialiasing, false); if(!width) width = nsoption_int(redraw_tile_size_x); if(!height) height = nsoption_int(redraw_tile_size_y); @@ -146,7 +146,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) } #endif - if(palette_mapped == true) { + if(gg->palette_mapped == true) { gg->bm = AllocBitMap(width, height, depth, 0, friend); } else { #ifdef __amigaos4__ @@ -184,7 +184,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height); - if((palette_mapped == true) && (pool_pens == NULL)) { + if((gg->palette_mapped == true) && (pool_pens == NULL)) { pool_pens = ami_misc_itempool_create(sizeof(struct ami_plot_pen)); } @@ -210,7 +210,7 @@ void ami_free_layers(struct gui_globals *gg) FreeVec(gg->tmprasbuf); FreeVec(gg->areabuf); DisposeLayerInfo(gg->layerinfo); - if(palette_mapped == false) { + if(gg->palette_mapped == false) { if(gg->bm) ami_rtg_freebitmap(gg->bm); } else { if(gg->bm) FreeBitMap(gg->bm); @@ -273,7 +273,7 @@ void ami_plot_release_pens(struct MinList *shared_pens) static void ami_plot_setapen(struct RastPort *rp, ULONG colr) { #ifdef __amigaos4__ - if(palette_mapped == false) { + if(glob->palette_mapped == false) { SetRPAttrs(rp, RPTAG_APenColor, ns_color_to_nscss(colr), TAG_DONE); @@ -288,7 +288,7 @@ static void ami_plot_setapen(struct RastPort *rp, ULONG colr) static void ami_plot_setopen(struct RastPort *rp, ULONG colr) { #ifdef __amigaos4__ - if(palette_mapped == false) { + if(glob->palette_mapped == false) { SetRPAttrs(rp, RPTAG_OPenColor, ns_color_to_nscss(colr), TAG_DONE); @@ -537,7 +537,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma #endif #ifdef __amigaos4__ - if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false) && + if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) && (glob->palette_mapped == false) && (nsoption_bool(direct_render) == false), 1)) { uint32 comptype = COMPOSITE_Src_Over_Dest; uint32 compflags = COMPFLAG_IgnoreDestAlpha; @@ -564,7 +564,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma { ULONG tag, tag_data, minterm = 0xc0; - if(palette_mapped == false) { + if(glob->palette_mapped == false) { tag = BLITA_UseSrcAlpha; tag_data = !bitmap->opaque; minterm = 0xc0; @@ -715,7 +715,7 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage for (yf = -bfbm->offsety; yf < msg->Bounds.MaxY; yf += bfbm->height) { #ifdef __amigaos4__ if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) && - (palette_mapped == false), 1)) { + (glob->palette_mapped == false), 1)) { CompositeTags(COMPOSITE_Src_Over_Dest, bfbm->bm, rp->BitMap, COMPTAG_Flags, COMPFLAG_IgnoreDestAlpha, COMPTAG_DestX, msg->Bounds.MinX, @@ -734,7 +734,7 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage { ULONG tag, tag_data, minterm = 0xc0; - if(palette_mapped == false) { + if(glob->palette_mapped == false) { tag = BLITA_UseSrcAlpha; tag_data = TRUE; minterm = 0xc0; @@ -876,7 +876,7 @@ static bool ami_path(const float *p, unsigned int n, colour fill, float width, bool ami_plot_screen_is_palettemapped(void) { - return palette_mapped; + return glob->palette_mapped; } struct plotter_table plot; diff --git a/amiga/plotters.h b/amiga/plotters.h index 49afbe177..841700e4a 100644 --- a/amiga/plotters.h +++ b/amiga/plotters.h @@ -33,13 +33,14 @@ struct gui_globals APTR tmprasbuf; struct Rectangle rect; struct MinList *shared_pens; + bool palette_mapped; int width; /* size of bm and */ int height; /* associated memory */ }; extern const struct plotter_table amiplot; -void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height); +void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool force32bit); void ami_free_layers(struct gui_globals *gg); void ami_clearclipreg(struct gui_globals *gg); void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox); diff --git a/amiga/print.c b/amiga/print.c index 25230112f..84cca8fac 100644 --- a/amiga/print.c +++ b/amiga/print.c @@ -481,7 +481,8 @@ bool ami_print_begin(struct print_settings *ps) ami_init_layers(ami_print_info.gg, ami_print_info.PED->ped_MaxXDots, - ami_print_info.PED->ped_MaxYDots); + ami_print_info.PED->ped_MaxYDots, + true); ami_print_info.page = 0; diff --git a/amiga/tree.c b/amiga/tree.c index 8a35a4453..54082099f 100644 --- a/amiga/tree.c +++ b/amiga/tree.c @@ -734,7 +734,7 @@ void ami_tree_open(struct treeview_window *twin,int type) twin->scrollerhook.h_Entry = (void *)ami_tree_scroller_hook; twin->scrollerhook.h_Data = twin; - ami_init_layers(&twin->globals, 0, 0); + ami_init_layers(&twin->globals, 0, 0, false); ami_tree_menu(twin); if(type == AMI_TREE_SSLCERT) From 9e1622a679031d2bb2205ba42e23269600bc9a3a Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 25 Jan 2016 12:20:58 +0000 Subject: [PATCH 2/5] Wrap verbose JS logging in debug macro. --- javascript/duktape/Document.bnd | 4 ++-- javascript/duktape/Window.bnd | 2 +- javascript/duktape/dukky.c | 4 ++-- javascript/duktape/dukky.h | 6 ++++++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/javascript/duktape/Document.bnd b/javascript/duktape/Document.bnd index a51b38dfd..e15f75f48 100644 --- a/javascript/duktape/Document.bnd +++ b/javascript/duktape/Document.bnd @@ -35,7 +35,7 @@ method Document::write() } duk_concat(ctx, duk_get_top(ctx)); text = duk_safe_to_lstring(ctx, 0, &text_len); - LOG("Writing %*s", (int)text_len, text); + JS_LOG("Writing %*s", (int)text_len, text); err = dom_node_get_user_data(priv->parent.node, corestring_dom___ns_key_html_content_data, @@ -69,7 +69,7 @@ method Document::writeln() duk_concat(ctx, duk_get_top(ctx)); text = duk_safe_to_lstring(ctx, 0, &text_len); - LOG("Writeln %*s", (int)text_len, text); + JS_LOG("Writeln %*s", (int)text_len, text); err = dom_node_get_user_data(priv->parent.node, corestring_dom___ns_key_html_content_data, &htmlc); diff --git a/javascript/duktape/Window.bnd b/javascript/duktape/Window.bnd index ed931c614..81d52809a 100644 --- a/javascript/duktape/Window.bnd +++ b/javascript/duktape/Window.bnd @@ -52,7 +52,7 @@ prototype Window() getter Window::document() %{ - LOG("priv=%p", priv); + JS_LOG("priv=%p", priv); dom_document *doc = priv->htmlc->document; dukky_push_node(ctx, (struct dom_node *)doc); return 1; diff --git a/javascript/duktape/dukky.c b/javascript/duktape/dukky.c index 437a3d48a..d583484bf 100644 --- a/javascript/duktape/dukky.c +++ b/javascript/duktape/dukky.c @@ -236,7 +236,7 @@ dukky_push_node_klass(duk_context *ctx, struct dom_node *node) duk_bool_t dukky_push_node(duk_context *ctx, struct dom_node *node) { - LOG("Pushing node %p", node); + JS_LOG("Pushing node %p", node); /* First check if we can find the node */ /* ... */ duk_get_global_string(ctx, NODE_MAGIC); @@ -251,7 +251,7 @@ dukky_push_node(duk_context *ctx, struct dom_node *node) /* ... node nodes */ duk_pop(ctx); /* ... node */ - LOG("Found it memoised"); + JS_LOG("Found it memoised"); return true; } /* ... nodes undefined */ diff --git a/javascript/duktape/dukky.h b/javascript/duktape/dukky.h index d1fff36aa..212525ebe 100644 --- a/javascript/duktape/dukky.h +++ b/javascript/duktape/dukky.h @@ -24,6 +24,12 @@ #ifndef DUKKY_H #define DUKKY_H +#ifdef JS_DEBUG +# define JS_LOG(format, args...) LOG(format , ##args) +#else +# define JS_LOG(format, ...) ((void) 0) +#endif + duk_ret_t dukky_create_object(duk_context *ctx, const char *name, int args); duk_bool_t dukky_push_node_stacked(duk_context *ctx); duk_bool_t dukky_push_node(duk_context *ctx, struct dom_node *node); From 822493af0d301fbfe05bae11b9ae12914171057f Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 22 Jan 2016 14:38:12 +0000 Subject: [PATCH 3/5] fixup some empty logging calls in atari hotlist code --- atari/hotlist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/atari/hotlist.c b/atari/hotlist.c index 265491191..380e1b6c1 100644 --- a/atari/hotlist.c +++ b/atari/hotlist.c @@ -72,13 +72,13 @@ static struct atari_treeview_callbacks atari_hotlist_treeview_callbacks = { static nserror atari_hotlist_init_phase2(struct core_window *cw, struct core_window_callback_table *cb_t) { - LOG(""); + LOG("cw:%p", cw); return(hotlist_init(cb_t, cw, hl.path)); } static void atari_hotlist_finish(struct core_window *cw) { - LOG(""); + LOG("cw:%p", cw); hotlist_fini(hl.path); } @@ -123,7 +123,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) GRECT tb_area; GUIWIN * gemtk_win; - LOG(""); + LOG("gw:%p", win); tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win); cw = (struct core_window *)tv; From 6d63f7959af64a45b0643d0610fcbdb0c07bfbc4 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 25 Jan 2016 15:48:07 +0000 Subject: [PATCH 4/5] make declarations match definitions for duk_raw_read_xxx_be --- javascript/duktape/duktape.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/javascript/duktape/duktape.c b/javascript/duktape/duktape.c index 105bdbef9..a215d13dc 100644 --- a/javascript/duktape/duktape.c +++ b/javascript/duktape/duktape.c @@ -4926,12 +4926,12 @@ DUK_INTERNAL_DECL duk_uint8_t *duk_bw_insert_ensure_area(duk_hthread *thr, duk_b DUK_INTERNAL_DECL void duk_bw_remove_raw_slice(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t off, duk_size_t len); /* No duk_bw_remove_ensure_slice(), functionality would be identical. */ -DUK_INTERNAL_DECL duk_uint16_t duk_raw_read_u16_be(duk_uint8_t **p); -DUK_INTERNAL_DECL duk_uint32_t duk_raw_read_u32_be(duk_uint8_t **p); -DUK_INTERNAL_DECL duk_double_t duk_raw_read_double_be(duk_uint8_t **p); -DUK_INTERNAL_DECL void duk_raw_write_u16_be(duk_uint8_t **p, duk_uint16_t val); -DUK_INTERNAL_DECL void duk_raw_write_u32_be(duk_uint8_t **p, duk_uint32_t val); -DUK_INTERNAL_DECL void duk_raw_write_double_be(duk_uint8_t **p, duk_double_t val); +DUK_INTERNAL_DECL DUK_INLINE duk_uint16_t duk_raw_read_u16_be(duk_uint8_t **p); +DUK_INTERNAL_DECL DUK_INLINE duk_uint32_t duk_raw_read_u32_be(duk_uint8_t **p); +DUK_INTERNAL_DECL DUK_INLINE duk_double_t duk_raw_read_double_be(duk_uint8_t **p); +DUK_INTERNAL_DECL DUK_INLINE void duk_raw_write_u16_be(duk_uint8_t **p, duk_uint16_t val); +DUK_INTERNAL_DECL DUK_INLINE void duk_raw_write_u32_be(duk_uint8_t **p, duk_uint32_t val); +DUK_INTERNAL_DECL DUK_INLINE void duk_raw_write_double_be(duk_uint8_t **p, duk_double_t val); #if defined(DUK_USE_DEBUGGER_SUPPORT) /* For now only needed by the debugger. */ DUK_INTERNAL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len); From 6847fad65368bab3418eb716af4f9d485dfe30b1 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 25 Jan 2016 16:10:42 +0000 Subject: [PATCH 5/5] remove javascript build option from jenkins script --- utils/jenkins-build.sh | 48 ++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/utils/jenkins-build.sh b/utils/jenkins-build.sh index e34d26c06..f85ae4b3f 100755 --- a/utils/jenkins-build.sh +++ b/utils/jenkins-build.sh @@ -30,7 +30,6 @@ # TARGET is set to the frontend target to build # HOST is set to the identifier of the toolchain doing the building # CC is the compiler (gcc or clang) -# BUILD_JS is the javascript type (json or jsoff) # BUILD_NUMBER is the CI build number ##### @@ -346,36 +345,29 @@ if [ "${CC}" = "clang" ];then fi # convert javascript parameters -if [ "${BUILD_JS}" = "json" ];then - case ${HOST} in - "arm-unknown-riscos") - BUILD_MOZJS=NO - BUILD_JS=NO - #BUILD_JS=YES - BUILD_DUKTAPE=YES - ;; - - "amd64-unknown-openbsd5.4") - BUILD_MOZJS=NO - BUILD_JS=NO - #BUILD_JS=YES - BUILD_DUKTAPE=YES - ;; - - *) - #BUILD_MOZJS=YES - BUILD_MOZJS=NO - BUILD_JS=NO - BUILD_DUKTAPE=YES +case ${HOST} in + "arm-unknown-riscos") + BUILD_MOZJS=NO + BUILD_JS=NO + #BUILD_JS=YES + BUILD_DUKTAPE=YES ;; - esac + "amd64-unknown-openbsd5.4") + BUILD_MOZJS=NO + BUILD_JS=NO + #BUILD_JS=YES + BUILD_DUKTAPE=YES + ;; -else - BUILD_JS=NO - BUILD_MOZJS=NO - BUILD_DUKTAPE=NO -fi + *) + #BUILD_MOZJS=YES + BUILD_MOZJS=NO + BUILD_JS=NO + BUILD_DUKTAPE=YES + ;; + +esac ########### Use distcc if present ######