mirror of
https://github.com/openharmony/third_party_weston.git
synced 2026-06-30 22:07:56 -04:00
refactor mix
Change-Id: I87a4dd11eec956649072129dcf94214ad95086c0 Signed-off-by: lizheng <lizheng2@huawei.com>
This commit is contained in:
@@ -503,6 +503,7 @@ ohos_shared_library("drm-backend") {
|
||||
|
||||
deps = [
|
||||
":drm_auth_protocol",
|
||||
":libmix-renderer",
|
||||
":libweston",
|
||||
":soft_vsync",
|
||||
":trace",
|
||||
@@ -634,6 +635,7 @@ ohos_shared_library("hdi-backend") {
|
||||
configs = [ ":hdi-backend_config" ]
|
||||
|
||||
deps = [
|
||||
":libmix-renderer",
|
||||
":libweston",
|
||||
":soft_vsync",
|
||||
":trace",
|
||||
@@ -717,4 +719,37 @@ ohos_shared_library("gl-renderer") {
|
||||
part_name = "graphic_standard"
|
||||
subsystem_name = "graphic"
|
||||
}
|
||||
|
||||
### Build gl-renderer.so }}}
|
||||
|
||||
### Build libmix-renderer.z.so {{{
|
||||
config("libmix-renderer_config") {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
cflags = [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-g3",
|
||||
]
|
||||
}
|
||||
|
||||
config("libmix-renderer_public_config") {
|
||||
include_dirs = [ "libweston/renderer-mix" ]
|
||||
}
|
||||
|
||||
ohos_shared_library("libmix-renderer") {
|
||||
sources = [ "libweston/renderer-mix/mix_renderer.cpp" ]
|
||||
|
||||
configs = [ ":libmix-renderer_config" ]
|
||||
|
||||
public_configs = [ ":libmix-renderer_public_config" ]
|
||||
|
||||
deps = [
|
||||
":libweston",
|
||||
":trace",
|
||||
]
|
||||
|
||||
part_name = "graphic_standard"
|
||||
subsystem_name = "graphic"
|
||||
}
|
||||
## Build libmix-renderer.z.so }}}
|
||||
|
||||
@@ -242,7 +242,7 @@ struct weston_output {
|
||||
/** Matches the lifetime from the user perspective */
|
||||
struct wl_signal user_destroy_signal;
|
||||
|
||||
//void *renderer_state;
|
||||
void *renderer_state;
|
||||
void *hdi_renderer_state;
|
||||
void *gpu_renderer_state;
|
||||
|
||||
@@ -1073,6 +1073,7 @@ struct weston_compositor {
|
||||
struct weston_plane primary_plane;
|
||||
uint32_t capabilities; /* combination of enum weston_capability */
|
||||
|
||||
struct weston_renderer *renderer;
|
||||
struct weston_renderer *hdi_renderer;
|
||||
struct weston_renderer *gpu_renderer;
|
||||
|
||||
@@ -1250,7 +1251,7 @@ struct weston_view {
|
||||
pixman_region32_t clip; /* See weston_view_damage_below() */
|
||||
float alpha; /* part of geometry, see below */
|
||||
|
||||
//void *renderer_state;
|
||||
void *renderer_state;
|
||||
void *hdi_renderer_state;
|
||||
void *gpu_renderer_state;
|
||||
|
||||
@@ -1415,7 +1416,7 @@ struct weston_surface {
|
||||
*/
|
||||
bool touched;
|
||||
|
||||
//void *renderer_state;
|
||||
void *renderer_state;
|
||||
void *hdi_renderer_state;
|
||||
void *gpu_renderer_state;
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
|
||||
#include "libweston/trace.h"
|
||||
#include "libweston/soft_vsync.h" //OHOS vsync module
|
||||
#include "mix_renderer.h"
|
||||
DEFINE_LOG_LABEL("DrmBackend");
|
||||
|
||||
static const char default_seat[] = "seat0";
|
||||
@@ -347,7 +348,7 @@ drm_output_render_pixman(struct drm_output_state *state,
|
||||
pixman_renderer_output_set_hw_extra_damage(&output->base,
|
||||
&output->previous_damage);
|
||||
|
||||
ec->hdi_renderer->repaint_output(&output->base, damage);
|
||||
ec->renderer->repaint_output(&output->base, damage);
|
||||
|
||||
pixman_region32_copy(&output->previous_damage, damage);
|
||||
|
||||
@@ -2987,6 +2988,11 @@ drm_backend_create(struct weston_compositor *compositor,
|
||||
goto err_udev_dev;
|
||||
}
|
||||
} else {
|
||||
// OHOS mix renderer
|
||||
if (mix_renderer_init(compositor) < 0) {
|
||||
LOG_ERROR("mix_renderer_init failed");
|
||||
goto err_udev_dev;
|
||||
}
|
||||
if (init_egl(b) < 0) {
|
||||
weston_log("failed to initialize egl\n");
|
||||
goto err_udev_dev;
|
||||
@@ -3064,7 +3070,7 @@ drm_backend_create(struct weston_compositor *compositor,
|
||||
// renderer_switch_binding, b);
|
||||
|
||||
|
||||
if (compositor->hdi_renderer->import_dmabuf) {
|
||||
if (compositor->renderer->import_dmabuf) {
|
||||
if (linux_dmabuf_setup(compositor) < 0)
|
||||
weston_log("Error: initializing dmabuf "
|
||||
"support failed.\n");
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include "hdi_output.h"
|
||||
#include "hdi_renderer.h"
|
||||
|
||||
#include "mix_renderer.h"
|
||||
|
||||
// C header adapter
|
||||
extern "C" {
|
||||
#include "libweston/backend-hdi.h"
|
||||
@@ -245,30 +247,24 @@ hdi_backend_create(struct weston_compositor *compositor,
|
||||
b->base.device_changed = NULL;
|
||||
b->base.can_scanout_dmabuf = NULL;
|
||||
|
||||
// 1. attr init
|
||||
if (config->use_hdi) {
|
||||
b->renderer_type = HDI_RENDERER_HDI;
|
||||
// init renderer
|
||||
ret = mix_renderer_init(compositor);
|
||||
if (ret < 0) {
|
||||
LOG_ERROR("mix_renderer_init failed");
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
// init renderer
|
||||
switch (b->renderer_type) {
|
||||
case HDI_RENDERER_HDI: {
|
||||
ret = hdi_renderer_init(compositor);
|
||||
if (ret < 0) {
|
||||
goto err_free;
|
||||
}
|
||||
} break;
|
||||
default: {
|
||||
assert(0 && "invalid renderer type");
|
||||
goto err_free;
|
||||
} break;
|
||||
ret = hdi_renderer_init(compositor);
|
||||
if (ret < 0) {
|
||||
LOG_ERROR("hdi_renderer_init failed");
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
ret = hdi_gl_renderer_init(b);
|
||||
if (ret < 0) {
|
||||
weston_log("hdi_gl_renderer_init failed, gpu render disable.");
|
||||
//goto err_free;
|
||||
}
|
||||
|
||||
// init hdi device
|
||||
ret = DeviceInitialize(&b->device_funcs);
|
||||
LOG_CORE("DeviceInitialize return %d", ret);
|
||||
|
||||
+10
-34
@@ -585,12 +585,7 @@ WL_EXPORT void
|
||||
weston_surface_set_color(struct weston_surface *surface,
|
||||
float red, float green, float blue, float alpha)
|
||||
{
|
||||
if (surface->compositor->gpu_renderer) {
|
||||
surface->compositor->gpu_renderer->surface_set_color(surface, red, green, blue, alpha);
|
||||
}
|
||||
else {
|
||||
surface->compositor->hdi_renderer->surface_set_color(surface, red, green, blue, alpha);
|
||||
}
|
||||
surface->compositor->renderer->surface_set_color(surface, red, green, blue, alpha);
|
||||
surface->is_opaque = !(alpha < 1.0);
|
||||
}
|
||||
|
||||
@@ -2444,10 +2439,7 @@ weston_surface_attach(struct weston_surface *surface,
|
||||
weston_surface_unmap(surface);
|
||||
}
|
||||
|
||||
surface->compositor->hdi_renderer->attach(surface, buffer);
|
||||
if (surface->compositor->gpu_renderer) {
|
||||
surface->compositor->gpu_renderer->attach(surface, buffer);
|
||||
}
|
||||
surface->compositor->renderer->attach(surface, buffer);
|
||||
|
||||
weston_surface_calculate_size_from_buffer(surface);
|
||||
weston_presentation_feedback_discard_list(&surface->feedback_list);
|
||||
@@ -2483,14 +2475,8 @@ static void
|
||||
surface_flush_damage(struct weston_surface *surface)
|
||||
{
|
||||
if (surface->buffer_ref.buffer &&
|
||||
wl_shm_buffer_get(surface->buffer_ref.buffer->resource)) {
|
||||
if (surface->compositor->gpu_renderer) {
|
||||
surface->compositor->gpu_renderer->flush_damage(surface);
|
||||
}
|
||||
else {
|
||||
surface->compositor->hdi_renderer->flush_damage(surface);
|
||||
}
|
||||
}
|
||||
wl_shm_buffer_get(surface->buffer_ref.buffer->resource))
|
||||
surface->compositor->renderer->flush_damage(surface);
|
||||
|
||||
// OHOS remove timeline
|
||||
// if (pixman_region32_not_empty(&surface->damage))
|
||||
@@ -4354,7 +4340,7 @@ WL_EXPORT void
|
||||
weston_surface_get_content_size(struct weston_surface *surface,
|
||||
int *width, int *height)
|
||||
{
|
||||
struct weston_renderer *rer = surface->compositor->hdi_renderer;
|
||||
struct weston_renderer *rer = surface->compositor->renderer;
|
||||
|
||||
if (!rer->surface_get_content_size) {
|
||||
*width = 0;
|
||||
@@ -4449,7 +4435,7 @@ weston_surface_copy_content(struct weston_surface *surface,
|
||||
int src_x, int src_y,
|
||||
int width, int height)
|
||||
{
|
||||
struct weston_renderer *rer = surface->compositor->hdi_renderer;
|
||||
struct weston_renderer *rer = surface->compositor->renderer;
|
||||
int cw, ch;
|
||||
const size_t bytespp = 4; /* PIXMAN_a8b8g8r8 */
|
||||
|
||||
@@ -7611,15 +7597,8 @@ weston_compositor_shutdown(struct weston_compositor *ec)
|
||||
wl_list_for_each_safe(output, next, &ec->pending_output_list, link)
|
||||
output->destroy(output);
|
||||
|
||||
if (ec->hdi_renderer) {
|
||||
if (ec->gpu_renderer) {
|
||||
ec->gpu_renderer->destroy(ec);
|
||||
}
|
||||
|
||||
if (ec->hdi_renderer) {
|
||||
ec->hdi_renderer->destroy(ec);
|
||||
}
|
||||
}
|
||||
if (ec->renderer)
|
||||
ec->renderer->destroy(ec);
|
||||
|
||||
weston_binding_list_destroy_all(&ec->key_binding_list);
|
||||
weston_binding_list_destroy_all(&ec->modifier_binding_list);
|
||||
@@ -7765,11 +7744,8 @@ weston_compositor_import_dmabuf(struct weston_compositor *compositor,
|
||||
struct linux_dmabuf_buffer *buffer)
|
||||
{
|
||||
struct weston_renderer *renderer;
|
||||
|
||||
renderer = compositor->gpu_renderer;
|
||||
if (!renderer) {
|
||||
renderer = compositor->hdi_renderer;
|
||||
}
|
||||
|
||||
renderer = compositor->renderer;
|
||||
|
||||
if (renderer->import_dmabuf == NULL)
|
||||
return false;
|
||||
|
||||
@@ -550,11 +550,11 @@ bind_linux_dmabuf(struct wl_client *client,
|
||||
* Use EGL_EXT_image_dma_buf_import_modifiers to query and advertise
|
||||
* format/modifier codes.
|
||||
*/
|
||||
compositor->hdi_renderer->query_dmabuf_formats(compositor, &formats,
|
||||
compositor->renderer->query_dmabuf_formats(compositor, &formats,
|
||||
&num_formats);
|
||||
|
||||
for (i = 0; i < num_formats; i++) {
|
||||
compositor->hdi_renderer->query_dmabuf_modifiers(compositor,
|
||||
compositor->renderer->query_dmabuf_modifiers(compositor,
|
||||
formats[i],
|
||||
&modifiers,
|
||||
&num_modifiers);
|
||||
|
||||
@@ -98,8 +98,8 @@ noop_renderer_surface_set_color(struct weston_surface *surface,
|
||||
static void
|
||||
noop_renderer_destroy(struct weston_compositor *ec)
|
||||
{
|
||||
free(ec->hdi_renderer);
|
||||
ec->hdi_renderer = NULL;
|
||||
free(ec->renderer);
|
||||
ec->renderer = NULL;
|
||||
}
|
||||
|
||||
WL_EXPORT int
|
||||
@@ -117,7 +117,7 @@ noop_renderer_init(struct weston_compositor *ec)
|
||||
renderer->attach = noop_renderer_attach;
|
||||
renderer->surface_set_color = noop_renderer_surface_set_color;
|
||||
renderer->destroy = noop_renderer_destroy;
|
||||
ec->hdi_renderer = renderer;
|
||||
ec->renderer = renderer;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+10
-10
@@ -46,7 +46,7 @@ pixman_renderer_create_surface(struct weston_surface *surface);
|
||||
struct pixman_output_state *
|
||||
get_output_state(struct weston_output *output)
|
||||
{
|
||||
return (struct pixman_output_state *)output->hdi_renderer_state;
|
||||
return (struct pixman_output_state *)output->renderer_state;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -55,16 +55,16 @@ pixman_renderer_create_surface(struct weston_surface *surface);
|
||||
struct pixman_surface_state *
|
||||
get_surface_state(struct weston_surface *surface)
|
||||
{
|
||||
if (!surface->hdi_renderer_state)
|
||||
if (!surface->renderer_state)
|
||||
pixman_renderer_create_surface(surface);
|
||||
|
||||
return (struct pixman_surface_state *)surface->hdi_renderer_state;
|
||||
return (struct pixman_surface_state *)surface->renderer_state;
|
||||
}
|
||||
|
||||
struct pixman_renderer *
|
||||
get_renderer(struct weston_compositor *ec)
|
||||
{
|
||||
return (struct pixman_renderer *)ec->hdi_renderer;
|
||||
return (struct pixman_renderer *)ec->renderer;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -314,7 +314,7 @@ repaint_region(struct weston_view *ev, struct weston_output *output,
|
||||
pixman_op_t pixman_op)
|
||||
{
|
||||
struct pixman_renderer *pr =
|
||||
(struct pixman_renderer *) output->compositor->hdi_renderer;
|
||||
(struct pixman_renderer *) output->compositor->renderer;
|
||||
struct pixman_surface_state *ps = get_surface_state(ev->surface);
|
||||
struct pixman_output_state *po = get_output_state(output);
|
||||
struct weston_buffer_viewport *vp = &ev->surface->buffer_viewport;
|
||||
@@ -694,7 +694,7 @@ pixman_renderer_surface_state_destroy(struct pixman_surface_state *ps)
|
||||
ps->buffer_destroy_listener.notify = NULL;
|
||||
}
|
||||
|
||||
ps->surface->hdi_renderer_state = NULL;
|
||||
ps->surface->renderer_state = NULL;
|
||||
|
||||
if (ps->image) {
|
||||
tde_unref_image_hook(ps);
|
||||
@@ -741,7 +741,7 @@ pixman_renderer_create_surface(struct weston_surface *surface)
|
||||
|
||||
tde_surface_state_alloc_hook(ps);
|
||||
|
||||
surface->hdi_renderer_state = ps;
|
||||
surface->renderer_state = ps;
|
||||
|
||||
ps->surface = surface;
|
||||
|
||||
@@ -794,7 +794,7 @@ pixman_renderer_destroy(struct weston_compositor *ec)
|
||||
tde_renderer_free_hook(pr);
|
||||
free(pr);
|
||||
|
||||
ec->hdi_renderer = NULL;
|
||||
ec->renderer = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -894,7 +894,7 @@ pixman_renderer_init(struct weston_compositor *ec)
|
||||
pixman_renderer_surface_get_content_size;
|
||||
renderer->base.surface_copy_content =
|
||||
pixman_renderer_surface_copy_content;
|
||||
ec->hdi_renderer = &renderer->base;
|
||||
ec->renderer = &renderer->base;
|
||||
ec->capabilities |= WESTON_CAP_ROTATION_ANY;
|
||||
ec->capabilities |= WESTON_CAP_VIEW_CLIP_MASK;
|
||||
|
||||
@@ -974,7 +974,7 @@ pixman_renderer_output_create(struct weston_output *output,
|
||||
}
|
||||
}
|
||||
|
||||
output->hdi_renderer_state = po;
|
||||
output->renderer_state = po;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial
|
||||
* portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "mix_renderer.h"
|
||||
|
||||
// C header adapter
|
||||
extern "C" {
|
||||
#include "libweston/libweston.h"
|
||||
#include "shared/helpers.h"
|
||||
}
|
||||
|
||||
#include "libweston/trace.h"
|
||||
DEFINE_LOG_LABEL("MixRenderer");
|
||||
|
||||
struct mix_renderer {
|
||||
struct weston_renderer base;
|
||||
};
|
||||
|
||||
static void
|
||||
mix_renderer_attach(struct weston_surface *surface,
|
||||
struct weston_buffer *buffer)
|
||||
{
|
||||
surface->compositor->hdi_renderer->attach(surface, buffer);
|
||||
if (surface->compositor->gpu_renderer) {
|
||||
surface->compositor->gpu_renderer->attach(surface, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mix_renderer_destroy(struct weston_compositor *compositor)
|
||||
{
|
||||
LOG_PASS();
|
||||
delete reinterpret_cast<struct mix_renderer *>(compositor->renderer);
|
||||
compositor->renderer = NULL;
|
||||
|
||||
if (compositor->gpu_renderer) {
|
||||
compositor->gpu_renderer->destroy(compositor);
|
||||
}
|
||||
|
||||
if (compositor->hdi_renderer) {
|
||||
compositor->hdi_renderer->destroy(compositor);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mix_renderer_flush_damage(struct weston_surface *surface)
|
||||
{
|
||||
if (surface->compositor->gpu_renderer) {
|
||||
surface->compositor->gpu_renderer->flush_damage(surface);
|
||||
} else {
|
||||
surface->compositor->hdi_renderer->flush_damage(surface);
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
mix_renderer_import_dmabuf(struct weston_compositor *compositor,
|
||||
struct linux_dmabuf_buffer *buffer)
|
||||
{
|
||||
struct weston_renderer *renderer = compositor->gpu_renderer;
|
||||
if (!renderer) {
|
||||
renderer = compositor->hdi_renderer;
|
||||
}
|
||||
|
||||
if (renderer->import_dmabuf == NULL)
|
||||
return false;
|
||||
|
||||
return renderer->import_dmabuf(compositor, buffer);
|
||||
}
|
||||
|
||||
static void
|
||||
mix_renderer_query_dmabuf_formats(struct weston_compositor *compositor,
|
||||
int **formats, int *num_formats)
|
||||
{
|
||||
compositor->hdi_renderer->query_dmabuf_formats(compositor, formats, num_formats);
|
||||
}
|
||||
|
||||
static void
|
||||
mix_renderer_query_dmabuf_modifiers(struct weston_compositor *compositor,
|
||||
int format,
|
||||
uint64_t **modifiers,
|
||||
int *num_modifiers)
|
||||
{
|
||||
compositor->hdi_renderer->query_dmabuf_modifiers(compositor, format, modifiers, num_modifiers);
|
||||
}
|
||||
|
||||
static int
|
||||
mix_renderer_read_pixels(struct weston_output *output,
|
||||
pixman_format_code_t format, void *pixels,
|
||||
uint32_t x, uint32_t y,
|
||||
uint32_t width, uint32_t height)
|
||||
{
|
||||
return output->compositor->hdi_renderer->read_pixels(output, format, pixels, x, y, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
mix_renderer_repaint_output(struct weston_output *output,
|
||||
pixman_region32_t *output_damage)
|
||||
{
|
||||
output->compositor->hdi_renderer->repaint_output(output, output_damage);
|
||||
}
|
||||
|
||||
static void
|
||||
mix_renderer_surface_set_color(struct weston_surface *surface,
|
||||
float red, float green,
|
||||
float blue, float alpha)
|
||||
{
|
||||
if (surface->compositor->gpu_renderer) {
|
||||
surface->compositor->gpu_renderer->surface_set_color(surface, red, green, blue, alpha);
|
||||
} else {
|
||||
surface->compositor->hdi_renderer->surface_set_color(surface, red, green, blue, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mix_renderer_surface_get_content_size(struct weston_surface *surface,
|
||||
int *width, int *height)
|
||||
{
|
||||
surface->compositor->hdi_renderer->surface_get_content_size(surface, width, height);
|
||||
}
|
||||
|
||||
static int
|
||||
mix_renderer_surface_copy_content(struct weston_surface *surface,
|
||||
void *target, size_t size,
|
||||
int src_x, int src_y, int width, int height)
|
||||
{
|
||||
return surface->compositor->hdi_renderer->surface_copy_content(surface, target, size,
|
||||
src_x, src_y, width, height);
|
||||
}
|
||||
|
||||
int
|
||||
mix_renderer_init(struct weston_compositor *compositor)
|
||||
{
|
||||
LOG_PASS();
|
||||
auto renderer = new struct mix_renderer();
|
||||
if (renderer == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
renderer->base.attach = mix_renderer_attach;
|
||||
renderer->base.destroy = mix_renderer_destroy;
|
||||
renderer->base.flush_damage = mix_renderer_flush_damage;
|
||||
renderer->base.import_dmabuf = mix_renderer_import_dmabuf;
|
||||
renderer->base.query_dmabuf_formats = mix_renderer_query_dmabuf_formats;
|
||||
renderer->base.query_dmabuf_modifiers = mix_renderer_query_dmabuf_modifiers;
|
||||
renderer->base.read_pixels = mix_renderer_read_pixels;
|
||||
renderer->base.repaint_output = mix_renderer_repaint_output;
|
||||
renderer->base.surface_set_color = mix_renderer_surface_set_color;
|
||||
renderer->base.surface_get_content_size = mix_renderer_surface_get_content_size;
|
||||
renderer->base.surface_copy_content = mix_renderer_surface_copy_content;
|
||||
|
||||
compositor->renderer = &renderer->base;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial
|
||||
* portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef LIBWESTON_RENDERER_MIX_MIX_RENDERER_H
|
||||
#define LIBWESTON_RENDERER_MIX_MIX_RENDERER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct weston_compositor;
|
||||
int mix_renderer_init(struct weston_compositor *compositor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LIBWESTON_RENDERER_MIX_MIX_RENDERER_H
|
||||
@@ -135,12 +135,12 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data)
|
||||
free(l);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
|
||||
compositor->renderer->read_pixels(output,
|
||||
compositor->read_format, pixels,
|
||||
0, 0, output->current_mode->width,
|
||||
output->current_mode->height);
|
||||
*/
|
||||
|
||||
stride = wl_shm_buffer_get_stride(l->buffer->shm_buffer);
|
||||
|
||||
d = wl_shm_buffer_get_data(l->buffer->shm_buffer);
|
||||
@@ -317,11 +317,11 @@ weston_recorder_frame_notify(struct wl_listener *listener, void *data)
|
||||
y_orig = output->current_mode->height - r[i].y2;
|
||||
else
|
||||
y_orig = r[i].y1;
|
||||
/*
|
||||
|
||||
compositor->renderer->read_pixels(output,
|
||||
compositor->read_format, recorder->rect,
|
||||
r[i].x1, y_orig, width, height);
|
||||
*/
|
||||
|
||||
p = outbuf;
|
||||
run = prev = 0; /* quiet gcc */
|
||||
for (j = 0; j < height; j++) {
|
||||
|
||||
@@ -243,7 +243,7 @@ static int tde_repaint_region(struct weston_view *ev,
|
||||
pixman_region32_t *buffer_region,
|
||||
pixman_region32_t *output_damage)
|
||||
{
|
||||
struct pixman_renderer *renderer = (struct pixman_renderer *)output->compositor->hdi_renderer;
|
||||
struct pixman_renderer *renderer = (struct pixman_renderer *)output->compositor->renderer;
|
||||
struct pixman_surface_state *surface = get_surface_state(ev->surface);
|
||||
dump_to_file(surface);
|
||||
struct pixman_output_state *output_state = get_output_state(output);
|
||||
@@ -397,7 +397,7 @@ static int tde_repaint_region(struct weston_view *ev,
|
||||
|
||||
void tde_repaint_finish_hook(struct weston_output *output)
|
||||
{
|
||||
struct pixman_renderer *renderer = (struct pixman_renderer *)output->compositor->hdi_renderer;
|
||||
struct pixman_renderer *renderer = (struct pixman_renderer *)output->compositor->renderer;
|
||||
struct pixman_output_state *output_state = get_output_state(output);
|
||||
for (auto &call : output_state->tde->calls) {
|
||||
if (renderer->tde->gfx_funcs->InitGfx() != 0) {
|
||||
@@ -640,7 +640,7 @@ int tde_render_attach_hook(struct weston_surface *es, struct weston_buffer *buff
|
||||
int tde_repaint_region_hook(struct weston_view *ev, struct weston_output *output,
|
||||
pixman_region32_t *buffer_region, pixman_region32_t *repaint_output)
|
||||
{
|
||||
struct pixman_renderer *renderer = (struct pixman_renderer *)output->compositor->hdi_renderer;
|
||||
struct pixman_renderer *renderer = (struct pixman_renderer *)output->compositor->renderer;
|
||||
if (!renderer->tde->use_tde) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user