···139139typedef struct amdgpu_va *amdgpu_va_handle;
140140141141/**
142142+ * Define handle dealing with VA allocation. An amdgpu_device
143143+ * owns one of these, but they can also be used without a device.
144144+ */
145145+typedef struct amdgpu_va_manager *amdgpu_va_manager_handle;
146146+147147+/**
142148 * Define handle for semaphore
143149 */
144150typedef struct amdgpu_semaphore *amdgpu_semaphore_handle;
···527533 uint32_t *minor_version,
528534 amdgpu_device_handle *device_handle);
529535536536+/**
537537+ * Same as amdgpu_device_initialize() except when deduplicate_device
538538+ * is false *and* fd points to a device that was already initialized.
539539+ * In this case, amdgpu_device_initialize would return the same
540540+ * amdgpu_device_handle while here amdgpu_device_initialize2 would
541541+ * return a new handle.
542542+ * amdgpu_device_initialize() should be preferred in most situations;
543543+ * the only use-case where not-deduplicating devices make sense is
544544+ * when one wants to have isolated device handles in the same process.
545545+ */
546546+int amdgpu_device_initialize2(int fd, bool deduplicate_device,
547547+ uint32_t *major_version,
548548+ uint32_t *minor_version,
549549+ amdgpu_device_handle *device_handle);
530550/**
531551 *
532552 * When access to such library does not needed any more the special
···14091429 enum amdgpu_gpu_va_range type,
14101430 uint64_t *start,
14111431 uint64_t *end);
14321432+14331433+/**
14341434+ * Allocate a amdgpu_va_manager object.
14351435+ * The returned object has be initialized with the amdgpu_va_manager_init
14361436+ * before use.
14371437+ * On release, amdgpu_va_manager_deinit needs to be called, then the memory
14381438+ * can be released using free().
14391439+ */
14401440+amdgpu_va_manager_handle amdgpu_va_manager_alloc(void);
14411441+14421442+void amdgpu_va_manager_init(amdgpu_va_manager_handle va_mgr,
14431443+ uint64_t low_va_offset, uint64_t low_va_max,
14441444+ uint64_t high_va_offset, uint64_t high_va_max,
14451445+ uint32_t virtual_address_alignment);
14461446+14471447+void amdgpu_va_manager_deinit(amdgpu_va_manager_handle va_mgr);
14481448+14491449+/**
14501450+ * Similar to #amdgpu_va_range_alloc() but allocates VA
14511451+ * directly from an amdgpu_va_manager_handle instead of using
14521452+ * the manager from an amdgpu_device.
14531453+ */
14541454+14551455+int amdgpu_va_range_alloc2(amdgpu_va_manager_handle va_mgr,
14561456+ enum amdgpu_gpu_va_range va_range_type,
14571457+ uint64_t size,
14581458+ uint64_t va_base_alignment,
14591459+ uint64_t va_base_required,
14601460+ uint64_t *va_base_allocated,
14611461+ amdgpu_va_handle *va_range_handle,
14621462+ uint64_t flags);
1412146314131464/**
14141465 * VA mapping/unmapping for the buffer object
+11-4
lib/libdrm/amdgpu/amdgpu_cs.c
···598598 uint32_t ring,
599599 amdgpu_semaphore_handle sem)
600600{
601601+ int ret;
602602+601603 if (!ctx || !sem)
602604 return -EINVAL;
603605 if (ip_type >= AMDGPU_HW_IP_NUM)
604606 return -EINVAL;
605607 if (ring >= AMDGPU_CS_MAX_RINGS)
606608 return -EINVAL;
609609+610610+ pthread_mutex_lock(&ctx->sequence_mutex);
607611 /* sem has been signaled */
608608- if (sem->signal_fence.context)
609609- return -EINVAL;
610610- pthread_mutex_lock(&ctx->sequence_mutex);
612612+ if (sem->signal_fence.context) {
613613+ ret = -EINVAL;
614614+ goto unlock;
615615+ }
611616 sem->signal_fence.context = ctx;
612617 sem->signal_fence.ip_type = ip_type;
613618 sem->signal_fence.ip_instance = ip_instance;
614619 sem->signal_fence.ring = ring;
615620 sem->signal_fence.fence = ctx->last_seq[ip_type][ip_instance][ring];
616621 update_references(NULL, &sem->refcount);
622622+ ret = 0;
623623+unlock:
617624 pthread_mutex_unlock(&ctx->sequence_mutex);
618618- return 0;
625625+ return ret;
619626}
620627621628drm_public int amdgpu_cs_wait_semaphore(amdgpu_context_handle ctx,
···6363 struct amdgpu_bo_va_mgr *vamgr;
6464};
65656666+struct amdgpu_va_manager {
6767+ /** The VA manager for the lower virtual address space */
6868+ struct amdgpu_bo_va_mgr vamgr_low;
6969+ /** The VA manager for the 32bit address space */
7070+ struct amdgpu_bo_va_mgr vamgr_32;
7171+ /** The VA manager for the high virtual address space */
7272+ struct amdgpu_bo_va_mgr vamgr_high;
7373+ /** The VA manager for the 32bit high address space */
7474+ struct amdgpu_bo_va_mgr vamgr_high_32;
7575+};
7676+6677struct amdgpu_device {
6778 atomic_t refcount;
6879 struct amdgpu_device *next;
···8091 pthread_mutex_t bo_table_mutex;
8192 struct drm_amdgpu_info_device dev_info;
8293 struct amdgpu_gpu_info info;
8383- /** The VA manager for the lower virtual address space */
8484- struct amdgpu_bo_va_mgr vamgr;
8585- /** The VA manager for the 32bit address space */
8686- struct amdgpu_bo_va_mgr vamgr_32;
8787- /** The VA manager for the high virtual address space */
8888- struct amdgpu_bo_va_mgr vamgr_high;
8989- /** The VA manager for the 32bit high address space */
9090- struct amdgpu_bo_va_mgr vamgr_high_32;
9494+9595+ struct amdgpu_va_manager va_mgr;
9196};
92979398struct amdgpu_bo {
···5454 * Format modifiers may change any property of the buffer, including the number
5555 * of planes and/or the required allocation size. Format modifiers are
5656 * vendor-namespaced, and as such the relationship between a fourcc code and a
5757- * modifier is specific to the modifer being used. For example, some modifiers
5757+ * modifier is specific to the modifier being used. For example, some modifiers
5858 * may preserve meaning - such as number of planes - from the fourcc code,
5959 * whereas others may not.
6060 *
···7979 * format.
8080 * - Higher-level programs interfacing with KMS/GBM/EGL/Vulkan/etc: these users
8181 * see modifiers as opaque tokens they can check for equality and intersect.
8282- * These users musn't need to know to reason about the modifier value
8282+ * These users mustn't need to know to reason about the modifier value
8383 * (i.e. they are not expected to extract information out of the modifier).
8484 *
8585 * Vendors should document their modifier usage in as much detail as
···540540 * This is a tiled layout using 4Kb tiles in row-major layout.
541541 * Within the tile pixels are laid out in 16 256 byte units / sub-tiles which
542542 * are arranged in four groups (two wide, two high) with column-major layout.
543543- * Each group therefore consits out of four 256 byte units, which are also laid
543543+ * Each group therefore consists out of four 256 byte units, which are also laid
544544 * out as 2x2 column-major.
545545 * 256 byte units are made out of four 64 byte blocks of pixels, producing
546546 * either a square block or a 2:1 unit.
···11031103 */
1104110411051105/*
11061106- * The top 4 bits (out of the 56 bits alloted for specifying vendor specific
11061106+ * The top 4 bits (out of the 56 bits allotted for specifying vendor specific
11071107 * modifiers) denote the category for modifiers. Currently we have three
11081108 * categories of modifiers ie AFBC, MISC and AFRC. We can have a maximum of
11091109 * sixteen different categories.
···14191419 * Amlogic FBC Memory Saving mode
14201420 *
14211421 * Indicates the storage is packed when pixel size is multiple of word
14221422- * boudaries, i.e. 8bit should be stored in this mode to save allocation
14221422+ * boundaries, i.e. 8bit should be stored in this mode to save allocation
14231423 * memory.
14241424 *
14251425 * This mode reduces body layout to 3072 bytes per 64x32 superblock with
···14761476#define AMD_FMT_MOD_TILE_VER_GFX10 2
14771477#define AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS 3
14781478#define AMD_FMT_MOD_TILE_VER_GFX11 4
14791479+#define AMD_FMT_MOD_TILE_VER_GFX12 5
1479148014801481/*
14811482 * 64K_S is the same for GFX9/GFX10/GFX10_RBPLUS and hence has GFX9 as canonical
···14861487/*
14871488 * 64K_D for non-32 bpp is the same for GFX9/GFX10/GFX10_RBPLUS and hence has
14881489 * GFX9 as canonical version.
14901490+ *
14911491+ * 64K_D_2D on GFX12 is identical to 64K_D on GFX11.
14891492 */
14901493#define AMD_FMT_MOD_TILE_GFX9_64K_D 10
14911494#define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25
···14931496#define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27
14941497#define AMD_FMT_MOD_TILE_GFX11_256K_R_X 31
1495149814991499+/* Gfx12 swizzle modes:
15001500+ * 0 - LINEAR
15011501+ * 1 - 256B_2D - 2D block dimensions
15021502+ * 2 - 4KB_2D
15031503+ * 3 - 64KB_2D
15041504+ * 4 - 256KB_2D
15051505+ * 5 - 4KB_3D - 3D block dimensions
15061506+ * 6 - 64KB_3D
15071507+ * 7 - 256KB_3D
15081508+ */
15091509+#define AMD_FMT_MOD_TILE_GFX12_64K_2D 3
15101510+#define AMD_FMT_MOD_TILE_GFX12_256K_2D 4
15111511+14961512#define AMD_FMT_MOD_DCC_BLOCK_64B 0
14971513#define AMD_FMT_MOD_DCC_BLOCK_128B 1
14981514#define AMD_FMT_MOD_DCC_BLOCK_256B 2
···15231539#define AMD_FMT_MOD_DCC_INDEPENDENT_128B_MASK 0x1
15241540#define AMD_FMT_MOD_DCC_MAX_COMPRESSED_BLOCK_SHIFT 18
15251541#define AMD_FMT_MOD_DCC_MAX_COMPRESSED_BLOCK_MASK 0x3
15421542+15431543+#define AMD_FMT_MOD_GFX12_DCC_MAX_COMPRESSED_BLOCK_SHIFT 3
15441544+#define AMD_FMT_MOD_GFX12_DCC_MAX_COMPRESSED_BLOCK_MASK 0x3 /* 0:64B, 1:128B, 2:256B */
1526154515271546/*
15281547 * DCC supports embedding some clear colors directly in the DCC surface.
+20-9
lib/libdrm/include/drm/drm_mode.h
···3636/**
3737 * DOC: overview
3838 *
3939- * DRM exposes many UAPI and structure definition to have a consistent
4040- * and standardized interface with user.
3939+ * DRM exposes many UAPI and structure definitions to have a consistent
4040+ * and standardized interface with users.
4141 * Userspace can refer to these structure definitions and UAPI formats
4242- * to communicate to driver
4242+ * to communicate to drivers.
4343 */
44444545#define DRM_CONNECTOR_NAME_LEN 32
···540540/* the PROP_ATOMIC flag is used to hide properties from userspace that
541541 * is not aware of atomic properties. This is mostly to work around
542542 * older userspace (DDX drivers) that read/write each prop they find,
543543- * witout being aware that this could be triggering a lengthy modeset.
543543+ * without being aware that this could be triggering a lengthy modeset.
544544 */
545545#define DRM_MODE_PROP_ATOMIC 0x80000000
546546···664664};
665665666666#define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
667667-#define DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifer[] */
667667+#define DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifier[] */
668668669669/**
670670 * struct drm_mode_fb_cmd2 - Frame-buffer metadata.
···858858};
859859860860/**
861861+ * struct drm_plane_size_hint - Plane size hints
862862+ *
863863+ * The plane SIZE_HINTS property blob contains an
864864+ * array of struct drm_plane_size_hint.
865865+ */
866866+struct drm_plane_size_hint {
867867+ __u16 width;
868868+ __u16 height;
869869+};
870870+871871+/**
861872 * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data.
862873 *
863874 * HDR Metadata Infoframe as per CTA 861.G spec. This is expected
···881892 * These are coded as unsigned 16-bit values in units of
882893 * 0.00002, where 0x0000 represents zero and 0xC350
883894 * represents 1.0000.
884884- * @display_primaries.x: X cordinate of color primary.
885885- * @display_primaries.y: Y cordinate of color primary.
895895+ * @display_primaries.x: X coordinate of color primary.
896896+ * @display_primaries.y: Y coordinate of color primary.
886897 */
887898 struct {
888899 __u16 x, y;
···892903 * These are coded as unsigned 16-bit values in units of
893904 * 0.00002, where 0x0000 represents zero and 0xC350
894905 * represents 1.0000.
895895- * @white_point.x: X cordinate of whitepoint of color primary.
896896- * @white_point.y: Y cordinate of whitepoint of color primary.
906906+ * @white_point.x: X coordinate of whitepoint of color primary.
907907+ * @white_point.y: Y coordinate of whitepoint of color primary.
897908 */
898909 struct {
899910 __u16 x, y;