From: Isaac Hermida Date: Thu, 16 Jan 2025 09:14:14 +0100 Subject: [PATCH] Revert "g2d-renderer: Support solid-colour weston_buffers" Currently, this feature prevents the CPU from properly entering the standby state on the i.MX93. With the current implementation, the PXP module generates "pxp-dmaengine-std" interrupts, which prevents the CPU from asserting the PMIC_STBY_REQ signal. An ongoing ticket with NXP is addressing this issue. In the meantime, use the following workaround to resolve the situation. This reverts commit 4f28004dbbc41abd6fbe84040327c852a1bc6ad5. https://onedigi.atlassian.net/browse/DEL-9356 Signed-off-by: Isaac Hermida --- libweston/renderer-g2d/g2d-renderer.c | 58 ++------------------------- 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/libweston/renderer-g2d/g2d-renderer.c b/libweston/renderer-g2d/g2d-renderer.c index 8442fc5304ac..458912357e7e 100644 --- a/libweston/renderer-g2d/g2d-renderer.c +++ b/libweston/renderer-g2d/g2d-renderer.c @@ -124,8 +124,6 @@ struct g2d_output_state { struct g2d_surface_state { float color[4]; - bool solid_clear; - int clcolor; struct weston_buffer_reference buffer_ref; struct weston_buffer_release_reference buffer_release_ref; int pitch; /* in pixels */ @@ -470,22 +468,6 @@ g2d_SetSurfaceRect(struct g2d_surfaceEx* g2dSurface, g2dRECT* rect) #define _hasAlpha(format) (format==G2D_RGBA8888 || format==G2D_BGRA8888 \ || format==G2D_ARGB8888 || format==G2D_ABGR8888) - -static int -g2d_clear_solid(void *handle, struct g2d_surfaceEx *dstG2dSurface, g2dRECT *clipRect, int clcolor) -{ - struct g2d_surfaceEx* soildSurface = dstG2dSurface; - - g2d_SetSurfaceRect(soildSurface, clipRect); - soildSurface->base.clrcolor = clcolor; - - if(g2d_clear(handle, &soildSurface->base)){ - printG2dSurfaceInfo(dstG2dSurface, "SOILD DST:"); - return -1; - } - return 0; -} - static int g2d_blit_surface(void *handle, struct g2d_surfaceEx * srcG2dSurface, struct g2d_surfaceEx *dstG2dSurface, g2dRECT *srcRect, g2dRECT *dstRect) @@ -706,7 +688,6 @@ repaint_region(struct weston_view *ev, struct weston_output *output, struct g2d_ struct g2d_renderer *gr = get_renderer(ev->surface->compositor); struct g2d_surface_state *gs = get_surface_state(ev->surface); - struct weston_buffer *buffer = gs->buffer_ref.buffer; pixman_box32_t *rects, *surf_rects, *bb_rects; int i, j, nrects, nsurf, nbb=0; @@ -731,10 +712,8 @@ repaint_region(struct weston_view *ev, struct weston_output *output, struct g2d_ return; } - if (!gs->solid_clear) { - if (srcsurface.base.width <= 0 || srcsurface.base.height <= 0) { - return; - } + if (srcsurface.base.width <= 0 || srcsurface.base.height <= 0) { + return; } bb_rects = pixman_region32_rectangles(&ev->transform.boundingbox, &nbb); @@ -833,17 +812,7 @@ repaint_region(struct weston_view *ev, struct weston_output *output, struct g2d_ return; } g2d_set_clipping(gr->handle, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom); - /* g2d_clear can't clear the sloid buffer with alpha.*/ - if (gs->solid_clear && - buffer->type == WESTON_BUFFER_SOLID && - buffer->pixel_format->format !=DRM_FORMAT_ARGB8888) { - g2d_clear_solid(gr->handle, dstsurface, &clipRect, gs->clcolor); - } - else - { - g2d_blit_surface(gr->handle, &srcsurface, dstsurface, &srcRect, &dstrect); - } - + g2d_blit_surface(gr->handle, &srcsurface, dstsurface, &srcRect, &dstrect); } } } @@ -1414,24 +1383,6 @@ done: weston_buffer_release_reference(&gs->buffer_release_ref, NULL); } -static uint32_t -pack_color(const uint32_t format, float *c) -{ - uint8_t r = round(c[0] * 255.0f); - uint8_t g = round(c[1] * 255.0f); - uint8_t b = round(c[2] * 255.0f); - uint8_t a = round(c[3] * 255.0f); - - switch (format) { - case DRM_FORMAT_ARGB8888: - case DRM_FORMAT_XRGB8888: - return (a << 24) | (b << 16) | (g << 8) | r; - default: - assert(0); - return 0; - } -} - static void g2d_renderer_attach_solid(struct weston_surface *surface, struct weston_buffer *buffer) @@ -1442,8 +1393,6 @@ g2d_renderer_attach_solid(struct weston_surface *surface, gs->color[1] = buffer->solid.g; gs->color[2] = buffer->solid.b; gs->color[3] = buffer->solid.a; - gs->solid_clear = true; - gs->clcolor = pack_color(buffer->pixel_format->format, gs->color); } static void @@ -1936,7 +1885,6 @@ static void g2d_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) { struct g2d_surface_state *gs = get_surface_state(es); - gs->solid_clear = false; if (!buffer) { gs->attached = 0;