uint32_t brightness_level = BRIGHTNESS_MAX;
uint32_t brightness_off;
+pixman_color_t level_color;
+pixman_image_t *brightness_image;
/* level : 1 ~ 100, interval : 1 or 2 */
/* skip 100 level, set to default alpha */
-uint8_t brightness_tbl[] = {100, /* level 0 : for dimming */
-/* level 01 ~ 10 */ 106, 108, 109, 111, 112, 114, 115, 117, 118, 120,
-/* level 11 ~ 20 */ 121, 123, 124, 126, 127, 129, 130, 132, 133, 135,
-/* level 21 ~ 30 */ 136, 138, 139, 141, 142, 144, 145, 147, 148, 150,
-/* level 31 ~ 40 */ 151, 153, 154, 156, 157, 159, 160, 162, 163, 165,
-/* level 41 ~ 50 */ 166, 168, 169, 171, 172, 174, 175, 177, 178, 180,
-/* level 51 ~ 60 */ 181, 183, 184, 186, 187, 189, 190, 192, 193, 195,
-/* level 61 ~ 70 */ 196, 198, 199, 201, 202, 204, 205, 207, 208, 210,
-/* level 71 ~ 80 */ 211, 213, 214, 216, 217, 219, 220, 222, 223, 225,
-/* level 81 ~ 90 */ 226, 228, 229, 231, 232, 234, 235, 237, 238, 240,
-/* level 91 ~ 99 */ 241, 243, 244, 246, 247, 249, 250, 252, 253};
+uint8_t brightness_tbl[] = {155, /* level 0 : for dimming */
+/* level 01 ~ 10 */ 149, 147, 146, 144, 143, 141, 140, 138, 137, 135,
+/* level 11 ~ 20 */ 134, 132, 131, 129, 128, 126, 125, 123, 122, 120,
+/* level 21 ~ 30 */ 119, 117, 116, 114, 113, 111, 110, 108, 107, 105,
+/* level 31 ~ 40 */ 104, 102, 101, 99, 98, 96, 95, 93, 92, 90,
+/* level 41 ~ 50 */ 89, 87, 86, 84, 83, 81, 80, 78, 77, 75,
+/* level 51 ~ 60 */ 74, 72, 71, 69, 68, 66, 65, 63, 62, 60,
+/* level 61 ~ 70 */ 59, 57, 56, 54, 53, 51, 50, 48, 47, 45,
+/* level 71 ~ 80 */ 44, 42, 41, 39, 38, 36, 35, 33, 32, 30,
+/* level 81 ~ 90 */ 29, 27, 26, 24, 23, 21, 20, 18, 17, 15,
+/* level 91 ~ 99 */ 14, 12, 11, 9, 8, 6, 5, 3, 2};
QEMUBH *bh;
ERR("brightness_reg_write: Invalide brightness level.\n");
} else {
brightness_level = val;
+ if (brightness_image) {
+ pixman_image_unref(brightness_image);
+ }
+ level_color.alpha = brightness_tbl[brightness_level] << 8;
+ brightness_image = pixman_image_create_solid_fill(&level_color);
INFO("brightness_level : %lld\n", val);
#ifdef TARGET_ARM
vga_hw_invalidate();
if (bh) {
qemu_bh_delete(bh);
}
+ if (brightness_image) {
+ pixman_image_unref(brightness_image);
+ }
}
static void maru_brightness_bh(void *opaque)
uint8_t *overlay_ptr;
+pixman_image_t *overlay0_image;
+pixman_image_t *overlay1_image;
+
uint8_t overlay0_power;
uint16_t overlay0_left;
uint16_t overlay0_top;
/* clear the last overlay area. */
memset(overlay_ptr, 0x00, (OVERLAY_MEM_SIZE / 2));
overlay0_left = overlay0_top = overlay0_width = overlay0_height = 0;
+ if (overlay0_image) {
+ pixman_image_unref(overlay0_image);
+ overlay0_image = NULL;
+ }
TRACE("clear the last overlay0 area\n");
+ } else {
+ overlay0_image = pixman_image_create_bits(PIXMAN_a8r8g8b8,
+ overlay0_width, overlay0_height,
+ (uint32_t *)overlay_ptr,
+ overlay0_width * 4);
+ TRACE("create the overlay0 pixman image\n");
}
break;
case OVERLAY_POSITION:
memset(overlay_ptr + OVERLAY1_REG_OFFSET,
0x00, (OVERLAY_MEM_SIZE / 2));
overlay1_left = overlay1_top = overlay1_width = overlay1_height = 0;
+ if (overlay1_image) {
+ pixman_image_unref(overlay1_image);
+ overlay1_image = NULL;
+ }
TRACE("clear the last overlay1 area\n");
+ } else {
+ overlay1_image = pixman_image_create_bits(PIXMAN_a8r8g8b8,
+ overlay1_width, overlay1_height,
+ (uint32_t *)(overlay_ptr + OVERLAY1_REG_OFFSET),
+ overlay1_width * 4);
+ TRACE("create the overlay1 pixman image\n");
}
break;
case OVERLAY1_REG_OFFSET + OVERLAY_POSITION:
uint8_t *d;
uint32_t v, addr1, addr;
maru_vga_draw_line_func *maru_vga_draw_line;
+ static pixman_image_t *surface = NULL;
full_update |= update_basic_params(s);
disp_width * 4, (uint8_t*)shared_memory); */
s->ds->surface = qemu_create_displaysurface(s->ds, disp_width, height);
+ surface = pixman_image_create_bits(PIXMAN_a8r8g8b8,
+ disp_width, height,
+ (uint32_t *)ds_get_data(s->ds),
+ disp_width * 4);
#else //MARU_VGA
s->ds->surface = qemu_create_displaysurface_from(disp_width, height, depth,
if (s->cursor_draw_line)
s->cursor_draw_line(s, d, y);
}
-
-#ifdef MARU_VGA
-
- int i;
- uint8_t *fb_sub;
- uint8_t *over_sub;
- uint8_t *dst_sub;
- uint8_t alpha, c_alpha;
- uint32_t *dst;
- uint16_t overlay_bottom;
-
- if ( overlay0_power ) {
-
- overlay_bottom = overlay0_top + overlay0_height;
-
- if ( overlay0_top <= y && y < overlay_bottom ) {
-
- fb_sub = s->vram_ptr + addr + overlay0_left * 4;
- over_sub = overlay_ptr + ( y - overlay0_top ) * overlay0_width * 4;
- dst = (uint32_t*) ( s->ds->surface->data + addr + overlay0_left * 4 );
-
- for ( i = 0; i < overlay0_width; i++, fb_sub += 4, over_sub += 4, dst++ ) {
-
- alpha = fb_sub[3];
- c_alpha = 0xff - alpha;
-
- *dst = ( ( c_alpha * over_sub[0] + alpha * fb_sub[0] ) >> 8 )
- | ( ( c_alpha * over_sub[1] + alpha * fb_sub[1] ) & 0xFF00 )
- | ( ( ( c_alpha * over_sub[2] + alpha * fb_sub[2] ) & 0xFF00 ) << 8 );
- }
-
- }
-
- }
-
- if ( overlay1_power ) {
-
- overlay_bottom = overlay1_top + overlay1_height;
-
- if ( overlay1_top <= y && y < overlay_bottom ) {
-
- fb_sub = s->vram_ptr + addr + overlay1_left * 4;
- over_sub = overlay_ptr + ( y - overlay1_top ) * overlay1_width * 4 + 0x00400000;
- dst = (uint32_t*) ( s->ds->surface->data + addr + overlay1_left * 4 );
-
- for ( i = 0; i < overlay1_width; i++, fb_sub += 4, over_sub += 4, dst++ ) {
-
- alpha = fb_sub[3];
- c_alpha = 0xff - alpha;
-
- *dst = ( ( c_alpha * over_sub[0] + alpha * fb_sub[0] ) >> 8 )
- | ( ( c_alpha * over_sub[1] + alpha * fb_sub[1] ) & 0xFF00 )
- | ( ( ( c_alpha * over_sub[2] + alpha * fb_sub[2] ) & 0xFF00 ) << 8 );
- }
-
- }
-
- }
- if (brightness_level < BRIGHTNESS_MAX) {
- alpha = brightness_tbl[brightness_level];
- dst_sub = ds_get_data(s->ds) + addr;
- dst = (uint32_t *)(ds_get_data(s->ds) + addr);
- for (i = 0; i < disp_width; i++, dst_sub += 4, dst++) {
- *dst = ((alpha * dst_sub[0])>> 8)
- | ((alpha * dst_sub[1]) & 0xFF00)
- | (((alpha * dst_sub[2]) & 0xFF00) << 8);
- }
- }
-#endif /* MARU_VGA */
-
} else {
if (y_start >= 0) {
/* flush to display */
d += linesize;
}
+#ifdef MARU_VGA
+ /* overlay0 */
+ if (overlay0_power) {
+ pixman_image_composite(PIXMAN_OP_OVER,
+ overlay0_image, NULL, surface,
+ 0, 0, 0, 0, overlay0_left, overlay0_top,
+ overlay0_width, overlay0_height);
+ }
+ /* overlay1 */
+ if (overlay1_power) {
+ pixman_image_composite(PIXMAN_OP_OVER,
+ overlay1_image, NULL, surface,
+ 0, 0, 0, 0, overlay1_left, overlay1_top,
+ overlay1_width, overlay1_height);
+ }
+ /* apply the brightness level */
+ if (brightness_level < BRIGHTNESS_MAX) {
+ pixman_image_composite(PIXMAN_OP_OVER,
+ brightness_image, NULL, surface,
+ 0, 0, 0, 0, 0, 0,
+ disp_width, height);
+ }
+#endif
if (y_start >= 0) {
/* flush to display */
dpy_update(s->ds, 0, y_start,