X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=drv_priv.h;h=4eb1ee194e5c3ddbe902fbf4e6847ad9f586ce46;hb=827b8c257087a9bac366a4cfa5edf5edc8fc24bf;hp=b497890eba2c3cafe5b2198e0557c059e10e07bf;hpb=298b7579139a5693096c00b794302df47f1bee6c;p=android-x86%2Fexternal-minigbm.git diff --git a/drv_priv.h b/drv_priv.h index b497890..4eb1ee1 100644 --- a/drv_priv.h +++ b/drv_priv.h @@ -8,6 +8,7 @@ #define DRV_PRIV_H #include +#include #include #include #include @@ -31,16 +32,11 @@ struct bo_metadata { struct bo { struct driver *drv; struct bo_metadata meta; + bool is_test_buffer; union bo_handle handles[DRV_MAX_PLANES]; void *priv; }; -struct kms_item { - uint32_t format; - uint64_t modifier; - uint64_t use_flags; -}; - struct format_metadata { uint32_t priority; uint32_t tiling; @@ -71,6 +67,11 @@ struct backend { uint64_t use_flags); int (*bo_create_with_modifiers)(struct bo *bo, uint32_t width, uint32_t height, uint32_t format, const uint64_t *modifiers, uint32_t count); + // Either both or neither _metadata functions must be implemented. + // If the functions are implemented, bo_create and bo_create_with_modifiers must not be. + int (*bo_compute_metadata)(struct bo *bo, uint32_t width, uint32_t height, uint32_t format, + uint64_t use_flags, const uint64_t *modifiers, uint32_t count); + int (*bo_create_from_metadata)(struct bo *bo); int (*bo_destroy)(struct bo *bo); int (*bo_import)(struct bo *bo, struct drv_import_fd_data *data); void *(*bo_map)(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags); @@ -78,19 +79,23 @@ struct backend { int (*bo_invalidate)(struct bo *bo, struct mapping *mapping); int (*bo_flush)(struct bo *bo, struct mapping *mapping); uint32_t (*resolve_format)(struct driver *drv, uint32_t format, uint64_t use_flags); + size_t (*num_planes_from_modifier)(struct driver *drv, uint32_t format, uint64_t modifier); }; // clang-format off -#define BO_USE_RENDER_MASK BO_USE_LINEAR | BO_USE_PROTECTED | BO_USE_RENDERING | \ +#define BO_USE_RENDER_MASK (BO_USE_LINEAR | BO_USE_PROTECTED | BO_USE_RENDERING | \ BO_USE_RENDERSCRIPT | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \ - BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE + BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE) -#define BO_USE_TEXTURE_MASK BO_USE_LINEAR | BO_USE_PROTECTED | BO_USE_RENDERSCRIPT | \ +#define BO_USE_TEXTURE_MASK (BO_USE_LINEAR | BO_USE_PROTECTED | BO_USE_RENDERSCRIPT | \ BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \ - BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE + BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE) + +#define BO_USE_SW_MASK (BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \ + BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY) -#define BO_USE_SW_MASK BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \ - BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY +#define BO_USE_NON_GPU_HW (BO_USE_SCANOUT | BO_USE_CAMERA_WRITE | BO_USE_CAMERA_READ | \ + BO_USE_HW_VIDEO_ENCODER | BO_USE_HW_VIDEO_DECODER) #ifndef DRM_FORMAT_MOD_LINEAR #define DRM_FORMAT_MOD_LINEAR DRM_FORMAT_MOD_NONE