libmks/lib/mks-dmabuf-paintable-private.h
Bilal Elmoussaoui c259212be5 dmabuf: Properly propagate damage area
The current approach makes use of
- A tiled rendering to work around gdk_texture_diff only doing pointer
comparaison
- Assumes that we would only recieve a scanout cmd followed by multiple
flush ones

In reality, with virtio-gpu at least, the scanout cmd is always
submitted followed by a flush one containing the damaged region.

With the assumption currently made, we end up creating a new paintable
for every scanout cmd causing a full redraw instead
of only redrawing the damaged areas.
Isntead we create the paintable once and call import whenever
we receive a flush cmd (UpdateDMABUF) so we can properly
pass the damage area when creating a GdkGLTexture making
the tiled rendering no longer needed.
2023-05-17 13:08:37 -07:00

50 lines
1.8 KiB
C

/* mks-dmabuf-paintable-private.h
*
* Copyright 2023 Christian Hergert <chergert@redhat.com>
* Copyright 2023 Bilal Elmoussaoui <belmouss@redhat.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include <gdk/gdk.h>
G_BEGIN_DECLS
typedef struct _MksDmabufScanoutData
{
guint width;
guint height;
guint stride;
guint fourcc;
guint64 modifier;
int dmabuf_fd;
} MksDmabufScanoutData;
#define MKS_TYPE_DMABUF_PAINTABLE (mks_dmabuf_paintable_get_type())
G_DECLARE_FINAL_TYPE (MksDmabufPaintable, mks_dmabuf_paintable, MKS, DMABUF_PAINTABLE, GObject)
MksDmabufPaintable *mks_dmabuf_paintable_new (void);
gboolean mks_dmabuf_paintable_import (MksDmabufPaintable *self,
GdkGLContext *gl_context,
MksDmabufScanoutData *data,
cairo_region_t *region,
GError **error);
G_END_DECLS