Skip to content

Commit

Permalink
webos-raspberrypi: mesa: update patch to apply on 23.2.1 version
Browse files Browse the repository at this point in the history
:Release Notes:

:Detailed Notes:
Fixes:
http://gecko.lge.com:8000/Errors/Details/708197

ERROR: Applying patch '0001-implement-drm_create_linear_prime_buffer.patch' on target directory 'TOPDIR/BUILD/work/raspberrypi4_64-webos-linux/mesa/23.2.1/mesa-23.2.1'
CmdError('quilt --quiltrc TOPDIR/BUILD/work/raspberrypi4_64-webos-linux/mesa/23.2.1/recipe-sysroot-native/etc/quiltrc push', 0, 'stdout: Applying patch 0001-implement-drm_create_linear_prime_buffer.patch
patching file include/GL/internal/dri_interface.h
Hunk #1 succeeded at 1506 (offset 1 line).
patching file src/egl/drivers/dri2/egl_dri2.c
Hunk #1 succeeded at 3129 (offset -15 lines).
Hunk #2 FAILED at 3165.
1 out of 2 hunks FAILED -- rejects in file src/egl/drivers/dri2/egl_dri2.c
patching file src/egl/drivers/dri2/platform_wayland.c
Hunk #1 FAILED at 1117.
1 out of 1 hunk FAILED -- rejects in file src/egl/drivers/dri2/platform_wayland.c
patching file src/egl/wayland/wayland-drm/meson.build
patching file src/egl/wayland/wayland-drm/wayland-drm.c
Hunk #1 FAILED at 37.
Hunk #2 FAILED at 59.
Hunk webosose#3 FAILED at 84.
Hunk webosose#4 FAILED at 128.
Hunk webosose#5 FAILED at 157.
Hunk webosose#6 FAILED at 170.
Hunk webosose#7 FAILED at 192.
7 out of 7 hunks FAILED -- rejects in file src/egl/wayland/wayland-drm/wayland-drm.c
patching file src/egl/wayland/wayland-drm/wayland-drm.h
Hunk #1 FAILED at 11.
1 out of 1 hunk FAILED -- rejects in file src/egl/wayland/wayland-drm/wayland-drm.h
patching file src/egl/wayland/wayland-drm/wayland-drm.xml
patching file src/gallium/frontends/dri/dri2.c
Hunk #1 succeeded at 1649 (offset 50 lines).
patching file src/gbm/backends/dri/gbm_dri.c
patching file src/loader/loader_dri3_helper.c
Hunk #1 succeeded at 1867 (offset 1 line).
Patch 0001-implement-drm_create_linear_prime_buffer.patch does not apply (enforce with -f)

A lot of conflicts because of upstream commit:
e85983d7726 egl: re-format using clang-format

:Testing Performed:
Only build tested.

:QA Notes:
No change to image.

:Issues Addressed:
[WRQ-691] Create GPVB with Yocto 4.3 Nanbield

Change-Id: I27f073f09d867928d5f81fe54f64c124d40ab621
  • Loading branch information
shr-project committed Nov 5, 2024
1 parent 3718b10 commit 1aa138c
Showing 1 changed file with 103 additions and 97 deletions.
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
From 7c3b7019059d428364901b74a1e1f1db6fb91e3a Mon Sep 17 00:00:00 2001
From b3f3f0c709269e34f6ef4e2b55a016c8b0d1e037 Mon Sep 17 00:00:00 2001
From: Martin Jansa <[email protected]>
Date: Fri, 7 Feb 2020 07:10:42 -0800
Subject: [PATCH] implement drm_create_linear_prime_buffer

Support wayland sink for gstreamer

use bool instead of boolean to fix:
http://gecko.lge.com:8000/Errors/Details/708473
after
94d827332f3 dri: Replace usage of boolean/TRUE/FALSE with bool/true/false

and remove unused result variable to fix:

../mesa-23.2.1/src/gallium/frontends/dri/dri2.c:1668:14: warning: variable 'result' set but not used [-Wunused-but-set-variable]
1668 | bool result;
| ^~~~~~

Signed-off-by: Martin Jansa <[email protected]>
---
Upstream-Status: Pending

include/GL/internal/dri_interface.h | 1 +
src/egl/drivers/dri2/egl_dri2.c | 3 ++-
src/egl/drivers/dri2/egl_dri2.c | 4 ++--
src/egl/drivers/dri2/platform_wayland.c | 1 +
src/egl/wayland/wayland-drm/meson.build | 1 +
src/egl/wayland/wayland-drm/wayland-drm.c | 28 +++++++++++++++++----
src/egl/wayland/wayland-drm/wayland-drm.c | 23 ++++++++++++++++-----
src/egl/wayland/wayland-drm/wayland-drm.h | 2 +-
src/egl/wayland/wayland-drm/wayland-drm.xml | 12 +++++++++
src/gallium/frontends/dri/dri2.c | 21 +++++++++++++---
src/egl/wayland/wayland-drm/wayland-drm.xml | 12 +++++++++++
src/gallium/frontends/dri/dri2.c | 20 +++++++++++++++---
src/gbm/backends/dri/gbm_dri.c | 1 +
src/loader/loader_dri3_helper.c | 1 +
10 files changed, 61 insertions(+), 10 deletions(-)
10 files changed, 55 insertions(+), 11 deletions(-)

diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index f4fc777d7e8..c5f97e8cc6a 100644
index 11746fbc5d5..22d046653de 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1505,6 +1505,7 @@ struct __DRIimageExtensionRec {
@@ -1506,6 +1506,7 @@ struct __DRIimageExtensionRec {
*/
__DRIimage *(*createImageFromFds)(__DRIscreen *screen,
int width, int height, int fourcc,
Expand All @@ -34,10 +45,10 @@ index f4fc777d7e8..c5f97e8cc6a 100644
int *strides, int *offsets,
void *loaderPrivate);
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 0ebc46ee845..0acc7390d49 100644
index 1a6fddcec00..f6a4a8a15f5 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -3144,7 +3144,7 @@ dri2_destroy_image_khr(_EGLDisplay *disp, _EGLImage *image)
@@ -3129,7 +3129,7 @@ dri2_destroy_image_khr(_EGLDisplay *disp, _EGLImage *image)

static void
dri2_wl_reference_buffer(void *user_data, uint32_t name, int fd,
Expand All @@ -46,28 +57,29 @@ index 0ebc46ee845..0acc7390d49 100644
{
_EGLDisplay *disp = user_data;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
@@ -3165,6 +3165,7 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name, int fd,
buffer->width,
buffer->height,
buffer->format,
+ modifier,
&fd, 1,
buffer->stride,
buffer->offset,
@@ -3143,7 +3143,7 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name, int fd,
else
img = dri2_dpy->image->createImageFromFds(
dri2_dpy->dri_screen_render_gpu, buffer->width, buffer->height,
- buffer->format, &fd, 1, buffer->stride, buffer->offset, NULL);
+ buffer->format, modifier, &fd, 1, buffer->stride, buffer->offset, NULL);

if (img == NULL)
return;
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 4a896269d0c..87662fe44b9 100644
index 49f99c1e4b6..9e0d75d9708 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1117,6 +1117,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
dri2_surf->base.Height,
loader_image_format_to_fourcc(
linear_dri_image_format),
+ DRM_FORMAT_MOD_INVALID,
&buffer_fds[0], num_planes,
&strides[0],
&offsets[0],
@@ -1149,6 +1149,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
dri2_dpy->dri_screen_render_gpu, dri2_surf->base.Width,
dri2_surf->base.Height,
loader_image_format_to_fourcc(linear_dri_image_format),
+ DRM_FORMAT_MOD_INVALID,
&buffer_fds[0], num_planes, &strides[0], &offsets[0],
dri2_surf->back);
for (i = 0; i < num_planes; ++i) {
diff --git a/src/egl/wayland/wayland-drm/meson.build b/src/egl/wayland/wayland-drm/meson.build
index b4782a013c9..2b400b8fa49 100644
index 6ab5b9260ff..5ff48d422a4 100644
--- a/src/egl/wayland/wayland-drm/meson.build
+++ b/src/egl/wayland/wayland-drm/meson.build
@@ -45,6 +45,7 @@ libwayland_drm = static_library(
Expand All @@ -79,102 +91,97 @@ index b4782a013c9..2b400b8fa49 100644
build_by_default : false,
)
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index 29558ea910e..d330f647d04 100644
index 45380ecb09e..59b7f9c4c64 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -37,6 +37,8 @@
#include "wayland-drm.h"
#include "wayland-drm-server-protocol.h"
#include <wayland-server.h>

+#include "drm-uapi/drm_fourcc.h"
+
#define MIN(x,y) (((x)<(y))?(x):(y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))

static void
@@ -59,7 +61,7 @@ static void
@@ -58,7 +60,7 @@ buffer_destroy(struct wl_client *client, struct wl_resource *resource)
static void
create_buffer(struct wl_client *client, struct wl_resource *resource,
uint32_t id, uint32_t name, int fd,
int32_t width, int32_t height,
- uint32_t format,
+ uint32_t format, uint64_t modifier,
int32_t offset0, int32_t stride0,
int32_t offset1, int32_t stride1,
int32_t offset2, int32_t stride2)
@@ -84,7 +86,7 @@ create_buffer(struct wl_client *client, struct wl_resource *resource,
buffer->offset[2] = offset2;
buffer->stride[2] = stride2;
uint32_t id, uint32_t name, int fd, int32_t width, int32_t height,
- uint32_t format, int32_t offset0, int32_t stride0,
+ uint32_t format, uint64_t modifier, int32_t offset0, int32_t stride0,
int32_t offset1, int32_t stride1, int32_t offset2,
int32_t stride2)
{
@@ -82,7 +84,7 @@ create_buffer(struct wl_client *client, struct wl_resource *resource,
buffer->offset[2] = offset2;
buffer->stride[2] = stride2;

- drm->callbacks.reference_buffer(drm->user_data, name, fd, buffer);
+ drm->callbacks.reference_buffer(drm->user_data, name, fd, buffer, modifier);
if (buffer->driver_buffer == NULL) {
wl_resource_post_error(resource,
WL_DRM_ERROR_INVALID_NAME,
@@ -128,7 +130,8 @@ drm_create_buffer(struct wl_client *client, struct wl_resource *resource,
}
- drm->callbacks.reference_buffer(drm->user_data, name, fd, buffer);
+ drm->callbacks.reference_buffer(drm->user_data, name, fd, buffer, modifier);
if (buffer->driver_buffer == NULL) {
wl_resource_post_error(resource, WL_DRM_ERROR_INVALID_NAME,
"invalid name");
@@ -122,7 +124,7 @@ drm_create_buffer(struct wl_client *client, struct wl_resource *resource,
return;
}

create_buffer(client, resource, id,
- name, -1, width, height, format, 0, stride, 0, 0, 0, 0);
+ name, -1, width, height, format, DRM_FORMAT_MOD_INVALID,
+ 0, stride, 0, 0, 0, 0);
- create_buffer(client, resource, id, name, -1, width, height, format, 0,
+ create_buffer(client, resource, id, name, -1, width, height, format, DRM_FORMAT_MOD_INVALID, 0,
stride, 0, 0, 0, 0);
}

static void
@@ -157,6 +160,7 @@ drm_create_planar_buffer(struct wl_client *client,
}
@@ -148,7 +150,7 @@ drm_create_planar_buffer(struct wl_client *client, struct wl_resource *resource,
return;
}

create_buffer(client, resource, id, name, -1, width, height, format,
+ DRM_FORMAT_MOD_INVALID,
offset0, stride0, offset1, stride1, offset2, stride2);
- create_buffer(client, resource, id, name, -1, width, height, format, offset0,
+ create_buffer(client, resource, id, name, -1, width, height, format, DRM_FORMAT_MOD_INVALID, offset0,
stride0, offset1, stride1, offset2, stride2);
}

@@ -170,10 +174,23 @@ drm_create_prime_buffer(struct wl_client *client,
int32_t offset2, int32_t stride2)
@@ -159,11 +161,21 @@ drm_create_prime_buffer(struct wl_client *client, struct wl_resource *resource,
int32_t offset1, int32_t stride1, int32_t offset2,
int32_t stride2)
{
create_buffer(client, resource, id, 0, fd, width, height, format,
+ DRM_FORMAT_MOD_INVALID,
offset0, stride0, offset1, stride1, offset2, stride2);
close(fd);
- create_buffer(client, resource, id, 0, fd, width, height, format, offset0,
+ create_buffer(client, resource, id, 0, fd, width, height, format, DRM_FORMAT_MOD_INVALID, offset0,
stride0, offset1, stride1, offset2, stride2);
close(fd);
}

+static void
+drm_create_linear_prime_buffer(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t id, int fd,
+ int32_t width, int32_t height, uint32_t format,
+ int32_t offset, int32_t stride)
+drm_create_linear_prime_buffer(struct wl_client *client, struct wl_resource *resource,
+ uint32_t id, int fd, int32_t width, int32_t height,
+ uint32_t format, int32_t offset, int32_t stride)
+{
+ create_buffer(client, resource, id, 0, fd, width, height, format,
+ DRM_FORMAT_MOD_LINEAR, offset, stride, 0, 0, 0, 0);
+ close(fd);
+ create_buffer(client, resource, id, 0, fd, width, height, format,
+ DRM_FORMAT_MOD_LINEAR, offset, stride, 0, 0, 0, 0);
+ close(fd);
+}
+
static void
drm_authenticate(struct wl_client *client,
struct wl_resource *resource, uint32_t id)
@@ -192,8 +209,9 @@ drm_authenticate(struct wl_client *client,
static const struct wl_drm_interface drm_interface = {
drm_authenticate,
drm_create_buffer,
- drm_create_planar_buffer,
- drm_create_prime_buffer
+ drm_create_planar_buffer,
+ drm_create_prime_buffer,
+ drm_create_linear_prime_buffer
drm_authenticate(struct wl_client *client, struct wl_resource *resource,
uint32_t id)
@@ -183,6 +195,7 @@ static const struct wl_drm_interface drm_interface = {
drm_create_buffer,
drm_create_planar_buffer,
drm_create_prime_buffer,
+ drm_create_linear_prime_buffer
};

static void
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.h b/src/egl/wayland/wayland-drm/wayland-drm.h
index 8b7fd3b0b64..2b4ffd0a681 100644
index 8f3522e9bcb..1b32016f826 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.h
+++ b/src/egl/wayland/wayland-drm/wayland-drm.h
@@ -11,7 +11,7 @@ struct wayland_drm_callbacks {
int (*authenticate)(void *user_data, uint32_t id);
int (*authenticate)(void *user_data, uint32_t id);

void (*reference_buffer)(void *user_data, uint32_t name, int fd,
- struct wl_drm_buffer *buffer);
+ struct wl_drm_buffer *buffer, uint64_t modifier);
void (*reference_buffer)(void *user_data, uint32_t name, int fd,
- struct wl_drm_buffer *buffer);
+ struct wl_drm_buffer *buffer, uint64_t modifier);

void (*release_buffer)(void *user_data, struct wl_drm_buffer *buffer);
void (*release_buffer)(void *user_data, struct wl_drm_buffer *buffer);

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.xml b/src/egl/wayland/wayland-drm/wayland-drm.xml
index eaf2654ab26..d6913d680ba 100644
Expand All @@ -200,14 +207,14 @@ index eaf2654ab26..d6913d680ba 100644

</protocol>
diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
index f45f95b659d..e51efdeecae 100644
index ab958626f52..a2fcc355782 100644
--- a/src/gallium/frontends/dri/dri2.c
+++ b/src/gallium/frontends/dri/dri2.c
@@ -1599,13 +1599,28 @@ dri2_from_planar(__DRIimage *image, int plane, void *loaderPrivate)
@@ -1649,13 +1649,27 @@ dri2_from_planar(__DRIimage *image, int plane, void *loaderPrivate)
return img;
}

+static boolean
+static bool
+dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
+ uint64_t *modifiers, unsigned int *external_only,
+ int *count);
Expand All @@ -225,8 +232,7 @@ index f45f95b659d..e51efdeecae 100644
+ */
+ unsigned int external_only= 0;
+ int count= 0;
+ boolean result;
+ result = dri2_query_dma_buf_modifiers( screen, fourcc, 1, &modifier, &external_only, &count);
+ dri2_query_dma_buf_modifiers( screen, fourcc, 1, &modifier, &external_only, &count);
+ }
+
return dri2_create_image_from_fd(screen, width, height, fourcc,
Expand All @@ -248,10 +254,10 @@ index ed76087b20b..c2d647b05b9 100644
&stride, &offset,
NULL);
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index 11bf6472894..f57bd5d9a8d 100644
index 32135770e9d..f871e7f533e 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -1866,6 +1866,7 @@ loader_dri3_create_image(xcb_connection_t *c,
@@ -1867,6 +1867,7 @@ loader_dri3_create_image(xcb_connection_t *c,
bp_reply->width,
bp_reply->height,
loader_image_format_to_fourcc(format),
Expand Down

0 comments on commit 1aa138c

Please sign in to comment.