[PATCH libdrm v1 2/2] tests/modetest: Add support for writeback connector

Rohith Iyer quic_rohiiyer at quicinc.com
Thu Aug 11 00:14:41 UTC 2022


Hi Andy,

On 7/25/2022 6:57 PM, Andy Yan wrote:
> 
> Hi Rohith:
> 
> 
> 
> 
> At 2022-07-26 03:26:39, "Rohith Iyer" <quic_rohiiyer at quicinc.com> wrote:
>> Add writeback support to modetest with the below options:
> 
>> +		case 'o':
>> +			pipe_args->dump = true;
>> +			dump_path = optarg;
>> +			break;
>> 		case 'P':
>> 			plane_args = realloc(plane_args,
>> 					     (plane_count + 1) * sizeof *plane_args);
>> @@ -2098,6 +2173,7 @@ int main(int argc, char **argv)
>> 			crtcs = 1;
>> 			planes = 1;
>> 			break;
>> +		case 'x':
>> 		case 's':
>> 			pipe_args = realloc(pipe_args,
>> 					    (count + 1) * sizeof *pipe_args);
>> @@ -2109,7 +2185,7 @@ int main(int argc, char **argv)
>>
>> 			if (parse_connector(&pipe_args[count], optarg) < 0)
>> 				usage(argv[0]);
>> -
>> +			pipe_args->custom = (c == 'x');
>> 			count++;
>> 			break;
>> 		case 'C':
>> @@ -2165,6 +2241,7 @@ int main(int argc, char **argv)
>>
>> 	if (use_atomic) {
>> 		ret = drmSetClientCap(dev.fd, DRM_CLIENT_CAP_ATOMIC, 1);
>> +		drmSetClientCap(dev.fd, DRM_CLIENT_CAP_WRITEBACK_CONNECTORS, 1);
>> 		if (ret) {
>> 			fprintf(stderr, "no atomic modesetting support: %s\n", strerror(errno));
>> 			drmClose(dev.fd);
>> @@ -2208,6 +2285,8 @@ int main(int argc, char **argv)
>> 			if (set_preferred || count)
>> 				set_mode(&dev, pipe_args, count);
>>
>> +			writeback_config(&dev, pipe_args, count);
>> +
>> 			if (plane_count)
>> 				atomic_set_planes(&dev, plane_args, plane_count, false);
>>
>> @@ -2217,6 +2296,13 @@ int main(int argc, char **argv)
>> 				return 1;
>> 			}
> 
>>
> 
> 
> How do we make sure the writeback is finished?  Do we need a writeback fence here?

Thanks for pointing this out. We plan to have a function that polls on 
the writeback fence fd, until the writeback is finished. Let me know if 
you have something else in mind.

> 
>> +			/*
>> +			 * Since only writeback connectors have an output fb, this should only be
>> +			 * called for writeback.
>> +			 */
>> +			if (pipe_args->dump)
>> +				dump_output_fb(&dev, pipe_args, dump_path, count);
>> +
>> 			if (test_vsync)
>> 				atomic_test_page_flip(&dev, pipe_args, plane_args, plane_count);
>>
>> -- 
>> 2.31.0

Thanks,
Rohith


More information about the dri-devel mailing list