summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/gdi
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2009-12-12 16:48:32 +0100
committerMichal Krol <[email protected]>2009-12-12 16:48:32 +0100
commita3eb0f718e19653a2ad8e49396c904183be456f3 (patch)
tree0092574c469ea586a6cab8b8ebb7ac62b8221a2a /src/gallium/winsys/gdi
parent491f384c3958067e6c4c994041f5d8d413b806bc (diff)
parent784cca9fa527de771754d76545970f78094b9adf (diff)
Merge branch 'master' into glsl-pp-rework-2
Conflicts: progs/perf/drawoverhead.c progs/perf/teximage.c progs/perf/vbo.c progs/perf/vertexrate.c src/mesa/shader/slang/library/slang_common_builtin_gc.h
Diffstat (limited to 'src/gallium/winsys/gdi')
-rw-r--r--src/gallium/winsys/gdi/SConscript18
-rw-r--r--src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c31
-rw-r--r--src/gallium/winsys/gdi/gdi_softpipe_winsys.c37
3 files changed, 38 insertions, 48 deletions
diff --git a/src/gallium/winsys/gdi/SConscript b/src/gallium/winsys/gdi/SConscript
index 9fbe9e800c3..74f6b2fd475 100644
--- a/src/gallium/winsys/gdi/SConscript
+++ b/src/gallium/winsys/gdi/SConscript
@@ -18,14 +18,20 @@ if env['platform'] == 'windows':
'ws2_32',
])
- if 'llvmpipe' in env['drivers']:
- sources = ['gdi_llvmpipe_winsys.c']
- drivers = [llvmpipe]
- env.Tool('llvm')
- elif 'softpipe' in env['drivers']:
+ sources = []
+ drivers = []
+
+ if 'softpipe' in env['drivers']:
sources = ['gdi_softpipe_winsys.c']
drivers = [softpipe]
- else:
+
+ if 'llvmpipe' in env['drivers']:
+ env.Tool('llvm')
+ if 'LLVM_VERSION' in env:
+ sources = ['gdi_llvmpipe_winsys.c']
+ drivers = [llvmpipe]
+
+ if not sources or not drivers:
print 'warning: softpipe or llvmpipe not selected, gdi winsys disabled'
Return()
diff --git a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c
index c0c33b45d59..81c46c0a96f 100644
--- a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c
+++ b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c
@@ -43,13 +43,12 @@
#include "util/u_memory.h"
#include "llvmpipe/lp_winsys.h"
#include "llvmpipe/lp_texture.h"
-#include "shared/stw_winsys.h"
+#include "stw_winsys.h"
struct gdi_llvmpipe_displaytarget
{
enum pipe_format format;
- struct pipe_format_block block;
unsigned width;
unsigned height;
unsigned stride;
@@ -118,16 +117,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 +136,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 = pf_get_blocksizebits(format);
+ cpp = pf_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);
@@ -234,9 +223,9 @@ gdi_llvmpipe_context_create(struct pipe_screen *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;
@@ -254,7 +243,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 */
};
diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
index 66120a6a983..173fa5b6fe0 100644
--- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
+++ b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
@@ -46,7 +46,7 @@
#include "util/u_memory.h"
#include "softpipe/sp_winsys.h"
#include "softpipe/sp_texture.h"
-#include "shared/stw_winsys.h"
+#include "stw_winsys.h"
struct gdi_softpipe_buffer
@@ -151,16 +151,6 @@ gdi_softpipe_user_buffer_create(struct pipe_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 pipe_buffer *
gdi_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
unsigned width, unsigned height,
@@ -170,13 +160,10 @@ gdi_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
unsigned *stride)
{
const unsigned alignment = 64;
- struct pipe_format_block block;
- unsigned nblocksx, nblocksy;
+ unsigned nblocksy;
- pf_get_block(format, &block);
- nblocksx = pf_get_nblocksx(&block, width);
- nblocksy = pf_get_nblocksy(&block, height);
- *stride = round_up(nblocksx * block.size, alignment);
+ nblocksy = pf_get_nblocksy(format, height);
+ *stride = align(pf_get_stride(format, width), alignment);
return winsys->buffer_create(winsys, alignment,
usage,
@@ -269,9 +256,9 @@ gdi_softpipe_context_create(struct pipe_screen *screen)
static void
-gdi_softpipe_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surface,
- HDC hDC)
+gdi_softpipe_present(struct pipe_screen *screen,
+ struct pipe_surface *surface,
+ HDC hDC)
{
struct softpipe_texture *texture;
struct gdi_softpipe_buffer *buffer;
@@ -283,10 +270,10 @@ gdi_softpipe_flush_frontbuffer(struct pipe_screen *screen,
memset(&bmi, 0, sizeof(BITMAPINFO));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- bmi.bmiHeader.biWidth = texture->stride[surface->level] / pf_get_size(surface->format);
+ bmi.bmiHeader.biWidth = texture->stride[surface->level] / pf_get_blocksize(surface->format);
bmi.bmiHeader.biHeight= -(long)surface->height;
bmi.bmiHeader.biPlanes = 1;
- bmi.bmiHeader.biBitCount = pf_get_bits(surface->format);
+ bmi.bmiHeader.biBitCount = pf_get_blocksizebits(surface->format);
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = 0;
bmi.bmiHeader.biXPelsPerMeter = 0;
@@ -304,7 +291,11 @@ gdi_softpipe_flush_frontbuffer(struct pipe_screen *screen,
static const struct stw_winsys stw_winsys = {
&gdi_softpipe_screen_create,
&gdi_softpipe_context_create,
- &gdi_softpipe_flush_frontbuffer
+ &gdi_softpipe_present,
+ NULL, /* get_adapter_luid */
+ NULL, /* shared_surface_open */
+ NULL, /* shared_surface_close */
+ NULL /* compose */
};