mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
freedreno/loader: Switch over to probe_nctx
Unwind the hacks that were previously used for freedreno to probe on virtgpu, and switch over to the new mechanism. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28777>
This commit is contained in:
parent
2ea4a59ab7
commit
450c9460c6
4 changed files with 37 additions and 24 deletions
|
|
@ -248,19 +248,26 @@ pipe_msm_create_screen(int fd, const struct pipe_screen_config *config)
|
|||
return screen ? debug_screen_wrap(screen) : NULL;
|
||||
}
|
||||
|
||||
static bool
|
||||
pipe_msm_probe_nctx(int fd, const struct virgl_renderer_capset_drm *caps)
|
||||
{
|
||||
return fd_drm_probe_nctx(fd, caps);
|
||||
}
|
||||
|
||||
const driOptionDescription msm_driconf[] = {
|
||||
#ifdef GALLIUM_FREEDRENO
|
||||
#include "freedreno/driinfo_freedreno.h"
|
||||
#endif
|
||||
};
|
||||
DRM_DRIVER_DESCRIPTOR(msm, msm_driconf, ARRAY_SIZE(msm_driconf))
|
||||
DRM_DRIVER_DESCRIPTOR(msm, msm_driconf, ARRAY_SIZE(msm_driconf),
|
||||
.probe_nctx = pipe_msm_probe_nctx)
|
||||
DRM_DRIVER_DESCRIPTOR_ALIAS(msm, kgsl, msm_driconf, ARRAY_SIZE(msm_driconf))
|
||||
#else
|
||||
DRM_DRIVER_DESCRIPTOR_STUB(msm)
|
||||
DRM_DRIVER_DESCRIPTOR_STUB(kgsl)
|
||||
#endif
|
||||
|
||||
#if defined(GALLIUM_VIRGL) || (defined(GALLIUM_FREEDRENO) && !defined(PIPE_LOADER_DYNAMIC))
|
||||
#if defined(GALLIUM_VIRGL)
|
||||
#include "virgl/drm/virgl_drm_public.h"
|
||||
#include "virgl/virgl_public.h"
|
||||
|
||||
|
|
@ -269,15 +276,9 @@ pipe_virtio_gpu_create_screen(int fd, const struct pipe_screen_config *config)
|
|||
{
|
||||
struct pipe_screen *screen = NULL;
|
||||
|
||||
/* Try native guest driver(s) first, and then fallback to virgl: */
|
||||
#ifdef GALLIUM_FREEDRENO
|
||||
if (!screen)
|
||||
screen = fd_drm_screen_create_renderonly(fd, NULL, config);
|
||||
#endif
|
||||
#ifdef GALLIUM_VIRGL
|
||||
if (!screen)
|
||||
screen = virgl_drm_screen_create(fd, config);
|
||||
#endif
|
||||
|
||||
return screen ? debug_screen_wrap(screen) : NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,20 +11,5 @@ DRI_CONF_SECTION_MISCELLANEOUS
|
|||
DRI_CONF_GLES_EMULATE_BGRA(true)
|
||||
DRI_CONF_GLES_APPLY_BGRA_DEST_SWIZZLE(true)
|
||||
DRI_CONF_GLES_SAMPLES_PASSED_VALUE(1024, 1, 400000000)
|
||||
|
||||
/*
|
||||
* Native-context drivers also (can) bind to the some virtio_gpu guest
|
||||
* kernel device. Because drm_helper ties the driconf config to the
|
||||
* drm device name, we also need to include config options for any
|
||||
* possible drm-native-context guest driver:
|
||||
*/
|
||||
DRI_CONF_DISABLE_CONSERVATIVE_LRZ(false)
|
||||
|
||||
DRI_CONF_VIRGL_SHADER_SYNC(false)
|
||||
DRI_CONF_SECTION_END
|
||||
|
||||
DRI_CONF_SECTION_DEBUG
|
||||
/* Also needed for native-context drivers (freedreno) */
|
||||
DRI_CONF_DISABLE_THROTTLING(false)
|
||||
DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION(false)
|
||||
DRI_CONF_SECTION_END
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
#ifndef __FREEDRENO_DRM_PUBLIC_H__
|
||||
#define __FREEDRENO_DRM_PUBLIC_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
struct pipe_screen;
|
||||
struct renderonly;
|
||||
|
||||
|
|
@ -9,4 +11,8 @@ struct pipe_screen *fd_drm_screen_create_renderonly(int drmFD,
|
|||
struct renderonly *ro,
|
||||
const struct pipe_screen_config *config);
|
||||
|
||||
struct virgl_renderer_capset_drm;
|
||||
|
||||
bool fd_drm_probe_nctx(int fd, const struct virgl_renderer_capset_drm *caps);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -31,9 +31,30 @@
|
|||
|
||||
#include "freedreno/freedreno_screen.h"
|
||||
|
||||
#include "virtio/virtio-gpu/drm_hw.h"
|
||||
|
||||
struct pipe_screen *
|
||||
fd_drm_screen_create_renderonly(int fd, struct renderonly *ro,
|
||||
const struct pipe_screen_config *config)
|
||||
{
|
||||
return u_pipe_screen_lookup_or_create(fd, config, ro, fd_screen_create);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the native-context type exposed by virtgpu is one we
|
||||
* support, and that we support the underlying device.
|
||||
*/
|
||||
bool
|
||||
fd_drm_probe_nctx(int fd, const struct virgl_renderer_capset_drm *caps)
|
||||
{
|
||||
if (caps->context_type != VIRTGPU_DRM_CONTEXT_MSM)
|
||||
return false;
|
||||
|
||||
struct fd_dev_id dev_id = {
|
||||
.gpu_id = caps->u.msm.gpu_id,
|
||||
.chip_id = caps->u.msm.chip_id,
|
||||
};
|
||||
const struct fd_dev_info info = fd_dev_info(&dev_id);
|
||||
|
||||
return info.chip != 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue