Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/radeon test some pointers and...



details:   https://anonhg.NetBSD.org/src/rev/e42d3874b18d
branches:  trunk
changeset: 332094:e42d3874b18d
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Sep 06 18:43:00 2014 +0000

description:
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.

diffstat:

 sys/external/bsd/drm2/dist/drm/radeon/evergreen_cs.c |  20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diffs (58 lines):

diff -r ae308d0e1c2b -r e42d3874b18d sys/external/bsd/drm2/dist/drm/radeon/evergreen_cs.c
--- a/sys/external/bsd/drm2/dist/drm/radeon/evergreen_cs.c      Sat Sep 06 18:37:01 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/evergreen_cs.c      Sat Sep 06 18:43:00 2014 +0000
@@ -546,6 +546,10 @@
        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 @@
                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 @@
                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 @@
                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 @@
                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",



Home | Main Index | Thread Index | Old Index