v3d: Use driconf to expose non-MSAA texture limits for Xorg.

The V3D 4.2 HW has a limit to MSAA texture sizes of 4096.  With non-MSAA,
we can go up to 7680 (actually probably 8138, but that hasn't been
validated by the HW team).  Exposing 7680 in X11 will allow dual 4k displays.
This commit is contained in:
Eric Anholt 2019-05-01 15:02:27 -07:00
parent 0c31fe9ee7
commit 60a64f028d
15 changed files with 85 additions and 23 deletions

View File

@ -111,10 +111,12 @@ static const struct drm_driver_descriptor driver_descriptors[] = {
{
.driver_name = "v3d",
.create_screen = pipe_v3d_create_screen,
.driconf_xml = &v3d_driconf_xml,
},
{
.driver_name = "vc4",
.create_screen = pipe_vc4_create_screen,
.driconf_xml = &v3d_driconf_xml,
},
{
.driver_name = "panfrost",
@ -137,6 +139,7 @@ static const struct drm_driver_descriptor driver_descriptors[] = {
static const struct drm_driver_descriptor default_driver_descriptor = {
.driver_name = "kmsro",
.create_screen = pipe_kmsro_create_screen,
.driconf_xml = &v3d_driconf_xml,
};
#endif

View File

@ -96,7 +96,7 @@ pipe_kmsro_create_screen(int fd, const struct pipe_screen_config *config)
{
struct pipe_screen *screen;
screen = kmsro_drm_screen_create(fd);
screen = kmsro_drm_screen_create(fd, config);
return screen ? debug_screen_wrap(screen) : NULL;
}
@ -281,10 +281,9 @@ pipe_vc4_create_screen(int fd, const struct pipe_screen_config *config)
{
struct pipe_screen *screen;
screen = vc4_drm_screen_create(fd);
screen = vc4_drm_screen_create(fd, config);
return screen ? debug_screen_wrap(screen) : NULL;
}
#else
struct pipe_screen *
@ -304,10 +303,14 @@ pipe_v3d_create_screen(int fd, const struct pipe_screen_config *config)
{
struct pipe_screen *screen;
screen = v3d_drm_screen_create(fd);
screen = v3d_drm_screen_create(fd, config);
return screen ? debug_screen_wrap(screen) : NULL;
}
const char *v3d_driconf_xml =
#include "v3d/v3d_driinfo.h"
;
#else
struct pipe_screen *
@ -317,6 +320,8 @@ pipe_v3d_create_screen(int fd, const struct pipe_screen_config *config)
return NULL;
}
const char *v3d_driconf_xml = NULL;
#endif
#ifdef GALLIUM_PANFROST

View File

@ -6,6 +6,7 @@ struct pipe_screen_config;
const char *iris_driconf_xml;
const char *radeonsi_driconf_xml;
const char *v3d_driconf_xml;
struct pipe_screen *
pipe_i915_create_screen(int fd, const struct pipe_screen_config *config);

View File

@ -0,0 +1,5 @@
// v3d-specific driconf options
DRI_CONF_SECTION_MISCELLANEOUS
DRI_CONF_V3D_NONMSAA_TEXTURE_SIZE_LIMIT("false")
DRI_CONF_SECTION_END

View File

@ -50,6 +50,16 @@ files_per_version = files(
'v3dx_state.c',
)
v3d_driinfo_h = custom_target(
'v3d_driinfo.h',
input : files(
'../../../util/merge_driinfo.py',
'../../auxiliary/pipe-loader/driinfo_gallium.h', 'driinfo_v3d.h'
),
output : 'v3d_driinfo.h',
command : [prog_python, '@INPUT@'],
capture : true,
)
v3d_args = ['-DV3D_BUILD_NEON']
dep_v3dv3 = dependency('v3dv3', required: false)
@ -93,7 +103,11 @@ libv3d_neon = static_library(
libv3d = static_library(
'v3d',
[files_libv3d, v3d_xml_pack],
[
files_libv3d,
v3d_xml_pack,
v3d_driinfo_h
],
include_directories : [
inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_broadcom,
inc_gallium_drivers,
@ -107,5 +121,6 @@ libv3d = static_library(
driver_v3d = declare_dependency(
compile_args : '-DGALLIUM_V3D',
link_with : [libv3d, libv3dwinsys, libbroadcom_cle, libbroadcom_v3d],
sources : v3d_driinfo_h,
dependencies : idep_nir,
)

View File

@ -36,6 +36,7 @@
#include "util/u_screen.h"
#include "util/u_transfer_helper.h"
#include "util/ralloc.h"
#include "util/xmlconfig.h"
#include <xf86drm.h>
#include "v3d_screen.h"
@ -208,6 +209,8 @@ v3d_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
if (screen->devinfo.ver < 40)
return 2048;
else if (screen->nonmsaa_texture_size_limit)
return 7680;
else
return 4096;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
@ -665,7 +668,8 @@ v3d_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen,
}
struct pipe_screen *
v3d_screen_create(int fd, struct renderonly *ro)
v3d_screen_create(int fd, const struct pipe_screen_config *config,
struct renderonly *ro)
{
struct v3d_screen *screen = rzalloc(NULL, struct v3d_screen);
struct pipe_screen *pscreen;
@ -700,6 +704,14 @@ v3d_screen_create(int fd, struct renderonly *ro)
if (!v3d_get_device_info(screen))
goto fail;
/* We have to driCheckOption for the simulator mode to not assertion
* fail on not having our XML config.
*/
const char *nonmsaa_name = "v3d_nonmsaa_texture_size_limit";
screen->nonmsaa_texture_size_limit =
driCheckOption(config->options, nonmsaa_name, DRI_BOOL) &&
driQueryOptionb(config->options, nonmsaa_name);
slab_create_parent(&screen->transfer_pool, sizeof(struct v3d_transfer), 16);
screen->has_csd = false; /* until the UABI is enabled. */

View File

@ -78,6 +78,7 @@ struct v3d_screen {
uint32_t bo_count;
bool has_csd;
bool nonmsaa_texture_size_limit;
struct v3d_simulator_file *sim_file;
};
@ -88,7 +89,9 @@ v3d_screen(struct pipe_screen *screen)
return (struct v3d_screen *)screen;
}
struct pipe_screen *v3d_screen_create(int fd, struct renderonly *ro);
struct pipe_screen *v3d_screen_create(int fd,
const struct pipe_screen_config *config,
struct renderonly *ro);
void
v3d_fence_init(struct v3d_screen *screen);

View File

@ -28,7 +28,9 @@
#define __KMSRO_DRM_PUBLIC_H__
struct pipe_screen;
struct pipe_screen_config;
struct pipe_screen *kmsro_drm_screen_create(int fd);
struct pipe_screen *kmsro_drm_screen_create(int fd,
const struct pipe_screen_config *config);
#endif /* __KMSRO_DRM_PUBLIC_H__ */

View File

@ -37,7 +37,8 @@
#include "pipe/p_screen.h"
#include "renderonly/renderonly.h"
struct pipe_screen *kmsro_drm_screen_create(int fd)
struct pipe_screen *kmsro_drm_screen_create(int fd,
const struct pipe_screen_config *config)
{
struct pipe_screen *screen = NULL;
struct renderonly ro = {
@ -53,7 +54,7 @@ struct pipe_screen *kmsro_drm_screen_create(int fd)
* flag on allocation will have ensured.
*/
ro.create_for_resource = renderonly_create_gpu_import_for_resource,
screen = vc4_drm_screen_create_renderonly(&ro);
screen = vc4_drm_screen_create_renderonly(&ro, config);
if (!screen)
close(ro.gpu_fd);
@ -114,7 +115,7 @@ struct pipe_screen *kmsro_drm_screen_create(int fd)
ro.gpu_fd = drmOpenWithType("v3d", NULL, DRM_NODE_RENDER);
if (ro.gpu_fd >= 0) {
ro.create_for_resource = renderonly_create_kms_dumb_buffer_for_resource,
screen = v3d_drm_screen_create_renderonly(&ro);
screen = v3d_drm_screen_create_renderonly(&ro, config);
if (!screen)
close(ro.gpu_fd);

View File

@ -25,9 +25,12 @@
#define __VC5_DRM_PUBLIC_H__
struct pipe_screen;
struct pipe_screen_config;
struct renderonly;
struct pipe_screen *v3d_drm_screen_create(int drmFD);
struct pipe_screen *v3d_drm_screen_create_renderonly(struct renderonly *ro);
struct pipe_screen *v3d_drm_screen_create(int drmFD,
const struct pipe_screen_config *config);
struct pipe_screen *v3d_drm_screen_create_renderonly(struct renderonly *ro,
const struct pipe_screen_config *config);
#endif /* __VC5_DRM_PUBLIC_H__ */

View File

@ -29,13 +29,14 @@
#include "v3d/v3d_screen.h"
struct pipe_screen *
v3d_drm_screen_create(int fd)
v3d_drm_screen_create(int fd, const struct pipe_screen_config *config)
{
return v3d_screen_create(fcntl(fd, F_DUPFD_CLOEXEC, 3), NULL);
return v3d_screen_create(fcntl(fd, F_DUPFD_CLOEXEC, 3), config, NULL);
}
struct pipe_screen *
v3d_drm_screen_create_renderonly(struct renderonly *ro)
v3d_drm_screen_create_renderonly(struct renderonly *ro,
const struct pipe_screen_config *config)
{
return v3d_screen_create(ro->gpu_fd, ro);
return v3d_screen_create(ro->gpu_fd, config, ro);
}

View File

@ -27,7 +27,9 @@
struct pipe_screen;
struct renderonly;
struct pipe_screen *vc4_drm_screen_create(int drmFD);
struct pipe_screen *vc4_drm_screen_create_renderonly(struct renderonly *ro);
struct pipe_screen *vc4_drm_screen_create(int drmFD,
const struct pipe_screen_config *config);
struct pipe_screen *vc4_drm_screen_create_renderonly(struct renderonly *ro,
const struct pipe_screen_config *config);
#endif /* __VC4_DRM_PUBLIC_H__ */

View File

@ -32,7 +32,7 @@
#include "drm-uapi/vc4_drm.h"
struct pipe_screen *
vc4_drm_screen_create(int fd)
vc4_drm_screen_create(int fd, const struct pipe_screen_config *config)
{
bool v3d_present = true;
@ -49,14 +49,15 @@ vc4_drm_screen_create(int fd)
return vc4_screen_create(fcntl(fd, F_DUPFD_CLOEXEC, 3), NULL);
#ifdef GALLIUM_KMSRO
return kmsro_drm_screen_create(fd);
return kmsro_drm_screen_create(fd, config);
#endif
return NULL;
}
struct pipe_screen *
vc4_drm_screen_create_renderonly(struct renderonly *ro)
vc4_drm_screen_create_renderonly(struct renderonly *ro,
const struct pipe_screen_config *config)
{
return vc4_screen_create(ro->gpu_fd, ro);
}

View File

@ -446,6 +446,9 @@ TODO: document the other workarounds.
<application name="mpv" executable="mpv">
<option name="adaptive_sync" value="false" />
</application>
<application name="Xorg" executable="Xorg">
<option name="v3d_nonmsaa_texture_size_limit" value="true" />
</application>
<!-- Gallium Nine workarounds: -->
<application name="Rayman Legends" executable="Rayman Legends.exe">
@ -481,4 +484,4 @@ TODO: document the other workarounds.
<option name="radeonsi_enable_nir" value="true"/>
</application>
</device>
</driconf>
</driconf>

View File

@ -358,3 +358,8 @@ DRI_CONF_OPT_BEGIN_B(radeonsi_zerovram, def) \
DRI_CONF_DESC(en,"Zero all vram allocations") \
DRI_CONF_OPT_END
#define DRI_CONF_V3D_NONMSAA_TEXTURE_SIZE_LIMIT(def) \
DRI_CONF_OPT_BEGIN_B(v3d_nonmsaa_texture_size_limit, def) \
DRI_CONF_DESC(en,"Report the non-MSAA-only texture size limit") \
DRI_CONF_OPT_END