From 09ee9d676ad314666df90c9e173950bd5361d126 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Sat, 6 Jul 2013 15:15:26 +0000 Subject: [PATCH] Gallium 3D: kos_winsys git-svn-id: svn://kolibrios.org@3773 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../video/Gallium/targets/graw_kos/graw_kos.c | 61 +++++++++++++++---- .../Gallium/targets/graw_kos/graw_util.c | 2 - .../video/Gallium/winsys/sw/kos_sw_winsys.c | 24 ++++++-- 3 files changed, 70 insertions(+), 17 deletions(-) diff --git a/drivers/video/Gallium/targets/graw_kos/graw_kos.c b/drivers/video/Gallium/targets/graw_kos/graw_kos.c index b36372332e..9b1220c785 100644 --- a/drivers/video/Gallium/targets/graw_kos/graw_kos.c +++ b/drivers/video/Gallium/targets/graw_kos/graw_kos.c @@ -72,14 +72,21 @@ graw_create_window_and_screen(int x, if (format != PIPE_FORMAT_B8G8R8X8_UNORM) goto fail; - winsys = kos_create_sw_winsys(); + winsys = kos_create_sw_winsys(); if (winsys == NULL) goto fail; - screen = sw_screen_create(winsys); + screen = sw_screen_create(winsys); + if (screen == NULL) goto fail; - + + BeginDraw(); + DrawWindow(x, y,width-1,height-1, + NULL,0,0x41); + EndDraw(); + + *handle = (void *)winsys; return (screen); fail: @@ -99,12 +106,44 @@ graw_set_display_func(void (* draw)(void)) void graw_main_loop(void) { - for (;;) { - - if (graw.draw) { - graw.draw(); - } - - delay(1); - } + int ev; + oskey_t key; + + BeginDraw(); + DrawWindow(0,0,0,0, NULL, 0x000000,0x41); + EndDraw(); + + if (graw.draw) + { + graw.draw(); + } + + while(1) + { + ev = wait_for_event(100); + + switch(ev) + { + case 1: + BeginDraw(); + DrawWindow(0,0,0,0, NULL, 0x000000,0x41); + EndDraw(); + + if (graw.draw) + { + graw.draw(); + } + continue; + + case 2: + key = get_key(); +// printf("key %x\n", key.code); + if( key.code == 0x1b) + return; + continue; + + default: + continue; + }; + }; } diff --git a/drivers/video/Gallium/targets/graw_kos/graw_util.c b/drivers/video/Gallium/targets/graw_kos/graw_util.c index 2ba1e2dda0..16792a6c9c 100644 --- a/drivers/video/Gallium/targets/graw_kos/graw_util.c +++ b/drivers/video/Gallium/targets/graw_kos/graw_util.c @@ -8,7 +8,6 @@ #include "util/u_memory.h" #include "state_tracker/graw.h" -#if 0 /* Helper functions. These are the same for all graw implementations. */ PUBLIC void * @@ -55,7 +54,6 @@ graw_parse_fragment_shader(struct pipe_context *pipe, state.tokens = tokens; return pipe->create_fs_state(pipe, &state); } -#endif static char out_filename[256] = ""; diff --git a/drivers/video/Gallium/winsys/sw/kos_sw_winsys.c b/drivers/video/Gallium/winsys/sw/kos_sw_winsys.c index bfa3647b86..6e56e12290 100644 --- a/drivers/video/Gallium/winsys/sw/kos_sw_winsys.c +++ b/drivers/video/Gallium/winsys/sw/kos_sw_winsys.c @@ -182,11 +182,27 @@ kos_sw_display( struct sw_winsys *winsys, struct sw_displaytarget *dt) { struct kos_sw_displaytarget *gdt = kos_sw_displaytarget(dt); + + struct blit_call bc; + int ret; + + bc.dstx = 0; + bc.dsty = 24; + bc.w = gdt->width; + bc.h = gdt->height; + bc.srcx = 0; + bc.srcy = 0; + bc.srcw = gdt->width; + bc.srch = gdt->height; + bc.stride = gdt->stride; + bc.bitmap = gdt->data; + + __asm__ __volatile__( + "int $0x40":"=a"(ret):"a"(73), "b"(0x00), + "c"(&bc):"memory"); + + return ret; -// StretchDIBits(hDC, -// 0, 0, gdt->width, gdt->height, -// 0, 0, gdt->width, gdt->height, -// gdt->data, &gdt->bmi, 0, SRCCOPY); } static void