diff options
author | Tomeu Vizoso <[email protected]> | 2019-07-31 15:00:46 +0200 |
---|---|---|
committer | Tomeu Vizoso <[email protected]> | 2019-08-08 07:42:52 +0200 |
commit | 19afd41e6546fb6ca852b62fc5a63359f3b70693 (patch) | |
tree | 469c37194dcefc9c1a021da20b4ebe83cb569f8b /src/gallium/drivers/panfrost | |
parent | 9398932c2d4cd1dfd337337a82ca8dc9bae35487 (diff) |
panfrost: Mark BOs as NOEXEC
Unless a BO has the EXECUTABLE flag, mark it as NOEXEC.
v2: - Rework version detection (Alyssa).
Signed-off-by: Tomeu Vizoso <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_drm.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_screen.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_screen.h | 3 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c index 8ae541ae11b..6d1e0c08d33 100644 --- a/src/gallium/drivers/panfrost/pan_drm.c +++ b/src/gallium/drivers/panfrost/pan_drm.c @@ -93,7 +93,11 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, size_t size, unsigned translated_flags = 0; - /* TODO: translate flags to kernel flags, if the kernel supports */ + if (screen->kernel_version->version_major > 1 || + screen->kernel_version->version_minor >= 1) { + if (!(flags & PAN_ALLOCATE_EXECUTE)) + translated_flags |= PANFROST_BO_NOEXEC; + } struct drm_panfrost_create_bo create_bo = { .size = size, diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index b2fac88e956..5f527d0d3b3 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -37,7 +37,6 @@ #include "pipe/p_defines.h" #include "pipe/p_screen.h" #include "draw/draw_context.h" -#include <xf86drm.h> #include <fcntl.h> @@ -537,6 +536,7 @@ panfrost_destroy_screen(struct pipe_screen *pscreen) { struct panfrost_screen *screen = pan_screen(pscreen); panfrost_bo_cache_evict_all(screen); + drmFreeVersion(screen->kernel_version); ralloc_free(screen); } @@ -617,6 +617,7 @@ panfrost_create_screen(int fd, struct renderonly *ro) screen->gpu_id = panfrost_drm_query_gpu_version(screen); screen->require_sfbd = screen->gpu_id < 0x0750; /* T760 is the first to support MFBD */ + screen->kernel_version = drmGetVersion(fd); /* Check if we're loading against a supported GPU model. */ diff --git a/src/gallium/drivers/panfrost/pan_screen.h b/src/gallium/drivers/panfrost/pan_screen.h index 22cd7dcc9fe..35fb8de2628 100644 --- a/src/gallium/drivers/panfrost/pan_screen.h +++ b/src/gallium/drivers/panfrost/pan_screen.h @@ -29,6 +29,7 @@ #ifndef PAN_SCREEN_H #define PAN_SCREEN_H +#include <xf86drm.h> #include "pipe/p_screen.h" #include "pipe/p_defines.h" #include "renderonly/renderonly.h" @@ -99,6 +100,8 @@ struct panfrost_screen { unsigned gpu_id; bool require_sfbd; + drmVersionPtr kernel_version; + struct renderonly *ro; /* Transient memory management is based on borrowing fixed-size slabs |