panfrost: Include glue for out-of-tree legacy code

In addition to the DRM interface in active development, for legacy
kernels Panfrost has a small, optional, out-of-tree glue repository. For
various reasons, this legacy code should not be included in Mesa proper,
but this commit allows it to coexist peacefully with upstream Panfrost.
If the nondrm repo is cloned/symlinked to the directory
`src/gallium/drivers/panfrost/nondrm`, legacy functionality will be
built. Otherwise, the driver will build normally, though a runtime error
message will be printed if a legacy kernel is detected.

This workaround is icky, but it allows a nearly-upstream Panfrost to
work on real hardware, today. Ideally, this patch will be reverted when
the Panfrost kernel module is mature and we drop legacy support.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
Alyssa Rosenzweig 2019-02-05 05:13:50 +00:00
parent 7da251fc72
commit d43ec104b7
5 changed files with 29 additions and 7 deletions

View File

@ -0,0 +1 @@
nondrm

View File

@ -39,7 +39,7 @@ files_panfrost = files(
'pan_blending.c',
'pan_blend_shaders.c',
'pan_wallpaper.c',
'pan_pretty_print.c'
'pan_pretty_print.c',
)
inc_panfrost = [
@ -53,6 +53,21 @@ inc_panfrost = [
include_directories('midgard'),
]
compile_args_panfrost = [
'-DGALLIUM_PANFROST',
'-Wno-pointer-arith'
]
overlay = join_paths(meson.source_root(), meson.current_source_dir(), 'nondrm/pan_nondrm.c')
nondrm_overlay_check = run_command('ls', overlay)
has_nondrm_overlay = nondrm_overlay_check.returncode() == 0
if has_nondrm_overlay
files_panfrost += files('nondrm/pan_nondrm.c')
inc_panfrost += include_directories('nondrm/include')
compile_args_panfrost += '-DPAN_NONDRM_OVERLAY'
endif
midgard_nir_algebraic_c = custom_target(
'midgard_nir_algebraic.c',
input : 'midgard/midgard_nir_algebraic.py',
@ -73,11 +88,11 @@ libpanfrost = static_library(
idep_nir
],
include_directories : inc_panfrost,
c_args : [c_vis_args, c_msvc_compat_args],
c_args : [c_vis_args, c_msvc_compat_args, compile_args_panfrost],
)
driver_panfrost = declare_dependency(
compile_args : ['-DGALLIUM_PANFROST', '-Wno-pointer-arith'],
compile_args : compile_args_panfrost,
link_with : [libpanfrost, libpanfrostwinsys],
)

View File

@ -1431,7 +1431,8 @@ panfrost_submit_frame(struct panfrost_context *ctx, bool flush_immediate)
#ifndef DRY_RUN
int fragment_id = screen->driver->submit_vs_fs_job(ctx, has_draws);
bool is_scanout = panfrost_is_scanout(ctx);
int fragment_id = screen->driver->submit_vs_fs_job(ctx, has_draws, is_scanout);
/* If visual, we can stall a frame */

View File

@ -50,7 +50,8 @@
#include "pan_context.h"
#include "midgard/midgard_compile.h"
#include "pan_drm.h"
struct panfrost_driver *panfrost_create_drm_driver(int fd);
struct panfrost_driver *panfrost_create_nondrm_driver(int fd);
static const char *
panfrost_get_name(struct pipe_screen *screen)
@ -539,8 +540,12 @@ panfrost_create_screen(int fd, struct renderonly *ro, bool is_drm)
if (is_drm) {
screen->driver = panfrost_create_drm_driver(fd);
} else {
fprintf(stderr, "Legacy (non-DRM) drivers are not supported in upstream Mesa\n");
#ifdef PAN_NONDRM_OVERLAY
screen->driver = panfrost_create_nondrm_driver(fd);
#else
fprintf(stderr, "Legacy (non-DRM) operation requires out-of-tree overlay\n");
return NULL;
#endif
}
#ifdef DUMP_PERFORMANCE_COUNTERS

View File

@ -53,7 +53,7 @@ struct panfrost_driver {
void (*unmap_bo) (struct panfrost_context *ctx, struct pipe_transfer *transfer);
void (*destroy_bo) (struct panfrost_screen *screen, struct panfrost_bo *bo);
int (*submit_vs_fs_job) (struct panfrost_context *ctx, bool has_draws);
int (*submit_vs_fs_job) (struct panfrost_context *ctx, bool has_draws, bool is_scanout);
void (*force_flush_fragment) (struct panfrost_context *ctx);
void (*allocate_slab) (struct panfrost_screen *screen,
struct panfrost_memory *mem,