mesa: Changes to 'upstream-experimental'
Rebased ref, commits from common ancestor:
commit aefd6769e87ba84b900db0daeaa814c83f2e6043
Author: Emil Velikov <emil.velikov@collabora.com>
Date: Sun Nov 29 23:25:51 2015 +0000
Update version to 11.1.0-rc2
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
diff --git a/VERSION b/VERSION
index 8436a1b..2fdb3a1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-11.1.0-rc1
+11.1.0-rc2
commit 82a363b851d897dacdbe53597652dc6bc613ecde
Author: Neil Roberts <neil@linux.intel.com>
Date: Wed Nov 4 15:52:06 2015 +0100
i965: Handle lum, intensity and missing components in the fast clear
It looks like the sampler hardware doesn't take into account the
surface format when sampling a cleared color after a fast clear has
been done. So for example if you clear a GL_RED surface to 1,1,1,1
then the sampling instructions will return 1,1,1,1 instead of 1,0,0,1.
This patch makes it override the color that is programmed in the
surface state in order to swizzle for luminance and intensity as well
as overriding the missing components.
Fixes the ext_framebuffer_multisample-fast-clear Piglit test.
v2: Handle luminance and intensity formats
Reviewed-by: Ben Widawsky <benjamin.widawsky@intel.com>
(cherry picked from commit 2010de4015c96f241e81012b395cb4254091f0bb)
diff --git a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
index 20adbd3..cd35035 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
@@ -394,13 +394,43 @@ set_fast_clear_color(struct brw_context *brw,
struct intel_mipmap_tree *mt,
const union gl_color_union *color)
{
+ union gl_color_union override_color = *color;
+
+ /* The sampler doesn't look at the format of the surface when the fast
+ * clear color is used so we need to implement luminance, intensity and
+ * missing components manually.
+ */
+ switch (_mesa_get_format_base_format(mt->format)) {
+ case GL_INTENSITY:
+ override_color.ui[3] = override_color.ui[0];
+ /* flow through */
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ override_color.ui[1] = override_color.ui[0];
+ override_color.ui[2] = override_color.ui[0];
+ break;
+ default:
+ for (int i = 0; i < 3; i++) {
+ if (!_mesa_format_has_color_component(mt->format, i))
+ override_color.ui[i] = 0;
+ }
+ break;
+ }
+
+ if (!_mesa_format_has_color_component(mt->format, 3)) {
+ if (_mesa_is_format_integer_color(mt->format))
+ override_color.ui[3] = 1;
+ else
+ override_color.f[3] = 1.0f;
+ }
+
if (brw->gen >= 9) {
- mt->gen9_fast_clear_color = *color;
+ mt->gen9_fast_clear_color = override_color;
} else {
mt->fast_clear_color_value = 0;
for (int i = 0; i < 4; i++) {
/* Testing for non-0 works for integer and float colors */
- if (color->f[i] != 0.0f) {
+ if (override_color.f[i] != 0.0f) {
mt->fast_clear_color_value |=
1 << (GEN7_SURFACE_CLEAR_COLOR_SHIFT + (3 - i));
}
commit b3183c81c431382a029c0ea450209843a9d6a9ca
Author: Nanley Chery <nanley.g.chery@intel.com>
Date: Wed Oct 28 14:50:58 2015 -0700
mesa/teximage: Fix S3TC regression due to ASTC interaction
A prior, literal reading of the ASTC spec led to the prohibition
of some compressed formats being used against the targets:
TEXTURE_CUBE_MAP_ARRAY and TEXTURE_3D. Since the spec does not specify
interactions with other extensions for specific compressed textures,
remove such interactions.
Fixes the following Piglit tests on Gen9:
piglit.spec.arb_direct_state_access.getcompressedtextureimage
piglit.spec.arb_get_texture_sub_image.arb_get_texture_sub_image-getcompressed
piglit.spec.arb_texture_cube_map_array.fbo-generatemipmap-cubemap array s3tc_dxt1
piglit.spec.ext_texture_compression_s3tc.getteximage-targets cube_array s3tc
v2. Don't interact with other specific compressed formats (Ian).
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91927
Suggested-by: Neil Roberts <neil@linux.intel.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
(cherry picked from commit d1212abf505a468c9947a66dbf2d59acb4616e42)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 87c8939..37dbe26 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1333,21 +1333,6 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
break;
case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
case GL_TEXTURE_CUBE_MAP_ARRAY:
- /* From section 3.8.6, page 146 of OpenGL ES 3.0 spec:
- *
- * "The ETC2/EAC texture compression algorithm supports only
- * two-dimensional images. If internalformat is an ETC2/EAC format,
- * glCompressedTexImage3D will generate an INVALID_OPERATION error if
- * target is not TEXTURE_2D_ARRAY."
- *
- * This should also be applicable for glTexStorage3D(). Other available
- * targets for these functions are: TEXTURE_3D and TEXTURE_CUBE_MAP_ARRAY.
- */
- if (layout == MESA_FORMAT_LAYOUT_ETC2 && _mesa_is_gles3(ctx))
- return write_error(error, GL_INVALID_OPERATION);
-
- target_can_be_compresed = ctx->Extensions.ARB_texture_cube_map_array;
-
/* From the KHR_texture_compression_astc_hdr spec:
*
* Add a second new column "3D Tex." which is empty for all non-ASTC
@@ -1368,16 +1353,24 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
* 8.19 is *not* checked'
*
* The instances of <internalformat> above should say <target>.
+ *
+ * ETC2/EAC formats are the only alternative in GLES and thus such errors
+ * have already been handled by normal ETC2/EAC behavior.
*/
- /* Throw an INVALID_OPERATION error if the target is
- * TEXTURE_CUBE_MAP_ARRAY and the format is not ASTC.
+ /* From section 3.8.6, page 146 of OpenGL ES 3.0 spec:
+ *
+ * "The ETC2/EAC texture compression algorithm supports only
+ * two-dimensional images. If internalformat is an ETC2/EAC format,
+ * glCompressedTexImage3D will generate an INVALID_OPERATION error if
+ * target is not TEXTURE_2D_ARRAY."
+ *
+ * This should also be applicable for glTexStorage3D(). Other available
+ * targets for these functions are: TEXTURE_3D and TEXTURE_CUBE_MAP_ARRAY.
*/
- if (target_can_be_compresed &&
- ctx->Extensions.KHR_texture_compression_astc_ldr &&
- layout != MESA_FORMAT_LAYOUT_ASTC)
- return write_error(error, GL_INVALID_OPERATION);
-
+ if (layout == MESA_FORMAT_LAYOUT_ETC2 && _mesa_is_gles3(ctx))
+ return write_error(error, GL_INVALID_OPERATION);
+ target_can_be_compresed = ctx->Extensions.ARB_texture_cube_map_array;
break;
case GL_TEXTURE_3D:
switch (layout) {
@@ -1401,12 +1394,6 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
return write_error(error, GL_INVALID_OPERATION);
break;
default:
- /* Throw an INVALID_OPERATION error if the target is TEXTURE_3D and
- * the format is not ASTC.
- * See comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY for more info.
- */
- if (ctx->Extensions.KHR_texture_compression_astc_ldr)
- return write_error(error, GL_INVALID_OPERATION);
break;
}
default:
commit f5e508649db5c046e506d817e158ddff6b3828b1
Author: Nanley Chery <nanley.g.chery@intel.com>
Date: Fri Nov 20 16:15:04 2015 -0800
mesa/extensions: Enable overriding permanently enabled extensions
Provide the ability to prevent any permanently enabled extension
from appearing in the string returned by glGetString[i]().
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 21d43fe51ab5bcbc89ad5c61a51d3517c4243298)
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 01cfdf1..fa50cb6 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -40,7 +40,6 @@
struct gl_extensions _mesa_extension_override_enables;
struct gl_extensions _mesa_extension_override_disables;
static char *extra_extensions = NULL;
-static char *cant_disable_extensions = NULL;
/**
@@ -68,29 +67,30 @@ const struct mesa_extension _mesa_extension_table[] = {
#undef EXT
};
+static bool disabled_extensions[ARRAY_SIZE(_mesa_extension_table)];
/**
* Given an extension name, lookup up the corresponding member of struct
- * gl_extensions and return that member's offset (in bytes). If the name is
- * not found in the \c _mesa_extension_table, return 0.
+ * gl_extensions and return that member's index. If the name is
+ * not found in the \c _mesa_extension_table, return -1.
*
* \param name Name of extension.
- * \return Offset of member in struct gl_extensions.
+ * \return Index of member in struct gl_extensions.
*/
-static size_t
-name_to_offset(const char* name)
+static int
+name_to_index(const char* name)
{
unsigned i;
if (name == 0)
- return 0;
+ return -1;
for (i = 0; i < ARRAY_SIZE(_mesa_extension_table); ++i) {
if (strcmp(name, _mesa_extension_table[i].name) == 0)
- return _mesa_extension_table[i].offset;
+ return i;
}
- return 0;
+ return -1;
}
/**
@@ -206,11 +206,11 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
* \return offset of extensions withint `ext' or 0 if extension is not known
*/
static size_t
-set_extension(struct gl_extensions *ext, const char *name, GLboolean state)
+set_extension(struct gl_extensions *ext, int i, GLboolean state)
{
size_t offset;
- offset = name_to_offset(name);
+ offset = i < 0 ? 0 : _mesa_extension_table[i].offset;
if (offset != 0 && (offset != o(dummy_true) || state != GL_FALSE)) {
((GLboolean *) ext)[offset] = state;
}
@@ -240,12 +240,6 @@ get_extension_override( struct gl_context *ctx )
{
override_extensions_in_context(ctx);
- if (cant_disable_extensions != NULL) {
- _mesa_problem(ctx,
- "Trying to disable permanently enabled extensions: %s",
- cant_disable_extensions);
- }
-
if (extra_extensions == NULL) {
return calloc(1, sizeof(char));
} else {
@@ -257,7 +251,7 @@ get_extension_override( struct gl_context *ctx )
/**
- * \brief Free extra_extensions and cant_disable_extensions strings
+ * \brief Free extra_extensions string
*
* These strings are allocated early during the first context creation by
* _mesa_one_time_init_extension_overrides.
@@ -266,7 +260,6 @@ static void
free_unknown_extensions_strings(void)
{
free(extra_extensions);
- free(cant_disable_extensions);
}
@@ -295,22 +288,20 @@ _mesa_one_time_init_extension_overrides(void)
/* extra_exts: List of unrecognized extensions. */
extra_extensions = calloc(ALIGN(strlen(env_const) + 2, 4), sizeof(char));
- cant_disable_extensions = calloc(ALIGN(strlen(env_const) + 2, 4), sizeof(char));
/* Copy env_const because strtok() is destructive. */
env = strdup(env_const);
if (env == NULL ||
- extra_extensions == NULL ||
- cant_disable_extensions == NULL) {
+ extra_extensions == NULL) {
free(env);
free(extra_extensions);
- free(cant_disable_extensions);
return;
}
for (ext = strtok(env, " "); ext != NULL; ext = strtok(NULL, " ")) {
int enable;
+ int i;
bool recognized;
switch (ext[0]) {
case '+':
@@ -326,7 +317,8 @@ _mesa_one_time_init_extension_overrides(void)
break;
}
- offset = set_extension(&_mesa_extension_override_enables, ext, enable);
+ i = name_to_index(ext);
+ offset = set_extension(&_mesa_extension_override_enables, i, enable);
if (offset != 0 && (offset != o(dummy_true) || enable != GL_FALSE)) {
((GLboolean *) &_mesa_extension_override_disables)[offset] = !enable;
recognized = true;
@@ -334,14 +326,12 @@ _mesa_one_time_init_extension_overrides(void)
recognized = false;
}
- if (!recognized) {
- if (enable) {
- strcat(extra_extensions, ext);
- strcat(extra_extensions, " ");
- } else if (offset == o(dummy_true)) {
- strcat(cant_disable_extensions, ext);
- strcat(cant_disable_extensions, " ");
- }
+ if (i >= 0)
+ disabled_extensions[i] = !enable;
+
+ if (!recognized && enable) {
+ strcat(extra_extensions, ext);
+ strcat(extra_extensions, " ");
}
}
@@ -355,13 +345,6 @@ _mesa_one_time_init_extension_overrides(void)
} else if (extra_extensions[len - 1] == ' ') {
extra_extensions[len - 1] = '\0';
}
- len = strlen(cant_disable_extensions);
- if (len == 0) {
- free(cant_disable_extensions);
- cant_disable_extensions = NULL;
- } else if (cant_disable_extensions[len - 1] == ' ') {
- cant_disable_extensions[len - 1] = '\0';
- }
}
@@ -402,7 +385,8 @@ _mesa_extension_supported(const struct gl_context *ctx, extension_index i)
const bool *base = (bool *) &ctx->Extensions;
const struct mesa_extension *ext = _mesa_extension_table + i;
- return (ctx->Version >= ext->version[ctx->API]) && base[ext->offset];
+ return !disabled_extensions[i] &&
+ (ctx->Version >= ext->version[ctx->API]) && base[ext->offset];
}
/**
commit 31546c0e8f0c0b696b1341add618cfe472ad6293
Author: Leo Liu <leo.liu@amd.com>
Date: Fri Nov 20 12:07:52 2015 -0500
radeon/vce: disable Stoney VCE for 11.0
Signed-off-by: Leo Liu <leo.liu@amd.com>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
diff --git a/src/gallium/drivers/radeon/radeon_vce.c b/src/gallium/drivers/radeon/radeon_vce.c
index 8a60441..bdfae10 100644
--- a/src/gallium/drivers/radeon/radeon_vce.c
+++ b/src/gallium/drivers/radeon/radeon_vce.c
@@ -389,6 +389,11 @@ struct pipe_video_codec *rvce_create_encoder(struct pipe_context *context,
struct radeon_surf *tmp_surf;
unsigned cpb_size;
+ if (rscreen->info.family == CHIP_STONEY) {
+ RVID_ERR("Stoney VCE is not supported!\n");
+ return NULL;
+ }
+
if (!rscreen->info.vce_fw_version) {
RVID_ERR("Kernel doesn't supports VCE!\n");
return NULL;
commit 6b149bedc3b44ff9ec34f42a16ab42e6a201d9bf
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date: Mon Nov 23 20:26:59 2015 +0000
auxiliary/vl/dri: fd management cleanups
Analogous to previous commit, minus the extra dup. We are the one
opening the device thus we can directly use the fd.
Spotted by Coverity (CID 1339867, 1339877)
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 5d294d9fa3dcdf8453d97f35e2c799efa887cbcc)
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index ae0d4cd..758f50d 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -392,7 +392,7 @@ vl_dri2_screen_create(Display *display, int screen)
goto free_connect;
if (drmGetMagic(fd, &magic))
- goto free_connect;
+ goto close_fd;
authenticate_cookie = xcb_dri2_authenticate_unchecked(scrn->conn,
get_xcb_screen(s, screen)->root,
@@ -402,7 +402,7 @@ vl_dri2_screen_create(Display *display, int screen)
if (authenticate == NULL || !authenticate->authenticated)
goto free_authenticate;
- if (pipe_loader_drm_probe_fd(&scrn->base.dev, dup(fd)))
+ if (pipe_loader_drm_probe_fd(&scrn->base.dev, fd))
scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev);
if (!scrn->base.pscreen)
@@ -428,8 +428,11 @@ vl_dri2_screen_create(Display *display, int screen)
release_pipe:
if (scrn->base.dev)
pipe_loader_release(&scrn->base.dev, 1);
+ fd = -1;
free_authenticate:
free(authenticate);
+close_fd:
+ close(fd);
free_connect:
free(connect);
free_query:
commit 7a4ba7bfad064a7046b8a425f94a9887b1fc9088
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date: Mon Nov 23 20:26:58 2015 +0000
auxiliary/vl/drm: fd management cleanups
Analogous to previous commit.
Spotted by Coverity (CID 1339868)
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 151290c1548052fa4e4d625ba99ad63919467e96)
diff --git a/src/gallium/auxiliary/vl/vl_winsys_drm.c b/src/gallium/auxiliary/vl/vl_winsys_drm.c
index f993e2c..6d9d947 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_drm.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_drm.c
@@ -41,12 +41,16 @@ struct vl_screen *
vl_drm_screen_create(int fd)
{
struct vl_screen *vscreen;
+ int new_fd = -1;
vscreen = CALLOC_STRUCT(vl_screen);
if (!vscreen)
return NULL;
- if (pipe_loader_drm_probe_fd(&vscreen->dev, dup(fd)))
+ if (fd < 0 || (new_fd = dup(fd)) < 0)
+ goto error;
+
+ if (pipe_loader_drm_probe_fd(&vscreen->dev, new_fd))
vscreen->pscreen = pipe_loader_create_screen(vscreen->dev);
if (!vscreen->pscreen)
@@ -63,6 +67,8 @@ vl_drm_screen_create(int fd)
error:
if (vscreen->dev)
pipe_loader_release(&vscreen->dev, 1);
+ else
+ close(new_fd);
FREE(vscreen);
return NULL;
commit ef6769f18f16c11ff1fa7cb50a8713b8cbaf3a12
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date: Mon Nov 23 20:26:57 2015 +0000
st/xa: fd management cleanups
Analogous to previous commit.
Spotted by Coverity (CID 1339866)
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit fe71059388ebb797255d5d5f7191f300343c6e3c)
diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c
index faa630c..d57464b 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -152,11 +152,15 @@ xa_tracker_create(int drm_fd)
struct xa_tracker *xa = calloc(1, sizeof(struct xa_tracker));
enum xa_surface_type stype;
unsigned int num_formats;
+ int fd = -1;
if (!xa)
return NULL;
- if (pipe_loader_drm_probe_fd(&xa->dev, dup(drm_fd)))
+ if (drm_fd < 0 || (fd = dup(drm_fd)) < 0)
+ goto out_no_fd;
+
+ if (pipe_loader_drm_probe_fd(&xa->dev, fd))
xa->screen = pipe_loader_create_screen(xa->dev);
if (!xa->screen)
@@ -208,6 +212,9 @@ xa_tracker_create(int drm_fd)
out_no_screen:
if (xa->dev)
pipe_loader_release(&xa->dev, 1);
+ fd = -1;
+ out_no_fd:
+ close(fd);
free(xa);
return NULL;
}
commit a71db1c46e12583cd2ecca9ad5258d8a1f4a2a03
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date: Mon Nov 23 20:26:56 2015 +0000
st/dri: fd management cleanups
Add some checks if the original/dup'd fd is valid and ensure that we
don't leak it on error. The former is implicitly handled within the
pipe_loader, although let's make things explicit and check beforehand.
Spotted by Coverity (CID 1339865)
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit d90ba57c08dc51579c92224c7eedfc9f88f47853)
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index beb0866..a11a6cb 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1446,6 +1446,7 @@ dri2_init_screen(__DRIscreen * sPriv)
struct pipe_screen *pscreen = NULL;
const struct drm_conf_ret *throttle_ret;
const struct drm_conf_ret *dmabuf_ret;
+ int fd = -1;
screen = CALLOC_STRUCT(dri_screen);
if (!screen)
@@ -1457,7 +1458,10 @@ dri2_init_screen(__DRIscreen * sPriv)
sPriv->driverPrivate = (void *)screen;
- if (pipe_loader_drm_probe_fd(&screen->dev, dup(screen->fd)))
+ if (screen->fd < 0 || (fd = dup(screen->fd)) < 0)
+ goto fail;
+
+ if (pipe_loader_drm_probe_fd(&screen->dev, fd))
pscreen = pipe_loader_create_screen(screen->dev);
if (!pscreen)
@@ -1502,6 +1506,8 @@ fail:
dri_destroy_screen_helper(screen);
if (screen->dev)
pipe_loader_release(&screen->dev, 1);
+ else
+ close(fd);
FREE(screen);
return NULL;
}
@@ -1519,6 +1525,7 @@ dri_kms_init_screen(__DRIscreen * sPriv)
struct dri_screen *screen;
struct pipe_screen *pscreen = NULL;
uint64_t cap;
+ int fd = -1;
screen = CALLOC_STRUCT(dri_screen);
if (!screen)
@@ -1529,7 +1536,10 @@ dri_kms_init_screen(__DRIscreen * sPriv)
sPriv->driverPrivate = (void *)screen;
- if (pipe_loader_sw_probe_kms(&screen->dev, dup(screen->fd)))
+ if (screen->fd < 0 || (fd = dup(screen->fd)) < 0)
+ goto fail;
+
+ if (pipe_loader_sw_probe_kms(&screen->dev, fd))
pscreen = pipe_loader_create_screen(screen->dev);
if (!pscreen)
@@ -1557,6 +1567,8 @@ fail:
dri_destroy_screen_helper(screen);
if (screen->dev)
pipe_loader_release(&screen->dev, 1);
+ else
+ close(fd);
FREE(screen);
#endif // GALLIUM_SOFTPIPE
return NULL;
commit 88cd21fefb99d08201a7fd1c96d76fffd2e46dd8
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date: Mon Nov 23 20:26:55 2015 +0000
pipe-loader: check if winsys.name is non-null prior to strcmp
In theory this wouldn't be an issue, as we'll find the correct name and
break out of the loop before we hit the sentinel.
Let's fix this and avoid issues in the future.
Spotted by Coverity (CID 1339869, 1339870, 1339871)
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 5f92906b876d5463efba3ffb19c1de0dcb3c755f)
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
index 02ceb44..c8e1f13 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
@@ -137,7 +137,7 @@ pipe_loader_sw_probe_dri(struct pipe_loader_device **devs, struct drisw_loader_f
if (!pipe_loader_sw_probe_init_common(sdev))
goto fail;
- for (i = 0; sdev->dd->winsys; i++) {
+ for (i = 0; sdev->dd->winsys[i].name; i++) {
if (strcmp(sdev->dd->winsys[i].name, "dri") == 0) {
sdev->ws = sdev->dd->winsys[i].create_winsys(drisw_lf);
break;
@@ -169,7 +169,7 @@ pipe_loader_sw_probe_kms(struct pipe_loader_device **devs, int fd)
if (!pipe_loader_sw_probe_init_common(sdev))
goto fail;
- for (i = 0; sdev->dd->winsys; i++) {
+ for (i = 0; sdev->dd->winsys[i].name; i++) {
if (strcmp(sdev->dd->winsys[i].name, "kms_dri") == 0) {
sdev->ws = sdev->dd->winsys[i].create_winsys(fd);
break;
@@ -200,7 +200,7 @@ pipe_loader_sw_probe_null(struct pipe_loader_device **devs)
if (!pipe_loader_sw_probe_init_common(sdev))
goto fail;
- for (i = 0; sdev->dd->winsys; i++) {
+ for (i = 0; sdev->dd->winsys[i].name; i++) {
if (strcmp(sdev->dd->winsys[i].name, "null") == 0) {
sdev->ws = sdev->dd->winsys[i].create_winsys();
break;
@@ -245,7 +245,7 @@ pipe_loader_sw_probe_wrapped(struct pipe_loader_device **dev,
if (!pipe_loader_sw_probe_init_common(sdev))
goto fail;
- for (i = 0; sdev->dd->winsys; i++) {
+ for (i = 0; sdev->dd->winsys[i].name; i++) {
if (strcmp(sdev->dd->winsys[i].name, "wrapped") == 0) {
sdev->ws = sdev->dd->winsys[i].create_winsys(screen);
break;
commit 97d4954f3f699c64ecdf2ad03bc0af9595d5bbe1
Author: Ilia Mirkin <imirkin@alum.mit.edu>
Date: Thu Nov 26 10:32:57 2015 -0500
mesa: support GL_RED/GL_RG in ES2 contexts when driver support exists
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93126
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 0396eaaf80c5d7955d7926c4e448f006c7682d2e)
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 2ed42ea..f528444 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -2077,12 +2077,18 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
* \return error code, or GL_NO_ERROR.
*/
GLenum
-_mesa_es_error_check_format_and_type(GLenum format, GLenum type,
+_mesa_es_error_check_format_and_type(const struct gl_context *ctx,
+ GLenum format, GLenum type,
unsigned dimensions)
{
GLboolean type_valid = GL_TRUE;
switch (format) {
+ case GL_RED:
+ case GL_RG:
+ if (ctx->API == API_OPENGLES || !ctx->Extensions.ARB_texture_rg)
+ return GL_INVALID_VALUE;
+ /* fallthrough */
case GL_ALPHA:
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index 92f4bc6..b366855 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -127,7 +127,8 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
GLenum format, GLenum type);
extern GLenum
-_mesa_es_error_check_format_and_type(GLenum format, GLenum type,
+_mesa_es_error_check_format_and_type(const struct gl_context *ctx,
+ GLenum format, GLenum type,
unsigned dimensions);
extern GLenum
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 81bb912..8cdc9fe 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -1043,7 +1043,7 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
_mesa_get_color_read_type(ctx) == type) {
err = GL_NO_ERROR;
} else if (ctx->Version < 30) {
- err = _mesa_es_error_check_format_and_type(format, type, 2);
+ err = _mesa_es_error_check_format_and_type(ctx, format, type, 2);
if (err == GL_NO_ERROR) {
if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) {
err = GL_INVALID_OPERATION;
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d9453e3..87c8939 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1712,7 +1712,7 @@ texture_format_error_check_gles(struct gl_context *ctx, GLenum format,
}
}
else {
- err = _mesa_es_error_check_format_and_type(format, type, dimensions);
+ err = _mesa_es_error_check_format_and_type(ctx, format, type, dimensions);
if (err != GL_NO_ERROR) {
_mesa_error(ctx, err, "%s(format = %s, type = %s)",
callerName, _mesa_enum_to_string(format),
commit 3d525c86506feb80597a180675c66754809dfcf8
Author: Nicolai Hähnle <nicolai.haehnle@amd.com>
Date: Sat Nov 28 00:02:26 2015 +0100
radeon: only suspend queries on flush if they haven't been suspended yet
Non-timer queries are suspended during blits. When the blits end, the queries
are resumed, but this resume operation itself might run out of CS space and
trigger a flush. When this happens, we must prevent a duplicate suspend during
preflush suspend, and we must also prevent a duplicate resume when the CS flush
returns back to the original resume operation.
This fixes a regression that was introduced by:
commit 8a125afa6e88a3eeddba8c7fdc1a75c9b99d5489
Author: Nicolai Hähnle <nhaehnle@gmail.com>
Date: Wed Nov 18 18:40:22 2015 +0100
radeon: ensure that timing/profiling queries are suspended on flush
The queries_suspended_for_flush flag is redundant because suspended queries
are not removed from their respective linked list.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reported-by: Axel Davy <axel.davy@ens.fr>
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
Tested-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 9e5e702cfb380af461062c96d974027da8d5f17a)
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 7464f67..12c0241 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -136,8 +136,12 @@ static void r600_memory_barrier(struct pipe_context *ctx, unsigned flags)
void r600_preflush_suspend_features(struct r600_common_context *ctx)
{
/* suspend queries */
- if (!LIST_IS_EMPTY(&ctx->active_nontimer_queries))
+ if (ctx->num_cs_dw_nontimer_queries_suspend) {
+ /* Since non-timer queries are suspended during blits,
+ * we have to guard against double-suspends. */
r600_suspend_nontimer_queries(ctx);
+ ctx->nontimer_queries_suspended_by_flush = true;
+ }
if (!LIST_IS_EMPTY(&ctx->active_timer_queries))
r600_suspend_timer_queries(ctx);
@@ -158,8 +162,10 @@ void r600_postflush_resume_features(struct r600_common_context *ctx)
/* resume queries */
if (!LIST_IS_EMPTY(&ctx->active_timer_queries))
r600_resume_timer_queries(ctx);
- if (!LIST_IS_EMPTY(&ctx->active_nontimer_queries))
+ if (ctx->nontimer_queries_suspended_by_flush) {
+ ctx->nontimer_queries_suspended_by_flush = false;
r600_resume_nontimer_queries(ctx);
+ }
}
static void r600_flush_from_st(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index fbdc5c4..425657a 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -392,6 +392,7 @@ struct r600_common_context {
struct list_head active_nontimer_queries;
struct list_head active_timer_queries;
unsigned num_cs_dw_nontimer_queries_suspend;
+ bool nontimer_queries_suspended_by_flush;
unsigned num_cs_dw_timer_queries_suspend;
/* Additional hardware info. */
unsigned backend_mask;
commit 9b9fff6830e4f3b46f5ada810f10740f9fab8f84
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date: Mon Nov 23 15:28:55 2015 +0000
targets: use the non-inline sw helpers
Previously (with the inline ones) things were embedded into the
pipe-loader, which means that we cannot control/select what we want in
each target.
That also meant that at runtime we ended up with the empty
sw_screen_create() as the GALLIUM_SOFTPIPE/LLVMPIPE were not set.
v2: Cover all the targets, not just dri.
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Edward O'Callaghan <edward.ocallaghan@koparo.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Oded Gabbay <oded.gabbay@gmail.com>
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
(cherry picked from commit 59cfb21d4670559d49a721df766073d9d288b51a)
Squashed with commit
targets/xvmc: use the non-inline sw helpers
This was missed in commit 59cfb21d ("targets: use the non-inline sw
helpers").
Fixes build failure:
CXXLD libXvMCgallium.la
../../../../src/gallium/auxiliary/pipe-loader/.libs/libpipe_loader_static.a(libpipe_loader_static_la-pipe_loader_sw.o):(.data.rel.ro+0x0): undefined reference to `sw_screen_create'
collect2: error: ld returned 1 exit status
Makefile:756: recipe for target 'libXvMCgallium.la' failed
make[3]: *** [libXvMCgallium.la] Error 1
Trivial.
(cherry picked from commit 22d2dda03be32d23bc8e9f5823a4f2469737ddbe)
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
index 091d4d6..02ceb44 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
@@ -33,9 +33,10 @@
#include "sw/kms-dri/kms_dri_sw_winsys.h"
#include "sw/null/null_sw_winsys.h"
#include "sw/wrapper/wrapper_sw_winsys.h"
-#include "target-helpers/inline_sw_helper.h"
+#include "target-helpers/sw_helper_public.h"
#include "state_tracker/drisw_api.h"
#include "state_tracker/sw_driver.h"
+#include "state_tracker/sw_winsys.h"
struct pipe_loader_sw_device {
struct pipe_loader_device base;
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index ad712db..5cd1ba7 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -31,6 +31,7 @@
#include "pipe/p_state.h"
#include "target-helpers/drm_helper.h"
+#include "target-helpers/sw_helper.h"
#include "state_tracker/drm_driver.h"
#include "d3dadapter/d3dadapter9.h"
diff --git a/src/gallium/targets/dri/target.c b/src/gallium/targets/dri/target.c
index d6fbd01..01532e2 100644
--- a/src/gallium/targets/dri/target.c
+++ b/src/gallium/targets/dri/target.c
@@ -1,4 +1,5 @@
#include "target-helpers/drm_helper.h"
+#include "target-helpers/sw_helper.h"
#include "dri_screen.h"
diff --git a/src/gallium/targets/omx/target.c b/src/gallium/targets/omx/target.c
index 42b1346..308e23b 100644
--- a/src/gallium/targets/omx/target.c
+++ b/src/gallium/targets/omx/target.c
@@ -1 +1,2 @@
#include "target-helpers/drm_helper.h"
+#include "target-helpers/sw_helper.h"
diff --git a/src/gallium/targets/va/target.c b/src/gallium/targets/va/target.c
index 42b1346..308e23b 100644
--- a/src/gallium/targets/va/target.c
+++ b/src/gallium/targets/va/target.c
@@ -1 +1,2 @@
#include "target-helpers/drm_helper.h"
+#include "target-helpers/sw_helper.h"
diff --git a/src/gallium/targets/vdpau/target.c b/src/gallium/targets/vdpau/target.c
index 42b1346..308e23b 100644
--- a/src/gallium/targets/vdpau/target.c
+++ b/src/gallium/targets/vdpau/target.c
@@ -1 +1,2 @@
#include "target-helpers/drm_helper.h"
+#include "target-helpers/sw_helper.h"
diff --git a/src/gallium/targets/xa/target.c b/src/gallium/targets/xa/target.c
index 42b1346..308e23b 100644
--- a/src/gallium/targets/xa/target.c
+++ b/src/gallium/targets/xa/target.c
@@ -1 +1,2 @@
#include "target-helpers/drm_helper.h"
+#include "target-helpers/sw_helper.h"
diff --git a/src/gallium/targets/xvmc/target.c b/src/gallium/targets/xvmc/target.c
index 42b1346..308e23b 100644
--- a/src/gallium/targets/xvmc/target.c
+++ b/src/gallium/targets/xvmc/target.c
@@ -1 +1,2 @@
#include "target-helpers/drm_helper.h"
+#include "target-helpers/sw_helper.h"
commit 3d09bede300084484d87689148147ed17145c09c
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date: Mon Nov 23 11:26:39 2015 +0000
target-hepers: add non inline sw helpers
Feeling rather dirty copying the inline ones, yet we need the inline
ones for swrast only targets like libgl-xlib, osmesa.
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Edward O'Callaghan <edward.ocallaghan@koparo.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Oded Gabbay <oded.gabbay@gmail.com>
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
(cherry picked from commit fbc6447c3d06d85a862df67aadb68333e2ea2431)
diff --git a/src/gallium/auxiliary/target-helpers/sw_helper.h b/src/gallium/auxiliary/target-helpers/sw_helper.h
new file mode 100644
index 0000000..ae5f3de
--- /dev/null
+++ b/src/gallium/auxiliary/target-helpers/sw_helper.h
@@ -0,0 +1,73 @@
+
+#ifndef SW_HELPER_H
+#define SW_HELPER_H
+
+#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
+#include "target-helpers/sw_helper_public.h"
+#include "state_tracker/sw_winsys.h"
+
+
+/* Helper function to choose and instantiate one of the software rasterizers:
+ * llvmpipe, softpipe.
+ */
+
+#ifdef GALLIUM_SOFTPIPE
+#include "softpipe/sp_public.h"
+#endif
+
+#ifdef GALLIUM_LLVMPIPE
+#include "llvmpipe/lp_public.h"
+#endif
+
+#ifdef GALLIUM_VIRGL
+#include "virgl/virgl_public.h"
+#include "virgl/vtest/virgl_vtest_public.h"
+#endif
+
+static inline struct pipe_screen *
Reply to: