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
This commit is contained in:
Axel Dörfler 2006-05-11 15:24:34 +00:00
parent 030d964e4e
commit efeb77268d
4 changed files with 78 additions and 14 deletions

View File

@ -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

View File

@ -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)
{
}
};

View File

@ -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));
}
}

View File

@ -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;
*/