st/xorg: Work around cursor reference counting bugs in older X servers.
[mesa.git] / src / gallium / winsys / gdi / gdi_llvmpipe_winsys.c
index 9d0daf77e9c54d4910e95bf0c5ff3f182183a57e..a9fa03b8e57ac73b05d9e38cf97e67aace73fbf6 100644 (file)
@@ -38,7 +38,8 @@
 
 #include "pipe/p_format.h"
 #include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "llvmpipe/lp_winsys.h"
@@ -49,7 +50,6 @@
 struct gdi_llvmpipe_displaytarget
 {
    enum pipe_format format;
-   struct pipe_format_block block;
    unsigned width;
    unsigned height;
    unsigned stride;
@@ -75,8 +75,8 @@ gdi_llvmpipe_is_displaytarget_format_supported( struct llvmpipe_winsys *ws,
                                                 enum pipe_format format )
 {
    switch(format) {
-   case PIPE_FORMAT_X8R8G8B8_UNORM:
-   case PIPE_FORMAT_A8R8G8B8_UNORM:
+   case PIPE_FORMAT_B8G8R8X8_UNORM:
+   case PIPE_FORMAT_B8G8R8A8_UNORM:
       return TRUE;
 
    /* TODO: Support other formats possible with BMPs, as described in 
@@ -118,16 +118,6 @@ gdi_llvmpipe_displaytarget_destroy(struct llvmpipe_winsys *winsys,
 }
 
 
-/**
- * Round n up to next multiple.
- */
-static INLINE unsigned
-round_up(unsigned n, unsigned multiple)
-{
-   return (n + multiple - 1) & ~(multiple - 1);
-}
-
-
 static struct llvmpipe_displaytarget *
 gdi_llvmpipe_displaytarget_create(struct llvmpipe_winsys *winsys,
                                   enum pipe_format format,
@@ -147,10 +137,10 @@ gdi_llvmpipe_displaytarget_create(struct llvmpipe_winsys *winsys,
    gdt->width = width;
    gdt->height = height;
 
-   bpp = pf_get_bits(format);
-   cpp = pf_get_size(format);
+   bpp = util_format_get_blocksizebits(format);
+   cpp = util_format_get_blocksize(format);
    
-   gdt->stride = round_up(width * cpp, alignment);
+   gdt->stride = align(width * cpp, alignment);
    gdt->size = gdt->stride * height;
    
    gdt->data = align_malloc(gdt->size, alignment);
@@ -226,17 +216,12 @@ no_winsys:
 }
 
 
-static struct pipe_context *
-gdi_llvmpipe_context_create(struct pipe_screen *screen)
-{
-   return llvmpipe_create(screen);
-}
 
 
 static void
-gdi_llvmpipe_flush_frontbuffer(struct pipe_screen *screen,
-                               struct pipe_surface *surface,
-                               HDC hDC)
+gdi_llvmpipe_present(struct pipe_screen *screen,
+                     struct pipe_surface *surface,
+                     HDC hDC)
 {
     struct llvmpipe_texture *texture;
     struct gdi_llvmpipe_displaytarget *gdt;
@@ -253,8 +238,11 @@ gdi_llvmpipe_flush_frontbuffer(struct pipe_screen *screen,
 
 static const struct stw_winsys stw_winsys = {
    &gdi_llvmpipe_screen_create,
-   &gdi_llvmpipe_context_create,
-   &gdi_llvmpipe_flush_frontbuffer
+   &gdi_llvmpipe_present,
+   NULL, /* get_adapter_luid */
+   NULL, /* shared_surface_open */
+   NULL, /* shared_surface_close */
+   NULL  /* compose */
 };
 
 
@@ -263,13 +251,13 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
 {
    switch (fdwReason) {
    case DLL_PROCESS_ATTACH:
-      if (!stw_init(&stw_winsys)) {
-         return FALSE;
-      }
-      return stw_init_thread();
+      stw_init(&stw_winsys);
+      stw_init_thread();
+      break;
 
    case DLL_THREAD_ATTACH:
-      return stw_init_thread();
+      stw_init_thread();
+      break;
 
    case DLL_THREAD_DETACH:
       stw_cleanup_thread();