Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame^] | 1 | From feb4ec510b1328fdd9aa77305d3273d1f9c7e124 Mon Sep 17 00:00:00 2001 |
| 2 | From: Alexander Kanavin <alex@linutronix.de> |
| 3 | Date: Thu, 9 Jun 2022 11:42:05 +0200 |
| 4 | Subject: [PATCH] swrast_kms: use swkmsDRI2Extension instead of |
| 5 | driDRI2Extension |
| 6 | |
| 7 | This set of changes: |
| 8 | https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15649 |
| 9 | |
| 10 | caused a regression in Xorg when using swrast_kms: |
| 11 | (EE) AIGLX error: Calling driver entry point failed |
| 12 | |
| 13 | This commit changes the swrast_kms driver to use a dedicated screen init function |
| 14 | (which I believe was overlooked); I also took the opportunity to rename the |
| 15 | associated plumbling to have swrast-specific names. |
| 16 | |
| 17 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16942] |
| 18 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> |
| 19 | --- |
| 20 | src/gallium/frontends/dri/dri2.c | 16 ++++++++-------- |
| 21 | src/gallium/frontends/dri/dri_screen.h | 4 ++-- |
| 22 | src/gallium/frontends/dri/dri_util.c | 2 +- |
| 23 | src/gallium/targets/dri/target.c | 2 +- |
| 24 | 4 files changed, 12 insertions(+), 12 deletions(-) |
| 25 | |
| 26 | diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c |
| 27 | index 63ac9d5..de33789 100644 |
| 28 | --- a/src/gallium/frontends/dri/dri2.c |
| 29 | +++ b/src/gallium/frontends/dri/dri2.c |
| 30 | @@ -2508,7 +2508,7 @@ release_pipe: |
| 31 | * Returns the struct gl_config supported by this driver. |
| 32 | */ |
| 33 | static const __DRIconfig ** |
| 34 | -dri_kms_init_screen(__DRIscreen * sPriv) |
| 35 | +dri_swrast_kms_init_screen(__DRIscreen * sPriv) |
| 36 | { |
| 37 | #if defined(GALLIUM_SOFTPIPE) |
| 38 | const __DRIconfig **configs; |
| 39 | @@ -2613,8 +2613,8 @@ static const struct __DRIDriverVtableExtensionRec galliumdrm_vtable = { |
| 40 | * hook. The latter is used to explicitly initialise the kms_swrast driver |
| 41 | * rather than selecting the approapriate driver as suggested by the loader. |
| 42 | */ |
| 43 | -const struct __DriverAPIRec dri_kms_driver_api = { |
| 44 | - .InitScreen = dri_kms_init_screen, |
| 45 | +const struct __DriverAPIRec dri_swrast_kms_driver_api = { |
| 46 | + .InitScreen = dri_swrast_kms_init_screen, |
| 47 | .DestroyScreen = dri_destroy_screen, |
| 48 | .CreateBuffer = dri2_create_buffer, |
| 49 | .DestroyBuffer = dri_destroy_buffer, |
| 50 | @@ -2633,17 +2633,17 @@ const __DRIextension *galliumdrm_driver_extensions[] = { |
| 51 | NULL |
| 52 | }; |
| 53 | |
| 54 | -static const struct __DRIDriverVtableExtensionRec dri_kms_vtable = { |
| 55 | +static const struct __DRIDriverVtableExtensionRec dri_swrast_kms_vtable = { |
| 56 | .base = { __DRI_DRIVER_VTABLE, 1 }, |
| 57 | - .vtable = &dri_kms_driver_api, |
| 58 | + .vtable = &dri_swrast_kms_driver_api, |
| 59 | }; |
| 60 | |
| 61 | -const __DRIextension *dri_kms_driver_extensions[] = { |
| 62 | +const __DRIextension *dri_swrast_kms_driver_extensions[] = { |
| 63 | &driCoreExtension.base, |
| 64 | &driImageDriverExtension.base, |
| 65 | - &driDRI2Extension.base, |
| 66 | + &swkmsDRI2Extension.base, |
| 67 | &gallium_config_options.base, |
| 68 | - &dri_kms_vtable.base, |
| 69 | + &dri_swrast_kms_vtable.base, |
| 70 | NULL |
| 71 | }; |
| 72 | |
| 73 | diff --git a/src/gallium/frontends/dri/dri_screen.h b/src/gallium/frontends/dri/dri_screen.h |
| 74 | index 0ee2feb..0bb8817 100644 |
| 75 | --- a/src/gallium/frontends/dri/dri_screen.h |
| 76 | +++ b/src/gallium/frontends/dri/dri_screen.h |
| 77 | @@ -168,8 +168,8 @@ dri_destroy_screen_helper(struct dri_screen * screen); |
| 78 | void |
| 79 | dri_destroy_screen(__DRIscreen * sPriv); |
| 80 | |
| 81 | -extern const struct __DriverAPIRec dri_kms_driver_api; |
| 82 | -extern const __DRIextension *dri_kms_driver_extensions[]; |
| 83 | +extern const struct __DriverAPIRec dri_swrast_kms_driver_api; |
| 84 | +extern const __DRIextension *dri_swrast_kms_driver_extensions[]; |
| 85 | extern const struct __DriverAPIRec galliumdrm_driver_api; |
| 86 | extern const __DRIextension *galliumdrm_driver_extensions[]; |
| 87 | extern const struct __DriverAPIRec galliumsw_driver_api; |
| 88 | diff --git a/src/gallium/frontends/dri/dri_util.c b/src/gallium/frontends/dri/dri_util.c |
| 89 | index 8d60526..03614e1 100644 |
| 90 | --- a/src/gallium/frontends/dri/dri_util.c |
| 91 | +++ b/src/gallium/frontends/dri/dri_util.c |
| 92 | @@ -187,7 +187,7 @@ swkmsCreateNewScreen(int scrn, int fd, |
| 93 | const __DRIconfig ***driver_configs, void *data) |
| 94 | { |
| 95 | return driCreateNewScreen2(scrn, fd, extensions, |
| 96 | - dri_kms_driver_extensions, |
| 97 | + dri_swrast_kms_driver_extensions, |
| 98 | driver_configs, data); |
| 99 | } |
| 100 | |
| 101 | diff --git a/src/gallium/targets/dri/target.c b/src/gallium/targets/dri/target.c |
| 102 | index 9b78351..e02b03b 100644 |
| 103 | --- a/src/gallium/targets/dri/target.c |
| 104 | +++ b/src/gallium/targets/dri/target.c |
| 105 | @@ -25,7 +25,7 @@ const __DRIextension **__driDriverGetExtensions_kms_swrast(void); |
| 106 | |
| 107 | PUBLIC const __DRIextension **__driDriverGetExtensions_kms_swrast(void) |
| 108 | { |
| 109 | - return dri_kms_driver_extensions; |
| 110 | + return dri_swrast_kms_driver_extensions; |
| 111 | } |
| 112 | |
| 113 | #endif |