aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-04-15 13:34:04 -0700
committerJason Ekstrand <[email protected]>2016-04-15 13:35:16 -0700
commitd8b85c96d13bee1b6f6276b4a1477b82415f94f7 (patch)
tree9815e1650731952be6297201b25889ceff6c9d9d /src
parent17a181bfa6fc7eb9f7c301ee14388ebee5833588 (diff)
parent1a100d4f2827cdfed67b563fba7ef2d9ea6a926b (diff)
Merge remote-tracking branch 'public/master' into vulkan
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_print.c34
-rw-r--r--src/gallium/auxiliary/target-helpers/sw_helper.h15
-rw-r--r--src/gallium/drivers/swr/Automake.inc8
-rw-r--r--src/gallium/drivers/swr/Makefile.am5
-rw-r--r--src/gallium/drivers/vc4/vc4_tiling.c8
-rw-r--r--src/gallium/targets/dri/Makefile.am1
-rw-r--r--src/gallium/targets/pipe-loader/Makefile.am19
-rw-r--r--src/mesa/drivers/x11/fakeglx.c79
-rw-r--r--src/mesa/drivers/x11/xmesaP.h1
9 files changed, 102 insertions, 68 deletions
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 84e926905b4..229539d44ee 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -315,6 +315,30 @@ print_constant(nir_constant *c, const struct glsl_type *type, print_state *state
}
}
+static const char *
+get_variable_mode_str(nir_variable_mode mode)
+{
+ switch (mode) {
+ case nir_var_shader_in:
+ return "shader_in";
+ case nir_var_shader_out:
+ return "shader_out";
+ case nir_var_uniform:
+ return "uniform";
+ case nir_var_shader_storage:
+ return "shader_storage";
+ case nir_var_system_value:
+ return "system";
+ case nir_var_shared:
+ return "shared";
+ case nir_var_param:
+ case nir_var_global:
+ case nir_var_local:
+ default:
+ return "";
+ }
+}
+
static void
print_var_decl(nir_variable *var, print_state *state)
{
@@ -326,13 +350,9 @@ print_var_decl(nir_variable *var, print_state *state)
const char *const samp = (var->data.sample) ? "sample " : "";
const char *const patch = (var->data.patch) ? "patch " : "";
const char *const inv = (var->data.invariant) ? "invariant " : "";
- const char *const mode[] = { "shader_in ", "shader_out ", "", "",
- "uniform ", "shader_storage ", "shared ",
- "system "};
-
- fprintf(fp, "%s%s%s%s%s%s ",
- cent, samp, patch, inv, mode[var->data.mode],
- glsl_interp_qualifier_name(var->data.interpolation));
+ fprintf(fp, "%s%s%s%s%s %s ",
+ cent, samp, patch, inv, get_variable_mode_str(var->data.mode),
+ glsl_interp_qualifier_name(var->data.interpolation));
glsl_print_type(var->type, fp);
diff --git a/src/gallium/auxiliary/target-helpers/sw_helper.h b/src/gallium/auxiliary/target-helpers/sw_helper.h
index ae5f3de92ba..5e4e9f78af6 100644
--- a/src/gallium/auxiliary/target-helpers/sw_helper.h
+++ b/src/gallium/auxiliary/target-helpers/sw_helper.h
@@ -9,7 +9,7 @@
/* Helper function to choose and instantiate one of the software rasterizers:
- * llvmpipe, softpipe.
+ * llvmpipe, softpipe, swr.
*/
#ifdef GALLIUM_SOFTPIPE
@@ -20,6 +20,10 @@
#include "llvmpipe/lp_public.h"
#endif
+#ifdef GALLIUM_SWR
+#include "swr/swr_public.h"
+#endif
+
#ifdef GALLIUM_VIRGL
#include "virgl/virgl_public.h"
#include "virgl/vtest/virgl_vtest_public.h"
@@ -44,10 +48,15 @@ sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
#endif
#if defined(GALLIUM_SOFTPIPE)
- if (screen == NULL)
+ if (screen == NULL && strcmp(driver, "softpipe") == 0)
screen = softpipe_create_screen(winsys);
#endif
+#if defined(GALLIUM_SWR)
+ if (screen == NULL && strcmp(driver, "swr") == 0)
+ screen = swr_create_screen(winsys);
+#endif
+
return screen;
}
@@ -62,6 +71,8 @@ sw_screen_create(struct sw_winsys *winsys)
default_driver = "llvmpipe";
#elif defined(GALLIUM_SOFTPIPE)
default_driver = "softpipe";
+#elif defined(GALLIUM_SWR)
+ default_driver = "swr";
#else
default_driver = "";
#endif
diff --git a/src/gallium/drivers/swr/Automake.inc b/src/gallium/drivers/swr/Automake.inc
new file mode 100644
index 00000000000..a51921455a9
--- /dev/null
+++ b/src/gallium/drivers/swr/Automake.inc
@@ -0,0 +1,8 @@
+if HAVE_GALLIUM_SWR
+
+TARGET_DRIVERS += swrast
+TARGET_CPPFLAGS += -DGALLIUM_SWR
+TARGET_LIB_DEPS += \
+ $(top_builddir)/src/gallium/drivers/swr/libmesaswr.la
+
+endif
diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am
index d6d6e7dc611..b1ff4233b56 100644
--- a/src/gallium/drivers/swr/Makefile.am
+++ b/src/gallium/drivers/swr/Makefile.am
@@ -22,7 +22,7 @@
include Makefile.sources
include $(top_srcdir)/src/gallium/Automake.inc
-AM_CXXFLAGS = $(GALLIUM_DRIVER_CFLAGS)
+AM_CXXFLAGS = $(GALLIUM_DRIVER_CFLAGS) -std=c++11
noinst_LTLIBRARIES = libmesaswr.la
@@ -30,7 +30,8 @@ libmesaswr_la_SOURCES = $(LOADER_SOURCES)
COMMON_CXXFLAGS = \
$(GALLIUM_DRIVER_CFLAGS) \
- $(LLVM_CFLAGS) \
+ $(LLVM_CXXFLAGS) \
+ -std=c++11 \
-I$(builddir)/rasterizer/scripts \
-I$(builddir)/rasterizer/jitter \
-I$(srcdir)/rasterizer \
diff --git a/src/gallium/drivers/vc4/vc4_tiling.c b/src/gallium/drivers/vc4/vc4_tiling.c
index cf86eb0fa31..2a803ab62ba 100644
--- a/src/gallium/drivers/vc4/vc4_tiling.c
+++ b/src/gallium/drivers/vc4/vc4_tiling.c
@@ -140,8 +140,8 @@ vc4_load_lt_image(void *dst, uint32_t dst_stride,
{
uint32_t utile_w = vc4_utile_width(cpp);
uint32_t utile_h = vc4_utile_height(cpp);
- uint32_t xstart = box->x / utile_w;
- uint32_t ystart = box->y / utile_h;
+ uint32_t xstart = box->x;
+ uint32_t ystart = box->y;
for (uint32_t y = 0; y < box->height; y += utile_h) {
for (int x = 0; x < box->width; x += utile_w) {
@@ -161,8 +161,8 @@ vc4_store_lt_image(void *dst, uint32_t dst_stride,
{
uint32_t utile_w = vc4_utile_width(cpp);
uint32_t utile_h = vc4_utile_height(cpp);
- uint32_t xstart = box->x / utile_w;
- uint32_t ystart = box->y / utile_h;
+ uint32_t xstart = box->x;
+ uint32_t ystart = box->y;
for (uint32_t y = 0; y < box->height; y += utile_h) {
for (int x = 0; x < box->width; x += utile_w) {
diff --git a/src/gallium/targets/dri/Makefile.am b/src/gallium/targets/dri/Makefile.am
index 2666524fbfe..f42dd25a56b 100644
--- a/src/gallium/targets/dri/Makefile.am
+++ b/src/gallium/targets/dri/Makefile.am
@@ -86,6 +86,7 @@ include $(top_srcdir)/src/gallium/drivers/virgl/Automake.inc
include $(top_srcdir)/src/gallium/drivers/softpipe/Automake.inc
include $(top_srcdir)/src/gallium/drivers/llvmpipe/Automake.inc
+include $(top_srcdir)/src/gallium/drivers/swr/Automake.inc
if HAVE_GALLIUM_STATIC_TARGETS
diff --git a/src/gallium/targets/pipe-loader/Makefile.am b/src/gallium/targets/pipe-loader/Makefile.am
index 0b516de0b5b..18b403f7331 100644
--- a/src/gallium/targets/pipe-loader/Makefile.am
+++ b/src/gallium/targets/pipe-loader/Makefile.am
@@ -192,16 +192,18 @@ pipe_vmwgfx_la_LIBADD = \
endif
-if HAVE_GALLIUM_SOFTPIPE
-AM_CPPFLAGS += -DGALLIUM_SOFTPIPE
-
+if HAVE_GALLIUM_SWRAST
pipe_LTLIBRARIES += pipe_swrast.la
pipe_swrast_la_SOURCES = pipe_swrast.c
nodist_EXTRA_pipe_swrast_la_SOURCES = dummy.cpp
+pipe_swrast_la_LIBADD = $(PIPE_LIBS)
-pipe_swrast_la_LIBADD = \
- $(PIPE_LIBS) \
+if HAVE_GALLIUM_SOFTPIPE
+AM_CPPFLAGS += -DGALLIUM_SOFTPIPE
+
+pipe_swrast_la_LIBADD += \
$(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la
+endif
if HAVE_GALLIUM_LLVMPIPE
AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
@@ -210,6 +212,13 @@ pipe_swrast_la_LIBADD += \
$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
endif
+if HAVE_GALLIUM_SWR
+AM_CPPFLAGS += -DGALLIUM_SWR
+
+pipe_swrast_la_LIBADD += \
+ $(top_builddir)/src/gallium/drivers/swr/libmesaswr.la
+endif
+
pipe_swrast_la_LIBADD += \
$(GALLIUM_PIPE_LOADER_WINSYS_LIBS)
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index 2f4d966973e..394800f02ea 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -256,7 +256,6 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
GLboolean ximageFlag = GL_TRUE;
XMesaVisual xmvis;
GLint i;
- GLboolean comparePointers;
if (dbFlag) {
/* Check if the MESA_BACK_BUFFER env var is set */
@@ -279,12 +278,6 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
return NULL;
}
- /* Comparing IDs uses less memory but sometimes fails. */
- /* XXX revisit this after 3.0 is finished. */
- if (getenv("MESA_GLX_VISUAL_HACK"))
- comparePointers = GL_TRUE;
- else
- comparePointers = GL_FALSE;
/* Force the visual to have an alpha channel */
if (getenv("MESA_GLX_FORCE_ALPHA"))
@@ -306,9 +299,8 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
&& (v->mesa_visual.accumGreenBits >= accumGreenSize || accumGreenSize == 0)
&& (v->mesa_visual.accumBlueBits >= accumBlueSize || accumBlueSize == 0)
&& (v->mesa_visual.accumAlphaBits >= accumAlphaSize || accumAlphaSize == 0)) {
- /* now either compare XVisualInfo pointers or visual IDs */
- if ((!comparePointers && v->visinfo->visualid == vinfo->visualid)
- || (comparePointers && v->vishandle == vinfo)) {
+ /* now compare visual IDs */
+ if (v->visinfo->visualid == vinfo->visualid) {
return v;
}
}
@@ -323,10 +315,6 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
accumBlueSize, accumAlphaSize, 0, level,
GLX_NONE_EXT );
if (xmvis) {
- /* Save a copy of the pointer now so we can find this visual again
- * if we need to search for it in find_glx_visual().
- */
- xmvis->vishandle = vinfo;
/* Allocate more space for additional visual */
VisualTable = realloc(VisualTable, sizeof(XMesaVisual) * (NumVisuals + 1));
/* add xmvis to the list */
@@ -442,13 +430,6 @@ find_glx_visual( Display *dpy, XVisualInfo *vinfo )
}
}
- /* if that fails, try to match pointers */
- for (i=0;i<NumVisuals;i++) {
- if (VisualTable[i]->display==dpy && VisualTable[i]->vishandle==vinfo) {
- return VisualTable[i];
- }
- }
-
return NULL;
}
@@ -745,27 +726,39 @@ choose_x_overlay_visual( Display *dpy, int scr,
vislist = XGetVisualInfo( dpy, VisualIDMask | VisualScreenMask,
&vistemplate, &count );
+ if (!vislist) {
+ /* no matches */
+ continue;
+ }
+
if (count!=1) {
/* something went wrong */
+ free(vislist);
continue;
}
if (preferred_class!=DONT_CARE && preferred_class!=vislist->CLASS) {
/* wrong visual class */
+ free(vislist);
continue;
}
/* Color-index rendering is not supported. Make sure we have True/DirectColor */
- if (vislist->CLASS != TrueColor && vislist->CLASS != DirectColor)
+ if (vislist->CLASS != TrueColor && vislist->CLASS != DirectColor) {
+ free(vislist);
continue;
+ }
- if (deepvis==NULL || vislist->depth > deepest) {
- /* YES! found a satisfactory visual */
- free(deepvis);
- deepest = vislist->depth;
- deepvis = vislist;
- /* DEBUG tt = ov->transparent_type;*/
- /* DEBUG tv = ov->value; */
+ if (deepvis!=NULL && vislist->depth <= deepest) {
+ free(vislist);
+ continue;
}
+
+ /* YES! found a satisfactory visual */
+ free(deepvis);
+ deepest = vislist->depth;
+ deepvis = vislist;
+ /* DEBUG tt = ov->transparent_type;*/
+ /* DEBUG tv = ov->value; */
}
/*DEBUG
@@ -1225,6 +1218,7 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
stereo_flag, depth_size, stencil_size,
accumRedSize, accumGreenSize,
accumBlueSize, accumAlphaSize, level, numAux );
+ free(vis);
}
return xmvis;
@@ -1241,16 +1235,11 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list )
xmvis = choose_visual(dpy, screen, list, GL_FALSE);
if (xmvis) {
-#if 0
- return xmvis->vishandle;
-#else
- /* create a new vishandle - the cached one may be stale */
- xmvis->vishandle = malloc(sizeof(XVisualInfo));
- if (xmvis->vishandle) {
- memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
+ XVisualInfo* visinfo = malloc(sizeof(XVisualInfo));
+ if (visinfo) {
+ memcpy(visinfo, xmvis->visinfo, sizeof(XVisualInfo));
}
- return xmvis->vishandle;
-#endif
+ return visinfo;
}
else
return NULL;
@@ -1931,6 +1920,7 @@ Fake_glXGetFBConfigs( Display *dpy, int screen, int *nelements )
for (i = 0; i < *nelements; i++) {
results[i] = create_glx_visual(dpy, visuals + i);
}
+ free(visuals);
return (GLXFBConfig *) results;
}
return NULL;
@@ -1974,16 +1964,11 @@ Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config )
{
if (dpy && config) {
XMesaVisual xmvis = (XMesaVisual) config;
-#if 0
- return xmvis->vishandle;
-#else
- /* create a new vishandle - the cached one may be stale */
- xmvis->vishandle = malloc(sizeof(XVisualInfo));
- if (xmvis->vishandle) {
- memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
+ XVisualInfo* visinfo = malloc(sizeof(XVisualInfo));
+ if (visinfo) {
+ memcpy(visinfo, xmvis->visinfo, sizeof(XVisualInfo));
}
- return xmvis->vishandle;
-#endif
+ return visinfo;
}
else {
return NULL;
diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
index d7a934e8df4..6cd020f2ed3 100644
--- a/src/mesa/drivers/x11/xmesaP.h
+++ b/src/mesa/drivers/x11/xmesaP.h
@@ -78,7 +78,6 @@ struct xmesa_visual {
int screen, visualID;
int visualType;
XMesaVisualInfo visinfo; /* X's visual info (pointer to private copy) */
- XVisualInfo *vishandle; /* Only used in fakeglx.c */
GLint BitsPerPixel; /* True bits per pixel for XImages */
GLboolean ximage_flag; /* Use XImage for back buffer (not pixmap)? */