Started implementing screen-to-screen blits, not yet tested.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17416 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-05-10 18:53:20 +00:00
parent 6c67d64cad
commit 2ace35ed22
5 changed files with 81 additions and 8 deletions

View File

@ -59,6 +59,7 @@ struct intel_shared_info {
display_mode current_mode;
uint32 bytes_per_row;
uint32 bits_per_pixel;
uint32 dpms_mode;
area_id registers_area; // area of memory mapped registers
@ -245,6 +246,9 @@ struct intel_free_graphics_memory {
#define COMMAND_OVERLAY_OFF (2 << 21)
#define OVERLAY_UPDATE_COEFFICIENTS 0x1
// 2D acceleration
#define COMMAND_BLIT 0x54c00006
// overlay
#define INTEL_OVERLAY_UPDATE 0x30000

View File

@ -39,5 +39,44 @@ class QueueCommands {
// commands
struct blit_command : command {
uint8 flags;
uint8 raster_operation;
uint16 dest_bytes_per_row;
uint16 dest_left;
uint16 dest_top;
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()
{
opcode = COMMAND_BLIT;
switch (gInfo->shared_info->bits_per_pixel) {
case 8:
flags = 0;
break;
case 15:
flags = 2;
break;
case 16:
flags = 1;
break;
case 32:
flags = 3;
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;
reserved = 0;
}
virtual size_t Length() { return 6; }
};
#endif // COMMANDS_H

View File

@ -195,3 +195,22 @@ intel_sync_to_token(sync_token *syncToken)
// #pragma mark - engine acceleration
void
intel_screen_to_screen_blit(engine_token *token, blit_params *params, uint32 count)
{
QueueCommands queue(gInfo->shared_info->primary_ring_buffer);
for (uint32 i = 0; i < count; i++) {
blit_command blit;
blit.source_left = params[i].src_left;
blit.source_top = params[i].src_top;
blit.dest_left = params[i].dest_left;
blit.dest_top = params[i].dest_top;
blit.dest_right = params[i].dest_left + params[i].width;
blit.dest_bottom = params[i].dest_top + params[i].height;
queue.Put(blit);
}
}

View File

@ -83,11 +83,16 @@ get_accelerant_hook(uint32 feature, void *data)
return intel_sync_to_token;
/* 2D acceleration */
/* HOOK(SCREEN_TO_SCREEN_BLIT);
HOOK(FILL_RECTANGLE);
HOOK(INVERT_RECTANGLE);
HOOK(FILL_SPAN);
*/
/*
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;
*/
// overlay
case B_OVERLAY_COUNT:
return intel_overlay_supported_spaces;

View File

@ -150,7 +150,8 @@ compute_pll_divisors(const display_mode &current, uint32 &postDivisor,
static void
get_color_space_format(const display_mode &mode, uint32 &colorMode, uint32 &bytesPerRow)
get_color_space_format(const display_mode &mode, uint32 &colorMode,
uint32 &bytesPerRow, uint32 &bitsPerPixel)
{
uint32 bytesPerPixel;
@ -158,19 +159,23 @@ get_color_space_format(const display_mode &mode, uint32 &colorMode, uint32 &byte
case B_RGB32_LITTLE:
colorMode = DISPLAY_CONTROL_RGB32;
bytesPerPixel = 4;
bitsPerPixel = 32;
break;
case B_RGB16_LITTLE:
colorMode = DISPLAY_CONTROL_RGB16;
bytesPerPixel = 2;
bitsPerPixel = 16;
break;
case B_RGB15_LITTLE:
colorMode = DISPLAY_CONTROL_RGB15;
bytesPerPixel = 2;
bitsPerPixel = 15;
break;
case B_CMAP8:
default:
colorMode = DISPLAY_CONTROL_CMAP8;
bytesPerPixel = 1;
bitsPerPixel = 8;
break;
}
@ -237,8 +242,8 @@ intel_set_display_mode(display_mode *mode)
set_display_power_mode(B_DPMS_OFF);
uint32 colorMode, bytesPerRow;
get_color_space_format(current, colorMode, bytesPerRow);
uint32 colorMode, bytesPerRow, bitsPerPixel;
get_color_space_format(current, colorMode, bytesPerRow, bitsPerPixel);
// free old and allocate new frame buffer in graphics memory
@ -316,6 +321,7 @@ intel_set_display_mode(display_mode *mode)
// update shared info
gInfo->shared_info->bytes_per_row = bytesPerRow;
gInfo->shared_info->current_mode = current;
gInfo->shared_info->bits_per_pixel = bitsPerPixel;
return B_OK;
}