From efeb77268db82e4081b7b09e610697feaa34e125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 11 May 2006 15:24:34 +0000 Subject: [PATCH] Say hello to B_FILL_RECTANGLE and B_INVERT_RECTANGLE - only B_FILL_SPAN is missing from the acceleration hooks in BeOS. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17424 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/intel_extreme/intel_extreme.h | 4 +- .../accelerants/intel_extreme/commands.h | 42 +++++++++++++----- .../accelerants/intel_extreme/engine.cpp | 44 ++++++++++++++++++- .../accelerants/intel_extreme/hooks.cpp | 2 +- 4 files changed, 78 insertions(+), 14 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index cc1e23a3d1..2a05174384 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -248,7 +248,9 @@ struct intel_free_graphics_memory { #define OVERLAY_UPDATE_COEFFICIENTS 0x1 // 2D acceleration -#define COMMAND_BLIT 0x54c00006 +#define XY_COMMAND_SOURCE_BLIT 0x54c00006 +#define XY_COMMAND_COLOR_BLIT 0x54000004 +#define COMMAND_COLOR_BLIT 0x50000003 #define COMMAND_BLIT_RGBA 0x00300000 // overlay diff --git a/src/add-ons/accelerants/intel_extreme/commands.h b/src/add-ons/accelerants/intel_extreme/commands.h index 0a689131aa..ed59443886 100644 --- a/src/add-ons/accelerants/intel_extreme/commands.h +++ b/src/add-ons/accelerants/intel_extreme/commands.h @@ -38,7 +38,7 @@ class QueueCommands { // commands -struct blit_command : command { +struct xy_command : command { uint16 dest_bytes_per_row; uint8 raster_operation; uint8 flags; @@ -47,15 +47,10 @@ struct blit_command : command { uint16 dest_right; uint16 dest_bottom; uint32 dest_base; - uint16 source_left; - uint16 source_top; - uint16 source_bytes_per_row; - uint16 reserved; - uint32 source_base; - blit_command() + xy_command(uint32 command, uint16 rop) { - opcode = COMMAND_BLIT; + opcode = command; switch (gInfo->shared_info->bits_per_pixel) { case 8: flags = 0; @@ -71,10 +66,35 @@ struct blit_command : command { opcode |= COMMAND_BLIT_RGBA; break; } - dest_base = source_base = gInfo->shared_info->frame_buffer_offset; - dest_bytes_per_row = source_bytes_per_row = gInfo->shared_info->bytes_per_row; + + dest_bytes_per_row = gInfo->shared_info->bytes_per_row; + dest_base = gInfo->shared_info->frame_buffer_offset; + raster_operation = rop; + } +}; + +struct xy_source_blit_command : xy_command { + uint16 source_left; + uint16 source_top; + uint16 source_bytes_per_row; + uint16 reserved; + uint32 source_base; + + xy_source_blit_command() + : xy_command(XY_COMMAND_SOURCE_BLIT, 0xcc) + { + source_bytes_per_row = dest_bytes_per_row; + source_base = dest_base; reserved = 0; - raster_operation = 0xcc; + } +}; + +struct xy_color_blit_command : xy_command { + uint32 color; + + xy_color_blit_command(bool invert) + : xy_command(XY_COMMAND_COLOR_BLIT, invert ? 0x55 : 0xf0) + { } }; diff --git a/src/add-ons/accelerants/intel_extreme/engine.cpp b/src/add-ons/accelerants/intel_extreme/engine.cpp index 2bc80d8e84..31bc2e48cf 100644 --- a/src/add-ons/accelerants/intel_extreme/engine.cpp +++ b/src/add-ons/accelerants/intel_extreme/engine.cpp @@ -178,6 +178,11 @@ intel_wait_engine_idle(void) { TRACE(("intel_wait_engine_idle()\n")); + { + QueueCommands queue(gInfo->shared_info->primary_ring_buffer); + queue.PutFlush(); + } + // TODO: this should only be a temporary solution! // a better way to do this would be to acquire the engine's lock and // sync to the latest token @@ -220,7 +225,7 @@ intel_screen_to_screen_blit(engine_token *token, blit_params *params, uint32 cou QueueCommands queue(gInfo->shared_info->primary_ring_buffer); for (uint32 i = 0; i < count; i++) { - blit_command blit; + xy_source_blit_command blit; blit.source_left = params[i].src_left; blit.source_top = params[i].src_top; blit.dest_left = params[i].dest_left; @@ -232,3 +237,40 @@ intel_screen_to_screen_blit(engine_token *token, blit_params *params, uint32 cou } } + +void +intel_fill_rectangle(engine_token *token, uint32 color, fill_rect_params *params, + uint32 count) +{ + QueueCommands queue(gInfo->shared_info->primary_ring_buffer); + + for (uint32 i = 0; i < count; i++) { + xy_color_blit_command blit(false); + blit.dest_left = params[i].left; + blit.dest_top = params[i].top; + blit.dest_right = params[i].right + 1; + blit.dest_bottom = params[i].bottom + 1; + blit.color = color; + + queue.Put(blit, sizeof(blit)); + } +} + + +void +intel_invert_rectangle(engine_token *token, fill_rect_params *params, uint32 count) +{ + QueueCommands queue(gInfo->shared_info->primary_ring_buffer); + + for (uint32 i = 0; i < count; i++) { + xy_color_blit_command blit(true); + blit.dest_left = params[i].left; + blit.dest_top = params[i].top; + blit.dest_right = params[i].right + 1; + blit.dest_bottom = params[i].bottom + 1; + blit.color = 0xffffffff; + + queue.Put(blit, sizeof(blit)); + } +} + diff --git a/src/add-ons/accelerants/intel_extreme/hooks.cpp b/src/add-ons/accelerants/intel_extreme/hooks.cpp index 4412d0a107..2403357e12 100644 --- a/src/add-ons/accelerants/intel_extreme/hooks.cpp +++ b/src/add-ons/accelerants/intel_extreme/hooks.cpp @@ -85,11 +85,11 @@ get_accelerant_hook(uint32 feature, void *data) /* 2D acceleration */ case B_SCREEN_TO_SCREEN_BLIT: return intel_screen_to_screen_blit; -/* case B_FILL_RECTANGLE: return intel_fill_rectangle; case B_INVERT_RECTANGLE: return intel_invert_rectangle; +/* case B_FILL_SPAN: return intel_fill_span; */