Module Name: src Committed By: mrg Date: Sat Sep 6 18:43:00 UTC 2014
Modified Files: src/sys/external/bsd/drm2/dist/drm/radeon: evergreen_cs.c Log Message: test some pointers and return EINVAL instead of blindly assuming they're valid. converts kernel crashes in to app failures. GL is still not working on evergreen for me. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/drm/radeon/evergreen_cs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/drm2/dist/drm/radeon/evergreen_cs.c diff -u src/sys/external/bsd/drm2/dist/drm/radeon/evergreen_cs.c:1.2 src/sys/external/bsd/drm2/dist/drm/radeon/evergreen_cs.c:1.3 --- src/sys/external/bsd/drm2/dist/drm/radeon/evergreen_cs.c:1.2 Wed Jul 16 20:59:57 2014 +++ src/sys/external/bsd/drm2/dist/drm/radeon/evergreen_cs.c Sat Sep 6 18:43:00 2014 @@ -546,6 +546,10 @@ static int evergreen_cs_track_validate_h size = roundup(nbx * nby * 4, track->npipes * (2 << 10)); size += track->htile_offset; + if (!track->htile_bo) { + dev_warn(p->dev, "%s:%d htile_bo not set", __func__, __LINE__); + return -EINVAL; + } if (size > radeon_bo_size(track->htile_bo)) { dev_warn(p->dev, "%s:%d htile surface too small %ld for %ld (%d %d)\n", __func__, __LINE__, radeon_bo_size(track->htile_bo), @@ -613,6 +617,10 @@ static int evergreen_cs_track_validate_s return -EINVAL; } offset += surf.layer_size * mslice; + if (!track->db_s_read_bo) { + dev_warn(p->dev, "%s:%d db_s_read_bo not set", __func__, __LINE__); + return -EINVAL; + } if (offset > radeon_bo_size(track->db_s_read_bo)) { dev_warn(p->dev, "%s:%d stencil read bo too small (layer size %d, " "offset %ld, max layer %d, bo size %ld)\n", @@ -632,6 +640,10 @@ static int evergreen_cs_track_validate_s return -EINVAL; } offset += surf.layer_size * mslice; + if (!track->db_s_write_bo) { + dev_warn(p->dev, "%s:%d db_s_write_bo not set", __func__, __LINE__); + return -EINVAL; + } if (offset > radeon_bo_size(track->db_s_write_bo)) { dev_warn(p->dev, "%s:%d stencil write bo too small (layer size %d, " "offset %ld, max layer %d, bo size %ld)\n", @@ -711,6 +723,10 @@ static int evergreen_cs_track_validate_d return -EINVAL; } offset += surf.layer_size * mslice; + if (!track->db_z_read_bo) { + dev_warn(p->dev, "%s:%d db_z_read_bo not set", __func__, __LINE__); + return -EINVAL; + } if (offset > radeon_bo_size(track->db_z_read_bo)) { dev_warn(p->dev, "%s:%d depth read bo too small (layer size %d, " "offset %ld, max layer %d, bo size %ld)\n", @@ -727,6 +743,10 @@ static int evergreen_cs_track_validate_d return -EINVAL; } offset += surf.layer_size * mslice; + if (!track->db_z_write_bo) { + dev_warn(p->dev, "%s:%d db_z_write_bo not set", __func__, __LINE__); + return -EINVAL; + } if (offset > radeon_bo_size(track->db_z_write_bo)) { dev_warn(p->dev, "%s:%d depth write bo too small (layer size %d, " "offset %ld, max layer %d, bo size %ld)\n",