Skip to content

Commit

Permalink
gallium: introduce dmabuf format and modifier querying
Browse files Browse the repository at this point in the history
***
this allows drivers to be queried for supported formats and format
modifiers. drivers that implement these queries must expose these under
PIPE_CAP_QUERY_DMABUF_ATTRIBS.

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
  • Loading branch information
Varad Gautam authored and varadgautam committed Jan 4, 2017
1 parent e888646 commit 676117e
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gallium/docs/source/screen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ The integer capabilities:
ARB_transform_feedback3.
* ``PIPE_CAP_TGSI_CAN_READ_OUTPUTS``: Whether every TGSI shader stage can read
from the output file.
* ``PIPE_CAP_QUERY_DMABUF_ATTRIBS``: Whether the driver supports querying for
supported dmabuf formats and format modifiers.


.. _pipe_capf:
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/freedreno/freedreno_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;

case PIPE_CAP_MAX_VIEWPORTS:
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/i915/i915_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
case PIPE_CAP_MAX_WINDOW_RECTANGLES:
case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;

case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/ilo/ilo_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;

case PIPE_CAP_VENDOR_ID:
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/llvmpipe/lp_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;
}
/* should only get here on unhandled cases */
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/nouveau/nv30/nv30_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;

case PIPE_CAP_VENDOR_ID:
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/nouveau/nv50/nv50_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;

case PIPE_CAP_VENDOR_ID:
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;

case PIPE_CAP_VENDOR_ID:
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/r300/r300_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;

/* SWTCL-only features. */
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/r600/r600_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;

case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/radeonsi/si_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_VOTE:
case PIPE_CAP_MAX_WINDOW_RECTANGLES:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;

case PIPE_CAP_QUERY_BUFFER_OBJECT:
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/softpipe/sp_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;
case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
return 4;
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/svga/svga_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/swr/swr_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;

case PIPE_CAP_VENDOR_ID:
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/vc4/vc4_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;

/* Stream output. */
Expand Down
1 change: 1 addition & 0 deletions src/gallium/drivers/virgl/virgl_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_QUERY_DMABUF_ATTRIBS:
return 0;
case PIPE_CAP_VENDOR_ID:
return 0x1af4;
Expand Down
1 change: 1 addition & 0 deletions src/gallium/include/pipe/p_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ enum pipe_cap
PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS,
PIPE_CAP_TGSI_CAN_READ_OUTPUTS,
PIPE_CAP_NATIVE_FENCE_FD,
PIPE_CAP_QUERY_DMABUF_ATTRIBS,
};

#define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
Expand Down
20 changes: 20 additions & 0 deletions src/gallium/include/pipe/p_screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,26 @@ struct pipe_screen {
const void *(*get_compiler_options)(struct pipe_screen *screen,
enum pipe_shader_ir ir,
unsigned shader);

/**
* Get driver-supported drm_fourcc formats.
* If \p max is 0, the total number of supported formats is returned
* in \p count, with no modification to \p formats. Otherwise, \p formats
* is filled with upto \p max supported format codes.
*/
void (*query_dmabuf_formats)(struct pipe_screen *screen, int max,
int *formats, int *count);

/**
* Get supported modifiers for a format.
* If \p max is 0, the total number of supported modifiers for the supplied
* format is returned in \p count, with no modification to \p modifiers.
* Otherwise, \p modifiers is filled with upto \p max supported modifier
* codes.
*/
void (*query_dmabuf_modifiers)(struct pipe_screen *screen,
enum pipe_format format, int max,
uint64_t *modifiers, int *count);
};


Expand Down

0 comments on commit 676117e

Please sign in to comment.