panfrost: Create a blitter library to replace the existing preload helpers

pan_blitter.c is meant to replace the pan_blit.c which currently
provides helpers to preload the tile buffer. Some changes
are worth mentioning:

- we use pre-frame DCDs on Bifrost (Midgard still uses a tiler job
  to preload the tile buffer)
- the blit shaders are now stored in a hash table and created lazily
- we now cache blend shader binaries and blit RSDs too

This library will soon be extended to cover regular blits.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10033>
This commit is contained in:
Boris Brezillon 2021-04-13 12:16:41 +02:00 committed by Marge Bot
parent a11807b795
commit 8ba2f9f698
5 changed files with 1191 additions and 0 deletions

View File

@ -36,6 +36,8 @@ lib_FILES := \
lib/pan_blend.c \
lib/pan_blend.h \
lib/pan_blit.c \
lib/pan_blitter.c \
lib/pan_blitter.h \
lib/pan_device.h \
lib/pan_encoder.h \
lib/pan_format.c \

View File

@ -27,6 +27,7 @@ libpanfrost_lib_files = files(
'pan_bo.c',
'pan_blend.c',
'pan_blit.c',
'pan_blitter.c',
'pan_cs.c',
'pan_format.c',
'pan_indirect_draw.c',

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
/*
* Copyright (C) 2021 Collabora, 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 __PAN_BLITTER_H
#define __PAN_BLITTER_H
#include "panfrost-job.h"
#include "pan_util.h"
struct pan_fb_info;
struct pan_scoreboard;
struct pan_pool;
struct panfrost_device;
void
pan_blitter_init(struct panfrost_device *dev);
void
pan_blitter_cleanup(struct panfrost_device *dev);
void
pan_preload_fb(struct pan_pool *desc_pool,
struct pan_scoreboard *scoreboard,
struct pan_fb_info *fb,
mali_ptr tsd, mali_ptr tiler);
#endif

View File

@ -92,6 +92,20 @@ struct pan_blit_shaders {
struct pan_blit_shader loads[PAN_BLIT_NUM_TARGETS][PAN_BLIT_NUM_TYPES][2];
};
struct pan_blitter {
struct {
struct pan_pool pool;
struct hash_table *blit;
struct hash_table *blend;
pthread_mutex_t lock;
} shaders;
struct {
struct pan_pool pool;
struct hash_table *rsds;
pthread_mutex_t lock;
} rsds;
};
struct pan_blend_shaders {
struct hash_table *shaders;
pthread_mutex_t lock;
@ -200,6 +214,7 @@ struct panfrost_device {
} bo_cache;
struct pan_blit_shaders blit_shaders;
struct pan_blitter blitter;
struct pan_blend_shaders blend_shaders;
struct pan_indirect_draw_shaders indirect_draw_shaders;