mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-22 05:20:37 +02:00
panfrost: Move the BO API to its own header
Right now, the BO API is spread over pan_{allocate,resource,screen}.h.
Let's move all BO related definitions to a separate header file.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
parent
34efaafc93
commit
154cb725d4
16 changed files with 112 additions and 74 deletions
|
|
@ -29,6 +29,7 @@
|
|||
#include <assert.h>
|
||||
#include <panfrost-misc.h>
|
||||
#include <panfrost-job.h>
|
||||
#include "pan_bo.h"
|
||||
#include "pan_context.h"
|
||||
|
||||
/* TODO: What does this actually have to be? */
|
||||
|
|
|
|||
|
|
@ -43,26 +43,6 @@ struct panfrost_transfer {
|
|||
mali_ptr gpu;
|
||||
};
|
||||
|
||||
struct panfrost_bo {
|
||||
/* Must be first for casting */
|
||||
struct list_head link;
|
||||
|
||||
struct pipe_reference reference;
|
||||
|
||||
/* Mapping for the entire object (all levels) */
|
||||
uint8_t *cpu;
|
||||
|
||||
/* GPU address for the object */
|
||||
mali_ptr gpu;
|
||||
|
||||
/* Size of all entire trees */
|
||||
size_t size;
|
||||
|
||||
int gem_handle;
|
||||
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct panfrost_transfer
|
||||
panfrost_allocate_transient(struct panfrost_batch *batch, size_t sz);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "pan_bo.h"
|
||||
#include "pan_context.h"
|
||||
|
||||
#include "compiler/nir/nir.h"
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "util/u_memory.h"
|
||||
#include "pan_blend_shaders.h"
|
||||
#include "pan_blending.h"
|
||||
#include "pan_bo.h"
|
||||
|
||||
/* A given Gallium blend state can be encoded to the hardware in numerous,
|
||||
* dramatically divergent ways due to the interactions of blending with
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include <pthread.h>
|
||||
#include "drm-uapi/panfrost_drm.h"
|
||||
|
||||
#include "pan_resource.h"
|
||||
#include "pan_bo.h"
|
||||
#include "pan_screen.h"
|
||||
#include "pan_util.h"
|
||||
#include "pandecode/decode.h"
|
||||
|
|
|
|||
100
src/gallium/drivers/panfrost/pan_bo.h
Normal file
100
src/gallium/drivers/panfrost/pan_bo.h
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* © Copyright 2019 Alyssa Rosenzweig
|
||||
* © Copyright 2019 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_BO_H__
|
||||
#define __PAN_BO_H__
|
||||
|
||||
#include <panfrost-misc.h>
|
||||
#include "pipe/p_state.h"
|
||||
#include "util/list.h"
|
||||
|
||||
struct panfrost_screen;
|
||||
|
||||
/* Flags for allocated memory */
|
||||
|
||||
/* This memory region is executable */
|
||||
#define PAN_BO_EXECUTE (1 << 0)
|
||||
|
||||
/* This memory region should be lazily allocated and grow-on-page-fault. Must
|
||||
* be used in conjunction with INVISIBLE */
|
||||
#define PAN_BO_GROWABLE (1 << 1)
|
||||
|
||||
/* This memory region should not be mapped to the CPU */
|
||||
#define PAN_BO_INVISIBLE (1 << 2)
|
||||
|
||||
/* This memory region will be used for varyings and needs to have the cache
|
||||
* bits twiddled accordingly */
|
||||
#define PAN_BO_COHERENT_LOCAL (1 << 3)
|
||||
|
||||
/* This region may not be used immediately and will not mmap on allocate
|
||||
* (semantically distinct from INVISIBLE, which cannot never be mmaped) */
|
||||
#define PAN_BO_DELAY_MMAP (1 << 4)
|
||||
|
||||
struct panfrost_bo {
|
||||
/* Must be first for casting */
|
||||
struct list_head link;
|
||||
|
||||
struct pipe_reference reference;
|
||||
|
||||
/* Mapping for the entire object (all levels) */
|
||||
uint8_t *cpu;
|
||||
|
||||
/* GPU address for the object */
|
||||
mali_ptr gpu;
|
||||
|
||||
/* Size of all entire trees */
|
||||
size_t size;
|
||||
|
||||
int gem_handle;
|
||||
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
void
|
||||
panfrost_bo_reference(struct panfrost_bo *bo);
|
||||
void
|
||||
panfrost_bo_unreference(struct pipe_screen *screen, struct panfrost_bo *bo);
|
||||
struct panfrost_bo *
|
||||
panfrost_bo_create(struct panfrost_screen *screen, size_t size,
|
||||
uint32_t flags);
|
||||
void
|
||||
panfrost_bo_mmap(struct panfrost_screen *screen, struct panfrost_bo *bo);
|
||||
void
|
||||
panfrost_bo_release(struct panfrost_screen *screen, struct panfrost_bo *bo,
|
||||
bool cacheable);
|
||||
struct panfrost_bo *
|
||||
panfrost_bo_import(struct panfrost_screen *screen, int fd);
|
||||
int
|
||||
panfrost_bo_export(struct panfrost_screen *screen, const struct panfrost_bo *bo);
|
||||
struct panfrost_bo *
|
||||
panfrost_bo_cache_fetch(struct panfrost_screen *screen,
|
||||
size_t size, uint32_t flags);
|
||||
bool
|
||||
panfrost_bo_cache_put(struct panfrost_screen *screen,
|
||||
struct panfrost_bo *bo);
|
||||
void
|
||||
panfrost_bo_cache_evict_all(struct panfrost_screen *screen);
|
||||
|
||||
#endif /* __PAN_BO_H__ */
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
#include <sys/poll.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "pan_bo.h"
|
||||
#include "pan_context.h"
|
||||
#include "pan_format.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "pan_bo.h"
|
||||
#include "pan_context.h"
|
||||
|
||||
/* See mali_job for notes on how this works. But basically, for small vertex
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "drm-uapi/panfrost_drm.h"
|
||||
|
||||
#include "pan_bo.h"
|
||||
#include "pan_context.h"
|
||||
#include "util/hash_table.h"
|
||||
#include "util/ralloc.h"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "pan_bo.h"
|
||||
#include "pan_context.h"
|
||||
#include "pan_util.h"
|
||||
#include "pan_format.h"
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include "util/u_transfer_helper.h"
|
||||
#include "util/u_gen_mipmap.h"
|
||||
|
||||
#include "pan_bo.h"
|
||||
#include "pan_context.h"
|
||||
#include "pan_screen.h"
|
||||
#include "pan_resource.h"
|
||||
|
|
|
|||
|
|
@ -57,12 +57,6 @@ struct panfrost_slice {
|
|||
bool initialized;
|
||||
};
|
||||
|
||||
void
|
||||
panfrost_bo_reference(struct panfrost_bo *bo);
|
||||
|
||||
void
|
||||
panfrost_bo_unreference(struct pipe_screen *screen, struct panfrost_bo *bo);
|
||||
|
||||
struct panfrost_resource {
|
||||
struct pipe_resource base;
|
||||
struct {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "drm-uapi/drm_fourcc.h"
|
||||
#include "drm-uapi/panfrost_drm.h"
|
||||
|
||||
#include "pan_bo.h"
|
||||
#include "pan_screen.h"
|
||||
#include "pan_resource.h"
|
||||
#include "pan_public.h"
|
||||
|
|
|
|||
|
|
@ -47,26 +47,6 @@ struct panfrost_screen;
|
|||
/* Driver limits */
|
||||
#define PAN_MAX_CONST_BUFFERS 16
|
||||
|
||||
/* Flags for allocated memory */
|
||||
|
||||
/* This memory region is executable */
|
||||
#define PAN_BO_EXECUTE (1 << 0)
|
||||
|
||||
/* This memory region should be lazily allocated and grow-on-page-fault. Must
|
||||
* be used in conjunction with INVISIBLE */
|
||||
#define PAN_BO_GROWABLE (1 << 1)
|
||||
|
||||
/* This memory region should not be mapped to the CPU */
|
||||
#define PAN_BO_INVISIBLE (1 << 2)
|
||||
|
||||
/* This memory region will be used for varyings and needs to have the cache
|
||||
* bits twiddled accordingly */
|
||||
#define PAN_BO_COHERENT_LOCAL (1 << 3)
|
||||
|
||||
/* This region may not be used immediately and will not mmap on allocate
|
||||
* (semantically distinct from INVISIBLE, which cannot never be mmaped) */
|
||||
#define PAN_BO_DELAY_MMAP (1 << 4)
|
||||
|
||||
/* Transient slab size. This is a balance between fragmentation against cache
|
||||
* locality and ease of bookkeeping */
|
||||
|
||||
|
|
@ -123,31 +103,4 @@ pan_screen(struct pipe_screen *p)
|
|||
struct panfrost_fence *
|
||||
panfrost_fence_create(struct panfrost_context *ctx);
|
||||
|
||||
struct panfrost_bo *
|
||||
panfrost_bo_create(struct panfrost_screen *screen, size_t size,
|
||||
uint32_t flags);
|
||||
void
|
||||
panfrost_bo_mmap(struct panfrost_screen *screen, struct panfrost_bo *bo);
|
||||
void
|
||||
panfrost_bo_release(struct panfrost_screen *screen, struct panfrost_bo *bo,
|
||||
bool cacheable);
|
||||
struct panfrost_bo *
|
||||
panfrost_bo_import(struct panfrost_screen *screen, int fd);
|
||||
int
|
||||
panfrost_bo_export(struct panfrost_screen *screen, const struct panfrost_bo *bo);
|
||||
|
||||
struct panfrost_bo *
|
||||
panfrost_bo_cache_fetch(
|
||||
struct panfrost_screen *screen,
|
||||
size_t size, uint32_t flags);
|
||||
|
||||
bool
|
||||
panfrost_bo_cache_put(
|
||||
struct panfrost_screen *screen,
|
||||
struct panfrost_bo *bo);
|
||||
|
||||
void
|
||||
panfrost_bo_cache_evict_all(
|
||||
struct panfrost_screen *screen);
|
||||
|
||||
#endif /* PAN_SCREEN_H */
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "pan_bo.h"
|
||||
#include "pan_context.h"
|
||||
#include "pan_util.h"
|
||||
#include "pan_format.h"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "pan_bo.h"
|
||||
#include "pan_context.h"
|
||||
#include "util/u_prim.h"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue