|
@@ -1,7 +1,7 @@
|
|
|
-From f1f625dbcb4e0cc062369729b1da3d7fc65969e8 Mon Sep 17 00:00:00 2001
|
|
|
+From e92a09b72b44a0969983635803022f7dc1a50924 Mon Sep 17 00:00:00 2001
|
|
|
From: Brendan King <Brendan.King@imgtec.com>
|
|
|
Date: Thu, 20 May 2021 20:16:18 +0100
|
|
|
-Subject: [PATCH 54/67] egl/null: add support for DRI_PRIME GPU selection
|
|
|
+Subject: [PATCH] egl/null: add support for DRI_PRIME GPU selection
|
|
|
|
|
|
Add support for selecting the GPU to be used for rendering using
|
|
|
the DRI_PRIME environment variable. If a different GPU is selected,
|
|
@@ -15,13 +15,14 @@ This is to prevent failure on PC based test systems, that often
|
|
|
include display hardware that is incompatible with the driver.
|
|
|
This code would not be needed for systems that don't use the PVR
|
|
|
driver, or on production systems that use the PVR driver.
|
|
|
+
|
|
|
---
|
|
|
src/egl/drivers/dri2/egl_dri2.c | 1 +
|
|
|
src/egl/drivers/dri2/platform_null.c | 133 +++++++++++++++++++--------
|
|
|
2 files changed, 98 insertions(+), 36 deletions(-)
|
|
|
|
|
|
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
|
|
|
-index ec4ac602a84..56b5175db6e 100644
|
|
|
+index ec4ac60..56b5175 100644
|
|
|
--- a/src/egl/drivers/dri2/egl_dri2.c
|
|
|
+++ b/src/egl/drivers/dri2/egl_dri2.c
|
|
|
@@ -1369,6 +1369,7 @@ dri2_display_destroy(_EGLDisplay *disp)
|
|
@@ -33,10 +34,10 @@ index ec4ac602a84..56b5175db6e 100644
|
|
|
case _EGL_PLATFORM_X11:
|
|
|
if (dri2_dpy->fd_dpy >= 0 && dri2_dpy->fd_dpy != dri2_dpy->fd)
|
|
|
diff --git a/src/egl/drivers/dri2/platform_null.c b/src/egl/drivers/dri2/platform_null.c
|
|
|
-index db6f1147670..af77ea4dd89 100644
|
|
|
+index 8efac19..0d81151 100644
|
|
|
--- a/src/egl/drivers/dri2/platform_null.c
|
|
|
+++ b/src/egl/drivers/dri2/platform_null.c
|
|
|
-@@ -44,6 +44,7 @@
|
|
|
+@@ -45,6 +45,7 @@
|
|
|
|
|
|
#include "egl_dri2.h"
|
|
|
#include "loader.h"
|
|
@@ -44,7 +45,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
|
|
|
#define NULL_CARD_MINOR_MAX 63U
|
|
|
|
|
|
-@@ -953,7 +954,7 @@ swap_idle_get_target_frame(struct dri2_egl_surface *dri2_surf,
|
|
|
+@@ -975,7 +976,7 @@ swap_idle_get_target_frame(struct dri2_egl_surface *dri2_surf,
|
|
|
* current vblank by the number of intervals set at the time swapBuffer
|
|
|
* is called. For intervals of 1 or 0, we don't need a target frame.
|
|
|
*/
|
|
@@ -53,7 +54,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
if (err)
|
|
|
return err;
|
|
|
|
|
|
-@@ -1003,7 +1004,7 @@ swap_vblank_state_transition(struct dri2_egl_surface *dri2_surf,
|
|
|
+@@ -1025,7 +1026,7 @@ swap_vblank_state_transition(struct dri2_egl_surface *dri2_surf,
|
|
|
uint32_t flags = DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT;
|
|
|
int err;
|
|
|
|
|
@@ -62,7 +63,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
flags, dri2_surf);
|
|
|
if (err) {
|
|
|
dri2_surf->swap_state = SWAP_ERROR;
|
|
|
-@@ -1029,7 +1030,7 @@ swap_flip_state_transition(struct dri2_egl_surface *dri2_surf)
|
|
|
+@@ -1051,7 +1052,7 @@ swap_flip_state_transition(struct dri2_egl_surface *dri2_surf)
|
|
|
flags |= DRM_MODE_PAGE_FLIP_ASYNC;
|
|
|
}
|
|
|
|
|
@@ -71,7 +72,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
dri2_surf->swap_data->fb_id, flags, dri2_surf);
|
|
|
if (err) {
|
|
|
dri2_surf->swap_state = SWAP_ERROR;
|
|
|
-@@ -1049,7 +1050,7 @@ swap_poll_state_transition(struct dri2_egl_surface *dri2_surf)
|
|
|
+@@ -1071,7 +1072,7 @@ swap_poll_state_transition(struct dri2_egl_surface *dri2_surf)
|
|
|
int err;
|
|
|
|
|
|
/* dri2_surf->swap_state is being set inside the handler */
|
|
@@ -80,7 +81,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
if (err) {
|
|
|
dri2_surf->swap_state = SWAP_ERROR;
|
|
|
return err;
|
|
|
-@@ -1201,7 +1202,7 @@ add_fb_for_dri_image(struct dri2_egl_display *dri2_dpy, __DRIimage *image,
|
|
|
+@@ -1226,7 +1227,7 @@ add_fb_for_dri_image(struct dri2_egl_display *dri2_dpy, __DRIimage *image,
|
|
|
handles[i] = (uint32_t) handle;
|
|
|
}
|
|
|
|
|
@@ -89,7 +90,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
dri2_null_formats[format_idx].drm_format,
|
|
|
handles, pitches, offsets, modifiers,
|
|
|
fb_id_out, flags);
|
|
|
-@@ -1459,7 +1460,7 @@ dri2_null_create_window_surface(_EGLDisplay *disp, _EGLConfig *config,
|
|
|
+@@ -1494,7 +1495,7 @@ dri2_null_create_window_surface(_EGLDisplay *disp, _EGLConfig *config,
|
|
|
goto err_destroy_surface;
|
|
|
}
|
|
|
|
|
@@ -98,7 +99,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
dri2_surf->front_buffer.fb_id);
|
|
|
if (err) {
|
|
|
_eglError(EGL_BAD_NATIVE_WINDOW, "window set mode");
|
|
|
-@@ -1573,11 +1574,11 @@ dri2_null_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
|
|
+@@ -1608,11 +1609,11 @@ dri2_null_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
|
|
dri2_dpy->image->destroyImage(dri2_surf->front_buffer.dri_image);
|
|
|
|
|
|
if (dri2_surf->front_buffer.fb_id)
|
|
@@ -112,7 +113,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
if (dri2_surf->color_buffers[i].dri_image)
|
|
|
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image);
|
|
|
}
|
|
|
-@@ -1734,12 +1735,22 @@ dri2_null_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
|
|
|
+@@ -1769,12 +1770,22 @@ dri2_null_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
|
|
|
(void) loaderPrivate;
|
|
|
}
|
|
|
|
|
@@ -136,7 +137,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
};
|
|
|
|
|
|
static const __DRIextension *image_loader_extensions[] = {
|
|
|
-@@ -1768,12 +1779,74 @@ dri2_null_device_is_kms(int fd)
|
|
|
+@@ -1803,12 +1814,74 @@ dri2_null_device_is_kms(int fd)
|
|
|
return is_kms;
|
|
|
}
|
|
|
|
|
@@ -211,7 +212,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
|
|
|
for (unsigned i = 0; i <= NULL_CARD_MINOR_MAX; i++) {
|
|
|
char *card_path;
|
|
|
-@@ -1781,32 +1854,20 @@ dri2_null_probe_device(_EGLDisplay *disp)
|
|
|
+@@ -1816,32 +1889,20 @@ dri2_null_probe_device(_EGLDisplay *disp)
|
|
|
if (asprintf(&card_path, DRM_DEV_NAME, DRM_DIR_NAME, i) < 0)
|
|
|
continue;
|
|
|
|
|
@@ -254,7 +255,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
dri2_dpy->fd = -1;
|
|
|
}
|
|
|
|
|
|
-@@ -1867,7 +1928,7 @@ dri2_null_setup_swap_interval(_EGLDisplay *disp)
|
|
|
+@@ -1902,7 +1963,7 @@ dri2_null_setup_swap_interval(_EGLDisplay *disp)
|
|
|
|
|
|
dri2_setup_swap_interval(disp, swap_max_interval);
|
|
|
|
|
@@ -263,7 +264,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
if (err || value == 0) {
|
|
|
|
|
|
/* DRM/KMS does not support async page flip. In order to support
|
|
|
-@@ -1914,7 +1975,7 @@ dri2_initialize_null(_EGLDisplay *disp)
|
|
|
+@@ -1950,7 +2011,7 @@ dri2_initialize_null(_EGLDisplay *disp)
|
|
|
* modesetting if not. If this succeeds then universal planes will also have
|
|
|
* been enabled.
|
|
|
*/
|
|
@@ -272,7 +273,7 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
dri2_dpy->atomic_enabled = !err;
|
|
|
|
|
|
if (!dri2_dpy->atomic_enabled) {
|
|
|
-@@ -1922,7 +1983,7 @@ dri2_initialize_null(_EGLDisplay *disp)
|
|
|
+@@ -1958,7 +2019,7 @@ dri2_initialize_null(_EGLDisplay *disp)
|
|
|
* Enable universal planes so that we can get the pixel formats for the
|
|
|
* primary plane
|
|
|
*/
|
|
@@ -281,17 +282,17 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
if (err) {
|
|
|
_eglError(EGL_NOT_INITIALIZED, "failed to enable universal planes");
|
|
|
goto cleanup;
|
|
|
-@@ -1955,7 +2016,7 @@ dri2_initialize_null(_EGLDisplay *disp)
|
|
|
- prefer_in_formats = dri2_dpy->image->base.version >= 14 &&
|
|
|
- dri2_dpy->image->createImageWithModifiers;
|
|
|
+@@ -1994,7 +2055,7 @@ dri2_initialize_null(_EGLDisplay *disp)
|
|
|
+ dri2_dpy->image->createImageWithModifiers;
|
|
|
+ }
|
|
|
|
|
|
- if (!display_output_init(dri2_dpy->fd, &dri2_dpy->output,
|
|
|
+ if (!display_output_init(dri2_dpy->fd_dpy, &dri2_dpy->output,
|
|
|
dri2_dpy->atomic_enabled,
|
|
|
prefer_in_formats,
|
|
|
&dri2_dpy->in_formats_enabled)) {
|
|
|
-@@ -1990,7 +2051,7 @@ dri2_teardown_null(struct dri2_egl_display *dri2_dpy)
|
|
|
- drmModeFreeFormats(dri2_dpy->output.in_formats);
|
|
|
+@@ -2028,7 +2089,7 @@ dri2_teardown_null(struct dri2_egl_display *dri2_dpy)
|
|
|
+ drmModeAtomicFree(dri2_dpy->output.atomic_state);
|
|
|
|
|
|
if (dri2_dpy->output.mode_blob_id)
|
|
|
- drmModeDestroyPropertyBlob(dri2_dpy->fd, dri2_dpy->output.mode_blob_id);
|
|
@@ -299,6 +300,3 @@ index db6f1147670..af77ea4dd89 100644
|
|
|
|
|
|
if (dri2_dpy->output.plane_prop_res) {
|
|
|
for (unsigned i = 0; dri2_dpy->output.plane_prop_res[i]; i++)
|
|
|
---
|
|
|
-2.25.1
|
|
|
-
|